Compare commits
1172
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea8023e51f | ||
|
|
8a9693a28e | ||
|
|
724fba4af9 | ||
|
|
beca1cbf96 | ||
|
|
b74d2ae9fa | ||
|
|
ec82a0154b | ||
|
|
0ea8dbea10 | ||
|
|
a131f44247 | ||
|
|
0423aedffc | ||
|
|
afc89cdd95 | ||
|
|
541606e00d | ||
|
|
c53fd5fc9a | ||
|
|
bc3dd06b26 | ||
|
|
fd39808ed8 | ||
|
|
a1b7cb5330 | ||
|
|
ac27fae712 | ||
|
|
f6270ec395 | ||
|
|
e9c70f8b1c | ||
|
|
50688e1159 | ||
|
|
8417fea3bf | ||
|
|
f5150d32af | ||
|
|
2263823f75 | ||
|
|
a882263033 | ||
|
|
24d2431522 | ||
|
|
fd27e7bd43 | ||
|
|
4dfe36cdc1 | ||
|
|
fc49be1e05 | ||
|
|
d06d94c767 | ||
|
|
66786651b0 | ||
|
|
e9b499b82d | ||
|
|
e6e3e686c6 | ||
|
|
1e6ba0cdc4 | ||
|
|
75db4c29b8 | ||
|
|
914d3e6a2b | ||
|
|
ff678a5ad7 | ||
|
|
46442ef50c | ||
|
|
7d8fde82e6 | ||
|
|
99cf057906 | ||
|
|
59d3d66f91 | ||
|
|
be73c0fe43 | ||
|
|
e5afc6f029 | ||
|
|
8816d0a9ac | ||
|
|
229837b14c | ||
|
|
94b068a40f | ||
|
|
2f0dfc4d74 | ||
|
|
3391c44107 | ||
|
|
35aae588b8 | ||
|
|
c19585e22a | ||
|
|
77946585b1 | ||
|
|
88a35fd162 | ||
|
|
7d8d4a03fb | ||
|
|
1a68d34663 | ||
|
|
72a0ff706d | ||
|
|
420e43d47d | ||
|
|
3c749d4774 | ||
|
|
d4310a7f3b | ||
|
|
f892d88c10 | ||
|
|
d226709836 | ||
|
|
fbfd03fe5c | ||
|
|
f513001798 | ||
|
|
31aa0ddabe | ||
|
|
767184cf3c | ||
|
|
fe86a9ed02 | ||
|
|
9be53e746f | ||
|
|
8b6f50d0cc | ||
|
|
80dc28bfb5 | ||
|
|
983e1abf48 | ||
|
|
ff65b82671 | ||
|
|
0b26c69222 | ||
|
|
904d714d6d | ||
|
|
2aed93a576 | ||
|
|
d1af42e9ad | ||
|
|
9f31addfa5 | ||
|
|
d56ea7e6c4 | ||
|
|
1cbe271ad5 | ||
|
|
33db3c377f | ||
|
|
a0535ef64d | ||
|
|
392ba18ff7 | ||
|
|
e872f9e928 | ||
|
|
04685a8179 | ||
|
|
55fbe68e62 | ||
|
|
f51e1f0cc8 | ||
|
|
d31b62d44d | ||
|
|
9fd90e26f7 | ||
|
|
dbea0c9361 | ||
|
|
201cb61f84 | ||
|
|
71141e830a | ||
|
|
7dc8bf3aa4 | ||
|
|
0fef94cfdb | ||
|
|
a9b45967ce | ||
|
|
0928bca531 | ||
|
|
77f73a79df | ||
|
|
279445d6bc | ||
|
|
54778ee1e1 | ||
|
|
4efcda534d | ||
|
|
45ac5cb2fa | ||
|
|
6d045a9403 | ||
|
|
8c57a77d7e | ||
|
|
1f585d6719 | ||
|
|
6c111f55aa | ||
|
|
b01693f426 | ||
|
|
e37232aeb4 | ||
|
|
1c1c7dad7b | ||
|
|
b70b81f4cc | ||
|
|
e3cf41a666 | ||
|
|
851a307c23 | ||
|
|
183d3749f0 | ||
|
|
3fe513f9e0 | ||
|
|
81bee2bbc6 | ||
|
|
34719da000 | ||
|
|
df8a3d9c60 | ||
|
|
53dea9b069 | ||
|
|
186bae2bd4 | ||
|
|
f83c8828f0 | ||
|
|
509d064286 | ||
|
|
2d039e393a | ||
|
|
9ab88d9387 | ||
|
|
882a2a0e52 | ||
|
|
c6ce1d8c67 | ||
|
|
77e1a2e4be | ||
|
|
b99f53fda3 | ||
|
|
a7f64cf7aa | ||
|
|
8ebc0f2b24 | ||
|
|
5330dc34bc | ||
|
|
4854a9e320 | ||
|
|
71be1a9e28 | ||
|
|
d0ae09c7e2 | ||
|
|
a25bd06138 | ||
|
|
1b55076897 | ||
|
|
5eac7974c9 | ||
|
|
3afd6e9f51 | ||
|
|
05c107ba9c | ||
|
|
99b00daf87 | ||
|
|
8ddb99f62f | ||
|
|
47dec485e5 | ||
|
|
f191b4f35c | ||
|
|
e24e3c0612 | ||
|
|
1dfac0a8b9 | ||
|
|
f5cc151618 | ||
|
|
1ff3a61de6 | ||
|
|
81d5b651d2 | ||
|
|
ea4ed7cdd1 | ||
|
|
e30ea5206f | ||
|
|
c188f6e3cb | ||
|
|
2fb8999ac2 | ||
|
|
9c9bfc1a98 | ||
|
|
f7a87789ab | ||
|
|
7bcf02a0b4 | ||
|
|
fcd1733787 | ||
|
|
c04ec5953f | ||
|
|
63aa16b97c | ||
|
|
cafbf860be | ||
|
|
700b0bc776 | ||
|
|
98ca36e8f5 | ||
|
|
25130e3c82 | ||
|
|
dc463d1c2c | ||
|
|
89d30acbc5 | ||
|
|
be405d2311 | ||
|
|
acbe42775c | ||
|
|
42d8772dd6 | ||
|
|
81ef922f02 | ||
|
|
d6e18c8a35 | ||
|
|
4993a5c6c0 | ||
|
|
052382af89 | ||
|
|
18f7102461 | ||
|
|
ddbb2bea8a | ||
|
|
27131b43cb | ||
|
|
e8c2483432 | ||
|
|
fd495574a4 | ||
|
|
12f85b3d1f | ||
|
|
47d88bcfa7 | ||
|
|
e4dacaf0d2 | ||
|
|
2906a2d007 | ||
|
|
3000fdc33c | ||
|
|
076bde34a2 | ||
|
|
836c563c89 | ||
|
|
78c0419007 | ||
|
|
9dd5b91cea | ||
|
|
b4c8b00c0e | ||
|
|
430e72b424 | ||
|
|
135a8102f0 | ||
|
|
c9cf4ad02a | ||
|
|
3001809bc3 | ||
|
|
9e77ff328e | ||
|
|
efddcb18a3 | ||
|
|
54ff2bec90 | ||
|
|
287ed83de7 | ||
|
|
dd13924a67 | ||
|
|
a050a3b80f | ||
|
|
f1201eaebc | ||
|
|
68dd50ecbc | ||
|
|
2129cf5aa6 | ||
|
|
cf1bdcef46 | ||
|
|
7a879e2abf | ||
|
|
22878b6f89 | ||
|
|
e99064ca18 | ||
|
|
b93661508e | ||
|
|
27ade6c420 | ||
|
|
473249d605 | ||
|
|
62cf65ce0f | ||
|
|
c4f6aa2f90 | ||
|
|
9ca112c362 | ||
|
|
cdcc17ee37 | ||
|
|
4f3e1587b1 | ||
|
|
b18c92f515 | ||
|
|
3270edcf87 | ||
|
|
c0e8dd97ae | ||
|
|
3a0ae3df58 | ||
|
|
d6361dfee4 | ||
|
|
b61692b667 | ||
|
|
2815688c7e | ||
|
|
78a78a17cc | ||
|
|
e202d4e4a5 | ||
|
|
8b585db238 | ||
|
|
e288549c9e | ||
|
|
f71f129e3b | ||
|
|
ee688166ab | ||
|
|
ed66c37de2 | ||
|
|
a5c6f8023b | ||
|
|
c82da8c9c8 | ||
|
|
07d1358e08 | ||
|
|
1212109c03 | ||
|
|
d4db4fcac3 | ||
|
|
1f46c79396 | ||
|
|
199419ae62 | ||
|
|
39a4d55866 | ||
|
|
c84e1d0f0e | ||
|
|
302deeb122 | ||
|
|
b2a6cdec4e | ||
|
|
87676fad4d | ||
|
|
75087095b1 | ||
|
|
d0a5032723 | ||
|
|
2d6a7c2cf7 | ||
|
|
56e9158dee | ||
|
|
3ba312116b | ||
|
|
e6ab3ddb7d | ||
|
|
8ed0fec364 | ||
|
|
ddfdbd75b8 | ||
|
|
00e21af5bb | ||
|
|
51a17a7a0f | ||
|
|
fa58672f09 | ||
|
|
4f7f5023df | ||
|
|
4838a9690e | ||
|
|
edcbfb52eb | ||
|
|
5af8bb7c8e | ||
|
|
3fa835d74c | ||
|
|
035ff3e1ea | ||
|
|
2c54237fe5 | ||
|
|
00c61204a4 | ||
|
|
284aa3a444 | ||
|
|
f0b7a27fd4 | ||
|
|
a781eea10e | ||
|
|
8e42e5bdba | ||
|
|
ad4a9eeaa5 | ||
|
|
190e6b3958 | ||
|
|
8a33223483 | ||
|
|
0e4eab1569 | ||
|
|
9d6e27c85c | ||
|
|
9720f8ca16 | ||
|
|
5b3dccc1f7 | ||
|
|
e0df014acf | ||
|
|
de3d433ead | ||
|
|
3407db3dd6 | ||
|
|
b10a40ff8d | ||
|
|
ec22623f1c | ||
|
|
7e8fb16507 | ||
|
|
a634d7c361 | ||
|
|
aae77a7983 | ||
|
|
3f6f34e7e1 | ||
|
|
eff1541ba3 | ||
|
|
e7e06c89e1 | ||
|
|
a41d5b1609 | ||
|
|
edbea633f3 | ||
|
|
950af5375c | ||
|
|
c6d2e32f05 | ||
|
|
3796ce4d86 | ||
|
|
ffb67f4014 | ||
|
|
d479686804 | ||
|
|
1387f47a79 | ||
|
|
65784896e1 | ||
|
|
e692e7c119 | ||
|
|
23d4628d88 | ||
|
|
38c335c339 | ||
|
|
e69d1b5a82 | ||
|
|
6695b918ea | ||
|
|
2b9072417b | ||
|
|
6cf2224146 | ||
|
|
a1f74729ab | ||
|
|
71443d1c9a | ||
|
|
a83f5deaac | ||
|
|
234e778e8f | ||
|
|
0bdeaeb4e2 | ||
|
|
cc37713a66 | ||
|
|
6129de31f0 | ||
|
|
0908f86714 | ||
|
|
31ed79fe43 | ||
|
|
1af2ad12bf | ||
|
|
44db6d9e44 | ||
|
|
6e662fe4d6 | ||
|
|
067ff4f8ed | ||
|
|
91cf3d4def | ||
|
|
1eb846a93a | ||
|
|
56661afc05 | ||
|
|
655971208f | ||
|
|
d3ab2d3fbc | ||
|
|
65aca6607e | ||
|
|
e44eb39046 | ||
|
|
ab7d2a4bcc | ||
|
|
87c744b88b | ||
|
|
dfc4b1564f | ||
|
|
db6e99f885 | ||
|
|
35681e3adf | ||
|
|
a5ca531aac | ||
|
|
2daf895d00 | ||
|
|
1041445a22 | ||
|
|
f712bc9294 | ||
|
|
2d174d0b14 | ||
|
|
dd54f6938e | ||
|
|
6e0e74a7d9 | ||
|
|
6a90696820 | ||
|
|
f9bf403fc0 | ||
|
|
0c13fb7ae4 | ||
|
|
9a113bdb44 | ||
|
|
69ef461e6d | ||
|
|
4abcf3215f | ||
|
|
4b607d6484 | ||
|
|
fe8ba57c94 | ||
|
|
de191107a9 | ||
|
|
77b8b278ea | ||
|
|
4758447370 | ||
|
|
77909577e4 | ||
|
|
1a835a2e1b | ||
|
|
8d0330675a | ||
|
|
95a9d7a229 | ||
|
|
2fed46e222 | ||
|
|
9ad070871a | ||
|
|
b95fb48a16 | ||
|
|
29462005b7 | ||
|
|
4de05629ee | ||
|
|
2b62411a78 | ||
|
|
6fa4c7e138 | ||
|
|
ece38a6dbf | ||
|
|
a592488f3e | ||
|
|
191675cc79 | ||
|
|
df2e5bf39f | ||
|
|
ac29faf3bb | ||
|
|
94eabf6220 | ||
|
|
40bc0cbd48 | ||
|
|
b55e9df70a | ||
|
|
986d2cc42a | ||
|
|
0b8bfd9ed8 | ||
|
|
eff0c610e2 | ||
|
|
ca97e67511 | ||
|
|
47c2dce26d | ||
|
|
619163d40e | ||
|
|
b11c13fb9f | ||
|
|
a5435b7d8c | ||
|
|
b5fb829468 | ||
|
|
43fceaf3a4 | ||
|
|
8cb8395a24 | ||
|
|
2a2be51b8f | ||
|
|
5a5d65134e | ||
|
|
0a96f4e145 | ||
|
|
ba21713329 | ||
|
|
32ef925a79 | ||
|
|
c62c778c88 | ||
|
|
2f0a6fdb67 | ||
|
|
70ec13e10b | ||
|
|
3693e3600c | ||
|
|
69debc6777 | ||
|
|
84d7488061 | ||
|
|
fbb7c84409 | ||
|
|
a7379c88f4 | ||
|
|
cc8977b83d | ||
|
|
50380bc6c5 | ||
|
|
92074f0d3c | ||
|
|
1e889c4d07 | ||
|
|
617a09d89a | ||
|
|
2af409f54d | ||
|
|
6d3766e913 | ||
|
|
9b130f099f | ||
|
|
20414e6ef4 | ||
|
|
78645169bf | ||
|
|
a276e7e379 | ||
|
|
1dfde64ac2 | ||
|
|
1fa27f2d19 | ||
|
|
2822006d01 | ||
|
|
288e63f0d8 | ||
|
|
66c9187c95 | ||
|
|
cbf8687e3d | ||
|
|
c9a80caff5 | ||
|
|
f9857235fc | ||
|
|
c595a276a0 | ||
|
|
b582cd230e | ||
|
|
ad6c04489c | ||
|
|
ec7e59eda1 | ||
|
|
d929323e93 | ||
|
|
5a96b283f6 | ||
|
|
d393e4a019 | ||
|
|
9700e46e47 | ||
|
|
036c0034c3 | ||
|
|
f5067b058c | ||
|
|
0d9b247da1 | ||
|
|
a2b75e0d7a | ||
|
|
c9165a565b | ||
|
|
49d8b96768 | ||
|
|
5ad6eb937b | ||
|
|
f66e023ea8 | ||
|
|
72f1538ac2 | ||
|
|
4e24095d8b | ||
|
|
1473eabc7c | ||
|
|
11fd888ed8 | ||
|
|
8c78588ee1 | ||
|
|
c74e212494 | ||
|
|
13f96cdcc9 | ||
|
|
86e32035d7 | ||
|
|
80274596df | ||
|
|
2cc5e776b3 | ||
|
|
57a3b0fd1e | ||
|
|
9414874e1d | ||
|
|
9e46820c57 | ||
|
|
3020990121 | ||
|
|
27219e0f58 | ||
|
|
098441f5fb | ||
|
|
a07ca86207 | ||
|
|
e4e3760b3d | ||
|
|
811147d08e | ||
|
|
a563cfd0f2 | ||
|
|
92f7445bb9 | ||
|
|
a72d858034 | ||
|
|
39d45e9e0a | ||
|
|
4fae9039c1 | ||
|
|
124db3da8e | ||
|
|
4bf4091ef7 | ||
|
|
b7fa1d4f02 | ||
|
|
f1c2afacc4 | ||
|
|
8aed0e75df | ||
|
|
cf2619613d | ||
|
|
2a9d39f201 | ||
|
|
ae0b8eb3b3 | ||
|
|
63081c94a1 | ||
|
|
c39926dd72 | ||
|
|
4683e7e9c9 | ||
|
|
dc9163f801 | ||
|
|
42cc699263 | ||
|
|
37457fcb33 | ||
|
|
441dc41715 | ||
|
|
811f156ad1 | ||
|
|
2a0e9d31e1 | ||
|
|
c473cd7213 | ||
|
|
1af8aacd1d | ||
|
|
5eb9acd8b6 | ||
|
|
6bc9eb950f | ||
|
|
593c884f14 | ||
|
|
9d20de068c | ||
|
|
96c2e4d3ab | ||
|
|
165d2ea978 | ||
|
|
0702272097 | ||
|
|
965c8ccfd2 | ||
|
|
b20a49b018 | ||
|
|
5a6b760847 | ||
|
|
7e2dc443ec | ||
|
|
21f2e1f250 | ||
|
|
cee8c5b5c7 | ||
|
|
7ee2633164 | ||
|
|
6c31a721b8 | ||
|
|
8fc97ea1ce | ||
|
|
423eba3733 | ||
|
|
49a23fdc2e | ||
|
|
fddac2443d | ||
|
|
182037ad67 | ||
|
|
5923956045 | ||
|
|
a89b9f6158 | ||
|
|
d7931a28ce | ||
|
|
cc47d33b32 | ||
|
|
68625e48b9 | ||
|
|
3496d64a52 | ||
|
|
f97ced2240 | ||
|
|
3d44f1c825 | ||
|
|
306c58e7ed | ||
|
|
82588b0daf | ||
|
|
aef8f13290 | ||
|
|
4ae7c90d49 | ||
|
|
cc2234bf54 | ||
|
|
368d280da2 | ||
|
|
4faf727f1b | ||
|
|
f28e472f59 | ||
|
|
69c5d5c86e | ||
|
|
f9332b813e | ||
|
|
052ce499c9 | ||
|
|
54db2e0ab1 | ||
|
|
b261836f71 | ||
|
|
a0290954d6 | ||
|
|
112eb04079 | ||
|
|
057cbe7cc3 | ||
|
|
945a9e0ac2 | ||
|
|
a92ea7f822 | ||
|
|
b57b223a59 | ||
|
|
f377c75dbd | ||
|
|
8d3de8dee5 | ||
|
|
cfdf992600 | ||
|
|
fd8c677b87 | ||
|
|
ff2eb6d2d3 | ||
|
|
97fcf48caa | ||
|
|
e17b3a753e | ||
|
|
865b0a3e56 | ||
|
|
0d1ddc5f44 | ||
|
|
6780a0c8d4 | ||
|
|
fee652d54a | ||
|
|
42b7c48671 | ||
|
|
75afee59c3 | ||
|
|
ae3f718fe3 | ||
|
|
4b02335637 | ||
|
|
7a52c2fa71 | ||
|
|
ec5d067d28 | ||
|
|
3c9fec78fa | ||
|
|
0a08ee836c | ||
|
|
5f804cb0eb | ||
|
|
a0fd942048 | ||
|
|
dad1577fe3 | ||
|
|
338f2311d4 | ||
|
|
27a1c0288b | ||
|
|
dd45be518f | ||
|
|
a9c058ba9d | ||
|
|
3e07423778 | ||
|
|
63ccb3df4c | ||
|
|
906ef85d90 | ||
|
|
895edf4f17 | ||
|
|
ff1c035d42 | ||
|
|
f61fe80f60 | ||
|
|
dfbdcc1bf0 | ||
|
|
b09636f5ca | ||
|
|
8727e609f0 | ||
|
|
40fc2907a1 | ||
|
|
81fd5535fc | ||
|
|
ad079b8ed4 | ||
|
|
a543560f7d | ||
|
|
bb2cc6ef2d | ||
|
|
977f23f0e7 | ||
|
|
24c047c94e | ||
|
|
22b4aa4d8b | ||
|
|
110753e92c | ||
|
|
be70656745 | ||
|
|
d36e13e8ed | ||
|
|
2e9896a9ab | ||
|
|
ee06ec0c40 | ||
|
|
aa0e3e3c9f | ||
|
|
3477e1a4f5 | ||
|
|
a4b788980c | ||
|
|
519a843340 | ||
|
|
269299d913 | ||
|
|
cc4b16b50d | ||
|
|
d10bcc8a53 | ||
|
|
92db9682e0 | ||
|
|
cd773e4764 | ||
|
|
f14ffd5b1d | ||
|
|
e34f597fe2 | ||
|
|
95ddc04a73 | ||
|
|
c6d5cbd52c | ||
|
|
75b695664a | ||
|
|
59ecf48b72 | ||
|
|
2fb13c76f5 | ||
|
|
7438aea869 | ||
|
|
83772c87ac | ||
|
|
6250f675db | ||
|
|
a31639682b | ||
|
|
576979c562 | ||
|
|
c53989adb8 | ||
|
|
a1bb62f43c | ||
|
|
5eec2e7889 | ||
|
|
f4bb236c04 | ||
|
|
c82df0590d | ||
|
|
43e13f0cf2 | ||
|
|
63a8209a83 | ||
|
|
7984f055e2 | ||
|
|
3104898c7c | ||
|
|
8cb716fe8e | ||
|
|
9cdf5ab9a1 | ||
|
|
bcf7ed501d | ||
|
|
09b0dd2b2d | ||
|
|
04a47dfb8d | ||
|
|
bc9b3f6ff1 | ||
|
|
086a30e61a | ||
|
|
cd8e7a1030 | ||
|
|
8e92c5d985 | ||
|
|
5708ec5a89 | ||
|
|
f665431132 | ||
|
|
9e27511ef9 | ||
|
|
344f876b0a | ||
|
|
10217a3b19 | ||
|
|
778cc4c435 | ||
|
|
bd999ca090 | ||
|
|
4d9980b0e6 | ||
|
|
a459b8fdbb | ||
|
|
c925c02e69 | ||
|
|
4566bece90 | ||
|
|
403b7c14aa | ||
|
|
b3e07077fa | ||
|
|
f7cee2ed56 | ||
|
|
b7173100c8 | ||
|
|
cb496379bc | ||
|
|
c37b9c95e6 | ||
|
|
919e01f26e | ||
|
|
cad21935d6 | ||
|
|
d290fdfc5f | ||
|
|
c77161e2b0 | ||
|
|
d2dfb81a09 | ||
|
|
4acf7ce840 | ||
|
|
2f6b84a2cc | ||
|
|
2c00a4ac35 | ||
|
|
c27ca18674 | ||
|
|
7c7f3d4fcd | ||
|
|
8fba4b0cbe | ||
|
|
b0015ab6e8 | ||
|
|
3a210d6fa6 | ||
|
|
b5a4a55370 | ||
|
|
35a449c7d0 | ||
|
|
1305e16425 | ||
|
|
08003ceba9 | ||
|
|
059db643bc | ||
|
|
39731debdc | ||
|
|
9ef56cbc48 | ||
|
|
becea84955 | ||
|
|
ceac7b46fc | ||
|
|
594095a363 | ||
|
|
3397066343 | ||
|
|
d1d8c68bf1 | ||
|
|
d37bf8a4ae | ||
|
|
e4e31be7d4 | ||
|
|
5ede8c12ba | ||
|
|
db509f4075 | ||
|
|
85e58b4a49 | ||
|
|
64b6a4ebf2 | ||
|
|
a0c48de39d | ||
|
|
d9a281c493 | ||
|
|
eb52f38c47 | ||
|
|
c1f51d5be7 | ||
|
|
08cb2039c5 | ||
|
|
6485ea4051 | ||
|
|
aa9e91f926 | ||
|
|
70ac6614e8 | ||
|
|
64ce231705 | ||
|
|
7a98f89e1b | ||
|
|
264e336a49 | ||
|
|
595328963a | ||
|
|
d951a55be0 | ||
|
|
7ffc84fb86 | ||
|
|
5871b54172 | ||
|
|
92976b7735 | ||
|
|
2e13c1fa4b | ||
|
|
b5134f15b4 | ||
|
|
bcb320b537 | ||
|
|
1475964145 | ||
|
|
1802ccf374 | ||
|
|
3849de1931 | ||
|
|
1a46974cb9 | ||
|
|
25918b8b76 | ||
|
|
20bd0737a2 | ||
|
|
31fdfbaf38 | ||
|
|
8428cae1c8 | ||
|
|
65ae34169d | ||
|
|
ecff995e7c | ||
|
|
40dc9ff95e | ||
|
|
24a421c83e | ||
|
|
b204b3c8eb | ||
|
|
34738bb20a | ||
|
|
1b1068248d | ||
|
|
9f684978cf | ||
|
|
747717e2ee | ||
|
|
ed7f2df04e | ||
|
|
b159a72ce9 | ||
|
|
29faf13afd | ||
|
|
427d6c3316 | ||
|
|
eafea28266 | ||
|
|
1cb9a79fd4 | ||
|
|
959791ffde | ||
|
|
a5775cdb94 | ||
|
|
05272d1070 | ||
|
|
b5d2cfdbea | ||
|
|
e716f82670 | ||
|
|
dc5af66748 | ||
|
|
40e177a02e | ||
|
|
36a8243f73 | ||
|
|
d90647e9ba | ||
|
|
c7152af191 | ||
|
|
2f9ba31b0a | ||
|
|
ef48baafcc | ||
|
|
1227bd4898 | ||
|
|
09e610b900 | ||
|
|
b317520543 | ||
|
|
25c3881782 | ||
|
|
27e8916843 | ||
|
|
fa27207351 | ||
|
|
3753d50992 | ||
|
|
b7654c181d | ||
|
|
50e226a146 | ||
|
|
991f28906e | ||
|
|
f18a9493b3 | ||
|
|
bca9a787f6 | ||
|
|
9699d76dcb | ||
|
|
5f07efa12a | ||
|
|
a175033e3b | ||
|
|
878b504f8e | ||
|
|
669ab640da | ||
|
|
2f381c22e3 | ||
|
|
ee06c12374 | ||
|
|
225c2803ac | ||
|
|
1e0bd6717e | ||
|
|
33c84965ad | ||
|
|
a668e47fa1 | ||
|
|
c95d76266a | ||
|
|
902948e3c6 | ||
|
|
2805a2d0cc | ||
|
|
410c5ae919 | ||
|
|
7525fd5e3e | ||
|
|
55208d7d1f | ||
|
|
88e2cdd283 | ||
|
|
6ac69b604e | ||
|
|
76ba747706 | ||
|
|
469c0242d4 | ||
|
|
115531e944 | ||
|
|
6edfacbf4e | ||
|
|
a2249becba | ||
|
|
b53c53d9d8 | ||
|
|
13736219ff | ||
|
|
3ac5ff0cac | ||
|
|
19119cc4ae | ||
|
|
38ac7b41ad | ||
|
|
b47d1ad5fd | ||
|
|
45f642c4e4 | ||
|
|
04dc28cb33 | ||
|
|
f7e9d79322 | ||
|
|
5c6076d72d | ||
|
|
ee1901225b | ||
|
|
b61ba449fb | ||
|
|
d53e2fa8c1 | ||
|
|
20ac2dcd04 | ||
|
|
ac7db26f17 | ||
|
|
4a65a23706 | ||
|
|
425d83c497 | ||
|
|
a7d338a58e | ||
|
|
6a612972e2 | ||
|
|
f06f25532c | ||
|
|
116c487384 | ||
|
|
5f70abb16d | ||
|
|
c17110f6e7 | ||
|
|
69cbc2feb5 | ||
|
|
feb0b83365 | ||
|
|
03796f2337 | ||
|
|
d4f5a35e87 | ||
|
|
da707f3e40 | ||
|
|
59a6fd1ed8 | ||
|
|
8c8d9e5cc4 | ||
|
|
d36170879c | ||
|
|
204e483c08 | ||
|
|
f582eb5310 | ||
|
|
6f9a14d6c4 | ||
|
|
76fcad0a0b | ||
|
|
cc06799838 | ||
|
|
8a26c382a2 | ||
|
|
22198d8bd2 | ||
|
|
d534dcadfb | ||
|
|
708ae35068 | ||
|
|
50cea4f64e | ||
|
|
c782a32076 | ||
|
|
edc877442f | ||
|
|
a1fe0f6305 | ||
|
|
cb5aee9fa4 | ||
|
|
9b18b14f11 | ||
|
|
0fd7bb8d3f | ||
|
|
c836018ac7 | ||
|
|
ba678eabdc | ||
|
|
9442d3d0f3 | ||
|
|
9f0313dd0b | ||
|
|
3d109f9c4c | ||
|
|
f8a337fb9f | ||
|
|
3c0966279c | ||
|
|
c033979130 | ||
|
|
c828961327 | ||
|
|
83a95a0488 | ||
|
|
f3c131ffaf | ||
|
|
b06e38699a | ||
|
|
3a07e2fe21 | ||
|
|
ca668f8a37 | ||
|
|
5181aecc7b | ||
|
|
0e92cfbd0d | ||
|
|
60c7507a33 | ||
|
|
c7c3fae5c2 | ||
|
|
4acbb2a312 | ||
|
|
4e6159aa07 | ||
|
|
6a1d05646c | ||
|
|
2e05043f43 | ||
|
|
1b8216e911 | ||
|
|
a2121b86df | ||
|
|
1cd17e9edd | ||
|
|
5229f5a13c | ||
|
|
4ff014d275 | ||
|
|
83243f471a | ||
|
|
3c0c51a946 | ||
|
|
08ad449774 | ||
|
|
eae1b99036 | ||
|
|
44f27b23d0 | ||
|
|
92c83bc280 | ||
|
|
10bbd435b7 | ||
|
|
2ef8672a6b | ||
|
|
a22dd264cd | ||
|
|
baf5116841 | ||
|
|
e55017bbfc | ||
|
|
19636bda4e | ||
|
|
83124e0c05 | ||
|
|
a079870bca | ||
|
|
ce71b8c1cf | ||
|
|
7b0c25f91e | ||
|
|
feab25d0be | ||
|
|
956b4406d0 | ||
|
|
3a0fbae4d9 | ||
|
|
f106dc2a29 | ||
|
|
252a539e69 | ||
|
|
df6badfdd5 | ||
|
|
7479ae521c | ||
|
|
416fb94ae8 | ||
|
|
3a620fe55d | ||
|
|
5208750cdb | ||
|
|
c684f8f043 | ||
|
|
73084863b7 | ||
|
|
503310cdb8 | ||
|
|
bda8d34c2b | ||
|
|
2ee87483f9 | ||
|
|
9e04bf1ece | ||
|
|
29c8c9f989 | ||
|
|
1035e714ff | ||
|
|
57fa022c9f | ||
|
|
76c3f7bc8f | ||
|
|
6d2646239e | ||
|
|
c955e61ba7 | ||
|
|
c31a5279af | ||
|
|
840780dc4a | ||
|
|
02b3c37b9f | ||
|
|
d14fe813a9 | ||
|
|
44ff23b227 | ||
|
|
257459abc6 | ||
|
|
e988dc0e42 | ||
|
|
7d544dee47 | ||
|
|
1670f88e54 | ||
|
|
58c7edfed6 | ||
|
|
122d7f681f | ||
|
|
acec1ba4bf | ||
|
|
0040757cd3 | ||
|
|
49d554e9d8 | ||
|
|
fa3389ed23 | ||
|
|
188a84a893 | ||
|
|
ceff1622c1 | ||
|
|
8d15cacf92 | ||
|
|
80161bfa96 | ||
|
|
c32ab1b84f | ||
|
|
73c0ce628b | ||
|
|
dc68397e48 | ||
|
|
c934b47f2e | ||
|
|
07d3d6508a | ||
|
|
e4a8896fdc | ||
|
|
33e1a9457a | ||
|
|
b6a20fd6e4 | ||
|
|
ae9757bf43 | ||
|
|
b9a34b1b05 | ||
|
|
c33f66b691 | ||
|
|
cf8d6c2621 | ||
|
|
6c789f7165 | ||
|
|
7d77eff4f4 | ||
|
|
f83278bd61 | ||
|
|
9a96018cc2 | ||
|
|
ab3612517f | ||
|
|
0909722bb5 | ||
|
|
1cb8f9237c | ||
|
|
4cac366468 | ||
|
|
a6138b3445 | ||
|
|
093e4614d3 | ||
|
|
82efb8a784 | ||
|
|
be720709fe | ||
|
|
325b13b101 | ||
|
|
203d1c2b45 | ||
|
|
c3c97f2956 | ||
|
|
ac535de2fa | ||
|
|
9d4f0f5824 | ||
|
|
b4f5eaa541 | ||
|
|
66cdbf6215 | ||
|
|
c9e0bfb7fe | ||
|
|
6da8ef83af | ||
|
|
f53559b8d0 | ||
|
|
49f038b9d1 | ||
|
|
ce67657e0a | ||
|
|
56c520f455 | ||
|
|
9f88b077ee | ||
|
|
50315a7346 | ||
|
|
6b58afe823 | ||
|
|
167cba9e93 | ||
|
|
ce89a410d2 | ||
|
|
98d0f33f8f | ||
|
|
c305341ef4 | ||
|
|
0607a67a92 | ||
|
|
5f2f95676c | ||
|
|
4bf16243fc | ||
|
|
607738f22e | ||
|
|
200df49d6e | ||
|
|
580a1b7fc2 | ||
|
|
3372f9fc0d | ||
|
|
4787ac64ff | ||
|
|
fef625ce27 | ||
|
|
0b53dd8fa7 | ||
|
|
fe628e44e1 | ||
|
|
d314b6a552 | ||
|
|
02462d1752 | ||
|
|
5b734d8c52 | ||
|
|
81d640ed7c | ||
|
|
7e2ad05fae | ||
|
|
bda5890f17 | ||
|
|
c7dd293e01 | ||
|
|
fbf0a20f38 | ||
|
|
87ccfbab02 | ||
|
|
97f39282ef | ||
|
|
4fd3d49fc1 | ||
|
|
a70c8a9cae | ||
|
|
c0926633e8 | ||
|
|
1ae91097ba | ||
|
|
bfd76880a9 | ||
|
|
662578dbe7 | ||
|
|
48c6d3d89a | ||
|
|
7bdb530440 | ||
|
|
bfe953c18d | ||
|
|
136676012f | ||
|
|
0994ffc195 | ||
|
|
df19feac34 | ||
|
|
961fa89b7a | ||
|
|
ddf9e08069 | ||
|
|
b5f3978b8a | ||
|
|
82dc6c32ec | ||
|
|
889e2d6f06 | ||
|
|
9a28642a4e | ||
|
|
0b953462f7 | ||
|
|
061eb686c6 | ||
|
|
937297561f | ||
|
|
bf70d6f087 | ||
|
|
26fdfc42f4 | ||
|
|
abab8c6ec8 | ||
|
|
a7697f6095 | ||
|
|
49270e99e5 | ||
|
|
d75ce1e12e | ||
|
|
289e768ca5 | ||
|
|
44c587400d | ||
|
|
df467b9dba | ||
|
|
510543e14b | ||
|
|
c3133f020d | ||
|
|
a7439aa056 | ||
|
|
d7bea0c4c6 | ||
|
|
764a3c29e9 | ||
|
|
3c57572b89 | ||
|
|
fe7c6554f7 | ||
|
|
19bb7f5a83 | ||
|
|
c0e20ad56b | ||
|
|
49887ff06e | ||
|
|
1f6555c9ad | ||
|
|
7f8efa7cef | ||
|
|
8106956be2 | ||
|
|
cc435ba817 | ||
|
|
0c55a4d7bb | ||
|
|
c4b4c0ce59 | ||
|
|
d31c1df639 | ||
|
|
780286ea81 | ||
|
|
20a75b9c9e | ||
|
|
2a2e2716bd | ||
|
|
6a07c22826 | ||
|
|
7c294915c8 | ||
|
|
7788cb288e | ||
|
|
c1762c709e | ||
|
|
8690528080 | ||
|
|
5376294389 | ||
|
|
fa1b703bf8 | ||
|
|
72d2c7f078 | ||
|
|
09ecc66e53 | ||
|
|
879dc295a8 | ||
|
|
8a5a1d3301 | ||
|
|
67c8067aed | ||
|
|
123e32e345 | ||
|
|
3a09d67f59 | ||
|
|
ec3ed8fbcd | ||
|
|
18370ebd08 | ||
|
|
acbc09b232 | ||
|
|
9d1cf253b4 | ||
|
|
e46304d1ce | ||
|
|
668c62b1f4 | ||
|
|
49f418f146 | ||
|
|
c46c735f2f | ||
|
|
82aa7fcbad | ||
|
|
2cfeeb4b13 | ||
|
|
aa859c488f | ||
|
|
1b2915aa2a | ||
|
|
e99c3d4705 | ||
|
|
d23491646a | ||
|
|
1d740a63bd | ||
|
|
d1897fabf0 | ||
|
|
d4178d6440 | ||
|
|
f4d42289d4 | ||
|
|
d0def466da | ||
|
|
959f44502b | ||
|
|
1840541f6d | ||
|
|
c5ec6927b3 | ||
|
|
7beaf3705e | ||
|
|
792ffa2d26 | ||
|
|
bbd61977f1 | ||
|
|
e3d1fa2686 | ||
|
|
293d3b4fb3 | ||
|
|
e1d8155565 | ||
|
|
c37b27a926 | ||
|
|
6b3a05e23f | ||
|
|
0e92bb58b0 | ||
|
|
63cbd4deb0 | ||
|
|
17bcd4e2ab | ||
|
|
72f301c655 | ||
|
|
a62a8518b9 | ||
|
|
fa169d6aa2 | ||
|
|
d2bcb86e1e | ||
|
|
ed7361622b | ||
|
|
3117ec5a7d | ||
|
|
cb4716f403 | ||
|
|
b48c0e968f | ||
|
|
aa2ed5fb0c | ||
|
|
8b7a279c61 | ||
|
|
b286e9d337 | ||
|
|
d671c3d9fa | ||
|
|
7086f2dc89 | ||
|
|
7e8bb9ea00 | ||
|
|
4e46bb6671 | ||
|
|
de35658096 | ||
|
|
034f5db3bd | ||
|
|
57375bfd73 | ||
|
|
b846e33ee3 | ||
|
|
cc9b817f0e | ||
|
|
0d419aba8a | ||
|
|
ae22321d9c | ||
|
|
87169febf8 | ||
|
|
dd044844e5 | ||
|
|
0c8c596ee5 | ||
|
|
b9496fef1d | ||
|
|
b4b9d3a4b7 | ||
|
|
0128c89f8d | ||
|
|
9e77d06c72 | ||
|
|
25bb1cc957 | ||
|
|
2c6f8299f0 | ||
|
|
6a2773c3ac | ||
|
|
1eea917121 | ||
|
|
ea1bbbabfa | ||
|
|
399d2bc73c | ||
|
|
0759dbcdc9 | ||
|
|
1ae0f9c19d | ||
|
|
e8364a03bc | ||
|
|
046d88ab2d | ||
|
|
f161f78a33 | ||
|
|
1912444886 | ||
|
|
b6ef5a0a3d | ||
|
|
401c88adbb | ||
|
|
42984d1bfb | ||
|
|
6997082b03 | ||
|
|
139217dc79 | ||
|
|
2cc2a857a2 | ||
|
|
7dfb463ba9 | ||
|
|
da07871bc6 | ||
|
|
530d2309e7 | ||
|
|
7e7a5d38f8 | ||
|
|
ecf949dee0 | ||
|
|
9b0ba10b0b | ||
|
|
9f9c4cf32c | ||
|
|
536ebf604f | ||
|
|
03a616b737 | ||
|
|
0b05f67114 | ||
|
|
0ede690580 | ||
|
|
d81545a871 | ||
|
|
1cda1fc201 | ||
|
|
490dad7838 | ||
|
|
13ecbb8bce | ||
|
|
3346bfc9a8 | ||
|
|
c5de65f115 | ||
|
|
4fffcf9975 | ||
|
|
8962d9b293 | ||
|
|
050c1560e8 | ||
|
|
68b3041f50 | ||
|
|
1ddd153399 | ||
|
|
df0a60caae | ||
|
|
675c86582d | ||
|
|
e6d01ed1a3 | ||
|
|
d8d1064e05 | ||
|
|
5d04cb81ba | ||
|
|
5d5906e980 | ||
|
|
2e7b862ad3 | ||
|
|
ad86e22824 | ||
|
|
536b8a213b | ||
|
|
2e13877926 | ||
|
|
967d63dec4 | ||
|
|
573c4268b6 | ||
|
|
f19e83dcf1 | ||
|
|
caabe8fc87 | ||
|
|
7c4e5309fc | ||
|
|
542124e90c | ||
|
|
e0d02be0f5 | ||
|
|
461e6d1b5b | ||
|
|
d767e6d7eb | ||
|
|
bff1584012 | ||
|
|
3d91a11b95 | ||
|
|
1349b46a8c | ||
|
|
74330ba1dd | ||
|
|
64ab227f62 | ||
|
|
1c51fbd1b4 | ||
|
|
4c2dd553f2 | ||
|
|
2fb985afa4 | ||
|
|
44c93d5074 | ||
|
|
dcf07a46aa | ||
|
|
284a9e0612 | ||
|
|
60349a8690 | ||
|
|
64072be83c | ||
|
|
229abb8412 | ||
|
|
7b1d1fd288 | ||
|
|
1ca1f6ad22 | ||
|
|
0ad66f4bc4 | ||
|
|
d5757c4fb8 | ||
|
|
7fe40bce86 | ||
|
|
5da3d64ede | ||
|
|
2e93b06ac0 | ||
|
|
1e6aa4b40f | ||
|
|
262383395d | ||
|
|
127226c421 | ||
|
|
fabcb021cb | ||
|
|
60ab1ab83e | ||
|
|
1f37095087 | ||
|
|
93c2f70b64 | ||
|
|
b0562df6bb | ||
|
|
65d6a5c774 | ||
|
|
650af0f7b0 | ||
|
|
cf9de25c25 | ||
|
|
fc4009aa50 | ||
|
|
d04cf4d897 | ||
|
|
2e45c67ef2 | ||
|
|
b6d8e1f842 | ||
|
|
284bc364fe | ||
|
|
a050654b4c | ||
|
|
7311dae483 | ||
|
|
c57c3cd1d3 | ||
|
|
3ec5e85485 | ||
|
|
ff95af0367 | ||
|
|
aa9c7d5435 | ||
|
|
dcc9f33357 | ||
|
|
1ace645505 | ||
|
|
dc2b87dce1 | ||
|
|
8e47f5d494 | ||
|
|
333d381f41 | ||
|
|
f9b064cc19 | ||
|
|
116a6c1b2e | ||
|
|
c4506b8e6c | ||
|
|
6786a7be4a | ||
|
|
bb370a304d | ||
|
|
fdcf53c688 | ||
|
|
d3f575547c | ||
|
|
68797e51c6 | ||
|
|
c76c55cdee | ||
|
|
f529ec3018 | ||
|
|
ad667be0d7 | ||
|
|
133fa09261 | ||
|
|
acf19cebf8 | ||
|
|
5dfa4c0840 | ||
|
|
f918602f58 | ||
|
|
2cf2dd24a4 | ||
|
|
eefb069d08 | ||
|
|
3dcffc7df8 | ||
|
|
b121277142 | ||
|
|
d283fcf7b4 |
-19
@@ -1,19 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
SimGear.spec
|
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache
|
|
||||||
config.cache
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
configure
|
|
||||||
do-config.sh
|
|
||||||
.cdtproject
|
|
||||||
.project
|
|
||||||
config.guess
|
|
||||||
config.sub
|
|
||||||
depcomp
|
|
||||||
INSTALL
|
|
||||||
install-sh
|
|
||||||
missing
|
|
||||||
mkinstalldirs
|
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
.*
|
||||||
|
Makefile
|
||||||
|
*.o
|
||||||
|
lib*.a
|
||||||
|
.*.swp
|
||||||
|
cmake_install.cmake
|
||||||
|
CMakeFiles
|
||||||
|
CMakeCache.txt
|
||||||
|
CPackConfig.cmake
|
||||||
|
CPackSourceConfig.cmake
|
||||||
|
cmake_uninstall.cmake
|
||||||
|
CTestTestfile.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
build*
|
||||||
|
Build
|
||||||
+374
@@ -0,0 +1,374 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.6.4)
|
||||||
|
include (CheckFunctionExists)
|
||||||
|
include (CheckIncludeFile)
|
||||||
|
include (CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
|
||||||
|
project(SimGear)
|
||||||
|
|
||||||
|
# read 'version' file into a variable (stripping any newlines or spaces)
|
||||||
|
file(READ version versionFile)
|
||||||
|
string(STRIP ${versionFile} SIMGEAR_VERSION)
|
||||||
|
|
||||||
|
# use simgear version also as the SO version (if building SOs)
|
||||||
|
SET(SIMGEAR_SOVERSION ${SIMGEAR_VERSION})
|
||||||
|
|
||||||
|
# Warning when build is not an out-of-source build.
|
||||||
|
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" InSourceBuild)
|
||||||
|
if(InSourceBuild)
|
||||||
|
message(WARNING "Avoid building inside the source tree!")
|
||||||
|
message(WARNING "Create a separate build directory instead (i.e. 'sgbuild') and call CMake from there: ")
|
||||||
|
message(WARNING " mkdir ../sgbuild && cd ../sgbuild && cmake ${CMAKE_SOURCE_DIR}")
|
||||||
|
endif(InSourceBuild)
|
||||||
|
|
||||||
|
#packaging
|
||||||
|
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
|
||||||
|
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simulation support libraries for FlightGear and related projects")
|
||||||
|
SET(CPACK_PACKAGE_VENDOR "The FlightGear project")
|
||||||
|
SET(CPACK_GENERATOR "TBZ2")
|
||||||
|
SET(CPACK_INSTALL_CMAKE_PROJECTS ${CMAKE_CURRENT_BINARY_DIR};SimGear;ALL;/)
|
||||||
|
|
||||||
|
|
||||||
|
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match
|
||||||
|
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${SIMGEAR_VERSION} )
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||||
|
|
||||||
|
message(STATUS "version is ${CPACK_PACKAGE_VERSION_MAJOR} dot ${CPACK_PACKAGE_VERSION_MINOR} dot ${CPACK_PACKAGE_VERSION_PATCH}")
|
||||||
|
|
||||||
|
set(CPACK_SOURCE_GENERATOR TBZ2)
|
||||||
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "simgear-${SIMGEAR_VERSION}" CACHE INTERNAL "tarball basename")
|
||||||
|
set(CPACK_SOURCE_IGNORE_FILES
|
||||||
|
"^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
|
||||||
|
|
||||||
|
message(STATUS "ignoring: ${CPACK_SOURCE_IGNORE_FILES}")
|
||||||
|
|
||||||
|
include (CPack)
|
||||||
|
|
||||||
|
# We have some custom .cmake scripts not in the official distribution.
|
||||||
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
|
# Change the default build type to something fast
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release CACHE STRING
|
||||||
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||||
|
FORCE)
|
||||||
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
# Determine name of library installation directory, i.e. "lib" vs "lib64", which
|
||||||
|
# differs between all Debian-based vs all other Linux distros.
|
||||||
|
# See cmake bug #11964, http://cmake.org/gitweb?p=cmake.git;a=commit;h=126c993d
|
||||||
|
# GNUInstallDirs requires CMake >= 2.8.5, use own file for older cmake
|
||||||
|
if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
else(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
|
||||||
|
include(OldGNUInstallDirs)
|
||||||
|
endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
|
||||||
|
message(STATUS "Library installation directory: ${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
# Configure library search paths
|
||||||
|
#####################################################################################
|
||||||
|
|
||||||
|
if(NOT "${CMAKE_LIBRARY_ARCHITECTURE}" STREQUAL "")
|
||||||
|
# Workaround for Ubuntu/Debian which introduced the "multiarch" library
|
||||||
|
# directory structure, which is unsupported by CMake < 2.8.10, so we need to
|
||||||
|
# add paths manually
|
||||||
|
# see http://www.cmake.org/Bug/view.php?id=12049 and
|
||||||
|
# http://www.cmake.org/Bug/view.php?id=12037
|
||||||
|
list(APPEND ADDITIONAL_LIBRARY_PATHS
|
||||||
|
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||||
|
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||||
|
/lib/${CMAKE_LIBRARY_ARCHITECTURE})
|
||||||
|
message(STATUS "additional library directories: ${ADDITIONAL_LIBRARY_PATHS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
# TBD: are these really necessary? Aren't they considered by cmake automatically?
|
||||||
|
list(APPEND ADDITIONAL_LIBRARY_PATHS
|
||||||
|
/opt/local
|
||||||
|
/usr/local
|
||||||
|
/usr)
|
||||||
|
endif()
|
||||||
|
#####################################################################################
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF)
|
||||||
|
option(SYSTEM_EXPAT "Set to ON to build SimGear using the system libExpat" OFF)
|
||||||
|
else()
|
||||||
|
# Building SimGear DLLs is currently not supported for MSVC.
|
||||||
|
set(SIMGEAR_SHARED OFF)
|
||||||
|
# Using a system expat is currently not supported for MSVC - it would require shared simgear (DLL).
|
||||||
|
set(SYSTEM_EXPAT OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(SIMGEAR_HEADLESS "Set to ON to build SimGear without GUI/graphics support" OFF)
|
||||||
|
option(JPEG_FACTORY "Enable JPEG-factory support" OFF)
|
||||||
|
option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" ON)
|
||||||
|
option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF)
|
||||||
|
option(ENABLE_TESTS "Set to OFF to disable building SimGear's test applications" ON)
|
||||||
|
option(ENABLE_SOUND "Set to OFF to disable building SimGear's sound support" ON)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty.x64")
|
||||||
|
else (CMAKE_CL_64)
|
||||||
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty")
|
||||||
|
endif (CMAKE_CL_64)
|
||||||
|
if (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
set(MSVC_3RDPARTY_ROOT ${PARENT_DIR} CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
else (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
endif (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
else (MSVC)
|
||||||
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
endif (MSVC)
|
||||||
|
|
||||||
|
if (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_ROOT}")
|
||||||
|
set( OSG_MSVC "msvc" )
|
||||||
|
if (${MSVC_VERSION} EQUAL 1700)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}110 )
|
||||||
|
elseif (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}100 )
|
||||||
|
else (${MSVC_VERSION} EQUAL 1700)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}90 )
|
||||||
|
endif (${MSVC_VERSION} EQUAL 1700)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}-64 )
|
||||||
|
set( MSVC_3RDPARTY_DIR 3rdParty.x64 )
|
||||||
|
else (CMAKE_CL_64)
|
||||||
|
set( MSVC_3RDPARTY_DIR 3rdParty )
|
||||||
|
endif (CMAKE_CL_64)
|
||||||
|
|
||||||
|
set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenRTI/lib )
|
||||||
|
set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenRTI/include)
|
||||||
|
find_path(BOOST_ROOT boost/version.hpp
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_52_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_51_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_50_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_49_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_48_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_47_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_46_1
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_46_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_45_0
|
||||||
|
${MSVC_3RDPARTY_ROOT}/boost_1_44_0
|
||||||
|
)
|
||||||
|
# set (BOOST_ROOT ${MSVC_3RDPARTY_ROOT}/boost_1_44_0)
|
||||||
|
message(STATUS "BOOST_ROOT is ${BOOST_ROOT}")
|
||||||
|
set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
||||||
|
set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib)
|
||||||
|
endif (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
|
||||||
|
find_package(Boost REQUIRED)
|
||||||
|
set (BOOST_CXX_FLAGS "-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
||||||
|
|
||||||
|
if(SIMGEAR_HEADLESS)
|
||||||
|
message(STATUS "SimGear mode: HEADLESS")
|
||||||
|
set(ENABLE_SOUND 0)
|
||||||
|
else()
|
||||||
|
message(STATUS "SimGear mode: NORMAL")
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
if (ENABLE_SOUND)
|
||||||
|
find_package(OpenAL REQUIRED)
|
||||||
|
message(STATUS "Sound support: ENABLED")
|
||||||
|
endif(ENABLE_SOUND)
|
||||||
|
|
||||||
|
find_package(OpenSceneGraph 3.0.0 REQUIRED osgText osgSim osgDB osgParticle osgGA osgUtil)
|
||||||
|
endif(SIMGEAR_HEADLESS)
|
||||||
|
|
||||||
|
if(JPEG_FACTORY)
|
||||||
|
message(STATUS "JPEG-factory: ENABLED")
|
||||||
|
find_package(JPEG REQUIRED)
|
||||||
|
include_directories(${JPEG_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
message(STATUS "JPEG-factory: DISABLED")
|
||||||
|
endif(JPEG_FACTORY)
|
||||||
|
|
||||||
|
if(ENABLE_LIBSVN)
|
||||||
|
find_package(SvnClient)
|
||||||
|
|
||||||
|
if(LIBSVN_FOUND)
|
||||||
|
message(STATUS "Subversion client support: ENABLED")
|
||||||
|
set(HAVE_SVN_CLIENT_H 1)
|
||||||
|
set(HAVE_LIBSVN_CLIENT_1 1)
|
||||||
|
else()
|
||||||
|
# Oops. ENABLE_LIBSVN is ON, but svn is still missing.
|
||||||
|
# Provide clearly visible warning/hint, so builders know what else they should install (or disable).
|
||||||
|
message(WARNING "Failed to enable subversion client support. Unable to find required subversion client library. Some features may not be available (scenery download).")
|
||||||
|
message(WARNING "Install 'libsvn' library/DLL (libsvn-devel/libsvnclient/...). Otherwise disable subversion support (set 'ENABLE_LIBSVN' to 'OFF').")
|
||||||
|
endif(LIBSVN_FOUND)
|
||||||
|
else()
|
||||||
|
message(STATUS "Subversion client support: DISABLED")
|
||||||
|
endif(ENABLE_LIBSVN)
|
||||||
|
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
if (SYSTEM_EXPAT)
|
||||||
|
message(STATUS "Requested to use system Expat library, forcing SIMGEAR_SHARED to true")
|
||||||
|
set(SIMGEAR_SHARED ON)
|
||||||
|
find_package(EXPAT REQUIRED)
|
||||||
|
include_directories(${EXPAT_INCLUDE_DIRS})
|
||||||
|
else()
|
||||||
|
message(STATUS "Using built-in expat code")
|
||||||
|
add_definitions(-DHAVE_EXPAT_CONFIG_H)
|
||||||
|
endif(SYSTEM_EXPAT)
|
||||||
|
|
||||||
|
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
||||||
|
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||||
|
check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H)
|
||||||
|
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||||
|
check_include_file(windows.h HAVE_WINDOWS_H)
|
||||||
|
|
||||||
|
if(HAVE_INTTYPES_H)
|
||||||
|
# ShivaVG needs inttypes.h
|
||||||
|
add_definitions(-DHAVE_INTTYPES_H)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_RTI)
|
||||||
|
# See if we have any rti library variant installed
|
||||||
|
message(STATUS "RTI: ENABLED")
|
||||||
|
find_package(RTI)
|
||||||
|
else()
|
||||||
|
message(STATUS "RTI: DISABLED")
|
||||||
|
endif(ENABLE_RTI)
|
||||||
|
|
||||||
|
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
|
||||||
|
check_function_exists(ftime HAVE_FTIME)
|
||||||
|
check_function_exists(timegm HAVE_TIMEGM)
|
||||||
|
check_function_exists(rint HAVE_RINT)
|
||||||
|
check_function_exists(mkdtemp HAVE_MKDTEMP)
|
||||||
|
check_function_exists(bcopy HAVE_BCOPY)
|
||||||
|
check_function_exists(mmap HAVE_MMAP)
|
||||||
|
|
||||||
|
if(HAVE_UNISTD_H)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"#include <unistd.h>
|
||||||
|
#if !defined(_POSIX_TIMERS) || (0 >= _POSIX_TIMERS)
|
||||||
|
#error clock_gettime is not supported
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main() { return 0; }
|
||||||
|
"
|
||||||
|
HAVE_CLOCK_GETTIME)
|
||||||
|
endif(HAVE_UNISTD_H)
|
||||||
|
|
||||||
|
set(RT_LIBRARY "")
|
||||||
|
if(HAVE_CLOCK_GETTIME)
|
||||||
|
check_library_exists(rt clock_gettime "" HAVE_RT)
|
||||||
|
if(HAVE_RT)
|
||||||
|
set(RT_LIBRARY rt)
|
||||||
|
endif(HAVE_RT)
|
||||||
|
endif(HAVE_CLOCK_GETTIME)
|
||||||
|
|
||||||
|
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually 'd' on windows")
|
||||||
|
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
SET(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
SET(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
|
||||||
|
# isnan might not be real symbol, so can't check using function_exists
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"#include <cmath>
|
||||||
|
void f() { isnan(0.0);} "
|
||||||
|
HAVE_ISNAN)
|
||||||
|
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"#include <cmath>
|
||||||
|
void f() { std::isnan(0.0);} "
|
||||||
|
HAVE_STD_ISNAN)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
set(WARNING_FLAGS_CXX "-Wall")
|
||||||
|
set(WARNING_FLAGS_C "-Wall")
|
||||||
|
|
||||||
|
# certain GCC versions don't provide the atomic builds, and hence
|
||||||
|
# require is to provide them in SGAtomic.cxx
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"int main() { unsigned mValue; return __sync_add_and_fetch(&mValue, 1); }"
|
||||||
|
GCC_ATOMIC_BUILTINS_FOUND)
|
||||||
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
set(WARNING_FLAGS_CXX "-Wall -Wno-overloaded-virtual")
|
||||||
|
set(WARNING_FLAGS_C "-Wall")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
add_definitions(-D_WIN32_WINNT=0x501)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# turn off various warnings
|
||||||
|
# foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
|
||||||
|
# SET(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
|
||||||
|
# endforeach(warning)
|
||||||
|
|
||||||
|
set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /wd4996 /wd4250")
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
# assumed on Windows
|
||||||
|
set(HAVE_GETLOCALTIME 1)
|
||||||
|
|
||||||
|
set( WINSOCK_LIBRARY "ws2_32.lib" )
|
||||||
|
set( RT_LIBRARY "winmm" )
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}")
|
||||||
|
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR})
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
|
||||||
|
include_directories(${PROJECT_BINARY_DIR}/simgear)
|
||||||
|
include_directories(${PROJECT_BINARY_DIR}/simgear/xml)
|
||||||
|
|
||||||
|
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
|
||||||
|
${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}
|
||||||
|
${OPENAL_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
|
# configure a header file to pass some of the CMake settings
|
||||||
|
# to the source code
|
||||||
|
configure_file (
|
||||||
|
"${PROJECT_SOURCE_DIR}/simgear/simgear_config_cmake.h.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/simgear/simgear_config.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file (
|
||||||
|
"${PROJECT_SOURCE_DIR}/simgear/xml/expat_config_cmake.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/simgear/xml/expat_config.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
|
# enable CTest / make test target
|
||||||
|
message(STATUS "Tests: ENABLED")
|
||||||
|
|
||||||
|
include (Dart)
|
||||||
|
enable_testing()
|
||||||
|
else()
|
||||||
|
message(STATUS "Tests: DISABLED")
|
||||||
|
endif(ENABLE_TESTS)
|
||||||
|
|
||||||
|
install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/)
|
||||||
|
add_subdirectory(simgear)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
### uninstall target
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
|
IMMEDIATE @ONLY)
|
||||||
|
ADD_CUSTOM_TARGET(uninstall
|
||||||
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# Find Subversion client libraries, and dependencies
|
||||||
|
# including APR (Apache Portable Runtime)
|
||||||
|
|
||||||
|
include (CheckFunctionExists)
|
||||||
|
include (CheckIncludeFile)
|
||||||
|
include (CheckLibraryExists)
|
||||||
|
|
||||||
|
macro(find_static_component comp libs)
|
||||||
|
# account for alternative Windows svn distribution naming
|
||||||
|
if(MSVC)
|
||||||
|
set(compLib "lib${comp}")
|
||||||
|
else(MSVC)
|
||||||
|
set(compLib "${comp}")
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
string(TOUPPER "${comp}" compLibBase)
|
||||||
|
set( compLibName ${compLibBase}_LIBRARY )
|
||||||
|
|
||||||
|
# NO_DEFAULT_PATH is important on Mac - we need to ensure subversion
|
||||||
|
# libraires in dist/ or Macports are picked over the Apple version
|
||||||
|
# in /usr, since that's what we will ship.
|
||||||
|
# On other platforms we do need default paths though, i.e. since Linux
|
||||||
|
# distros may use architecture-specific directories (like
|
||||||
|
# /usr/lib/x86_64-linux-gnu) which we cannot hardcode/guess here.
|
||||||
|
FIND_LIBRARY(${compLibName}
|
||||||
|
if(APPLE)
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
endif(APPLE)
|
||||||
|
NAMES ${compLib}
|
||||||
|
HINTS $ENV{LIBSVN_DIR} ${CMAKE_INSTALL_PREFIX} ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS ${ADDITIONAL_LIBRARY_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND ${libs} ${${compLibName}})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
find_program(HAVE_APR_CONFIG apr-1-config)
|
||||||
|
if(HAVE_APR_CONFIG)
|
||||||
|
|
||||||
|
execute_process(COMMAND apr-1-config --cppflags --includes
|
||||||
|
OUTPUT_VARIABLE APR_CFLAGS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
execute_process(COMMAND apr-1-config --link-ld
|
||||||
|
OUTPUT_VARIABLE RAW_APR_LIBS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
# clean up some vars, or other CMake pieces complain
|
||||||
|
string(STRIP "${RAW_APR_LIBS}" APR_LIBS)
|
||||||
|
|
||||||
|
else(HAVE_APR_CONFIG)
|
||||||
|
message(STATUS "apr-1-config not found, implement manual search for APR")
|
||||||
|
endif(HAVE_APR_CONFIG)
|
||||||
|
|
||||||
|
if(HAVE_APR_CONFIG OR MSVC)
|
||||||
|
find_path(LIBSVN_INCLUDE_DIR svn_client.h
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
HINTS
|
||||||
|
$ENV{LIBSVN_DIR} ${CMAKE_INSTALL_PREFIX} ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include
|
||||||
|
PATH_SUFFIXES include/subversion-1
|
||||||
|
PATHS
|
||||||
|
/opt/local
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LIBSVN_LIBRARIES "")
|
||||||
|
if (MSVC)
|
||||||
|
find_static_component("apr-1" LIBSVN_LIBRARIES)
|
||||||
|
else (MSVC)
|
||||||
|
list(APPEND LIBSVN_LIBRARIES ${APR_LIBS})
|
||||||
|
endif (MSVC)
|
||||||
|
find_static_component("svn_client-1" LIBSVN_LIBRARIES)
|
||||||
|
find_static_component("svn_subr-1" LIBSVN_LIBRARIES)
|
||||||
|
find_static_component("svn_ra-1" LIBSVN_LIBRARIES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG LIBSVN_LIBRARIES LIBSVN_INCLUDE_DIR)
|
||||||
|
if(NOT LIBSVN_FOUND)
|
||||||
|
set(LIBSVN_LIBRARIES "")
|
||||||
|
endif(NOT LIBSVN_FOUND)
|
||||||
|
endif(HAVE_APR_CONFIG OR MSVC)
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
# - Define GNU standard installation directories
|
||||||
|
# Provides install directory variables as defined for GNU software:
|
||||||
|
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||||
|
# Inclusion of this module defines the following variables:
|
||||||
|
# CMAKE_INSTALL_<dir> - destination for files of a given type
|
||||||
|
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
|
||||||
|
# where <dir> is one of:
|
||||||
|
# BINDIR - user executables (bin)
|
||||||
|
# SBINDIR - system admin executables (sbin)
|
||||||
|
# LIBEXECDIR - program executables (libexec)
|
||||||
|
# SYSCONFDIR - read-only single-machine data (etc)
|
||||||
|
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
|
||||||
|
# LOCALSTATEDIR - modifiable single-machine data (var)
|
||||||
|
# LIBDIR - object code libraries (lib or lib64)
|
||||||
|
# INCLUDEDIR - C header files (include)
|
||||||
|
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
|
||||||
|
# DATAROOTDIR - read-only architecture-independent data root (share)
|
||||||
|
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
|
||||||
|
# INFODIR - info documentation (DATAROOTDIR/info)
|
||||||
|
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
|
||||||
|
# MANDIR - man documentation (DATAROOTDIR/man)
|
||||||
|
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
|
||||||
|
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
|
||||||
|
# install() commands for the corresponding file type. If the includer does
|
||||||
|
# not define a value the above-shown default will be used and the value will
|
||||||
|
# appear in the cache for editing by the user.
|
||||||
|
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
|
||||||
|
# from the corresponding destination by prepending (if necessary) the value
|
||||||
|
# of CMAKE_INSTALL_PREFIX.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
|
||||||
|
# Copyright 2011 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.)
|
||||||
|
|
||||||
|
# Installation directories
|
||||||
|
#
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
|
||||||
|
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
|
||||||
|
set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
|
||||||
|
set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
|
||||||
|
set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
|
||||||
|
set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
|
||||||
|
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
set(_LIBDIR_DEFAULT "lib")
|
||||||
|
# Override this default 'lib' with 'lib64' iff:
|
||||||
|
# - we are on Linux system but NOT cross-compiling
|
||||||
|
# - we are NOT on debian
|
||||||
|
# - we are on a 64 bits system
|
||||||
|
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
|
||||||
|
# Note that the future of multi-arch handling may be even
|
||||||
|
# more complicated than that: http://wiki.debian.org/Multiarch
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
|
||||||
|
AND NOT CMAKE_CROSSCOMPILING
|
||||||
|
AND NOT EXISTS "/etc/debian_version")
|
||||||
|
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
|
||||||
|
message(AUTHOR_WARNING
|
||||||
|
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
|
||||||
|
"Please enable at least one language before including GNUInstallDirs.")
|
||||||
|
else()
|
||||||
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||||
|
set(_LIBDIR_DEFAULT "lib64")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
|
||||||
|
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
|
||||||
|
set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
|
||||||
|
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
|
||||||
|
# the cache and store the defaults in local variables if the cache values are
|
||||||
|
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_DATADIR)
|
||||||
|
set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
|
||||||
|
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_INFODIR)
|
||||||
|
set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
|
||||||
|
set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_LOCALEDIR)
|
||||||
|
set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
|
||||||
|
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_MANDIR)
|
||||||
|
set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
|
||||||
|
set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_DOCDIR)
|
||||||
|
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
|
||||||
|
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
CMAKE_INSTALL_BINDIR
|
||||||
|
CMAKE_INSTALL_SBINDIR
|
||||||
|
CMAKE_INSTALL_LIBEXECDIR
|
||||||
|
CMAKE_INSTALL_SYSCONFDIR
|
||||||
|
CMAKE_INSTALL_SHAREDSTATEDIR
|
||||||
|
CMAKE_INSTALL_LOCALSTATEDIR
|
||||||
|
CMAKE_INSTALL_LIBDIR
|
||||||
|
CMAKE_INSTALL_INCLUDEDIR
|
||||||
|
CMAKE_INSTALL_OLDINCLUDEDIR
|
||||||
|
CMAKE_INSTALL_DATAROOTDIR
|
||||||
|
CMAKE_INSTALL_DATADIR
|
||||||
|
CMAKE_INSTALL_INFODIR
|
||||||
|
CMAKE_INSTALL_LOCALEDIR
|
||||||
|
CMAKE_INSTALL_MANDIR
|
||||||
|
CMAKE_INSTALL_DOCDIR
|
||||||
|
)
|
||||||
|
|
||||||
|
# Result directories
|
||||||
|
#
|
||||||
|
foreach(dir
|
||||||
|
BINDIR
|
||||||
|
SBINDIR
|
||||||
|
LIBEXECDIR
|
||||||
|
SYSCONFDIR
|
||||||
|
SHAREDSTATEDIR
|
||||||
|
LOCALSTATEDIR
|
||||||
|
LIBDIR
|
||||||
|
INCLUDEDIR
|
||||||
|
OLDINCLUDEDIR
|
||||||
|
DATAROOTDIR
|
||||||
|
DATADIR
|
||||||
|
INFODIR
|
||||||
|
LOCALEDIR
|
||||||
|
MANDIR
|
||||||
|
DOCDIR
|
||||||
|
)
|
||||||
|
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
|
||||||
|
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
macro(simgear_component_common name includePath sourcesList sources headers)
|
||||||
|
set(fc${sourcesList} ${name})
|
||||||
|
set(fh${sourcesList} ${name})
|
||||||
|
foreach(s ${sources})
|
||||||
|
set_property(GLOBAL
|
||||||
|
APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
|
||||||
|
set(fc${sourcesList} "${fc${sourcesList}}#${CMAKE_CURRENT_SOURCE_DIR}/${s}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(h ${headers})
|
||||||
|
set_property(GLOBAL
|
||||||
|
APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
||||||
|
set(fh${sourcesList} "${fh${sourcesList}}#${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_property(GLOBAL APPEND PROPERTY FG_GROUPS_${sourcesList}_C "${fc${sourcesList}}@")
|
||||||
|
set_property(GLOBAL APPEND PROPERTY FG_GROUPS_${sourcesList}_H "${fh${sourcesList}}@")
|
||||||
|
|
||||||
|
install (FILES ${headers} DESTINATION include/simgear/${includePath})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
function(simgear_component name includePath sources headers)
|
||||||
|
simgear_component_common(${name} ${includePath} CORE_SOURCES "${sources}" "${headers}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(simgear_scene_component name includePath sources headers)
|
||||||
|
simgear_component_common(${name} ${includePath} SCENE_SOURCES "${sources}" "${headers}")
|
||||||
|
endfunction()
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||||
|
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||||
|
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
|
|
||||||
|
FOREACH(file ${files})
|
||||||
|
MESSAGE(STATUS "Uninstalling \"${file}\"")
|
||||||
|
IF(EXISTS "${file}")
|
||||||
|
EXEC_PROGRAM(
|
||||||
|
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
|
||||||
|
OUTPUT_VARIABLE rm_out
|
||||||
|
RETURN_VALUE rm_retval
|
||||||
|
)
|
||||||
|
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||||
|
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
|
||||||
|
ENDIF()
|
||||||
|
ELSE()
|
||||||
|
MESSAGE(STATUS "File \"${file}\" does not exist.")
|
||||||
|
ENDIF()
|
||||||
|
ENDFOREACH()
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ convey the exclusion of warranty; and each file should have at least the
|
|||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ PROJECT_NAME = SimGear
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 1.9.0
|
PROJECT_NUMBER = 2.2.0
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
How to build SimGear
|
||||||
|
====================
|
||||||
|
|
||||||
|
SimGear uses the CMake build system to generate a platform-specific
|
||||||
|
build environment. CMake reads the CMakeLists.txt files that you'll
|
||||||
|
find throughout the source directories, checks for installed
|
||||||
|
dependencies and then generates the appropriate build system.
|
||||||
|
|
||||||
|
If you don't already have CMake installed on your system you can grab
|
||||||
|
it from http://www.cmake.org, use version 2.6.4 or later.
|
||||||
|
|
||||||
|
Under unices (i.e. Linux, Solaris, Free-BSD, HP-Ux, OSX) use the cmake
|
||||||
|
or ccmake command-line utils. Preferably, create an out-of-source
|
||||||
|
build directory and run cmake or ccmake from there. The advantage to
|
||||||
|
this approach is that the temporary files created by CMake won't
|
||||||
|
clutter the source directory, and also makes it possible to have
|
||||||
|
multiple independent build targets by creating multiple build
|
||||||
|
directories. In a directory alongside the SimGear source directory
|
||||||
|
use:
|
||||||
|
|
||||||
|
mkdir sgbuild
|
||||||
|
cd sgbuild
|
||||||
|
cmake ../simgear -DCMAKE_BUILD_TYPE=Release
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
|
||||||
|
Build Dependencies
|
||||||
|
==================
|
||||||
|
SimGear depends on a number of 3rd party libraries, the most notable
|
||||||
|
being:
|
||||||
|
|
||||||
|
* OpenSceneGraph (OSG) - see README.OSG
|
||||||
|
* zlib compression library - see README.zlib
|
||||||
|
* Open Audio Library (OpenAL) - see README.OpenAL
|
||||||
|
* Subversion Client Library (optional dependency)
|
||||||
|
|
||||||
|
|
||||||
|
Further information
|
||||||
|
===================
|
||||||
|
* README.cmake
|
||||||
|
for more detailed CMake instructions
|
||||||
|
|
||||||
|
* README.msvc
|
||||||
|
in the FlightGear source package for more Windows-specific instructions
|
||||||
|
|
||||||
|
* FlightGear Wiki
|
||||||
|
http://wiki.flightgear.org/Building_Flightgear
|
||||||
|
|
||||||
|
* FlightGear Forums
|
||||||
|
For help on building see: http://www.flightgear.org/forums
|
||||||
|
=> Support/Compiling
|
||||||
|
|
||||||
|
* FlightGear Mailing lists
|
||||||
|
http://wiki.flightgear.org/index.php/Mailing_list
|
||||||
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
EXTRA_DIST = \
|
|
||||||
acinclude.m4 \
|
|
||||||
autogen.sh \
|
|
||||||
DoxygenMain.cxx \
|
|
||||||
README.MSVC \
|
|
||||||
README.zlib \
|
|
||||||
README.plib \
|
|
||||||
README.OpenAL \
|
|
||||||
README.OSG \
|
|
||||||
projects \
|
|
||||||
SimGear.dsp \
|
|
||||||
SimGear.dsw
|
|
||||||
|
|
||||||
SUBDIRS = simgear
|
|
||||||
|
|
||||||
dist-hook:
|
|
||||||
(cd $(top_srcdir); $(HOME)/Projects/FlightGear/admin/am2dsp.pl)
|
|
||||||
rm -rf `find $(distdir)/projects -name CVS`
|
|
||||||
|
|
||||||
#
|
|
||||||
# Rule to build RPM distribution package
|
|
||||||
#
|
|
||||||
rpm: dist
|
|
||||||
rpm -ta $(PACKAGE)-$(VERSION).tar.gz
|
|
||||||
|
|
||||||
@@ -1 +1,15 @@
|
|||||||
[ Nothing here at this time. ]
|
SimGear - Simulator Construction Tools
|
||||||
|
======================================
|
||||||
|
http://www.flightgear.org
|
||||||
|
|
||||||
|
SimGear is a set of open-source libraries designed to be used as building
|
||||||
|
blocks for quickly assembling 3d simulations, games, and visualization
|
||||||
|
applications.
|
||||||
|
|
||||||
|
SimGear is developed by the FlightGear project and also provides the base
|
||||||
|
for the FlightGear Flight Simulator.
|
||||||
|
|
||||||
|
Source code for SimGear is released under the GNU Library General Public
|
||||||
|
License (LGPL) - see COPYING for license details.
|
||||||
|
|
||||||
|
See INSTALL file for help on building SimGear.
|
||||||
|
|||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
This document describes how to build SimGear using the supplied workspace and
|
|
||||||
project files.
|
|
||||||
|
|
||||||
Unpack the SimGear source file into your work directory. This creates a new
|
|
||||||
subdirectory called SimGear-X.Y.Z. Rename this to SimGear. Before we can
|
|
||||||
build SimGear you must unpack and build the third party libraries metakit and
|
|
||||||
zlib. Sources for these are included in the SimGear/src-libs directory.
|
|
||||||
Unpack these into the top level SimGear directory. At this point your
|
|
||||||
directory structure should look something like this:
|
|
||||||
|
|
||||||
<work_dir>/
|
|
||||||
SimGear/
|
|
||||||
metakit-x.y.z/
|
|
||||||
simgear/
|
|
||||||
src-libs/
|
|
||||||
zlib-x.y.z/
|
|
||||||
|
|
||||||
Now open the SimGear workspace. This workspace file contains projects for
|
|
||||||
building metakit(mklib), SimGear and zlib. Select each project as the active
|
|
||||||
project and build all. Order is unimportant since there are no dependencies
|
|
||||||
between the projects.
|
|
||||||
|
|
||||||
The workspace and project files are generated by a perl script with extra
|
|
||||||
input from the am2dsp.cfg file.
|
|
||||||
+3
-4
@@ -1,10 +1,9 @@
|
|||||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||||
|
|
||||||
You *must* have OpenSceneGraph (OSG) installed to build this version of
|
You *must* have OpenSceneGraph (OSG) installed to build this version of
|
||||||
FlightGear.
|
FlightGear.
|
||||||
|
|
||||||
Notice that FlightGear 1.9.0 requires at least version 2.7.8. Using earlier
|
Notice that this version of SimGear/FlightGear requires at least OSG 3.0.0.
|
||||||
versions of OSG will yield serious rendering bugs.
|
|
||||||
|
|
||||||
You can get the latest version of OSG from:
|
You can get the latest version of OSG from:
|
||||||
|
|
||||||
@@ -22,6 +21,6 @@ ccmake .
|
|||||||
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
||||||
then press 'g' to generate and exit ]
|
then press 'g' to generate and exit ]
|
||||||
|
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,3 @@ ccmake .
|
|||||||
then press 'g' to generate and exit ]
|
then press 'g' to generate and exit ]
|
||||||
|
|
||||||
|
|
||||||
The alut library is also required, but comes separately in the package
|
|
||||||
freelut-1.1.0.tar.gz. This package can be downloaded from the same page
|
|
||||||
(http://connect.creativelabs.com/openal/default.aspx). Download and run:
|
|
||||||
tar xzvf freelut-1.1.0.tar.gz
|
|
||||||
cd freealut-1.1.0
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
|
|||||||
+161
@@ -0,0 +1,161 @@
|
|||||||
|
Getting started with CMake
|
||||||
|
==========================
|
||||||
|
|
||||||
|
(These instructions apply to Unix-like systems, including Cygwin and Mac. To
|
||||||
|
build using Visual Studio or some other IDE supported by CMake, most of the
|
||||||
|
information below still applies. Otherwise see
|
||||||
|
http://wiki.flightgear.org/Building_Flightgear for Windows specific build
|
||||||
|
instructions.)
|
||||||
|
|
||||||
|
Always compile in a separate directory to the code. For example, if the
|
||||||
|
code (eg, from Git) is at /home/curt/projects/simgear, you might create
|
||||||
|
/home/curt/projects/sgbuild. Change into the new directory, and run
|
||||||
|
|
||||||
|
cmake ../simgear
|
||||||
|
|
||||||
|
To generate standard Unix Makefiles in sgbuild.
|
||||||
|
|
||||||
|
Probably you want to specify an install prefix:
|
||||||
|
|
||||||
|
cmake ../simgear -DCMAKE_INSTALL_PREFIX=/usr
|
||||||
|
|
||||||
|
Note the install prefix is automatically searched for required libraries
|
||||||
|
and header files, so if you install OpenSceneGraph to the same prefix,
|
||||||
|
most configuration options are unnecessary.
|
||||||
|
|
||||||
|
If for some reason you have a dependency (or several) at a different prefix,
|
||||||
|
you can specify one or more via CMAKE_PREFIX_PATH:
|
||||||
|
|
||||||
|
cmake ../simgear -DCMAKE_PREFIX_PATH="/opt/local;/opt/fgfs"
|
||||||
|
|
||||||
|
(note the use of semi-colons to specify multiple prefix paths)
|
||||||
|
|
||||||
|
Standard prefixes are searched automatically (/usr, /usr/local, /opt/local)
|
||||||
|
|
||||||
|
Most dependencies also expose an environment variable to specify their
|
||||||
|
installation directory explicitly eg OSG_DIR. Any of the methods
|
||||||
|
described above will work, but specifying an INSTALL_PREFIX or PREFIX_PATH is
|
||||||
|
usually simpler.
|
||||||
|
|
||||||
|
By default, we select a release build. To create a debug build, use
|
||||||
|
|
||||||
|
cmake ../simgear -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
|
||||||
|
(or MinSizeRel, or RelWithDbg)
|
||||||
|
|
||||||
|
Debug builds will automatically use corresponding debug builds of required
|
||||||
|
libraries, if they are available. For example you can install debug builds of
|
||||||
|
OpenSceneGraph, and a debug SimGear build will use them.
|
||||||
|
|
||||||
|
(Debug builds of libraries have the 'd' suffix by default - Release builds
|
||||||
|
have no additional suffix)
|
||||||
|
|
||||||
|
Note most IDE projects (eg Xcode and Visual Studio) support building all the
|
||||||
|
build types from the same project, so you can omit the CMAKE_BUILD_TYPE option
|
||||||
|
when running cmake, and simply pick the build configuration as normal in the
|
||||||
|
IDE.
|
||||||
|
|
||||||
|
It's common to have several build directories with different build
|
||||||
|
configurations, eg
|
||||||
|
|
||||||
|
/home/curt/projects/simgear (the git clone)
|
||||||
|
/home/curt/projects/sgdebug
|
||||||
|
/home/curt/projects/sgrelease
|
||||||
|
/home/curt/projects/sg-with-svn-osg
|
||||||
|
|
||||||
|
To set an optional feature, do
|
||||||
|
|
||||||
|
cmake ../simgear -DFEATURE_NAME=ON
|
||||||
|
|
||||||
|
(or 'OFF' to disable )
|
||||||
|
|
||||||
|
To see the variables that can be configured / are currently defined, you can
|
||||||
|
run one of the GUI front ends, or the following command:
|
||||||
|
|
||||||
|
cmake ../simgear -L
|
||||||
|
|
||||||
|
Add 'A' to see all the options (including advanced options), or 'H' to see
|
||||||
|
the help for each option (similar to running configure --help under autoconf):
|
||||||
|
|
||||||
|
cmake ../simgear -LH
|
||||||
|
|
||||||
|
|
||||||
|
Build Targets
|
||||||
|
=============
|
||||||
|
|
||||||
|
For a Unix makefile build, 'make dist', 'make uninstall' and 'make test' are
|
||||||
|
all available and should work as expected. 'make clean' is also as normal,
|
||||||
|
but there is *no* 'make distclean' target. The equivalent is to completely
|
||||||
|
remove your build directory, and start with a fresh one.
|
||||||
|
|
||||||
|
Adding new files to the build
|
||||||
|
|
||||||
|
Add source files to the SOURCES list, and headers to the HEADERS list. Note
|
||||||
|
technically you only need to add source files, but omitting headers confuses
|
||||||
|
project generation and distribution / packaging targets.
|
||||||
|
|
||||||
|
For target conditional files, you can append to the SOURCES or HEADERS lists
|
||||||
|
inside an if() test, for example:
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
list(APPEND SOURCES extraFile1.cxx extraFile2.cxx)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
Setting include directories
|
||||||
|
|
||||||
|
In any CMakeList.txt, you can do the following:
|
||||||
|
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR}/some/path)
|
||||||
|
|
||||||
|
For example, this can be done in particular subdirectory, or at the project
|
||||||
|
root, or an intermediate level.
|
||||||
|
|
||||||
|
Setting target specific compile flags, includes or defines
|
||||||
|
|
||||||
|
Use set_target_property(), for example
|
||||||
|
|
||||||
|
set_target_property(fgfs PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS FOO BAR=1)
|
||||||
|
|
||||||
|
You can set a property on an individual source file:
|
||||||
|
|
||||||
|
set_property(SOURCE myfile.cxx PROPERTY COMPILE_FLAGS "-Wno-unsigned-compare")
|
||||||
|
|
||||||
|
Detecting Features / Libraries
|
||||||
|
|
||||||
|
For most standard libraries (Gtk, wxWidget, Python, GDAL, Qt, libXml, Boost),
|
||||||
|
cmake provides a standard helper. To see the available modules, run:
|
||||||
|
|
||||||
|
cmake --help-module-list
|
||||||
|
|
||||||
|
In the root CMakeLists file, use a statement like:
|
||||||
|
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
Each package helper sets various variables such aaa_FOUND, aaa_INCLUDE_DIR,
|
||||||
|
and aaa_LIBRARY. Depending on the complexity of the package, these variables
|
||||||
|
might have different names (eg, OPENSCENEGRAPH_LIBRARIES).
|
||||||
|
|
||||||
|
If there's no standard helper for a library you need, find a similar one, copy
|
||||||
|
it to CMakeModules/FindABC.cmake, and modify the code to fit. Generally this
|
||||||
|
is pretty straightforward. The built-in modules reside in the Cmake 'share'
|
||||||
|
directory, eg /usr/share/cmake/modules on Unix systems.
|
||||||
|
|
||||||
|
Note libraries support by pkg-config can be handled directly, with no need
|
||||||
|
to create a custom FindABC helper.
|
||||||
|
|
||||||
|
Adding a new executable target
|
||||||
|
|
||||||
|
add_executable(myexecutable ${SOURCES} ${HEADERS})
|
||||||
|
target_link_libraries(myexecutable .... libraries ... )
|
||||||
|
install(TARGETS myexecutable RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
|
(If the executable should not be installed, omit the final line above)
|
||||||
|
|
||||||
|
If you add an additional line
|
||||||
|
|
||||||
|
add_test(testname ${EXECUTABLE_OUTPUT_PATH}/myexecutable)
|
||||||
|
|
||||||
|
Then running 'make test' will run your executable as a unit test. The
|
||||||
|
executable should return either a success or failure result code.
|
||||||
|
|
||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
|
||||||
|
|
||||||
You *must* have plib version 1.8.5 or later installed on your system
|
|
||||||
to build FlightGear!" Flight Gear is no longer compatible with the
|
|
||||||
earlier versions of the library.
|
|
||||||
|
|
||||||
You can get the latest version of plib from:
|
|
||||||
|
|
||||||
http://plib.sourceforge.net
|
|
||||||
|
|
||||||
Build notes:
|
|
||||||
|
|
||||||
You should be able to just run "./configure" to configure the package
|
|
||||||
and use all of plib's defaults. Then run "make" followed by "make
|
|
||||||
install". By default, plib installs itself into /usr so if you don't
|
|
||||||
like this, be sure to specify an alternate prefix such as --prefix=/usr/local
|
|
||||||
|
|
||||||
As of this writing (2007-11-18), many linux distributions are shipped with a
|
|
||||||
working version of plib, so chances are that this library is already
|
|
||||||
installed. It should be noted, that currently plib version no longer compiles
|
|
||||||
using recent versions of gcc (confirmed on version gcc 4.1.2, as shipped with
|
|
||||||
SuSe 10.2). As a workaround, it is possible to either use plib SVN. Run the
|
|
||||||
following commands:
|
|
||||||
|
|
||||||
|
|
||||||
svn co https://plib.svn.sourceforge.net/svnroot/plib/trunk plib
|
|
||||||
cd plib
|
|
||||||
./autogen.sh
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
03/25/2001 - Resolve location of Sky dome implimentation documentation.
|
|
||||||
-686
@@ -1,686 +0,0 @@
|
|||||||
dnl
|
|
||||||
dnl originally from ncftp 2.3.0
|
|
||||||
dnl added wi_EXTRA_PDIR and wi_ANSI_C
|
|
||||||
dnl $Id$
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_EXTRA_IDIR], [
|
|
||||||
incdir="$1"
|
|
||||||
if test -r $incdir ; then
|
|
||||||
case "$CPPFLAGS" in
|
|
||||||
*-I${incdir}*)
|
|
||||||
# echo " + already had $incdir" 1>&6
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if test "$CPPFLAGS" = "" ; then
|
|
||||||
CPPFLAGS="-I$incdir"
|
|
||||||
else
|
|
||||||
CPPFLAGS="$CPPFLAGS -I$incdir"
|
|
||||||
fi
|
|
||||||
echo " + found $incdir" 1>&6
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_EXTRA_LDIR], [
|
|
||||||
mylibdir="$1"
|
|
||||||
if test -r $mylibdir ; then
|
|
||||||
case "$LDFLAGS" in
|
|
||||||
*-L${mylibdir}*)
|
|
||||||
# echo " + already had $mylibdir" 1>&6
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if test "$LDFLAGS" = "" ; then
|
|
||||||
LDFLAGS="-L$mylibdir"
|
|
||||||
else
|
|
||||||
LDFLAGS="$LDFLAGS -L$mylibdir"
|
|
||||||
fi
|
|
||||||
echo " + found $mylibdir" 1>&6
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl __FP__
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_EXTRA_PDIR], [
|
|
||||||
progdir="$1"
|
|
||||||
if test -r $progdir ; then
|
|
||||||
case "$PATH" in
|
|
||||||
*:${progdir}*)
|
|
||||||
# echo " + already had $progdir" 1>&6
|
|
||||||
;;
|
|
||||||
*${progdir}:*)
|
|
||||||
# echo " + already had $progdir" 1>&6
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if test "$PATH" = "" ; then
|
|
||||||
PATH="$progdir"
|
|
||||||
else
|
|
||||||
PATH="$PATH:$progdir"
|
|
||||||
fi
|
|
||||||
echo " + found $progdir" 1>&6
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl If you want to also look for include and lib subdirectories in the
|
|
||||||
dnl $HOME tree, you supply "yes" as the first argument to this macro.
|
|
||||||
dnl
|
|
||||||
dnl If you want to look for subdirectories in include/lib directories,
|
|
||||||
dnl you pass the names in argument 3, otherwise pass a dash.
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_EXTRA_DIRS], [echo "checking for extra include and lib directories..." 1>&6
|
|
||||||
ifelse([$1], yes, [dnl
|
|
||||||
b1=`cd .. ; pwd`
|
|
||||||
b2=`cd ../.. ; pwd`
|
|
||||||
exdirs="$HOME $j $b1 $b2 $prefix $2"
|
|
||||||
],[dnl
|
|
||||||
exdirs="$prefix $2"
|
|
||||||
])
|
|
||||||
subexdirs="$3"
|
|
||||||
if test "$subexdirs" = "" ; then
|
|
||||||
subexdirs="-"
|
|
||||||
fi
|
|
||||||
for subexdir in $subexdirs ; do
|
|
||||||
if test "$subexdir" = "-" ; then
|
|
||||||
subexdir=""
|
|
||||||
else
|
|
||||||
subexdir="/$subexdir"
|
|
||||||
fi
|
|
||||||
for exdir in $exdirs ; do
|
|
||||||
if test "$exdir" != "/usr" || test "$subexdir" != ""; then
|
|
||||||
incdir="${exdir}/include${subexdir}"
|
|
||||||
wi_EXTRA_IDIR($incdir)
|
|
||||||
|
|
||||||
mylibdir="${exdir}/lib${subexdir}"
|
|
||||||
wi_EXTRA_LDIR($mylibdir)
|
|
||||||
|
|
||||||
progdir="${exdir}/bin${subexdir}"
|
|
||||||
wi_EXTRA_PDIR($progdir)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_HPUX_CFLAGS],
|
|
||||||
[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
os=`uname -s | tr '[A-Z]' '[a-z]'`
|
|
||||||
ac_cv_hpux_flags=no
|
|
||||||
if test "$os" = hp-ux ; then
|
|
||||||
if test "$ac_cv_prog_gcc" = yes ; then
|
|
||||||
if test "$CFLAGS" != "" ; then
|
|
||||||
# Shouldn't be in there.
|
|
||||||
CFLAGS=`echo "$CFLAGS" | sed 's/-Aa//g'`
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# If you're not using gcc, then you better have a cc/c89
|
|
||||||
# that is usable. If you have the barebones compiler, it
|
|
||||||
# won't work. The good compiler uses -Aa for the ANSI
|
|
||||||
# compatible stuff.
|
|
||||||
x=`echo $CFLAGS | grep 'Aa' 2>/dev/null`
|
|
||||||
if test "$x" = "" ; then
|
|
||||||
CFLAGS="$CFLAGS -Aa"
|
|
||||||
fi
|
|
||||||
ac_cv_hpux_flags=yes
|
|
||||||
fi
|
|
||||||
# Also add _HPUX_SOURCE to get the extended namespace.
|
|
||||||
x=`echo $CFLAGS | grep '_HPUX_SOURCE' 2>/dev/null`
|
|
||||||
if test "$x" = "" ; then
|
|
||||||
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($ac_cv_hpux_flags)
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_CFLAGS], [AC_REQUIRE([AC_PROG_CC])
|
|
||||||
wi_HPUX_CFLAGS
|
|
||||||
if test "$CFLAGS" = "" ; then
|
|
||||||
CFLAGS="-O"
|
|
||||||
elif test "$ac_cv_prog_gcc" = "yes" ; then
|
|
||||||
case "$CFLAGS" in
|
|
||||||
*"-g -O"*)
|
|
||||||
#echo "using -g as default gcc CFLAGS" 1>&6
|
|
||||||
CFLAGS=`echo $CFLAGS | sed 's/-g\ -O/-O/'`
|
|
||||||
;;
|
|
||||||
*"-O -g"*)
|
|
||||||
# Leave the -g, but remove all -O options.
|
|
||||||
#echo "using -g as default gcc CFLAGS" 1>&6
|
|
||||||
CFLAGS=`echo $CFLAGS | sed 's/-O\ -g/-O/'`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_PROTOTYPES], [
|
|
||||||
AC_MSG_CHECKING(if the compiler supports function prototypes)
|
|
||||||
AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
|
|
||||||
AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
|
|
||||||
AC_MSG_RESULT($wi_cv_prototypes)
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_ANSI_C], [
|
|
||||||
AC_MSG_CHECKING(ANSI-style function definitions)
|
|
||||||
AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes
|
|
||||||
AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no)
|
|
||||||
AC_MSG_RESULT($wi_cv_ansi_funcs)
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_HEADER_SYS_SELECT_H], [
|
|
||||||
# See if <sys/select.h> is includable after <sys/time.h>
|
|
||||||
if test "$ac_cv_header_sys_time_h" = no ; then
|
|
||||||
AC_CHECK_HEADERS(sys/time.h sys/select.h)
|
|
||||||
else
|
|
||||||
AC_CHECK_HEADERS(sys/select.h)
|
|
||||||
fi
|
|
||||||
if test "$ac_cv_header_sys_select_h" = yes ; then
|
|
||||||
AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
|
|
||||||
selecth=yes
|
|
||||||
if test "$ac_cv_header_sys_time_h" = yes ; then
|
|
||||||
AC_TRY_COMPILE([#include <sys/time.h>
|
|
||||||
#include <sys/select.h>],[
|
|
||||||
fd_set a;
|
|
||||||
struct timeval tmval;
|
|
||||||
|
|
||||||
tmval.tv_sec = 0;],selecth=yes,selecth=no)
|
|
||||||
|
|
||||||
if test "$selecth" = yes ; then
|
|
||||||
AC_DEFINE(CAN_USE_SYS_SELECT_H)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($selecth)
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_LIB_RESOLV], [
|
|
||||||
# See if we could access two well-known sites without help of any special
|
|
||||||
# libraries, like resolv.
|
|
||||||
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
struct hostent *hp1, *hp2;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
hp1 = gethostbyname("gatekeeper.dec.com");
|
|
||||||
hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
|
|
||||||
result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
|
|
||||||
exit(! result);
|
|
||||||
}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if we need to look for -lresolv])
|
|
||||||
AC_MSG_RESULT($look_for_resolv)
|
|
||||||
if test "$look_for_resolv" = yes ; then
|
|
||||||
AC_CHECK_LIB(resolv,main)
|
|
||||||
else
|
|
||||||
ac_cv_lib_resolv=no
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
|
|
||||||
AC_DEFUN([wi_LIB_NSL], [
|
|
||||||
AC_MSG_CHECKING(if we can use -lnsl)
|
|
||||||
ac_save_LIBS="$LIBS";
|
|
||||||
LIBS="$LIBS -lnsl";
|
|
||||||
AC_CACHE_VAL(r_cv_use_libnsl, [
|
|
||||||
AC_TRY_RUN(
|
|
||||||
main() { if (getpwuid(getuid())) exit(0); exit(-1); },
|
|
||||||
nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no)
|
|
||||||
])
|
|
||||||
if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi
|
|
||||||
AC_MSG_RESULT($nc_cv_use_libnsl)
|
|
||||||
])dnl
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
|
|
||||||
AC_DEFUN([nc_PATH_PROG_ZCAT], [
|
|
||||||
AC_PATH_PROG(GZCAT,gzcat)
|
|
||||||
AC_PATH_PROG(ZCAT,zcat)
|
|
||||||
if test "x$GZCAT" = x ; then
|
|
||||||
if test "x$ZCAT" != x ; then
|
|
||||||
# See if zcat is really gzcat. gzcat has a --version option, regular
|
|
||||||
# zcat does not.
|
|
||||||
AC_MSG_CHECKING(if zcat is really gzcat in disguise)
|
|
||||||
if $ZCAT --version 2> /dev/null ; then
|
|
||||||
AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT")
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$ZCAT" != x ; then
|
|
||||||
AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT")
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_SYSV_EXTRA_DIRS], [
|
|
||||||
# Use System V because their curses extensions are required. This must
|
|
||||||
# be done early so we use the -I and -L in the library checks also.
|
|
||||||
# This is mostly a Solaris/SunOS hack. Note that doing this will also
|
|
||||||
# use all of the other System V libraries and headers.
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for alternative System V libraries)
|
|
||||||
if test -f /usr/5include/curses.h ; then
|
|
||||||
CPPFLAGS="$CPPFLAGS -I/usr/5include"
|
|
||||||
LDFLAGS="$LDFLAGS -L/usr/5lib"
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_DEFINE_UNAME], [
|
|
||||||
# Get first 127 chars of all uname information. Some folks have
|
|
||||||
# way too much stuff there, so grab only the first 127.
|
|
||||||
unam=`uname -a 2>/dev/null | cut -c1-127`
|
|
||||||
if test "$unam" != "" ; then
|
|
||||||
AC_DEFINE_UNQUOTED(UNAME, "$unam")
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([wi_READLINE_WITH_NCURSES], [
|
|
||||||
# Readline and Ncurses could both define "backspace".
|
|
||||||
# Warn about this if we have both things in our definitions list.
|
|
||||||
|
|
||||||
if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(if readline and ncurses will link together)
|
|
||||||
j="$LIBS"
|
|
||||||
LIBS="-lreadline -lncurses"
|
|
||||||
AC_TRY_LINK(,[
|
|
||||||
readline("prompt");
|
|
||||||
endwin();
|
|
||||||
],k=yes,k=no)
|
|
||||||
if test "$k" = no ; then
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
# Remove '-lreadline' from LIBS.
|
|
||||||
LIBS=`echo $j | sed s/-lreadline//g`
|
|
||||||
ac_cv_lib_readline=no
|
|
||||||
AC_WARN([The versions of GNU readline and ncurses you have installed on this system
|
|
||||||
can't be used together, because they use the same symbol, backspace. If
|
|
||||||
possible, recompile one of the libraries with -Dbackspace=back_space, then
|
|
||||||
re-run configure.])
|
|
||||||
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
LIBS="$j"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
dnl
|
|
||||||
|
|
||||||
dnl AC_EXT_DAYLIGHT
|
|
||||||
dnl Check for an external variable daylight. Stolen from w3c-libwww.
|
|
||||||
AC_DEFUN([AC_EXT_DAYLIGHT],
|
|
||||||
[ AC_MSG_CHECKING(int daylight variable)
|
|
||||||
AC_TRY_COMPILE([#include <time.h>], [return daylight;],
|
|
||||||
have_daylight=yes,
|
|
||||||
have_daylight=no)
|
|
||||||
AC_MSG_RESULT($have_daylight)
|
|
||||||
])dnl
|
|
||||||
|
|
||||||
dnl AC_EXT_TIMEZONE
|
|
||||||
dnl Check for an external variable timezone. Stolen from tcl-8.0.
|
|
||||||
AC_DEFUN([AC_EXT_TIMEZONE],
|
|
||||||
[
|
|
||||||
#
|
|
||||||
# Its important to include time.h in this check, as some systems (like convex)
|
|
||||||
# have timezone functions, etc.
|
|
||||||
#
|
|
||||||
have_timezone=no
|
|
||||||
AC_MSG_CHECKING([long timezone variable])
|
|
||||||
AC_TRY_COMPILE([#include <time.h>],
|
|
||||||
[extern long timezone;
|
|
||||||
timezone += 1;
|
|
||||||
exit (0);],
|
|
||||||
[have_timezone=yes
|
|
||||||
AC_MSG_RESULT(yes)],
|
|
||||||
AC_MSG_RESULT(no))
|
|
||||||
|
|
||||||
#
|
|
||||||
# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
|
|
||||||
#
|
|
||||||
if test "$have_timezone" = no; then
|
|
||||||
AC_MSG_CHECKING([time_t timezone variable])
|
|
||||||
AC_TRY_COMPILE([#include <time.h>],
|
|
||||||
[extern time_t timezone;
|
|
||||||
timezone += 1;
|
|
||||||
exit (0);],
|
|
||||||
[have_timezone=yes
|
|
||||||
AC_MSG_RESULT(yes)],
|
|
||||||
AC_MSG_RESULT(no))
|
|
||||||
fi
|
|
||||||
])dnl
|
|
||||||
|
|
||||||
## AC_BZ_SET_COMPILER: Addition by Theodore Papadopoulo
|
|
||||||
## Patch by Jim McKelvey: change sed -e 's/ /@/g' to sed -e 's/ /@/'
|
|
||||||
AC_DEFUN([AC_SG_SET_COMPILER],
|
|
||||||
[cxxwith=`echo $1 | sed -e 's/ /@/'`
|
|
||||||
case "$cxxwith" in
|
|
||||||
*:*@*) # Full initialization syntax
|
|
||||||
CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)@.*/\1/p'`
|
|
||||||
CXXFLAGS=`echo "$cxxwith" | sed -n -e 's/.*:.*@\(.*\)/\1/p'`
|
|
||||||
;;
|
|
||||||
*:*) # Simple initialization syntax
|
|
||||||
CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)/\1/p'`
|
|
||||||
CXXFLAGS=$3
|
|
||||||
;;
|
|
||||||
*) # Default values
|
|
||||||
CXX=$2
|
|
||||||
CXXFLAGS=$3
|
|
||||||
CC="$2 --c"
|
|
||||||
## CFLAGS=
|
|
||||||
;;
|
|
||||||
esac])
|
|
||||||
|
|
||||||
pushdef([AC_PROG_INSTALL],
|
|
||||||
[
|
|
||||||
dnl our own version, testing for a -p flag
|
|
||||||
popdef([AC_PROG_INSTALL])
|
|
||||||
dnl as AC_PROG_INSTALL works as it works we first have
|
|
||||||
dnl to save if the user didn't specify INSTALL, as the
|
|
||||||
dnl autoconf one overwrites INSTALL and we have no chance to find
|
|
||||||
dnl out afterwards
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
|
|
||||||
# OK, user hasn't given any INSTALL, autoconf found one for us
|
|
||||||
# now we test, if it supports the -p flag
|
|
||||||
AC_MSG_CHECKING(for -p flag to install)
|
|
||||||
rm -f confinst.$$.* > /dev/null 2>&1
|
|
||||||
echo "Testtest" > confinst.$$.orig
|
|
||||||
ac_res=no
|
|
||||||
if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
|
|
||||||
if test -f confinst.$$.new ; then
|
|
||||||
# OK, -p seems to do no harm to install
|
|
||||||
INSTALL="${INSTALL} -p"
|
|
||||||
ac_res=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
rm -f confinst.$$.*
|
|
||||||
AC_MSG_RESULT($ac_res)
|
|
||||||
dnl the following tries to resolve some signs and wonders coming up
|
|
||||||
dnl with different autoconf/automake versions
|
|
||||||
dnl e.g.:
|
|
||||||
dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
|
|
||||||
dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
|
|
||||||
dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
|
|
||||||
dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
|
|
||||||
dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
|
|
||||||
dnl install-@DIR@PROGRAMS targets to explicitly use that flag
|
|
||||||
dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
|
|
||||||
dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
|
|
||||||
dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
|
|
||||||
dnl to clean up that mess we:
|
|
||||||
dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
|
|
||||||
dnl which cleans KDE's program with automake > 1.4;
|
|
||||||
dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
|
|
||||||
dnl with automake<=1.4
|
|
||||||
dnl note that dues to this sometimes two '-s' flags are used
|
|
||||||
INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
|
|
||||||
INSTALL_SCRIPT='${INSTALL}'
|
|
||||||
])dnl
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# http://autoconf-archive.cryp.to/ax_boost_base.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_BOOST_BASE([MINIMUM-VERSION])
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Test for the Boost C++ libraries of a particular version (or newer)
|
|
||||||
#
|
|
||||||
# If no path to the installed boost library is given the macro searchs
|
|
||||||
# under /usr, /usr/local, /opt and /opt/local and evaluates the
|
|
||||||
# $BOOST_ROOT environment variable. Further documentation is available at
|
|
||||||
# <http://randspringer.de/boost/index.html>.
|
|
||||||
#
|
|
||||||
# This macro calls:
|
|
||||||
#
|
|
||||||
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
|
|
||||||
#
|
|
||||||
# And sets:
|
|
||||||
#
|
|
||||||
# HAVE_BOOST
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2008-04-12
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_BOOST_BASE],
|
|
||||||
[
|
|
||||||
AC_ARG_WITH([boost],
|
|
||||||
AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
|
|
||||||
[
|
|
||||||
if test "$withval" = "no"; then
|
|
||||||
want_boost="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
want_boost="yes"
|
|
||||||
ac_boost_path=""
|
|
||||||
else
|
|
||||||
want_boost="yes"
|
|
||||||
ac_boost_path="$withval"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_boost="yes"])
|
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_WITH([boost-libdir],
|
|
||||||
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
|
||||||
[Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
|
|
||||||
[
|
|
||||||
if test -d $withval
|
|
||||||
then
|
|
||||||
ac_boost_lib_path="$withval"
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR(--with-boost-libdir expected directory name)
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[ac_boost_lib_path=""]
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "x$want_boost" = "xyes"; then
|
|
||||||
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
|
||||||
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
|
||||||
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
|
||||||
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
|
||||||
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
|
||||||
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
|
||||||
boost_lib_version_req_sub_minor="0"
|
|
||||||
fi
|
|
||||||
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
|
||||||
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
|
||||||
succeeded=no
|
|
||||||
|
|
||||||
dnl first we check the system location for boost libraries
|
|
||||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
|
||||||
dnl or if you install boost with RPM
|
|
||||||
if test "$ac_boost_path" != ""; then
|
|
||||||
BOOST_LDFLAGS="-L$ac_boost_path/lib"
|
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
|
||||||
else
|
|
||||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
|
||||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
|
||||||
BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
|
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl overwrite ld flags if we have required special directory with
|
|
||||||
dnl --with-boost-libdir parameter
|
|
||||||
if test "$ac_boost_lib_path" != ""; then
|
|
||||||
BOOST_LDFLAGS="-L$ac_boost_lib_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
export CPPFLAGS
|
|
||||||
|
|
||||||
LDFLAGS_SAVED="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
@%:@include <boost/version.hpp>
|
|
||||||
]], [[
|
|
||||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
|
||||||
// Everything is okay
|
|
||||||
#else
|
|
||||||
# error Boost version is too old
|
|
||||||
#endif
|
|
||||||
]])],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
succeeded=yes
|
|
||||||
found_system=yes
|
|
||||||
],[
|
|
||||||
])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl if we found no boost with system layout we search for boost libraries
|
|
||||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
|
||||||
if test "x$succeeded" != "xyes"; then
|
|
||||||
_version=0
|
|
||||||
if test "$ac_boost_path" != ""; then
|
|
||||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
|
||||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
|
||||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
|
||||||
V_CHECK=`expr $_version_tmp \> $_version`
|
|
||||||
if test "$V_CHECK" = "1" ; then
|
|
||||||
_version=$_version_tmp
|
|
||||||
fi
|
|
||||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
|
|
||||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
|
||||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
|
||||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
|
||||||
V_CHECK=`expr $_version_tmp \> $_version`
|
|
||||||
if test "$V_CHECK" = "1" ; then
|
|
||||||
_version=$_version_tmp
|
|
||||||
best_path=$ac_boost_path
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
|
||||||
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
|
||||||
if test "$ac_boost_lib_path" = ""
|
|
||||||
then
|
|
||||||
BOOST_LDFLAGS="-L$best_path/lib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$BOOST_ROOT" != "x"; then
|
|
||||||
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
|
|
||||||
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
|
|
||||||
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
|
||||||
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
|
||||||
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
|
||||||
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
|
|
||||||
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
|
||||||
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
|
||||||
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
export CPPFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
@%:@include <boost/version.hpp>
|
|
||||||
]], [[
|
|
||||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
|
||||||
// Everything is okay
|
|
||||||
#else
|
|
||||||
# error Boost version is too old
|
|
||||||
#endif
|
|
||||||
]])],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
succeeded=yes
|
|
||||||
found_system=yes
|
|
||||||
],[
|
|
||||||
])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$succeeded" != "yes" ; then
|
|
||||||
if test "$_version" = "0" ; then
|
|
||||||
AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([Your boost libraries seems to old (version $_version).])
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_SUBST(BOOST_CPPFLAGS)
|
|
||||||
AC_SUBST(BOOST_LDFLAGS)
|
|
||||||
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
|
||||||
LDFLAGS="$LDFLAGS_SAVED"
|
|
||||||
fi
|
|
||||||
|
|
||||||
])
|
|
||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
type = StaticLibrary,Multithreaded,
|
|
||||||
exclude_dir = threads
|
|
||||||
|
|
||||||
include_path = .
|
|
||||||
include_path = ..
|
|
||||||
include_path = .\SimGear
|
|
||||||
include_path = ..\zlib-1.2.3
|
|
||||||
include_path = "..\OpenAL 1.0 Software Development Kit\include"
|
|
||||||
|
|
||||||
define = _USE_MATH_DEFINES
|
|
||||||
define = _CRT_SECURE_NO_DEPRECATE
|
|
||||||
define = HAVE_CONFIG_H
|
|
||||||
|
|
||||||
# Rule to create simgear_config.h
|
|
||||||
add_source_file = SOURCE=.\simgear\simgear_config.h.vc5\
|
|
||||||
\
|
|
||||||
!IF "$(CFG)" == "SimGear - Win32 Release"\
|
|
||||||
\
|
|
||||||
# Begin Custom Build - Creating config.h\
|
|
||||||
InputPath=.\simgear\simgear_config.h.vc5\
|
|
||||||
\
|
|
||||||
".\simgear\simgear_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\
|
|
||||||
copy .\simgear\simgear_config.h.vc5 .\simgear\simgear_config.h\
|
|
||||||
\
|
|
||||||
# End Custom Build\
|
|
||||||
\
|
|
||||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"\
|
|
||||||
\
|
|
||||||
# Begin Custom Build - Creating config.h\
|
|
||||||
InputPath=.\simgear\simgear_config.h.vc5\
|
|
||||||
\
|
|
||||||
".\simgear\simgear_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\
|
|
||||||
copy .\simgear\simgear_config.h.vc5 .\simgear\simgear_config.h\
|
|
||||||
\
|
|
||||||
# End Custom Build\
|
|
||||||
\
|
|
||||||
!ENDIF\
|
|
||||||
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
OSTYPE=`uname -s`
|
|
||||||
MACHINE=`uname -m`
|
|
||||||
AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\.\([0-9]*\).*/\1/'`
|
|
||||||
if test $AUTO_MAKE_VERSION -lt 15; then
|
|
||||||
echo ""
|
|
||||||
echo "You need to upgrade to automake version 1.5 or greater."
|
|
||||||
echo "Most distributions have packages available to install or you can"
|
|
||||||
echo "find the source for the most recent version at"
|
|
||||||
echo "ftp://ftp.gnu.org/gnu/automake"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Host info: $OSTYPE $MACHINE"
|
|
||||||
echo -n " automake: `automake --version | head -1 | awk '{print $4}'`"
|
|
||||||
echo " ($AUTO_MAKE_VERSION)"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "Running aclocal"
|
|
||||||
aclocal
|
|
||||||
|
|
||||||
echo "Running autoheader"
|
|
||||||
autoheader
|
|
||||||
if [ ! -e simgear/simgear_config.h.in ]; then
|
|
||||||
echo "ERROR: autoheader didn't create simgear/simgear_config.h.in!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running automake --add-missing"
|
|
||||||
automake --add-missing
|
|
||||||
|
|
||||||
echo "Running autoconf"
|
|
||||||
autoconf
|
|
||||||
|
|
||||||
if [ ! -e configure ]; then
|
|
||||||
echo "ERROR: configure was not created!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "======================================"
|
|
||||||
|
|
||||||
if [ -f config.cache ]; then
|
|
||||||
echo "config.cache exists. Removing the config.cache file will force"
|
|
||||||
echo "the ./configure script to rerun all it's tests rather than using"
|
|
||||||
echo "the previously cached values."
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Now you are ready to run './configure'"
|
|
||||||
echo "======================================"
|
|
||||||
-638
@@ -1,638 +0,0 @@
|
|||||||
dnl Process this file with autoget.sh to produce a working configure
|
|
||||||
dnl script.
|
|
||||||
|
|
||||||
AC_INIT
|
|
||||||
AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
|
|
||||||
|
|
||||||
dnl Require at least automake 2.52
|
|
||||||
AC_PREREQ(2.52)
|
|
||||||
|
|
||||||
dnl Initialize the automake stuff
|
|
||||||
AM_INIT_AUTOMAKE(SimGear, 2.0.0-rc2)
|
|
||||||
|
|
||||||
dnl Specify KAI C++ compiler and flags.
|
|
||||||
dnl Borrowed with slight modification from blitz distribution.
|
|
||||||
AC_ARG_WITH(cxx,
|
|
||||||
[ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
|
|
||||||
[case "$withval" in
|
|
||||||
KCC*) # KAI C++ http://www.kai.com/
|
|
||||||
echo "Configuring for KAI C++"
|
|
||||||
AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
|
|
||||||
CXX_OPTIMIZE_FLAGS=="+K3 -O3"
|
|
||||||
CXX_DEBUG_FLAGS="-g +K0"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([CXX])
|
|
||||||
AC_MSG_RESULT([$CXX])
|
|
||||||
AC_MSG_CHECKING([CC])
|
|
||||||
AC_MSG_RESULT([$CC])
|
|
||||||
|
|
||||||
dnl Checks for programs.
|
|
||||||
AC_PROG_MAKE_SET
|
|
||||||
AC_PROG_CC
|
|
||||||
AC_PROG_CPP
|
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_RANLIB
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
AC_PROG_LN_S
|
|
||||||
AX_BOOST_BASE([1.37.0])
|
|
||||||
|
|
||||||
if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl set the $host variable based on local machine/os
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
|
|
||||||
dnl Used on the Irix platform
|
|
||||||
case "${host}" in
|
|
||||||
*-*-irix*)
|
|
||||||
if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
|
|
||||||
AR="$CXX -ar"
|
|
||||||
ARFLAGS="-o"
|
|
||||||
CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
|
|
||||||
compatibility_DIR="compatibility"
|
|
||||||
MIPSpro_DIRS="MIPSpro740"
|
|
||||||
AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
|
|
||||||
AC_TRY_RUN([
|
|
||||||
int main() {
|
|
||||||
if ( _COMPILER_VERSION < 740 ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
], AC_MSG_RESULT(yes),
|
|
||||||
[ AC_MSG_RESULT(no)
|
|
||||||
CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
|
|
||||||
MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
|
|
||||||
AC_MSG_WARN([Using our own subset of the STL headers])
|
|
||||||
], AC_MSG_RESULT(yes))
|
|
||||||
AC_SUBST(MIPSpro_DIRS)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AR="ar"
|
|
||||||
ARFLAGS="cru"
|
|
||||||
compatibility_DIR=
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_SUBST(AR)
|
|
||||||
AC_SUBST(ARFLAGS)
|
|
||||||
AC_SUBST(compatibility_DIR)
|
|
||||||
|
|
||||||
if echo $includedir | egrep "simgear$" > /dev/null; then
|
|
||||||
echo "includedir is" $includedir "libdir is" $libdir
|
|
||||||
else
|
|
||||||
includedir="${includedir}/simgear"
|
|
||||||
echo "includedir changed to" $includedir "libdir is" $libdir
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl set logging; default value of with_logging=yes
|
|
||||||
AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
|
|
||||||
if test "x$with_logging" = "xno" ; then
|
|
||||||
AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Specify if we want to build with Norman's jpeg image server support.
|
|
||||||
# This requires libjpeg to be installed and available.
|
|
||||||
# Default to with_jpeg_server=no
|
|
||||||
JPEGLIB=''
|
|
||||||
AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
|
|
||||||
if test "x$with_jpeg_factory" = "xyes" ; then
|
|
||||||
echo "Building with Norman's jpeg image factory support"
|
|
||||||
AC_CHECK_LIB(jpeg, jpeg_start_compress)
|
|
||||||
if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
|
|
||||||
echo
|
|
||||||
echo "In order to build the jpeg factory code you need libjpeg installed."
|
|
||||||
echo "otherwise please configure with the --with-jpeg-sever=no option"
|
|
||||||
echo
|
|
||||||
echo "libjpeg is available at :"
|
|
||||||
echo " ftp://ftp.uu.net in the directory graphics/jpeg"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Building without Norman's jpeg image server support"
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
|
|
||||||
|
|
||||||
# specify the plib location
|
|
||||||
AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
|
|
||||||
|
|
||||||
if test "x$with_plib" != "x" ; then
|
|
||||||
echo "plib prefix is $with_plib"
|
|
||||||
EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(plib_framework, [ --with-plib-framework=PREFIX Specify the prefix path to PLIB.framework ])
|
|
||||||
|
|
||||||
if test "x$with_plib_framework" != "x"; then
|
|
||||||
echo "plib framework prefix is $with_plib_framework"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# specify the osg location
|
|
||||||
AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
|
|
||||||
|
|
||||||
if test "x$with_osg" != "x" ; then
|
|
||||||
echo "osg prefix is $with_osg"
|
|
||||||
EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
|
|
||||||
|
|
||||||
if test "x$with_osg_framework" != "x"; then
|
|
||||||
echo "osg framework prefix is $with_osg_framework"
|
|
||||||
CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
|
|
||||||
export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl specifying OpenAL.framework (for user provided OpenAL.framework / ALUT)
|
|
||||||
AC_ARG_WITH(openal_framework, [ --with-openal-framework=PREFIX Speicfy the prefix path to OpenAL.framework ])
|
|
||||||
|
|
||||||
if test "x$with_openal_framework" != "x"; then
|
|
||||||
echo "OpenAL framework prefix is $with_openal_framework"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Determine an extra directories to add to include/lib search paths
|
|
||||||
case "${host}" in
|
|
||||||
*-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
|
|
||||||
echo no EXTRA_DIRS for $host
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
if test -d /usr/X11R6 ; then
|
|
||||||
EXTRA_DIR1="/usr/X11R6"
|
|
||||||
fi
|
|
||||||
if test -d /opt/X11R6 ; then
|
|
||||||
EXTRA_DIR2="/opt/X11R6"
|
|
||||||
fi
|
|
||||||
EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
|
|
||||||
|
|
||||||
|
|
||||||
dnl Using AM_CONDITIONAL is a step out of the protected little
|
|
||||||
dnl automake fold so it is potentially dangerous. But, we are
|
|
||||||
dnl beginning to run into cases where the standard checks are not
|
|
||||||
dnl enough. AM_CONDITIONALS are then referenced to conditionally
|
|
||||||
dnl build a Makefile.in from a Makefile.am which lets us define custom
|
|
||||||
dnl includes, compile alternative source files, etc.
|
|
||||||
|
|
||||||
dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
|
|
||||||
dnl to use it if it is.
|
|
||||||
case "${host}" in
|
|
||||||
*-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
|
|
||||||
echo no fancy X11 check
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
AC_PATH_XTRA
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl Checks for libraries.
|
|
||||||
|
|
||||||
dnl Thread related checks
|
|
||||||
AC_CHECK_HEADER(pthread.h)
|
|
||||||
AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
|
|
||||||
if test "x$ac_cv_header_pthread_h" = "xyes"; then
|
|
||||||
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
|
|
||||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
|
||||||
|
|
||||||
if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
|
|
||||||
CXXFLAGS="-pthread $CXXFLAGS"
|
|
||||||
CFLAGS="-pthread $CFLAGS"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
|
|
||||||
|
|
||||||
thread_LIBS="$LIBS"
|
|
||||||
LIBS=""
|
|
||||||
|
|
||||||
dnl search for network related libraries
|
|
||||||
AC_SEARCH_LIBS(inet_addr, xnet)
|
|
||||||
AC_SEARCH_LIBS(socket, socket)
|
|
||||||
|
|
||||||
network_LIBS="$LIBS"
|
|
||||||
LIBS=""
|
|
||||||
|
|
||||||
dnl check for some default libraries
|
|
||||||
AC_SEARCH_LIBS(cos, m)
|
|
||||||
AC_SEARCH_LIBS(clock_gettime, rt)
|
|
||||||
|
|
||||||
base_LIBS="$LIBS"
|
|
||||||
|
|
||||||
dnl check for OpenGL related libraries
|
|
||||||
case "${host}" in
|
|
||||||
*-*-cygwin* | *-*-mingw32*)
|
|
||||||
dnl CygWin under Windoze.
|
|
||||||
|
|
||||||
echo Win32 specific hacks...
|
|
||||||
AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
|
|
||||||
AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
|
|
||||||
|
|
||||||
LIBS="$LIBS -lglu32 -lopengl32"
|
|
||||||
LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
|
|
||||||
|
|
||||||
dnl add -lwsock32 for mingwin
|
|
||||||
case "${host}" in
|
|
||||||
*-*-mingw32*)
|
|
||||||
base_LIBS="$base_LIBS -lws2_32"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "Will link apps with $LIBS"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-apple-darwin*)
|
|
||||||
dnl Mac OS X
|
|
||||||
|
|
||||||
LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
dnl X-Windows based machines
|
|
||||||
|
|
||||||
AC_SEARCH_LIBS(XCreateWindow, X11)
|
|
||||||
AC_SEARCH_LIBS(XShmCreateImage, Xext)
|
|
||||||
AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
|
|
||||||
AC_SEARCH_LIBS(IceOpenConnection, ICE)
|
|
||||||
AC_SEARCH_LIBS(SmcOpenConnection, SM)
|
|
||||||
AC_SEARCH_LIBS(XtMalloc, Xt)
|
|
||||||
AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
|
|
||||||
|
|
||||||
AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
|
|
||||||
if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
|
|
||||||
dnl if GLcore found, then also check for GL
|
|
||||||
AC_SEARCH_LIBS(glXCreateContext, GL)
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl if using mesa, check for xmesa.h
|
|
||||||
if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
|
|
||||||
AC_CHECK_HEADER(GL/fxmesa.h)
|
|
||||||
if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
|
|
||||||
AC_DEFINE([XMESA], 1, [Define for fxmesa])
|
|
||||||
AC_DEFINE([FX], 1, [Define for fxmesa])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
|
|
||||||
AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
|
|
||||||
|
|
||||||
opengl_LIBS="$LIBS"
|
|
||||||
LIBS="$base_LIBS"
|
|
||||||
|
|
||||||
dnl check for OpenAL libraries
|
|
||||||
OPENAL_OK="no"
|
|
||||||
ALUT_OK="no"
|
|
||||||
case "${host}" in
|
|
||||||
*-*-cygwin* | *-*-mingw32*)
|
|
||||||
dnl CygWin under Windoze.
|
|
||||||
INCLUDES="$INCLUDES -I/usr/local/include/"
|
|
||||||
LIBS="$LIBS -L/usr/local/lib"
|
|
||||||
AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
|
|
||||||
AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
|
|
||||||
LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
|
|
||||||
openal_LIBS="$LIBS"
|
|
||||||
OPENAL_OK="$ac_cv_search_alGenBuffers"
|
|
||||||
ALUT_OK="$ac_cv_search_alutInit"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-apple-darwin*)
|
|
||||||
dnl Mac OS X
|
|
||||||
|
|
||||||
LIBS="$LIBS -framework IOKit -framework OpenAL"
|
|
||||||
openal_LIBS="$LIBS"
|
|
||||||
OPENAL_OK="yes"
|
|
||||||
ALUT_OK="no"
|
|
||||||
|
|
||||||
if test "x$with_openal_lib" != "x"; then
|
|
||||||
echo "libopenal is not supported on Mac OS platform."
|
|
||||||
openal_LIBS=""
|
|
||||||
fi
|
|
||||||
OPENAL_OK="yes"
|
|
||||||
# Looking for alut.h, if found assume that it is a part of
|
|
||||||
# the OpenAL package.
|
|
||||||
AC_CHECK_HEADERS([OpenAL/alut.h],[ALUT_OK="yes"])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Thank you Christian Bauer from SheepSaver
|
|
||||||
dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
|
|
||||||
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH) ; $3 is optional
|
|
||||||
AC_DEFUN([AC_CHECK_FRAMEWORK], [
|
|
||||||
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
|
|
||||||
AC_CACHE_CHECK([whether compiler supports framework $1],
|
|
||||||
ac_Framework, [
|
|
||||||
saved_LIBS="$LIBS"
|
|
||||||
FRAMEWORKS="$FRAMEWORKS -framework $1"
|
|
||||||
if test "$3" = ""; then
|
|
||||||
FRAMEWORKS="$FRAMEWORKS $ADD2LD"
|
|
||||||
elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
|
|
||||||
FRAMEWORKS="$FRAMEWORKS -F$3"
|
|
||||||
CXXFLAGS="$CXXFLAGS -F$3"
|
|
||||||
CCFLAGS="$CCFLAGS -F$3"
|
|
||||||
dnl This is needed for AC_TRY_LINK when a framework path is specified
|
|
||||||
export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
|
|
||||||
fi
|
|
||||||
AC_TRY_LINK(
|
|
||||||
[$2], [],
|
|
||||||
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
|
|
||||||
)
|
|
||||||
])
|
|
||||||
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
|
|
||||||
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
|
|
||||||
)
|
|
||||||
AS_VAR_POPDEF([ac_Framework])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Check for OpenAL.framework when --with-openal-framework is specified
|
|
||||||
dnl Of cource OpenAL.framework needs to have alut.h
|
|
||||||
if test "x$with_openal_framework" != "x"; then
|
|
||||||
AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/alut.h>], $with_openal_framework)
|
|
||||||
fi
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
dnl default unix style machines
|
|
||||||
|
|
||||||
save_LIBS=$LIBS
|
|
||||||
LIBS="$LIBS $thread_LIBS"
|
|
||||||
AC_SEARCH_LIBS(alGenBuffers, openal)
|
|
||||||
AC_SEARCH_LIBS(alutInit, [ alut openal ] )
|
|
||||||
OPENAL_OK="$ac_cv_search_alGenBuffers"
|
|
||||||
ALUT_OK="$ac_cv_search_alutInit"
|
|
||||||
openal_LIBS="$LIBS"
|
|
||||||
LIBS=$save_LIBS
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test "$OPENAL_OK" == "no"; then
|
|
||||||
echo
|
|
||||||
echo "You *must* have the openal library installed on your system to build"
|
|
||||||
echo "SimGear!"
|
|
||||||
echo
|
|
||||||
echo "Please see README.OpenAL for more details."
|
|
||||||
echo
|
|
||||||
echo "configure aborted."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ALUT_OK" == "no"; then
|
|
||||||
echo
|
|
||||||
echo "You *must* have the alut library installed on your system to build"
|
|
||||||
echo "SimGear!"
|
|
||||||
echo
|
|
||||||
echo "Please see README.OpenAL for more details."
|
|
||||||
echo
|
|
||||||
echo "configure aborted."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LIBS="$base_LIBS"
|
|
||||||
|
|
||||||
AC_SUBST(base_LIBS)
|
|
||||||
AC_SUBST(openal_LIBS)
|
|
||||||
AC_SUBST(opengl_LIBS)
|
|
||||||
AC_SUBST(thread_LIBS)
|
|
||||||
AC_SUBST(network_LIBS)
|
|
||||||
|
|
||||||
dnl Check for MS Windows environment
|
|
||||||
AC_CHECK_HEADER(windows.h)
|
|
||||||
AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
|
|
||||||
|
|
||||||
# The following are C++ items that need to be tested for with the c++
|
|
||||||
# compiler
|
|
||||||
|
|
||||||
CXXCPP="g++ -E"
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
|
|
||||||
dnl Check for "plib" without which we cannot go on
|
|
||||||
case ${host} in
|
|
||||||
*-apple-darwin*)
|
|
||||||
# Check PLIB framework availability when with-plib-framework is specified
|
|
||||||
if test "x$with_plib_framework" != "x"; then
|
|
||||||
AC_CHECK_FRAMEWORK(PLIB, [#include <plib/ul.h>], $with_plib_framework)
|
|
||||||
plib_FRAMEWORK="$FRAMEWORKS"
|
|
||||||
FRAMEWORKS=""
|
|
||||||
AC_SUBST(plib_FRAMEWORK)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AM_CONDITIONAL(HAVE_FRAMEWORK_PLIB, test "x$ac_cv_framework_PLIB" != "x")
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(plib/ul.h)
|
|
||||||
if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
|
|
||||||
echo
|
|
||||||
echo "You *must* have the plib library installed on your system to build"
|
|
||||||
echo "SimGear!"
|
|
||||||
echo
|
|
||||||
echo "Please see README.plib for more details."
|
|
||||||
echo
|
|
||||||
echo "configure aborted."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for plib 1.8.5 or newer])
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <plib/ul.h>
|
|
||||||
|
|
||||||
#define MIN_PLIB_VERSION 185
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
AC_MSG_RESULT(yes),
|
|
||||||
[AC_MSG_RESULT(wrong version);
|
|
||||||
AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
)
|
|
||||||
|
|
||||||
LIBS="$saved_LIBS"
|
|
||||||
|
|
||||||
# OpenSceneGraph
|
|
||||||
case "${host}" in
|
|
||||||
*-apple-darwin*)
|
|
||||||
if test "x$with_osg_framework" != "x"; then
|
|
||||||
AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
|
|
||||||
AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
|
|
||||||
osg_FRAMEWORKS="$FRAMEWORKS"
|
|
||||||
FRAMEWORKS=""
|
|
||||||
AC_SUBST(osg_FRAMEWORKS)
|
|
||||||
AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
|
|
||||||
openthreads_FRAMEWORK="$FRAMEWORKS"
|
|
||||||
FRAMEWORKS=""
|
|
||||||
AC_SUBST(openthreads_FRAMEWORK)
|
|
||||||
else
|
|
||||||
dnl
|
|
||||||
dnl This is needed when osg dynamic libs are specified
|
|
||||||
dnl instead of OSG frameworks on Mac OS X
|
|
||||||
dnl
|
|
||||||
LDFLAGS="$LDFLAGS -L$with_osg"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(osg/Version)
|
|
||||||
if test "x$ac_cv_header_osg_Version" != "xyes"; then
|
|
||||||
if test "x$ac_cv_framework_osg" != "xyes"; then
|
|
||||||
echo
|
|
||||||
echo "You *must* have the OpenSceneGraph support library installed on your system"
|
|
||||||
echo "to build this version of SimGear!"
|
|
||||||
echo
|
|
||||||
echo "Please see README.OSG for more details."
|
|
||||||
echo
|
|
||||||
echo "configure aborted."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(boost/version.hpp)
|
|
||||||
if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
|
|
||||||
echo
|
|
||||||
echo "You *must* have the Boost library installed on your system"
|
|
||||||
echo "to build this version of SimGear!"
|
|
||||||
echo
|
|
||||||
echo "configure aborted."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_LANG_POP
|
|
||||||
|
|
||||||
dnl Check for system installed zlib
|
|
||||||
AC_CHECK_HEADER(zlib.h)
|
|
||||||
if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
|
||||||
echo
|
|
||||||
echo "zlib library not found."
|
|
||||||
echo
|
|
||||||
echo "If your OS does not provide an installable package for zlib"
|
|
||||||
echo "you will have to compile and install it first yourself. A copy"
|
|
||||||
echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
|
|
||||||
echo "have to untar this source code, and follow its included instructions"
|
|
||||||
echo "to compile and install on your system."
|
|
||||||
echo
|
|
||||||
echo "configure aborted."
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
|
||||||
AC_HEADER_STDC
|
|
||||||
AC_CHECK_HEADERS( \
|
|
||||||
fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
|
|
||||||
sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
|
|
||||||
|
|
||||||
if test "x$ac_cv_header_stdint_h" = "xyes"; then
|
|
||||||
AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
AC_C_CONST
|
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
AC_TYPE_MODE_T
|
|
||||||
AC_HEADER_TIME
|
|
||||||
AC_STRUCT_TM
|
|
||||||
|
|
||||||
dnl Checks for library functions.
|
|
||||||
old_LIBS=$LIBS
|
|
||||||
LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
|
|
||||||
AC_TYPE_SIGNAL
|
|
||||||
AC_FUNC_VPRINTF
|
|
||||||
AC_CHECK_FUNCS( [ \
|
|
||||||
ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
|
|
||||||
random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
|
|
||||||
LIBS=$old_LIBS
|
|
||||||
|
|
||||||
AM_CONFIG_HEADER(simgear/simgear_config.h)
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([ \
|
|
||||||
Makefile \
|
|
||||||
SimGear.spec \
|
|
||||||
simgear/Makefile \
|
|
||||||
simgear/version.h \
|
|
||||||
simgear/compatibility/Makefile \
|
|
||||||
simgear/compatibility/MIPSpro721/Makefile \
|
|
||||||
simgear/compatibility/MIPSpro740/Makefile \
|
|
||||||
simgear/bucket/Makefile \
|
|
||||||
simgear/debug/Makefile \
|
|
||||||
simgear/ephemeris/Makefile \
|
|
||||||
simgear/io/Makefile \
|
|
||||||
simgear/magvar/Makefile \
|
|
||||||
simgear/math/Makefile \
|
|
||||||
simgear/environment/Makefile \
|
|
||||||
simgear/misc/Makefile \
|
|
||||||
simgear/nasal/Makefile \
|
|
||||||
simgear/props/Makefile \
|
|
||||||
simgear/route/Makefile \
|
|
||||||
simgear/scene/Makefile \
|
|
||||||
simgear/scene/bvh/Makefile \
|
|
||||||
simgear/scene/material/Makefile \
|
|
||||||
simgear/scene/model/Makefile \
|
|
||||||
simgear/scene/sky/Makefile \
|
|
||||||
simgear/scene/tgdb/Makefile \
|
|
||||||
simgear/scene/util/Makefile \
|
|
||||||
simgear/screen/Makefile \
|
|
||||||
simgear/serial/Makefile \
|
|
||||||
simgear/sound/Makefile \
|
|
||||||
simgear/structure/Makefile \
|
|
||||||
simgear/threads/Makefile \
|
|
||||||
simgear/timing/Makefile \
|
|
||||||
simgear/xml/Makefile \
|
|
||||||
])
|
|
||||||
AC_OUTPUT
|
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Configure Summary"
|
|
||||||
echo "================="
|
|
||||||
|
|
||||||
echo "Prefix: $prefix"
|
|
||||||
|
|
||||||
if test "x$with_logging" != "x"; then
|
|
||||||
echo "Debug messages: $with_logging"
|
|
||||||
else
|
|
||||||
echo "Debug messages: yes"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "Automake version: "
|
|
||||||
automake --version | head -1
|
|
||||||
|
|
||||||
if test "x$with_jpeg_factory" = "xyes"; then
|
|
||||||
echo "With JPEG Factory support"
|
|
||||||
else
|
|
||||||
echo "Without JPEG Factory support"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$ac_cv_header_pthread_h" = "xyes"; then
|
|
||||||
echo "Threads: pthread lib found."
|
|
||||||
else
|
|
||||||
echo "Threads: no threads (pthread lib not found.)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Building a SimGear RPM package for Red Hat
|
||||||
|
|
||||||
|
Please see the "package/openSUSE" directory for an
|
||||||
|
example how to build a SimGear RPM package with
|
||||||
|
shared SimGear libraries.
|
||||||
|
|
||||||
|
You may need to adapt the names (exact spelling) of some
|
||||||
|
of the package dependencies in the openSUSE RPM spec,
|
||||||
|
since these may slightly differ for Red Hat.
|
||||||
|
|
||||||
|
(If you have a working and tested Red Hat RPM spec,
|
||||||
|
you're welcome to contribute it to this project.)
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
Building a SimGear RPM package for openSUSE
|
||||||
|
|
||||||
|
(Last tested with openSUSE 11.4+12.1)
|
||||||
|
|
||||||
|
This directory contains the files which, along with
|
||||||
|
the source code tar files, can be used to build
|
||||||
|
an RPM package targeted at an openSUSE Linux system.
|
||||||
|
|
||||||
|
To build SimGear from source do the following:
|
||||||
|
|
||||||
|
1. obtain simgear-2.8.0.tar.bz2 (adapt version if
|
||||||
|
necessary) and copy it into ~/rpmbuild/SOURCES
|
||||||
|
|
||||||
|
2. look in the BuildRequires section of SimGear.spec
|
||||||
|
and check that all the packages referred to are
|
||||||
|
installed (note, some of these packages may be part
|
||||||
|
of openSUSE's "games" repository).
|
||||||
|
|
||||||
|
3. run 'rpmbuild -ba simgear.spec' and find the RPM
|
||||||
|
build result in ~/rpmbuild/RPMS
|
||||||
|
|
||||||
|
That's all!
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
Summary: Simulator Construction Gear
|
||||||
|
Name: SimGear
|
||||||
|
Version: 2.8.0
|
||||||
|
Release: 1
|
||||||
|
License: LGPL
|
||||||
|
URL: http://www.flightgear.org
|
||||||
|
Group: Amusements/Games/3D/Simulation
|
||||||
|
Source: http://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/Source/simgear-%{version}.tar.bz2
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
|
BuildRequires: gcc, gcc-c++, cmake
|
||||||
|
BuildRequires: libopenal1-soft, openal-soft
|
||||||
|
BuildRequires: libOpenSceneGraph-devel >= 3.0
|
||||||
|
BuildRequires: zlib, zlib-devel
|
||||||
|
BuildRequires: libjpeg62, libjpeg62-devel
|
||||||
|
BuildRequires: boost-devel >= 1.37
|
||||||
|
BuildRequires: subversion-devel, libapr1-devel
|
||||||
|
Requires: OpenSceneGraph-plugins >= 3.0
|
||||||
|
|
||||||
|
%description
|
||||||
|
This package contains a tools and libraries useful for constructing
|
||||||
|
simulation and visualization applications such as FlightGear or TerraGear.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Group: Development/Libraries/Other
|
||||||
|
Summary: Development header files for SimGear
|
||||||
|
Requires: SimGear = %{version}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
Development headers and libraries for building applications against SimGear.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -T -q -n simgear-%{version} -b 0
|
||||||
|
|
||||||
|
%build
|
||||||
|
export CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
export CXXFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
# build SHARED simgear libraries
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DSIMGEAR_SHARED:BOOL=ON -DENABLE_TESTS:BOOL=OFF -DJPEG_FACTORY:BOOL=ON
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%install
|
||||||
|
make DESTDIR=%{buildroot} install
|
||||||
|
|
||||||
|
%post -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-, root, root, -)
|
||||||
|
%doc AUTHORS COPYING ChangeLog NEWS README
|
||||||
|
%{_libdir}/libSimGear*.so.*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%dir %{_includedir}/simgear
|
||||||
|
%{_includedir}/simgear/*
|
||||||
|
%{_libdir}/libSimGear*.so
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Jul 02 2012 thorstenb@flightgear.org
|
||||||
|
- Initial version
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
Debug
|
|
||||||
Release
|
|
||||||
SimGear.ncb
|
|
||||||
SimGear.suo
|
|
||||||
*.user
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimGear", "SimGear.vcproj", "{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
|
||||||
Debug = Debug
|
|
||||||
Release = Release
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
|
||||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Debug.ActiveCfg = Debug|Win32
|
|
||||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Debug.Build.0 = Debug|Win32
|
|
||||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Release.ActiveCfg = Release|Win32
|
|
||||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Release.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
|||||||
SimGear.ncb
|
|
||||||
SimGear.suo
|
|
||||||
*.user
|
|
||||||
Win32
|
|
||||||
x64
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
simgear_config.h
|
|
||||||
simgear_config.h.in
|
|
||||||
stamp-h
|
|
||||||
stamp-h.in
|
|
||||||
stamp-h1
|
|
||||||
version.h
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
simgear_config.h
|
||||||
|
version.h
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
|
||||||
|
file(WRITE ${PROJECT_BINARY_DIR}/simgear/version.h "#define SIMGEAR_VERSION ${SIMGEAR_VERSION}")
|
||||||
|
|
||||||
|
foreach( mylibfolder
|
||||||
|
bucket
|
||||||
|
bvh
|
||||||
|
debug
|
||||||
|
ephemeris
|
||||||
|
io
|
||||||
|
magvar
|
||||||
|
math
|
||||||
|
misc
|
||||||
|
nasal
|
||||||
|
nasal/cppbind
|
||||||
|
props
|
||||||
|
serial
|
||||||
|
structure
|
||||||
|
threads
|
||||||
|
timing
|
||||||
|
xml
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(${mylibfolder})
|
||||||
|
|
||||||
|
endforeach( mylibfolder )
|
||||||
|
|
||||||
|
if(NOT SIMGEAR_HEADLESS)
|
||||||
|
add_subdirectory(canvas)
|
||||||
|
add_subdirectory(environment)
|
||||||
|
add_subdirectory(screen)
|
||||||
|
add_subdirectory(scene)
|
||||||
|
add_subdirectory(sound)
|
||||||
|
endif(NOT SIMGEAR_HEADLESS)
|
||||||
|
|
||||||
|
|
||||||
|
if(ENABLE_RTI)
|
||||||
|
add_subdirectory(hla)
|
||||||
|
endif(ENABLE_RTI)
|
||||||
|
|
||||||
|
|
||||||
|
set(HEADERS compiler.h constants.h sg_inlines.h ${PROJECT_BINARY_DIR}/simgear/version.h)
|
||||||
|
install (FILES ${HEADERS} DESTINATION include/simgear/)
|
||||||
|
|
||||||
|
get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
|
||||||
|
get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
|
||||||
|
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
|
||||||
|
|
||||||
|
if(LIBSVN_FOUND)
|
||||||
|
add_definitions(${APR_CFLAGS})
|
||||||
|
include_directories(${LIBSVN_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SIMGEAR_SHARED)
|
||||||
|
message(STATUS "Library building mode: SHARED LIBRARIES")
|
||||||
|
add_library(SimGearCore SHARED ${coreSources})
|
||||||
|
|
||||||
|
# set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1)
|
||||||
|
# message(STATUS "public header: ${publicHeaders}")
|
||||||
|
# set_property(TARGET SimGearCore PROPERTY PUBLIC_HEADER "${publicHeaders}")
|
||||||
|
set_property(TARGET SimGearCore PROPERTY LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
|
set_property(TARGET SimGearCore PROPERTY VERSION ${SIMGEAR_VERSION})
|
||||||
|
set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
|
||||||
|
|
||||||
|
target_link_libraries(SimGearCore ${ZLIB_LIBRARY} ${RT_LIBRARY}
|
||||||
|
${EXPAT_LIBRARIES}
|
||||||
|
${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
|
if(LIBSVN_FOUND)
|
||||||
|
target_link_libraries(SimGearCore ${LIBSVN_LIBRARIES})
|
||||||
|
endif(LIBSVN_FOUND)
|
||||||
|
|
||||||
|
if(NOT SIMGEAR_HEADLESS)
|
||||||
|
add_library(SimGearScene SHARED ${sceneSources})
|
||||||
|
# set_property(TARGET SimGearScene PROPERTY FRAMEWORK 1)
|
||||||
|
# set_property(TARGET SimGearScene PROPERTY PUBLIC_HEADER "${publicHeaders}")
|
||||||
|
set_property(TARGET SimGearScene PROPERTY LINKER_LANGUAGE CXX)
|
||||||
|
set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION})
|
||||||
|
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
|
||||||
|
|
||||||
|
target_link_libraries(SimGearScene
|
||||||
|
SimGearCore
|
||||||
|
${ZLIB_LIBRARY}
|
||||||
|
${OPENSCENEGRAPH_LIBRARIES}
|
||||||
|
${OPENAL_LIBRARY}
|
||||||
|
${OPENGL_LIBRARY}
|
||||||
|
${JPEG_LIBRARY})
|
||||||
|
|
||||||
|
install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS SimGearCore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
else()
|
||||||
|
message(STATUS "Library building mode: STATIC LIBRARIES")
|
||||||
|
|
||||||
|
get_property(FG_GROUPS_CORE_SOURCES_C GLOBAL PROPERTY FG_GROUPS_CORE_SOURCES_C)
|
||||||
|
string(REPLACE "@" ";" groups ${FG_GROUPS_CORE_SOURCES_C} )
|
||||||
|
foreach(g ${groups})
|
||||||
|
string(REPLACE "#" ";" g2 ${g})
|
||||||
|
list(GET g2 0 name)
|
||||||
|
list(REMOVE_AT g2 0)
|
||||||
|
source_group("${name}\\Sources" FILES ${g2})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
get_property(FG_GROUPS_CORE_SOURCES_H GLOBAL PROPERTY FG_GROUPS_CORE_SOURCES_H)
|
||||||
|
string(REPLACE "@" ";" groups ${FG_GROUPS_CORE_SOURCES_H} )
|
||||||
|
foreach(g ${groups})
|
||||||
|
string(REPLACE "#" ";" g2 ${g})
|
||||||
|
list(GET g2 0 name)
|
||||||
|
list(REMOVE_AT g2 0)
|
||||||
|
source_group("${name}\\Headers" FILES ${g2})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_library(SimGearCore STATIC ${coreSources})
|
||||||
|
install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
|
if(NOT SIMGEAR_HEADLESS)
|
||||||
|
get_property(FG_GROUPS_SCENE_SOURCES_C GLOBAL PROPERTY FG_GROUPS_SCENE_SOURCES_C)
|
||||||
|
string(REPLACE "@" ";" groups ${FG_GROUPS_SCENE_SOURCES_C} )
|
||||||
|
foreach(g ${groups})
|
||||||
|
string(REPLACE "#" ";" g2 ${g})
|
||||||
|
list(GET g2 0 name)
|
||||||
|
list(REMOVE_AT g2 0)
|
||||||
|
source_group("${name}\\Sources" FILES ${g2})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
get_property(FG_GROUPS_SCENE_SOURCES_H GLOBAL PROPERTY FG_GROUPS_SCENE_SOURCES_H)
|
||||||
|
string(REPLACE "@" ";" groups ${FG_GROUPS_SCENE_SOURCES_H} )
|
||||||
|
foreach(g ${groups})
|
||||||
|
string(REPLACE "#" ";" g2 ${g})
|
||||||
|
list(GET g2 0 name)
|
||||||
|
list(REMOVE_AT g2 0)
|
||||||
|
source_group("${name}\\Headers" FILES ${g2})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_library(SimGearScene STATIC ${sceneSources})
|
||||||
|
install(TARGETS SimGearScene ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif(NOT SIMGEAR_HEADLESS)
|
||||||
|
endif(SIMGEAR_SHARED)
|
||||||
|
|
||||||
|
if(ENABLE_RTI)
|
||||||
|
# Ugly first aid to make hla compile agian
|
||||||
|
set_property(SOURCE hla/RTI13InteractionClass.cxx hla/RTI13ObjectClass.cxx
|
||||||
|
hla/RTI13ObjectInstance.cxx hla/RTI13Federate.cxx
|
||||||
|
hla/RTI13FederateFactory.cxx
|
||||||
|
APPEND PROPERTY COMPILE_FLAGS "-I${RTI_INCLUDE_DIR}")
|
||||||
|
endif(ENABLE_RTI)
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
if HAVE_THREADS
|
|
||||||
SGTHREAD_DIR = threads
|
|
||||||
else
|
|
||||||
SGTHREAD_DIR =
|
|
||||||
endif
|
|
||||||
|
|
||||||
# METAR_DIRS =
|
|
||||||
METAR_DIRS = environment
|
|
||||||
|
|
||||||
EXTRA_DIST = simgear_config.h.vc5 simgear_config.h-msvc71 version.h.in
|
|
||||||
|
|
||||||
include_HEADERS = \
|
|
||||||
compiler.h constants.h sg_inlines.h version.h
|
|
||||||
|
|
||||||
SUBDIRS = \
|
|
||||||
$(compatibility_DIR) \
|
|
||||||
xml \
|
|
||||||
debug \
|
|
||||||
misc \
|
|
||||||
structure \
|
|
||||||
bucket \
|
|
||||||
ephemeris \
|
|
||||||
io \
|
|
||||||
magvar \
|
|
||||||
math \
|
|
||||||
$(METAR_DIRS) \
|
|
||||||
nasal \
|
|
||||||
props \
|
|
||||||
route \
|
|
||||||
scene \
|
|
||||||
screen \
|
|
||||||
serial \
|
|
||||||
sound \
|
|
||||||
$(SGTHREAD_DIR) \
|
|
||||||
timing
|
|
||||||
|
|
||||||
DIST_SUBDIRS = $(SUBDIRS) compatibility
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS newbucket.hxx)
|
||||||
|
set(SOURCES newbucket.cxx)
|
||||||
|
|
||||||
|
simgear_component(bucket bucket "${SOURCES}" "${HEADERS}")
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
includedir = @includedir@/bucket
|
|
||||||
|
|
||||||
lib_LIBRARIES = libsgbucket.a
|
|
||||||
|
|
||||||
include_HEADERS = newbucket.hxx
|
|
||||||
|
|
||||||
libsgbucket_a_SOURCES = newbucket.cxx
|
|
||||||
|
|
||||||
# noinst_PROGRAMS = testbucket
|
|
||||||
|
|
||||||
# testbucket_SOURCES = testbucket.cxx
|
|
||||||
|
|
||||||
# testbucket_LDADD = \
|
|
||||||
# libsgbucket.a \
|
|
||||||
# $(top_builddir)/misc/libsgmisc.a
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)
|
|
||||||
@@ -92,6 +92,11 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
|
|||||||
|
|
||||||
// cout << "diff = " << diff << " span = " << span << endl;
|
// cout << "diff = " << diff << " span = " << span << endl;
|
||||||
|
|
||||||
|
/* Calculate the greatest integral longitude less than
|
||||||
|
* or equal to the given longitude (floor(dlon)),
|
||||||
|
* but attribute coordinates near the east border
|
||||||
|
* to the next tile.
|
||||||
|
*/
|
||||||
if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
||||||
lon = (int)dlon;
|
lon = (int)dlon;
|
||||||
} else {
|
} else {
|
||||||
@@ -100,22 +105,48 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
|
|||||||
|
|
||||||
// find subdivision or super lon if needed
|
// find subdivision or super lon if needed
|
||||||
if ( span < SG_EPSILON ) {
|
if ( span < SG_EPSILON ) {
|
||||||
|
/* sg_bucket_span() never returns 0.0
|
||||||
|
* or anything near it, so this really
|
||||||
|
* should not occur at any time.
|
||||||
|
*/
|
||||||
// polar cap
|
// polar cap
|
||||||
lon = 0;
|
lon = 0;
|
||||||
x = 0;
|
x = 0;
|
||||||
} else if ( span <= 1.0 ) {
|
} else if ( span <= 1.0 ) {
|
||||||
|
/* We have more than one tile per degree of
|
||||||
|
* longitude, so we need an x offset.
|
||||||
|
*/
|
||||||
x = (int)((dlon - lon) / span);
|
x = (int)((dlon - lon) / span);
|
||||||
} else {
|
} else {
|
||||||
if ( dlon >= 0 ) {
|
/* We have one or more degrees per tile,
|
||||||
lon = (int)( (int)(lon / span) * span);
|
* so we need to find the base longitude
|
||||||
} else {
|
* of that tile.
|
||||||
// cout << " lon = " << lon
|
*
|
||||||
// << " tmp = " << (int)((lon-1) / span) << endl;
|
* First we calculate the integral base longitude
|
||||||
lon = (int)( (int)((lon + 1) / span) * span - span);
|
* (e.g. -85.5 => -86) and then find the greatest
|
||||||
if ( lon < -180 ) {
|
* multiple of span that is less than or equal to
|
||||||
lon = -180;
|
* that longitude.
|
||||||
}
|
*
|
||||||
}
|
* That way, the Greenwich Meridian is always
|
||||||
|
* a tile border.
|
||||||
|
*
|
||||||
|
* This gets us into trouble with the polar caps,
|
||||||
|
* which have width 360 and thus either span
|
||||||
|
* the range from 0 to 360 or from -360 to 0
|
||||||
|
* degrees, depending on whether lon is positive
|
||||||
|
* or negative!
|
||||||
|
*
|
||||||
|
* We also get into trouble with the 8 degree tiles
|
||||||
|
* north of 88N and south of 88S, because the west-
|
||||||
|
* and east-most tiles in that range will cover 184W
|
||||||
|
* to 176W and 176E to 184E respectively, with their
|
||||||
|
* center at 180E/W!
|
||||||
|
*/
|
||||||
|
lon=(int)floor(floor((lon+SG_EPSILON)/span)*span);
|
||||||
|
/* Correct the polar cap issue */
|
||||||
|
if ( lon < -180 ) {
|
||||||
|
lon = -180;
|
||||||
|
}
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,11 +155,15 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
|
|||||||
//
|
//
|
||||||
diff = dlat - (double)(int)dlat;
|
diff = dlat - (double)(int)dlat;
|
||||||
|
|
||||||
|
/* Again, a modified floor() function (see longitude) */
|
||||||
if ( (dlat >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
if ( (dlat >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
||||||
lat = (int)dlat;
|
lat = (int)dlat;
|
||||||
} else {
|
} else {
|
||||||
lat = (int)dlat - 1;
|
lat = (int)dlat - 1;
|
||||||
}
|
}
|
||||||
|
/* Latitude base and offset are easier, as
|
||||||
|
* tiles always are 1/8 degree of latitude wide.
|
||||||
|
*/
|
||||||
y = (int)((dlat - lat) * 8);
|
y = (int)((dlat - lat) * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +174,7 @@ void SGBucket::set_bucket(const SGGeod& geod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the path name for this bucket
|
// Build the path name for this bucket
|
||||||
string SGBucket::gen_base_path() const {
|
std::string SGBucket::gen_base_path() const {
|
||||||
// long int index;
|
// long int index;
|
||||||
int top_lon, top_lat, main_lon, main_lat;
|
int top_lon, top_lat, main_lon, main_lat;
|
||||||
char hem, pole;
|
char hem, pole;
|
||||||
@@ -189,6 +224,17 @@ string SGBucket::gen_base_path() const {
|
|||||||
|
|
||||||
// return width of the tile in degrees
|
// return width of the tile in degrees
|
||||||
double SGBucket::get_width() const {
|
double SGBucket::get_width() const {
|
||||||
|
if (lon==-180 && (lat==-89 || lat==88) ) {
|
||||||
|
/* Normally the tile at 180W in 88N and 89S
|
||||||
|
* would cover 184W to 176W and the next
|
||||||
|
* on the east side starts at 176W.
|
||||||
|
* To correct, make this a special tile
|
||||||
|
* from 180W to 176W with 4 degrees width
|
||||||
|
* instead of the normal 8 degrees at
|
||||||
|
* that latitude.
|
||||||
|
*/
|
||||||
|
return 4.0;
|
||||||
|
}
|
||||||
return sg_bucket_span( get_center_lat() );
|
return sg_bucket_span( get_center_lat() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +259,7 @@ double SGBucket::get_width_m() const {
|
|||||||
double local_perimeter = local_radius * SGD_2PI;
|
double local_perimeter = local_radius * SGD_2PI;
|
||||||
double degree_width = local_perimeter / 360.0;
|
double degree_width = local_perimeter / 360.0;
|
||||||
|
|
||||||
return sg_bucket_span( get_center_lat() ) * degree_width;
|
return get_width() * degree_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@
|
|||||||
|
|
||||||
/** \file newbucket.hxx
|
/** \file newbucket.hxx
|
||||||
* A class and associated utiltity functions to manage world scenery tiling.
|
* A class and associated utiltity functions to manage world scenery tiling.
|
||||||
|
*
|
||||||
|
* Tile borders are aligned along circles of latitude and longitude.
|
||||||
|
* All tiles are 1/8 degree of latitude high and their width in degrees
|
||||||
|
* longitude depends on their latitude, adjusted in such a way that
|
||||||
|
* all tiles cover about the same amount of area of the earth surface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _NEWBUCKET_HXX
|
#ifndef _NEWBUCKET_HXX
|
||||||
@@ -211,9 +216,9 @@ public:
|
|||||||
double span = sg_bucket_span( lat + y / 8.0 + SG_HALF_BUCKET_SPAN );
|
double span = sg_bucket_span( lat + y / 8.0 + SG_HALF_BUCKET_SPAN );
|
||||||
|
|
||||||
if ( span >= 1.0 ) {
|
if ( span >= 1.0 ) {
|
||||||
return lon + span / 2.0;
|
return lon + get_width() / 2.0;
|
||||||
} else {
|
} else {
|
||||||
return lon + x * span + span / 2.0;
|
return lon + x * span + get_width() / 2.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +334,7 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy );
|
|||||||
inline std::ostream&
|
inline std::ostream&
|
||||||
operator<< ( std::ostream& out, const SGBucket& b )
|
operator<< ( std::ostream& out, const SGBucket& b )
|
||||||
{
|
{
|
||||||
return out << b.lon << ":" << b.x << ", " << b.lat << ":" << b.y;
|
return out << b.lon << ":" << (int)b.x << ", " << b.lat << ":" << (int)b.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
bvhtest
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "BVHVisitor.hxx"
|
#include "BVHVisitor.hxx"
|
||||||
#include "BVHNode.hxx"
|
#include "BVHNode.hxx"
|
||||||
#include "BVHGroup.hxx"
|
#include "BVHGroup.hxx"
|
||||||
|
#include "BVHPageNode.hxx"
|
||||||
#include "BVHTransform.hxx"
|
#include "BVHTransform.hxx"
|
||||||
#include "BVHMotionTransform.hxx"
|
#include "BVHMotionTransform.hxx"
|
||||||
#include "BVHLineGeometry.hxx"
|
#include "BVHLineGeometry.hxx"
|
||||||
@@ -45,6 +46,8 @@ public:
|
|||||||
|
|
||||||
virtual void apply(BVHGroup& node)
|
virtual void apply(BVHGroup& node)
|
||||||
{ expandBy(node.getBoundingSphere()); }
|
{ expandBy(node.getBoundingSphere()); }
|
||||||
|
virtual void apply(BVHPageNode& node)
|
||||||
|
{ expandBy(node.getBoundingSphere()); }
|
||||||
virtual void apply(BVHTransform& node)
|
virtual void apply(BVHTransform& node)
|
||||||
{ expandBy(node.getBoundingSphere()); }
|
{ expandBy(node.getBoundingSphere()); }
|
||||||
virtual void apply(BVHMotionTransform& node)
|
virtual void apply(BVHMotionTransform& node)
|
||||||
+13
-1
@@ -15,7 +15,10 @@
|
|||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <simgear/math/SGMath.hxx>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "BVHLineSegmentVisitor.hxx"
|
#include "BVHLineSegmentVisitor.hxx"
|
||||||
|
|
||||||
#include <simgear/math/SGGeometry.hxx>
|
#include <simgear/math/SGGeometry.hxx>
|
||||||
@@ -24,6 +27,7 @@
|
|||||||
|
|
||||||
#include "BVHNode.hxx"
|
#include "BVHNode.hxx"
|
||||||
#include "BVHGroup.hxx"
|
#include "BVHGroup.hxx"
|
||||||
|
#include "BVHPageNode.hxx"
|
||||||
#include "BVHTransform.hxx"
|
#include "BVHTransform.hxx"
|
||||||
#include "BVHMotionTransform.hxx"
|
#include "BVHMotionTransform.hxx"
|
||||||
#include "BVHLineGeometry.hxx"
|
#include "BVHLineGeometry.hxx"
|
||||||
@@ -44,6 +48,14 @@ BVHLineSegmentVisitor::apply(BVHGroup& group)
|
|||||||
return;
|
return;
|
||||||
group.traverse(*this);
|
group.traverse(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHLineSegmentVisitor::apply(BVHPageNode& pageNode)
|
||||||
|
{
|
||||||
|
if (!intersects(_lineSegment, pageNode.getBoundingSphere()))
|
||||||
|
return;
|
||||||
|
pageNode.traverse(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BVHLineSegmentVisitor::apply(BVHTransform& transform)
|
BVHLineSegmentVisitor::apply(BVHTransform& transform)
|
||||||
@@ -20,13 +20,14 @@
|
|||||||
|
|
||||||
#include <simgear/math/SGGeometry.hxx>
|
#include <simgear/math/SGGeometry.hxx>
|
||||||
#include <simgear/structure/SGSharedPtr.hxx>
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
#include <simgear/scene/material/mat.hxx>
|
|
||||||
|
|
||||||
#include "BVHVisitor.hxx"
|
#include "BVHVisitor.hxx"
|
||||||
#include "BVHNode.hxx"
|
#include "BVHNode.hxx"
|
||||||
|
|
||||||
namespace simgear {
|
namespace simgear {
|
||||||
|
|
||||||
|
class BVHMaterial;
|
||||||
|
|
||||||
class BVHLineSegmentVisitor : public BVHVisitor {
|
class BVHLineSegmentVisitor : public BVHVisitor {
|
||||||
public:
|
public:
|
||||||
BVHLineSegmentVisitor(const SGLineSegmentd& lineSegment,
|
BVHLineSegmentVisitor(const SGLineSegmentd& lineSegment,
|
||||||
@@ -54,12 +55,13 @@ public:
|
|||||||
{ return _linearVelocity; }
|
{ return _linearVelocity; }
|
||||||
const SGVec3d& getAngularVelocity() const
|
const SGVec3d& getAngularVelocity() const
|
||||||
{ return _angularVelocity; }
|
{ return _angularVelocity; }
|
||||||
const SGMaterial* getMaterial() const
|
const BVHMaterial* getMaterial() const
|
||||||
{ return _material; }
|
{ return _material; }
|
||||||
BVHNode::Id getId() const
|
BVHNode::Id getId() const
|
||||||
{ return _id; }
|
{ return _id; }
|
||||||
|
|
||||||
virtual void apply(BVHGroup& group);
|
virtual void apply(BVHGroup& group);
|
||||||
|
virtual void apply(BVHPageNode& node);
|
||||||
virtual void apply(BVHTransform& transform);
|
virtual void apply(BVHTransform& transform);
|
||||||
virtual void apply(BVHMotionTransform& transform);
|
virtual void apply(BVHMotionTransform& transform);
|
||||||
virtual void apply(BVHLineGeometry&);
|
virtual void apply(BVHLineGeometry&);
|
||||||
@@ -87,7 +89,7 @@ private:
|
|||||||
SGVec3d _normal;
|
SGVec3d _normal;
|
||||||
SGVec3d _linearVelocity;
|
SGVec3d _linearVelocity;
|
||||||
SGVec3d _angularVelocity;
|
SGVec3d _angularVelocity;
|
||||||
const SGMaterial* _material;
|
const BVHMaterial* _material;
|
||||||
BVHNode::Id _id;
|
BVHNode::Id _id;
|
||||||
|
|
||||||
bool _haveHit;
|
bool _haveHit;
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// PathOptions.cxx -- make an osgDB Options object from a path
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
// Copyright (C) 2007 Tim Moore timoore@redhat.com
|
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Library General Public
|
// modify it under the terms of the GNU Library General Public
|
||||||
@@ -15,19 +14,22 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
// $Id$
|
|
||||||
|
|
||||||
#include <osgDB/Registry>
|
#include "BVHMaterial.hxx"
|
||||||
|
|
||||||
#include "PathOptions.hxx"
|
namespace simgear {
|
||||||
|
|
||||||
using namespace simgear;
|
BVHMaterial::BVHMaterial() :
|
||||||
|
_solid(true),
|
||||||
osgDB::ReaderWriter::Options* simgear::makeOptionsFromPath(const SGPath& path)
|
_friction_factor(1),
|
||||||
|
_rolling_friction(0.02),
|
||||||
|
_bumpiness(0),
|
||||||
|
_load_resistance(1e30)
|
||||||
{
|
{
|
||||||
using namespace osgDB;
|
}
|
||||||
ReaderWriter::Options *options
|
|
||||||
= new ReaderWriter::Options(*(Registry::instance()->getOptions()));
|
BVHMaterial::~BVHMaterial()
|
||||||
options->setDatabasePath(path.str());
|
{
|
||||||
return options;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BVHMaterial_hxx
|
||||||
|
#define BVHMaterial_hxx
|
||||||
|
|
||||||
|
#include <simgear/structure/SGReferenced.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class BVHMaterial : public SGReferenced {
|
||||||
|
public:
|
||||||
|
BVHMaterial();
|
||||||
|
virtual ~BVHMaterial();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if the surface material is solid, if it is not solid, a fluid
|
||||||
|
* can be assumed, that is usually water.
|
||||||
|
*/
|
||||||
|
bool get_solid () const { return _solid; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the friction factor for that material
|
||||||
|
*/
|
||||||
|
double get_friction_factor () const { return _friction_factor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the rolling friction for that material
|
||||||
|
*/
|
||||||
|
double get_rolling_friction () const { return _rolling_friction; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the bumpines for that material
|
||||||
|
*/
|
||||||
|
double get_bumpiness () const { return _bumpiness; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the load resistance
|
||||||
|
*/
|
||||||
|
double get_load_resistance () const { return _load_resistance; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// True if the material is solid, false if it is a fluid
|
||||||
|
bool _solid;
|
||||||
|
|
||||||
|
// the friction factor of that surface material
|
||||||
|
double _friction_factor;
|
||||||
|
|
||||||
|
// the rolling friction of that surface material
|
||||||
|
double _rolling_friction;
|
||||||
|
|
||||||
|
// the bumpiness of that surface material
|
||||||
|
double _bumpiness;
|
||||||
|
|
||||||
|
// the load resistance of that surface material
|
||||||
|
double _load_resistance;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -15,6 +15,10 @@
|
|||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "BVHMotionTransform.hxx"
|
#include "BVHMotionTransform.hxx"
|
||||||
|
|
||||||
#include "BVHVisitor.hxx"
|
#include "BVHVisitor.hxx"
|
||||||
@@ -103,13 +107,13 @@ BVHMotionTransform::updateAmplificationFactors()
|
|||||||
// But anyway, almost all transforms in a scenegraph will
|
// But anyway, almost all transforms in a scenegraph will
|
||||||
// have them equal to 1 ...
|
// have them equal to 1 ...
|
||||||
double r = norm(_toWorldReference.xformVec(SGVec3d(1, 0, 0)));
|
double r = norm(_toWorldReference.xformVec(SGVec3d(1, 0, 0)));
|
||||||
r = std::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 1, 0))));
|
r = SGMiscd::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 1, 0))));
|
||||||
r = std::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 0, 1))));
|
r = SGMiscd::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 0, 1))));
|
||||||
_toWorldAmplification = r;
|
_toWorldAmplification = r;
|
||||||
|
|
||||||
r = norm(_toLocalReference.xformVec(SGVec3d(1, 0, 0)));
|
r = norm(_toLocalReference.xformVec(SGVec3d(1, 0, 0)));
|
||||||
r = std::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 1, 0))));
|
r = SGMiscd::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 1, 0))));
|
||||||
r = std::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 0, 1))));
|
r = SGMiscd::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 0, 1))));
|
||||||
_toLocalAmplification = r;
|
_toLocalAmplification = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
+9
-2
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "BVHNode.hxx"
|
#include "BVHNode.hxx"
|
||||||
#include "BVHGroup.hxx"
|
#include "BVHGroup.hxx"
|
||||||
|
#include "BVHPageNode.hxx"
|
||||||
#include "BVHTransform.hxx"
|
#include "BVHTransform.hxx"
|
||||||
#include "BVHLineGeometry.hxx"
|
#include "BVHLineGeometry.hxx"
|
||||||
#include "BVHStaticGeometry.hxx"
|
#include "BVHStaticGeometry.hxx"
|
||||||
@@ -52,6 +53,12 @@ public:
|
|||||||
return;
|
return;
|
||||||
leaf.traverse(*this);
|
leaf.traverse(*this);
|
||||||
}
|
}
|
||||||
|
virtual void apply(BVHPageNode& leaf)
|
||||||
|
{
|
||||||
|
if (!intersects(_sphere, leaf.getBoundingSphere()))
|
||||||
|
return;
|
||||||
|
leaf.traverse(*this);
|
||||||
|
}
|
||||||
virtual void apply(BVHTransform& transform)
|
virtual void apply(BVHTransform& transform)
|
||||||
{
|
{
|
||||||
if (!intersects(_sphere, transform.getBoundingSphere()))
|
if (!intersects(_sphere, transform.getBoundingSphere()))
|
||||||
@@ -140,7 +147,7 @@ public:
|
|||||||
{ return _linearVelocity; }
|
{ return _linearVelocity; }
|
||||||
const SGVec3d& getAngularVelocity() const
|
const SGVec3d& getAngularVelocity() const
|
||||||
{ return _angularVelocity; }
|
{ return _angularVelocity; }
|
||||||
const SGMaterial* getMaterial() const
|
const BVHMaterial* getMaterial() const
|
||||||
{ return _material; }
|
{ return _material; }
|
||||||
BVHNode::Id getId() const
|
BVHNode::Id getId() const
|
||||||
{ return _id; }
|
{ return _id; }
|
||||||
@@ -155,7 +162,7 @@ private:
|
|||||||
SGVec3d _point;
|
SGVec3d _point;
|
||||||
SGVec3d _linearVelocity;
|
SGVec3d _linearVelocity;
|
||||||
SGVec3d _angularVelocity;
|
SGVec3d _angularVelocity;
|
||||||
const SGMaterial* _material;
|
const BVHMaterial* _material;
|
||||||
BVHNode::Id _id;
|
BVHNode::Id _id;
|
||||||
|
|
||||||
bool _havePoint;
|
bool _havePoint;
|
||||||
@@ -26,6 +26,7 @@ namespace simgear {
|
|||||||
|
|
||||||
class BVHGroup;
|
class BVHGroup;
|
||||||
class BVHVisitor;
|
class BVHVisitor;
|
||||||
|
class BVHPageNode;
|
||||||
|
|
||||||
// Base for the tree nodes
|
// Base for the tree nodes
|
||||||
class BVHNode : public SGReferenced {
|
class BVHNode : public SGReferenced {
|
||||||
@@ -55,6 +56,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class BVHGroup;
|
friend class BVHGroup;
|
||||||
|
friend class BVHPageNode;
|
||||||
void addParent(BVHNode* parent);
|
void addParent(BVHNode* parent);
|
||||||
void removeParent(BVHNode* parent);
|
void removeParent(BVHNode* parent);
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "BVHPageNode.hxx"
|
||||||
|
|
||||||
|
#include "BVHPager.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
BVHPageNode::BVHPageNode() :
|
||||||
|
_useStamp(0),
|
||||||
|
_requested(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BVHPageNode::~BVHPageNode()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHPageNode::accept(BVHVisitor& visitor)
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BVHPageNode_hxx
|
||||||
|
#define BVHPageNode_hxx
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
|
||||||
|
#include "BVHGroup.hxx"
|
||||||
|
#include "BVHVisitor.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class BVHPager;
|
||||||
|
class BVHPageRequest;
|
||||||
|
|
||||||
|
class BVHPageNode : public BVHGroup {
|
||||||
|
public:
|
||||||
|
BVHPageNode();
|
||||||
|
virtual ~BVHPageNode();
|
||||||
|
|
||||||
|
virtual void accept(BVHVisitor& visitor);
|
||||||
|
|
||||||
|
/// Return the usage stamp of the last access
|
||||||
|
unsigned getUseStamp() const
|
||||||
|
{ return _useStamp; }
|
||||||
|
|
||||||
|
virtual SGSphered computeBoundingSphere() const = 0;
|
||||||
|
|
||||||
|
virtual BVHPageRequest* newRequest() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void invalidateBound() = 0;
|
||||||
|
|
||||||
|
bool getRequested() const
|
||||||
|
{ return _requested; }
|
||||||
|
void setRequested(bool requested)
|
||||||
|
{ _requested = requested; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class BVHPager;
|
||||||
|
|
||||||
|
std::list<SGSharedPtr<BVHPageNode> >::iterator _iterator;
|
||||||
|
unsigned _useStamp;
|
||||||
|
bool _requested;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "BVHPageRequest.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
BVHPageRequest::~BVHPageRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BVHPageRequest_hxx
|
||||||
|
#define BVHPageRequest_hxx
|
||||||
|
|
||||||
|
#include <simgear/structure/SGReferenced.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class BVHPageNode;
|
||||||
|
|
||||||
|
class BVHPageRequest : public SGReferenced {
|
||||||
|
public:
|
||||||
|
virtual ~BVHPageRequest();
|
||||||
|
|
||||||
|
/// Happens in the pager thread, do not modify the calling bvh tree
|
||||||
|
virtual void load() = 0;
|
||||||
|
/// Happens in the bvh main thread where the bvh is actually used.
|
||||||
|
/// So inside here it is safe to modify the paged node
|
||||||
|
virtual void insert() = 0;
|
||||||
|
/// The page node this request is for
|
||||||
|
virtual BVHPageNode* getPageNode() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "BVHPager.hxx"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
#include <simgear/threads/SGThread.hxx>
|
||||||
|
#include <simgear/threads/SGGuard.hxx>
|
||||||
|
|
||||||
|
#include "BVHPageNode.hxx"
|
||||||
|
#include "BVHPageRequest.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
struct BVHPager::_PrivateData : protected SGThread {
|
||||||
|
typedef SGSharedPtr<BVHPageRequest> _Request;
|
||||||
|
typedef std::list<_Request> _RequestList;
|
||||||
|
typedef std::list<SGSharedPtr<BVHPageNode> > _PageNodeList;
|
||||||
|
|
||||||
|
struct _LockedQueue {
|
||||||
|
void _push(const _Request& request)
|
||||||
|
{
|
||||||
|
SGGuard<SGMutex> scopeLock(_mutex);
|
||||||
|
_requestList.push_back(request);
|
||||||
|
}
|
||||||
|
_Request _pop()
|
||||||
|
{
|
||||||
|
SGGuard<SGMutex> scopeLock(_mutex);
|
||||||
|
if (_requestList.empty())
|
||||||
|
return _Request();
|
||||||
|
_Request request;
|
||||||
|
request.swap(_requestList.front());
|
||||||
|
_requestList.pop_front();
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
SGMutex _mutex;
|
||||||
|
_RequestList _requestList;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _WorkQueue {
|
||||||
|
void _stop()
|
||||||
|
{
|
||||||
|
_push(_Request());
|
||||||
|
}
|
||||||
|
void _push(const _Request& request)
|
||||||
|
{
|
||||||
|
SGGuard<SGMutex> scopeLock(_mutex);
|
||||||
|
bool needSignal = _requestList.empty();
|
||||||
|
_requestList.push_back(request);
|
||||||
|
if (needSignal)
|
||||||
|
_waitCondition.signal();
|
||||||
|
}
|
||||||
|
_Request _pop()
|
||||||
|
{
|
||||||
|
SGGuard<SGMutex> scopeLock(_mutex);
|
||||||
|
while (_requestList.empty())
|
||||||
|
_waitCondition.wait(_mutex);
|
||||||
|
_Request request;
|
||||||
|
request.swap(_requestList.front());
|
||||||
|
_requestList.pop_front();
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
SGMutex _mutex;
|
||||||
|
SGWaitCondition _waitCondition;
|
||||||
|
_RequestList _requestList;
|
||||||
|
};
|
||||||
|
|
||||||
|
_PrivateData() :
|
||||||
|
_started(false),
|
||||||
|
_useStamp(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~_PrivateData()
|
||||||
|
{
|
||||||
|
_stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void run()
|
||||||
|
{
|
||||||
|
for (;;) {
|
||||||
|
_Request request = _pendingRequests._pop();
|
||||||
|
// This means stop working
|
||||||
|
if (!request.valid())
|
||||||
|
return;
|
||||||
|
request->load();
|
||||||
|
_processedRequests._push(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _start()
|
||||||
|
{
|
||||||
|
if (_started)
|
||||||
|
return true;
|
||||||
|
if (!start())
|
||||||
|
return false;
|
||||||
|
_started = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _stop()
|
||||||
|
{
|
||||||
|
if (!_started)
|
||||||
|
return;
|
||||||
|
// send a stop request ...
|
||||||
|
_pendingRequests._stop();
|
||||||
|
// ... and wait for the thread to finish
|
||||||
|
join();
|
||||||
|
_started = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _use(BVHPageNode& pageNode)
|
||||||
|
{
|
||||||
|
if (pageNode._requested) {
|
||||||
|
// move it forward in the lru list
|
||||||
|
_pageNodeList.splice(_pageNodeList.end(), _pageNodeList,
|
||||||
|
pageNode._iterator);
|
||||||
|
} else {
|
||||||
|
_Request request = pageNode.newRequest();
|
||||||
|
if (!request.valid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
pageNode._iterator = _pageNodeList.insert(_pageNodeList.end(),
|
||||||
|
&pageNode);
|
||||||
|
pageNode._requested = true;
|
||||||
|
|
||||||
|
if (_started) {
|
||||||
|
_pendingRequests._push(request);
|
||||||
|
} else {
|
||||||
|
request->load();
|
||||||
|
request->insert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pageNode._useStamp = _useStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _update(unsigned expiry)
|
||||||
|
{
|
||||||
|
// Insert all processed requests
|
||||||
|
for (;;) {
|
||||||
|
SGSharedPtr<BVHPageRequest> request;
|
||||||
|
request = _processedRequests._pop();
|
||||||
|
if (!request.valid())
|
||||||
|
break;
|
||||||
|
request->insert();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... and throw away stuff that is not used for a long time
|
||||||
|
unsigned useStamp = _useStamp - expiry;
|
||||||
|
_PageNodeList::iterator i = _pageNodeList.begin();
|
||||||
|
while (i != _pageNodeList.end()) {
|
||||||
|
// Ok, this means if the highest bit in the below difference
|
||||||
|
// is set which is aequivalent to having a negative difference
|
||||||
|
// but being wraparound save.
|
||||||
|
unsigned diff = (*i)->_useStamp - useStamp;
|
||||||
|
// test the sign bit of the difference
|
||||||
|
if (!(diff & (~((~0u) >> 1))))
|
||||||
|
break;
|
||||||
|
(*i)->clear();
|
||||||
|
(*i)->_requested = false;
|
||||||
|
i = _pageNodeList.erase(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _started;
|
||||||
|
unsigned _useStamp;
|
||||||
|
_WorkQueue _pendingRequests;
|
||||||
|
_LockedQueue _processedRequests;
|
||||||
|
// Store the rcu list of loaded nodes so that they can expire
|
||||||
|
_PageNodeList _pageNodeList;
|
||||||
|
};
|
||||||
|
|
||||||
|
BVHPager::BVHPager() :
|
||||||
|
_privateData(new _PrivateData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BVHPager::~BVHPager()
|
||||||
|
{
|
||||||
|
delete _privateData;
|
||||||
|
_privateData = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BVHPager::start()
|
||||||
|
{
|
||||||
|
return _privateData->_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHPager::stop()
|
||||||
|
{
|
||||||
|
_privateData->_stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHPager::use(BVHPageNode& pageNode)
|
||||||
|
{
|
||||||
|
_privateData->_use(pageNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHPager::update(unsigned expiry)
|
||||||
|
{
|
||||||
|
_privateData->_update(expiry);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHPager::setUseStamp(unsigned stamp)
|
||||||
|
{
|
||||||
|
_privateData->_useStamp = stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
BVHPager::getUseStamp() const
|
||||||
|
{
|
||||||
|
return _privateData->_useStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BVHPager_hxx
|
||||||
|
#define BVHPager_hxx
|
||||||
|
|
||||||
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class BVHPageNode;
|
||||||
|
class BVHPageRequest;
|
||||||
|
|
||||||
|
class BVHPager {
|
||||||
|
public:
|
||||||
|
BVHPager();
|
||||||
|
~BVHPager();
|
||||||
|
|
||||||
|
/// Starts the pager thread
|
||||||
|
bool start();
|
||||||
|
|
||||||
|
/// Stops the pager thread
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
/// Use this page node, if loaded make it as used, if not loaded schedule
|
||||||
|
void use(BVHPageNode& pageNode);
|
||||||
|
|
||||||
|
/// Call this from the main thread to incorporate the processed page
|
||||||
|
/// requests into the bounding volume tree
|
||||||
|
void update(unsigned expiry);
|
||||||
|
|
||||||
|
/// The usage stamp to mark usage of BVHPageNodes
|
||||||
|
void setUseStamp(unsigned stamp);
|
||||||
|
unsigned getUseStamp() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BVHPager(const BVHPager&);
|
||||||
|
BVHPager& operator=(const BVHPager&);
|
||||||
|
|
||||||
|
struct _PrivateData;
|
||||||
|
_PrivateData* _privateData;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -22,11 +22,7 @@
|
|||||||
#include <simgear/structure/SGReferenced.hxx>
|
#include <simgear/structure/SGReferenced.hxx>
|
||||||
#include <simgear/structure/SGSharedPtr.hxx>
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
#include <simgear/math/SGGeometry.hxx>
|
#include <simgear/math/SGGeometry.hxx>
|
||||||
|
#include "BVHMaterial.hxx"
|
||||||
/// FIXME, the SGMaterial class is too much tied to the scenegraph aspects of
|
|
||||||
/// the materials. Use some class more decribing the
|
|
||||||
/// nature of the surface we live on ...
|
|
||||||
class SGMaterial;
|
|
||||||
|
|
||||||
namespace simgear {
|
namespace simgear {
|
||||||
|
|
||||||
@@ -40,20 +36,20 @@ public:
|
|||||||
{ return _vertices[i]; }
|
{ return _vertices[i]; }
|
||||||
|
|
||||||
|
|
||||||
unsigned addMaterial(const SGMaterial* material)
|
unsigned addMaterial(const BVHMaterial* material)
|
||||||
{ _materials.push_back(material); return _materials.size() - 1; }
|
{ _materials.push_back(material); return _materials.size() - 1; }
|
||||||
const SGMaterial* getMaterial(unsigned i) const
|
const BVHMaterial* getMaterial(unsigned i) const
|
||||||
{ if (_materials.size() <= i) return 0; return _materials[i]; }
|
{ if (_materials.size() <= i) return 0; return _materials[i]; }
|
||||||
|
|
||||||
void trim()
|
void trim()
|
||||||
{
|
{
|
||||||
std::vector<SGVec3f>(_vertices).swap(_vertices);
|
std::vector<SGVec3f>(_vertices).swap(_vertices);
|
||||||
std::vector<const SGMaterial*>(_materials).swap(_materials);
|
std::vector<SGSharedPtr<const BVHMaterial> >(_materials).swap(_materials);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<SGVec3f> _vertices;
|
std::vector<SGVec3f> _vertices;
|
||||||
std::vector<const SGMaterial*> _materials;
|
std::vector<SGSharedPtr<const BVHMaterial> > _materials;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
+5
-5
@@ -78,16 +78,16 @@ public:
|
|||||||
typedef std::set<SGVec3<unsigned> > TriangleSet;
|
typedef std::set<SGVec3<unsigned> > TriangleSet;
|
||||||
TriangleSet _triangleSet;
|
TriangleSet _triangleSet;
|
||||||
|
|
||||||
void setCurrentMaterial(const SGMaterial* material)
|
void setCurrentMaterial(const BVHMaterial* material)
|
||||||
{
|
{
|
||||||
_currentMaterial = material;
|
_currentMaterial = material;
|
||||||
_currentMaterialIndex = addMaterial(material);
|
_currentMaterialIndex = addMaterial(material);
|
||||||
}
|
}
|
||||||
const SGMaterial* getCurrentMaterial() const
|
const BVHMaterial* getCurrentMaterial() const
|
||||||
{
|
{
|
||||||
return _currentMaterial;
|
return _currentMaterial;
|
||||||
}
|
}
|
||||||
unsigned addMaterial(const SGMaterial* material)
|
unsigned addMaterial(const BVHMaterial* material)
|
||||||
{
|
{
|
||||||
MaterialMap::const_iterator i = _materialMap.find(material);
|
MaterialMap::const_iterator i = _materialMap.find(material);
|
||||||
if (i != _materialMap.end())
|
if (i != _materialMap.end())
|
||||||
@@ -97,9 +97,9 @@ public:
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::map<const SGMaterial*, unsigned> MaterialMap;
|
typedef std::map<const BVHMaterial*, unsigned> MaterialMap;
|
||||||
MaterialMap _materialMap;
|
MaterialMap _materialMap;
|
||||||
const SGMaterial* _currentMaterial;
|
const BVHMaterial* _currentMaterial;
|
||||||
unsigned _currentMaterialIndex;
|
unsigned _currentMaterialIndex;
|
||||||
|
|
||||||
void addTriangle(const SGVec3f& v1, const SGVec3f& v2, const SGVec3f& v3)
|
void addTriangle(const SGVec3f& v1, const SGVec3f& v2, const SGVec3f& v3)
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "BVHSubTreeCollector.hxx"
|
#include "BVHSubTreeCollector.hxx"
|
||||||
|
|
||||||
#include <simgear/math/SGGeometry.hxx>
|
#include <simgear/math/SGGeometry.hxx>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include "BVHNode.hxx"
|
#include "BVHNode.hxx"
|
||||||
#include "BVHGroup.hxx"
|
#include "BVHGroup.hxx"
|
||||||
@@ -58,6 +59,22 @@ BVHSubTreeCollector::apply(BVHGroup& group)
|
|||||||
popNodeList(parentNodeList);
|
popNodeList(parentNodeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BVHSubTreeCollector::apply(BVHPageNode& group)
|
||||||
|
{
|
||||||
|
if (!intersects(_sphere, group.getBoundingSphere()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// The _nodeList content is somehow the 'return value' of the subtree.
|
||||||
|
// Set it to zero to see if we have something to collect down there.
|
||||||
|
NodeList parentNodeList;
|
||||||
|
pushNodeList(parentNodeList);
|
||||||
|
|
||||||
|
group.traverse(*this);
|
||||||
|
|
||||||
|
popNodeList(parentNodeList);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BVHSubTreeCollector::apply(BVHTransform& transform)
|
BVHSubTreeCollector::apply(BVHTransform& transform)
|
||||||
{
|
{
|
||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
virtual ~BVHSubTreeCollector();
|
virtual ~BVHSubTreeCollector();
|
||||||
|
|
||||||
virtual void apply(BVHGroup&);
|
virtual void apply(BVHGroup&);
|
||||||
|
virtual void apply(BVHPageNode&);
|
||||||
virtual void apply(BVHTransform&);
|
virtual void apply(BVHTransform&);
|
||||||
virtual void apply(BVHMotionTransform&);
|
virtual void apply(BVHMotionTransform&);
|
||||||
virtual void apply(BVHLineGeometry&);
|
virtual void apply(BVHLineGeometry&);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2008 - 2009 Mathias Froehlich - Mathias.Froehlich@web.de
|
// Copyright (C) 2008 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Library General Public
|
// modify it under the terms of the GNU Library General Public
|
||||||
@@ -23,6 +23,7 @@ namespace simgear {
|
|||||||
class BVHStaticData;
|
class BVHStaticData;
|
||||||
|
|
||||||
class BVHGroup;
|
class BVHGroup;
|
||||||
|
class BVHPageNode;
|
||||||
class BVHTransform;
|
class BVHTransform;
|
||||||
class BVHMotionTransform;
|
class BVHMotionTransform;
|
||||||
class BVHStaticGeometry;
|
class BVHStaticGeometry;
|
||||||
@@ -41,6 +42,7 @@ public:
|
|||||||
|
|
||||||
// High level nodes to handle
|
// High level nodes to handle
|
||||||
virtual void apply(BVHGroup&) = 0;
|
virtual void apply(BVHGroup&) = 0;
|
||||||
|
virtual void apply(BVHPageNode&) = 0;
|
||||||
virtual void apply(BVHTransform&) = 0;
|
virtual void apply(BVHTransform&) = 0;
|
||||||
virtual void apply(BVHMotionTransform&) = 0;
|
virtual void apply(BVHMotionTransform&) = 0;
|
||||||
virtual void apply(BVHLineGeometry&) = 0;
|
virtual void apply(BVHLineGeometry&) = 0;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
BVHBoundingBoxVisitor.hxx
|
||||||
|
BVHGroup.hxx
|
||||||
|
BVHLineGeometry.hxx
|
||||||
|
BVHLineSegmentVisitor.hxx
|
||||||
|
BVHMotionTransform.hxx
|
||||||
|
BVHNearestPointVisitor.hxx
|
||||||
|
BVHNode.hxx
|
||||||
|
BVHPageNode.hxx
|
||||||
|
BVHPageRequest.hxx
|
||||||
|
BVHPager.hxx
|
||||||
|
BVHStaticBinary.hxx
|
||||||
|
BVHStaticData.hxx
|
||||||
|
BVHStaticGeometry.hxx
|
||||||
|
BVHStaticGeometryBuilder.hxx
|
||||||
|
BVHStaticLeaf.hxx
|
||||||
|
BVHStaticNode.hxx
|
||||||
|
BVHStaticTriangle.hxx
|
||||||
|
BVHSubTreeCollector.hxx
|
||||||
|
BVHMaterial.hxx
|
||||||
|
BVHTransform.hxx
|
||||||
|
BVHVisitor.hxx
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
BVHGroup.cxx
|
||||||
|
BVHLineGeometry.cxx
|
||||||
|
BVHLineSegmentVisitor.cxx
|
||||||
|
BVHMotionTransform.cxx
|
||||||
|
BVHNode.cxx
|
||||||
|
BVHPageNode.cxx
|
||||||
|
BVHPageRequest.cxx
|
||||||
|
BVHPager.cxx
|
||||||
|
BVHStaticBinary.cxx
|
||||||
|
BVHStaticGeometry.cxx
|
||||||
|
BVHStaticLeaf.cxx
|
||||||
|
BVHStaticNode.cxx
|
||||||
|
BVHStaticTriangle.cxx
|
||||||
|
BVHSubTreeCollector.cxx
|
||||||
|
BVHMaterial.cxx
|
||||||
|
BVHTransform.cxx
|
||||||
|
)
|
||||||
|
|
||||||
|
simgear_component(bvh bvh "${SOURCES}" "${HEADERS}")
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
|
add_executable(bvhtest bvhtest.cxx)
|
||||||
|
target_link_libraries(bvhtest SimGearCore)
|
||||||
|
add_test(bvhtest ${EXECUTABLE_OUTPUT_PATH}/bvhtest)
|
||||||
|
endif(ENABLE_TESTS)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
canvas_fwd.hxx
|
||||||
|
Canvas.hxx
|
||||||
|
CanvasEvent.hxx
|
||||||
|
CanvasEventListener.hxx
|
||||||
|
CanvasEventManager.hxx
|
||||||
|
CanvasEventTypes.hxx
|
||||||
|
CanvasEventVisitor.hxx
|
||||||
|
CanvasMgr.hxx
|
||||||
|
CanvasPlacement.hxx
|
||||||
|
CanvasSystemAdapter.hxx
|
||||||
|
MouseEvent.hxx
|
||||||
|
ODGauge.hxx
|
||||||
|
VGInitOperation.hxx
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
Canvas.cxx
|
||||||
|
CanvasEvent.cxx
|
||||||
|
CanvasEventListener.cxx
|
||||||
|
CanvasEventManager.cxx
|
||||||
|
CanvasEventVisitor.cxx
|
||||||
|
CanvasMgr.cxx
|
||||||
|
CanvasPlacement.cxx
|
||||||
|
ODGauge.cxx
|
||||||
|
VGInitOperation.cxx
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(ShivaVG/src)
|
||||||
|
add_subdirectory(elements)
|
||||||
|
|
||||||
|
simgear_scene_component(canvas canvas "${SOURCES}" "${HEADERS}")
|
||||||
@@ -0,0 +1,552 @@
|
|||||||
|
// The canvas for rendering with the 2d API
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "Canvas.hxx"
|
||||||
|
#include "CanvasEventManager.hxx"
|
||||||
|
#include "CanvasEventVisitor.hxx"
|
||||||
|
#include <simgear/canvas/MouseEvent.hxx>
|
||||||
|
#include <simgear/canvas/CanvasPlacement.hxx>
|
||||||
|
#include <simgear/scene/util/parse_color.hxx>
|
||||||
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
|
|
||||||
|
#include <osg/Camera>
|
||||||
|
#include <osg/Geode>
|
||||||
|
#include <osgText/Text>
|
||||||
|
#include <osgViewer/Viewer>
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Canvas::CullCallback::CullCallback(const CanvasWeakPtr& canvas):
|
||||||
|
_canvas( canvas )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::CullCallback::operator()( osg::Node* node,
|
||||||
|
osg::NodeVisitor* nv )
|
||||||
|
{
|
||||||
|
if( (nv->getTraversalMask() & simgear::MODEL_BIT) && !_canvas.expired() )
|
||||||
|
_canvas.lock()->enableRendering();
|
||||||
|
|
||||||
|
traverse(node, nv);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Canvas::Canvas(SGPropertyNode* node):
|
||||||
|
PropertyBasedElement(node),
|
||||||
|
_canvas_mgr(0),
|
||||||
|
_event_manager(new EventManager),
|
||||||
|
_size_x(-1),
|
||||||
|
_size_y(-1),
|
||||||
|
_view_width(-1),
|
||||||
|
_view_height(-1),
|
||||||
|
_status(node, "status"),
|
||||||
|
_status_msg(node, "status-msg"),
|
||||||
|
_sampling_dirty(false),
|
||||||
|
_render_dirty(true),
|
||||||
|
_visible(true),
|
||||||
|
_render_always(false)
|
||||||
|
{
|
||||||
|
_status = 0;
|
||||||
|
setStatusFlags(MISSING_SIZE_X | MISSING_SIZE_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Canvas::~Canvas()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setSystemAdapter(const SystemAdapterPtr& system_adapter)
|
||||||
|
{
|
||||||
|
_system_adapter = system_adapter;
|
||||||
|
_texture.setSystemAdapter(system_adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
SystemAdapterPtr Canvas::getSystemAdapter() const
|
||||||
|
{
|
||||||
|
return _system_adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setCanvasMgr(CanvasMgr* canvas_mgr)
|
||||||
|
{
|
||||||
|
_canvas_mgr = canvas_mgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CanvasMgr* Canvas::getCanvasMgr() const
|
||||||
|
{
|
||||||
|
return _canvas_mgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::addDependentCanvas(const CanvasWeakPtr& canvas)
|
||||||
|
{
|
||||||
|
if( canvas.expired() )
|
||||||
|
{
|
||||||
|
SG_LOG
|
||||||
|
(
|
||||||
|
SG_GENERAL,
|
||||||
|
SG_WARN,
|
||||||
|
"Canvas::addDependentCanvas: got an expired Canvas dependent on "
|
||||||
|
<< _node->getPath()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dependent_canvases.insert(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::removeDependentCanvas(const CanvasWeakPtr& canvas)
|
||||||
|
{
|
||||||
|
_dependent_canvases.erase(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
GroupPtr Canvas::createGroup(const std::string& name)
|
||||||
|
{
|
||||||
|
return boost::dynamic_pointer_cast<Group>
|
||||||
|
(
|
||||||
|
_root_group->createChild("group", name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::enableRendering(bool force)
|
||||||
|
{
|
||||||
|
_visible = true;
|
||||||
|
if( force )
|
||||||
|
_render_dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::update(double delta_time_sec)
|
||||||
|
{
|
||||||
|
if( (!_texture.serviceable() && _status != STATUS_DIRTY)
|
||||||
|
|| (_status & CREATE_FAILED) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( _status == STATUS_DIRTY )
|
||||||
|
{
|
||||||
|
_texture.setSize(_size_x, _size_y);
|
||||||
|
|
||||||
|
if( !_texture.serviceable() )
|
||||||
|
{
|
||||||
|
_texture.useImageCoords(true);
|
||||||
|
_texture.useStencil(true);
|
||||||
|
_texture.allocRT(/*_camera_callback*/);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Resizing causes a new texture to be created so we need to reapply all
|
||||||
|
// existing placements
|
||||||
|
for(size_t i = 0; i < _placements.size(); ++i)
|
||||||
|
{
|
||||||
|
if( !_placements[i].empty() )
|
||||||
|
_dirty_placements.push_back( _placements[i].front()->getProps() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
osg::Camera* camera = _texture.getCamera();
|
||||||
|
|
||||||
|
osg::Vec4 clear_color(0.0f, 0.0f, 0.0f , 1.0f);
|
||||||
|
parseColor(_node->getStringValue("background"), clear_color);
|
||||||
|
camera->setClearColor(clear_color);
|
||||||
|
|
||||||
|
camera->addChild(_root_group->getMatrixTransform());
|
||||||
|
|
||||||
|
// Ensure objects are drawn in order of traversal
|
||||||
|
camera->getOrCreateStateSet()->setBinName("TraversalOrderBin");
|
||||||
|
|
||||||
|
if( _texture.serviceable() )
|
||||||
|
{
|
||||||
|
setStatusFlags(STATUS_OK);
|
||||||
|
setStatusFlags(STATUS_DIRTY, false);
|
||||||
|
_render_dirty = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setStatusFlags(CREATE_FAILED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( _visible || _render_always )
|
||||||
|
{
|
||||||
|
if( _render_dirty )
|
||||||
|
{
|
||||||
|
// Also mark all dependent (eg. recursively used) canvases as dirty
|
||||||
|
BOOST_FOREACH(CanvasWeakPtr canvas, _dependent_canvases)
|
||||||
|
{
|
||||||
|
if( !canvas.expired() )
|
||||||
|
canvas.lock()->_render_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_texture.setRender(_render_dirty);
|
||||||
|
|
||||||
|
_render_dirty = false;
|
||||||
|
_visible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_texture.setRender(false);
|
||||||
|
|
||||||
|
_root_group->update(delta_time_sec);
|
||||||
|
|
||||||
|
if( _sampling_dirty )
|
||||||
|
{
|
||||||
|
_texture.setSampling(
|
||||||
|
_node->getBoolValue("mipmapping"),
|
||||||
|
_node->getIntValue("coverage-samples"),
|
||||||
|
_node->getIntValue("color-samples")
|
||||||
|
);
|
||||||
|
_sampling_dirty = false;
|
||||||
|
_render_dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( !_dirty_placements.empty() )
|
||||||
|
{
|
||||||
|
SGPropertyNode *node = _dirty_placements.back();
|
||||||
|
_dirty_placements.pop_back();
|
||||||
|
|
||||||
|
if( node->getIndex() >= static_cast<int>(_placements.size()) )
|
||||||
|
// New placement
|
||||||
|
_placements.resize(node->getIndex() + 1);
|
||||||
|
else
|
||||||
|
// Remove possibly existing placements
|
||||||
|
_placements[ node->getIndex() ].clear();
|
||||||
|
|
||||||
|
// Get new placements
|
||||||
|
PlacementFactoryMap::const_iterator placement_factory =
|
||||||
|
_placement_factories.find( node->getStringValue("type", "object") );
|
||||||
|
if( placement_factory != _placement_factories.end() )
|
||||||
|
{
|
||||||
|
Placements& placements = _placements[ node->getIndex() ] =
|
||||||
|
placement_factory->second
|
||||||
|
(
|
||||||
|
node,
|
||||||
|
boost::static_pointer_cast<Canvas>(_self.lock())
|
||||||
|
);
|
||||||
|
node->setStringValue
|
||||||
|
(
|
||||||
|
"status-msg",
|
||||||
|
placements.empty() ? "No match" : "Ok"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
node->setStringValue("status-msg", "Unknown placement type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
naRef Canvas::addEventListener(const nasal::CallContext& ctx)
|
||||||
|
{
|
||||||
|
if( !_root_group.get() )
|
||||||
|
naRuntimeError(ctx.c, "Canvas: No root group!");
|
||||||
|
|
||||||
|
return _root_group->addEventListener(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setSizeX(int sx)
|
||||||
|
{
|
||||||
|
if( _size_x == sx )
|
||||||
|
return;
|
||||||
|
_size_x = sx;
|
||||||
|
setStatusFlags(STATUS_DIRTY);
|
||||||
|
|
||||||
|
if( _size_x <= 0 )
|
||||||
|
setStatusFlags(MISSING_SIZE_X);
|
||||||
|
else
|
||||||
|
setStatusFlags(MISSING_SIZE_X, false);
|
||||||
|
|
||||||
|
// reset flag to allow creation with new size
|
||||||
|
setStatusFlags(CREATE_FAILED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setSizeY(int sy)
|
||||||
|
{
|
||||||
|
if( _size_y == sy )
|
||||||
|
return;
|
||||||
|
_size_y = sy;
|
||||||
|
setStatusFlags(STATUS_DIRTY);
|
||||||
|
|
||||||
|
if( _size_y <= 0 )
|
||||||
|
setStatusFlags(MISSING_SIZE_Y);
|
||||||
|
else
|
||||||
|
setStatusFlags(MISSING_SIZE_Y, false);
|
||||||
|
|
||||||
|
// reset flag to allow creation with new size
|
||||||
|
setStatusFlags(CREATE_FAILED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int Canvas::getSizeX() const
|
||||||
|
{
|
||||||
|
return _size_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int Canvas::getSizeY() const
|
||||||
|
{
|
||||||
|
return _size_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setViewWidth(int w)
|
||||||
|
{
|
||||||
|
if( _view_width == w )
|
||||||
|
return;
|
||||||
|
_view_width = w;
|
||||||
|
|
||||||
|
_texture.setViewSize(_view_width, _view_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setViewHeight(int h)
|
||||||
|
{
|
||||||
|
if( _view_height == h )
|
||||||
|
return;
|
||||||
|
_view_height = h;
|
||||||
|
|
||||||
|
_texture.setViewSize(_view_width, _view_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int Canvas::getViewWidth() const
|
||||||
|
{
|
||||||
|
return _view_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int Canvas::getViewHeight() const
|
||||||
|
{
|
||||||
|
return _view_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool Canvas::handleMouseEvent(const MouseEventPtr& event)
|
||||||
|
{
|
||||||
|
if( !_root_group.get() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
EventVisitor visitor( EventVisitor::TRAVERSE_DOWN,
|
||||||
|
event->getClientPos(),
|
||||||
|
event->getDelta() );
|
||||||
|
if( !_root_group->accept(visitor) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return _event_manager->handleEvent(event, visitor.getPropagationPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::childAdded( SGPropertyNode * parent,
|
||||||
|
SGPropertyNode * child )
|
||||||
|
{
|
||||||
|
if( parent != _node )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( child->getNameString() == "placement" )
|
||||||
|
_dirty_placements.push_back(child);
|
||||||
|
else if( _root_group.get() )
|
||||||
|
static_cast<Element*>(_root_group.get())->childAdded(parent, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::childRemoved( SGPropertyNode * parent,
|
||||||
|
SGPropertyNode * child )
|
||||||
|
{
|
||||||
|
_render_dirty = true;
|
||||||
|
|
||||||
|
if( parent != _node )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( child->getNameString() == "placement" )
|
||||||
|
_placements[ child->getIndex() ].clear();
|
||||||
|
else if( _root_group.get() )
|
||||||
|
static_cast<Element*>(_root_group.get())->childRemoved(parent, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::valueChanged(SGPropertyNode* node)
|
||||||
|
{
|
||||||
|
if( boost::starts_with(node->getNameString(), "status")
|
||||||
|
|| node->getParent()->getNameString() == "bounding-box" )
|
||||||
|
return;
|
||||||
|
_render_dirty = true;
|
||||||
|
|
||||||
|
bool handled = true;
|
||||||
|
if( node->getParent()->getParent() == _node
|
||||||
|
&& node->getParent()->getNameString() == "placement" )
|
||||||
|
{
|
||||||
|
bool placement_dirty = false;
|
||||||
|
BOOST_FOREACH(Placements& placements, _placements)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(PlacementPtr& placement, placements)
|
||||||
|
{
|
||||||
|
// check if change can be directly handled by placement
|
||||||
|
if( placement->getProps() == node->getParent()
|
||||||
|
&& !placement->childChanged(node) )
|
||||||
|
placement_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !placement_dirty )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// prevent double updates...
|
||||||
|
for( size_t i = 0; i < _dirty_placements.size(); ++i )
|
||||||
|
{
|
||||||
|
if( node->getParent() == _dirty_placements[i] )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dirty_placements.push_back(node->getParent());
|
||||||
|
}
|
||||||
|
else if( node->getParent() == _node )
|
||||||
|
{
|
||||||
|
if( node->getNameString() == "background" )
|
||||||
|
{
|
||||||
|
osg::Vec4 color;
|
||||||
|
if( _texture.getCamera() && parseColor(node->getStringValue(), color) )
|
||||||
|
{
|
||||||
|
_texture.getCamera()->setClearColor(color);
|
||||||
|
_render_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( node->getNameString() == "mipmapping"
|
||||||
|
|| node->getNameString() == "coverage-samples"
|
||||||
|
|| node->getNameString() == "color-samples" )
|
||||||
|
{
|
||||||
|
_sampling_dirty = true;
|
||||||
|
}
|
||||||
|
else if( node->getNameString() == "render-always" )
|
||||||
|
{
|
||||||
|
_render_always = node->getBoolValue();
|
||||||
|
}
|
||||||
|
else if( node->getNameString() == "size" )
|
||||||
|
{
|
||||||
|
if( node->getIndex() == 0 )
|
||||||
|
setSizeX( node->getIntValue() );
|
||||||
|
else if( node->getIndex() == 1 )
|
||||||
|
setSizeY( node->getIntValue() );
|
||||||
|
}
|
||||||
|
else if( node->getNameString() == "view" )
|
||||||
|
{
|
||||||
|
if( node->getIndex() == 0 )
|
||||||
|
setViewWidth( node->getIntValue() );
|
||||||
|
else if( node->getIndex() == 1 )
|
||||||
|
setViewHeight( node->getIntValue() );
|
||||||
|
}
|
||||||
|
else if( node->getNameString() == "freeze" )
|
||||||
|
_texture.setRender( node->getBoolValue() );
|
||||||
|
else
|
||||||
|
handled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
handled = false;
|
||||||
|
|
||||||
|
if( !handled && _root_group.get() )
|
||||||
|
_root_group->valueChanged(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
osg::Texture2D* Canvas::getTexture() const
|
||||||
|
{
|
||||||
|
return _texture.getTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Canvas::CullCallbackPtr Canvas::getCullCallback() const
|
||||||
|
{
|
||||||
|
return _cull_callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::addPlacementFactory( const std::string& type,
|
||||||
|
PlacementFactory factory )
|
||||||
|
{
|
||||||
|
if( _placement_factories.find(type) != _placement_factories.end() )
|
||||||
|
SG_LOG
|
||||||
|
(
|
||||||
|
SG_GENERAL,
|
||||||
|
SG_WARN,
|
||||||
|
"Canvas::addPlacementFactory: replace existing factor for type " << type
|
||||||
|
);
|
||||||
|
|
||||||
|
_placement_factories[type] = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setSelf(const PropertyBasedElementPtr& self)
|
||||||
|
{
|
||||||
|
PropertyBasedElement::setSelf(self);
|
||||||
|
|
||||||
|
CanvasPtr canvas = boost::static_pointer_cast<Canvas>(self);
|
||||||
|
|
||||||
|
_root_group.reset( new Group(canvas, _node) );
|
||||||
|
_root_group->setSelf(_root_group);
|
||||||
|
|
||||||
|
// Remove automatically created property listener as we forward them on our
|
||||||
|
// own
|
||||||
|
_root_group->removeListener();
|
||||||
|
|
||||||
|
_cull_callback = new CullCallback(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Canvas::setStatusFlags(unsigned int flags, bool set)
|
||||||
|
{
|
||||||
|
if( set )
|
||||||
|
_status |= flags;
|
||||||
|
else
|
||||||
|
_status &= ~flags;
|
||||||
|
|
||||||
|
if( (_status & MISSING_SIZE_X) && (_status & MISSING_SIZE_Y) )
|
||||||
|
_status_msg = "Missing size";
|
||||||
|
else if( _status & MISSING_SIZE_X )
|
||||||
|
_status_msg = "Missing size-x";
|
||||||
|
else if( _status & MISSING_SIZE_Y )
|
||||||
|
_status_msg = "Missing size-y";
|
||||||
|
else if( _status & CREATE_FAILED )
|
||||||
|
_status_msg = "Creating render target failed";
|
||||||
|
else if( _status == STATUS_DIRTY )
|
||||||
|
_status_msg = "Creation pending...";
|
||||||
|
else
|
||||||
|
_status_msg = "Ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Canvas::PlacementFactoryMap Canvas::_placement_factories;
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
// The canvas for rendering with the 2d API
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_HXX_
|
||||||
|
#define CANVAS_HXX_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
#include "ODGauge.hxx"
|
||||||
|
|
||||||
|
#include <simgear/canvas/elements/CanvasGroup.hxx>
|
||||||
|
#include <simgear/props/PropertyBasedElement.hxx>
|
||||||
|
#include <simgear/props/propertyObject.hxx>
|
||||||
|
#include <osg/NodeCallback>
|
||||||
|
#include <osg/observer_ptr>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
class CanvasMgr;
|
||||||
|
class MouseEvent;
|
||||||
|
|
||||||
|
class Canvas:
|
||||||
|
public PropertyBasedElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum StatusFlags
|
||||||
|
{
|
||||||
|
STATUS_OK,
|
||||||
|
STATUS_DIRTY = 1,
|
||||||
|
MISSING_SIZE_X = STATUS_DIRTY << 1,
|
||||||
|
MISSING_SIZE_Y = MISSING_SIZE_X << 1,
|
||||||
|
CREATE_FAILED = MISSING_SIZE_Y << 1
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This callback is installed on every placement of the canvas in the
|
||||||
|
* scene to only render the canvas if at least one placement is visible
|
||||||
|
*/
|
||||||
|
class CullCallback:
|
||||||
|
public osg::NodeCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CullCallback(const CanvasWeakPtr& canvas);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CanvasWeakPtr _canvas;
|
||||||
|
|
||||||
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
||||||
|
};
|
||||||
|
typedef osg::ref_ptr<CullCallback> CullCallbackPtr;
|
||||||
|
|
||||||
|
Canvas(SGPropertyNode* node);
|
||||||
|
virtual ~Canvas();
|
||||||
|
|
||||||
|
void setSystemAdapter(const SystemAdapterPtr& system_adapter);
|
||||||
|
SystemAdapterPtr getSystemAdapter() const;
|
||||||
|
|
||||||
|
void setCanvasMgr(CanvasMgr* canvas_mgr);
|
||||||
|
CanvasMgr* getCanvasMgr() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a canvas which should be mared as dirty upon any change to this
|
||||||
|
* canvas.
|
||||||
|
*
|
||||||
|
* This mechanism is used to eg. redraw a canvas if it's displaying
|
||||||
|
* another canvas (recursive canvases)
|
||||||
|
*/
|
||||||
|
void addDependentCanvas(const CanvasWeakPtr& canvas);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop notifying the given canvas upon changes
|
||||||
|
*/
|
||||||
|
void removeDependentCanvas(const CanvasWeakPtr& canvas);
|
||||||
|
|
||||||
|
GroupPtr createGroup(const std::string& name = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable rendering for the next frame
|
||||||
|
*
|
||||||
|
* @param force Force redraw even if nothing has changed (if dirty flag
|
||||||
|
* is not set)
|
||||||
|
*/
|
||||||
|
void enableRendering(bool force = false);
|
||||||
|
|
||||||
|
void update(double delta_time_sec);
|
||||||
|
|
||||||
|
naRef addEventListener(const nasal::CallContext& ctx);
|
||||||
|
|
||||||
|
void setSizeX(int sx);
|
||||||
|
void setSizeY(int sy);
|
||||||
|
|
||||||
|
int getSizeX() const;
|
||||||
|
int getSizeY() const;
|
||||||
|
|
||||||
|
void setViewWidth(int w);
|
||||||
|
void setViewHeight(int h);
|
||||||
|
|
||||||
|
int getViewWidth() const;
|
||||||
|
int getViewHeight() const;
|
||||||
|
|
||||||
|
bool handleMouseEvent(const MouseEventPtr& event);
|
||||||
|
|
||||||
|
virtual void childAdded( SGPropertyNode * parent,
|
||||||
|
SGPropertyNode * child );
|
||||||
|
virtual void childRemoved( SGPropertyNode * parent,
|
||||||
|
SGPropertyNode * child );
|
||||||
|
virtual void valueChanged (SGPropertyNode * node);
|
||||||
|
|
||||||
|
osg::Texture2D* getTexture() const;
|
||||||
|
|
||||||
|
CullCallbackPtr getCullCallback() const;
|
||||||
|
|
||||||
|
static void addPlacementFactory( const std::string& type,
|
||||||
|
PlacementFactory factory );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
SystemAdapterPtr _system_adapter;
|
||||||
|
CanvasMgr *_canvas_mgr;
|
||||||
|
|
||||||
|
std::auto_ptr<EventManager> _event_manager;
|
||||||
|
|
||||||
|
int _size_x,
|
||||||
|
_size_y,
|
||||||
|
_view_width,
|
||||||
|
_view_height;
|
||||||
|
|
||||||
|
PropertyObject<int> _status;
|
||||||
|
PropertyObject<std::string> _status_msg;
|
||||||
|
|
||||||
|
bool _sampling_dirty,
|
||||||
|
_render_dirty,
|
||||||
|
_visible;
|
||||||
|
|
||||||
|
ODGauge _texture;
|
||||||
|
GroupPtr _root_group;
|
||||||
|
|
||||||
|
CullCallbackPtr _cull_callback;
|
||||||
|
bool _render_always; //<! Used to disable automatic lazy rendering (culling)
|
||||||
|
|
||||||
|
std::vector<SGPropertyNode*> _dirty_placements;
|
||||||
|
std::vector<Placements> _placements;
|
||||||
|
std::set<CanvasWeakPtr> _dependent_canvases; //<! Canvases which use this
|
||||||
|
// canvas and should be
|
||||||
|
// notified about changes
|
||||||
|
|
||||||
|
typedef std::map<std::string, PlacementFactory> PlacementFactoryMap;
|
||||||
|
static PlacementFactoryMap _placement_factories;
|
||||||
|
|
||||||
|
virtual void setSelf(const PropertyBasedElementPtr& self);
|
||||||
|
void setStatusFlags(unsigned int flags, bool set = true);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Canvas(const Canvas&); // = delete;
|
||||||
|
Canvas& operator=(const Canvas&); // = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* CANVAS_HXX_ */
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
// Canvas Event for event model similar to DOM Level 3 Event Model
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "CanvasEvent.hxx"
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Event::Event():
|
||||||
|
type(UNKNOWN),
|
||||||
|
propagation_stopped(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Event::~Event()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Event::Type Event::getType() const
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string Event::getTypeString() const
|
||||||
|
{
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
# define ENUM_MAPPING(name, str) case name: return str;
|
||||||
|
# include "CanvasEventTypes.hxx"
|
||||||
|
# undef ENUM_MAPPING
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
ElementWeakPtr Event::getTarget() const
|
||||||
|
{
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
double Event::getTime() const
|
||||||
|
{
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Event::stopPropagation()
|
||||||
|
{
|
||||||
|
propagation_stopped = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Event::Type Event::strToType(const std::string& str)
|
||||||
|
{
|
||||||
|
typedef std::map<std::string, Type> TypeMap;
|
||||||
|
static TypeMap type_map;
|
||||||
|
|
||||||
|
if( type_map.empty() )
|
||||||
|
{
|
||||||
|
# define ENUM_MAPPING(type, str) type_map[ str ] = type;
|
||||||
|
# include "CanvasEventTypes.hxx"
|
||||||
|
# undef ENUM_MAPPING
|
||||||
|
}
|
||||||
|
|
||||||
|
TypeMap::const_iterator it = type_map.find(str);
|
||||||
|
if( it == type_map.end() )
|
||||||
|
return UNKNOWN;
|
||||||
|
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// Canvas Event for event model similar to DOM Level 3 Event Model
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_EVENT_HXX_
|
||||||
|
#define CANVAS_EVENT_HXX_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class Event
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
UNKNOWN,
|
||||||
|
# define ENUM_MAPPING(name, str) name,
|
||||||
|
# include "CanvasEventTypes.hxx"
|
||||||
|
# undef ENUM_MAPPING
|
||||||
|
USER_TYPE ///<! first unused id to be used for user defined types (not
|
||||||
|
/// implemented yet)
|
||||||
|
};
|
||||||
|
|
||||||
|
Type type;
|
||||||
|
ElementWeakPtr target;
|
||||||
|
double time;
|
||||||
|
bool propagation_stopped;
|
||||||
|
|
||||||
|
Event();
|
||||||
|
|
||||||
|
// We need a vtable to allow nasal::Ghost to determine the dynamic type
|
||||||
|
// of the actual event instances.
|
||||||
|
virtual ~Event();
|
||||||
|
|
||||||
|
Type getType() const;
|
||||||
|
std::string getTypeString() const;
|
||||||
|
|
||||||
|
ElementWeakPtr getTarget() const;
|
||||||
|
|
||||||
|
double getTime() const;
|
||||||
|
|
||||||
|
void stopPropagation();
|
||||||
|
|
||||||
|
static Type strToType(const std::string& str);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* CANVAS_EVENT_HXX_ */
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// Listener for canvas (GUI) events being passed to a Nasal function/code
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "CanvasEvent.hxx"
|
||||||
|
#include "CanvasEventListener.hxx"
|
||||||
|
#include "CanvasSystemAdapter.hxx"
|
||||||
|
|
||||||
|
#include <simgear/nasal/cppbind/Ghost.hxx>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventListener::EventListener(naRef code, const SystemAdapterPtr& sys_adapter):
|
||||||
|
_code(code),
|
||||||
|
_gc_key(-1),
|
||||||
|
_sys(sys_adapter)
|
||||||
|
{
|
||||||
|
assert( sys_adapter );
|
||||||
|
if( !naIsCode(code)
|
||||||
|
&& !naIsCCode(code)
|
||||||
|
&& !naIsFunc(code) )
|
||||||
|
throw std::runtime_error
|
||||||
|
(
|
||||||
|
"canvas::EventListener: invalid function argument"
|
||||||
|
);
|
||||||
|
|
||||||
|
_gc_key = sys_adapter->gcSave(_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventListener::~EventListener()
|
||||||
|
{
|
||||||
|
assert( !_sys.expired() );
|
||||||
|
_sys.lock()->gcRelease(_gc_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void EventListener::call(const canvas::EventPtr& event)
|
||||||
|
{
|
||||||
|
SystemAdapterPtr sys = _sys.lock();
|
||||||
|
|
||||||
|
naRef args[] = {
|
||||||
|
nasal::Ghost<EventPtr>::create(sys->getNasalContext(), event)
|
||||||
|
};
|
||||||
|
const int num_args = sizeof(args)/sizeof(args[0]);
|
||||||
|
|
||||||
|
sys->callMethod(_code, naNil(), num_args, args, naNil());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// Listener for canvas (GUI) events being passed to a Nasal function/code
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_EVENT_LISTENER_HXX_
|
||||||
|
#define CANVAS_EVENT_LISTENER_HXX_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
#include <simgear/nasal/naref.h>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class EventListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EventListener( naRef code,
|
||||||
|
const SystemAdapterPtr& sys_adapter );
|
||||||
|
~EventListener();
|
||||||
|
|
||||||
|
void call(const canvas::EventPtr& event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
naRef _code;
|
||||||
|
int _gc_key;
|
||||||
|
SystemAdapterWeakPtr _sys;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* CANVAS_EVENT_LISTENER_HXX_ */
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "CanvasEventManager.hxx"
|
||||||
|
#include "MouseEvent.hxx"
|
||||||
|
#include <simgear/canvas/elements/CanvasElement.hxx>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
const unsigned int drag_threshold = 8;
|
||||||
|
const double multi_click_timeout = 0.4;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventManager::StampedPropagationPath::StampedPropagationPath():
|
||||||
|
time(0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
EventManager::StampedPropagationPath::StampedPropagationPath(
|
||||||
|
const EventPropagationPath& path,
|
||||||
|
double time
|
||||||
|
):
|
||||||
|
path(path),
|
||||||
|
time(time)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void EventManager::StampedPropagationPath::clear()
|
||||||
|
{
|
||||||
|
path.clear();
|
||||||
|
time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool EventManager::StampedPropagationPath::valid() const
|
||||||
|
{
|
||||||
|
return !path.empty() && time > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventManager::EventManager():
|
||||||
|
_current_click_count(0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool EventManager::handleEvent( const MouseEventPtr& event,
|
||||||
|
const EventPropagationPath& path )
|
||||||
|
{
|
||||||
|
switch( event->type )
|
||||||
|
{
|
||||||
|
case Event::MOUSE_DOWN:
|
||||||
|
_last_mouse_down = StampedPropagationPath(path, event->getTime());
|
||||||
|
break;
|
||||||
|
case Event::MOUSE_UP:
|
||||||
|
{
|
||||||
|
if( _last_mouse_down.path.empty() )
|
||||||
|
// Ignore mouse up without any previous mouse down
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// normal mouseup
|
||||||
|
propagateEvent(event, path);
|
||||||
|
|
||||||
|
// now handle click/dblclick
|
||||||
|
if( checkClickDistance(path, _last_mouse_down.path) )
|
||||||
|
handleClick(event, getCommonAncestor(_last_mouse_down.path, path));
|
||||||
|
|
||||||
|
_last_mouse_down.clear();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Event::DRAG:
|
||||||
|
if( !_last_mouse_down.valid() )
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return propagateEvent(event, _last_mouse_down.path);
|
||||||
|
case Event::MOUSE_MOVE:
|
||||||
|
handleMove(event, path);
|
||||||
|
break;
|
||||||
|
case Event::MOUSE_LEAVE:
|
||||||
|
// Mouse leaves window and therefore also current mouseover element
|
||||||
|
handleMove(event, EventPropagationPath());
|
||||||
|
return true;
|
||||||
|
case Event::WHEEL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return propagateEvent(event, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void EventManager::handleClick( const MouseEventPtr& event,
|
||||||
|
const EventPropagationPath& path )
|
||||||
|
{
|
||||||
|
MouseEventPtr click(new MouseEvent(*event));
|
||||||
|
click->type = Event::CLICK;
|
||||||
|
|
||||||
|
if( event->getTime() > _last_click.time + multi_click_timeout )
|
||||||
|
_current_click_count = 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Maximum current click count is 3
|
||||||
|
_current_click_count = (_current_click_count % 3) + 1;
|
||||||
|
|
||||||
|
if( _current_click_count > 1 )
|
||||||
|
{
|
||||||
|
// Reset current click count if moved too far
|
||||||
|
if( !checkClickDistance(path, _last_click.path) )
|
||||||
|
_current_click_count = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
click->click_count = _current_click_count;
|
||||||
|
|
||||||
|
MouseEventPtr dbl_click;
|
||||||
|
if( _current_click_count == 2 )
|
||||||
|
{
|
||||||
|
dbl_click.reset(new MouseEvent(*click));
|
||||||
|
dbl_click->type = Event::DBL_CLICK;
|
||||||
|
}
|
||||||
|
|
||||||
|
propagateEvent(click, path);
|
||||||
|
|
||||||
|
if( dbl_click )
|
||||||
|
propagateEvent(dbl_click, getCommonAncestor(_last_click.path, path));
|
||||||
|
|
||||||
|
_last_click = StampedPropagationPath(path, event->getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void EventManager::handleMove( const MouseEventPtr& event,
|
||||||
|
const EventPropagationPath& path )
|
||||||
|
{
|
||||||
|
if( _last_mouse_over.path == path )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( !_last_mouse_over.path.empty() )
|
||||||
|
{
|
||||||
|
MouseEventPtr mouseout(new MouseEvent(*event));
|
||||||
|
mouseout->type = Event::MOUSE_OUT;
|
||||||
|
propagateEvent(mouseout, _last_mouse_over.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !path.empty() )
|
||||||
|
{
|
||||||
|
MouseEventPtr mouseover(new MouseEvent(*event));
|
||||||
|
mouseover->type = Event::MOUSE_OVER;
|
||||||
|
propagateEvent(mouseover, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
_last_mouse_over.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool EventManager::propagateEvent( const EventPtr& event,
|
||||||
|
const EventPropagationPath& path )
|
||||||
|
{
|
||||||
|
event->target = path.back().element;
|
||||||
|
MouseEventPtr mouse_event = boost::dynamic_pointer_cast<MouseEvent>(event);
|
||||||
|
|
||||||
|
// Event propagation similar to DOM Level 3 event flow:
|
||||||
|
// http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
|
||||||
|
|
||||||
|
// Capturing phase
|
||||||
|
// for( EventTargets::iterator it = _target_path.begin();
|
||||||
|
// it != _target_path.end();
|
||||||
|
// ++it )
|
||||||
|
// {
|
||||||
|
// if( it->element )
|
||||||
|
// std::cout << it->element->getProps()->getPath() << " "
|
||||||
|
// << "(" << it->local_pos.x() << "|" << it->local_pos.y() << ")\n";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Bubbling phase
|
||||||
|
for( EventPropagationPath::const_reverse_iterator
|
||||||
|
it = path.rbegin();
|
||||||
|
it != path.rend();
|
||||||
|
++it )
|
||||||
|
{
|
||||||
|
ElementPtr el = it->element.lock();
|
||||||
|
|
||||||
|
if( !el )
|
||||||
|
// Ignore element if it has been destroyed while traversing the event
|
||||||
|
// (eg. removed by another event handler)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// TODO provide functions to convert position and delta to local
|
||||||
|
// coordinates on demand. Events shouldn't contain informations in
|
||||||
|
// local coordinates as they might differe between different elements
|
||||||
|
// receiving the same event.
|
||||||
|
// if( mouse_event && event->type != Event::DRAG )
|
||||||
|
// {
|
||||||
|
// // TODO transform pos and delta for drag events. Maybe we should just
|
||||||
|
// // store the global coordinates and convert to local coordinates
|
||||||
|
// // on demand.
|
||||||
|
//
|
||||||
|
// // Position and delta are specified in local coordinate system of
|
||||||
|
// // current element
|
||||||
|
// mouse_event->pos = it->local_pos;
|
||||||
|
// mouse_event->delta = it->local_delta;
|
||||||
|
// }
|
||||||
|
|
||||||
|
el->callListeners(event);
|
||||||
|
|
||||||
|
if( event->propagation_stopped )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
EventManager::checkClickDistance( const EventPropagationPath& path1,
|
||||||
|
const EventPropagationPath& path2 ) const
|
||||||
|
{
|
||||||
|
osg::Vec2 delta = path1.front().local_pos - path2.front().local_pos;
|
||||||
|
return delta.x() < drag_threshold
|
||||||
|
&& delta.y() < drag_threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventPropagationPath
|
||||||
|
EventManager::getCommonAncestor( const EventPropagationPath& path1,
|
||||||
|
const EventPropagationPath& path2 ) const
|
||||||
|
{
|
||||||
|
if( path1.back().element.lock() == path2.back().element.lock() )
|
||||||
|
return path2;
|
||||||
|
|
||||||
|
EventPropagationPath path;
|
||||||
|
|
||||||
|
for( size_t i = 0; i < path1.size() && i < path2.size(); ++i )
|
||||||
|
{
|
||||||
|
if( path1[i].element.lock() != path2[i].element.lock() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
path.push_back(path2[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_EVENT_MANAGER_HXX_
|
||||||
|
#define CANVAS_EVENT_MANAGER_HXX_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
struct EventTarget
|
||||||
|
{
|
||||||
|
ElementWeakPtr element;
|
||||||
|
osg::Vec2f local_pos,
|
||||||
|
local_delta;
|
||||||
|
};
|
||||||
|
typedef std::deque<EventTarget> EventPropagationPath;
|
||||||
|
inline bool operator==(const EventTarget& t1, const EventTarget& t2)
|
||||||
|
{
|
||||||
|
return t1.element.lock() == t2.element.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
class EventManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EventManager();
|
||||||
|
|
||||||
|
bool handleEvent( const MouseEventPtr& event,
|
||||||
|
const EventPropagationPath& path );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
struct StampedPropagationPath
|
||||||
|
{
|
||||||
|
StampedPropagationPath();
|
||||||
|
StampedPropagationPath(const EventPropagationPath& path, double time);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
bool valid() const;
|
||||||
|
|
||||||
|
EventPropagationPath path;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO if we really need the paths modify to not copy around the paths
|
||||||
|
// that much.
|
||||||
|
StampedPropagationPath _last_mouse_down,
|
||||||
|
_last_click,
|
||||||
|
_last_mouse_over;
|
||||||
|
size_t _current_click_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Propagate click event and handle multi-click (eg. create dblclick)
|
||||||
|
*/
|
||||||
|
void handleClick( const MouseEventPtr& event,
|
||||||
|
const EventPropagationPath& path );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle mouseover/enter/out/leave
|
||||||
|
*/
|
||||||
|
void handleMove( const MouseEventPtr& event,
|
||||||
|
const EventPropagationPath& path );
|
||||||
|
|
||||||
|
bool propagateEvent( const EventPtr& event,
|
||||||
|
const EventPropagationPath& path );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if two click events (either mousedown/up or two consecutive
|
||||||
|
* clicks) are inside a maximum distance to still create a click or
|
||||||
|
* dblclick event respectively.
|
||||||
|
*/
|
||||||
|
bool checkClickDistance( const EventPropagationPath& path1,
|
||||||
|
const EventPropagationPath& path2 ) const;
|
||||||
|
EventPropagationPath
|
||||||
|
getCommonAncestor( const EventPropagationPath& path1,
|
||||||
|
const EventPropagationPath& path2 ) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* CANVAS_EVENT_MANAGER_HXX_ */
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Mapping between canvas gui Event types and their names
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef ENUM_MAPPING
|
||||||
|
# error "Don't include this file directly!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ENUM_MAPPING(MOUSE_DOWN, "mousedown")
|
||||||
|
ENUM_MAPPING(MOUSE_UP, "mouseup")
|
||||||
|
ENUM_MAPPING(CLICK, "click")
|
||||||
|
ENUM_MAPPING(DBL_CLICK, "dblclick")
|
||||||
|
ENUM_MAPPING(DRAG, "drag")
|
||||||
|
ENUM_MAPPING(WHEEL, "wheel")
|
||||||
|
ENUM_MAPPING(MOUSE_MOVE, "mousemove")
|
||||||
|
ENUM_MAPPING(MOUSE_OVER, "mouseover")
|
||||||
|
ENUM_MAPPING(MOUSE_OUT, "mouseout")
|
||||||
|
ENUM_MAPPING(MOUSE_ENTER, "mouseenter")
|
||||||
|
ENUM_MAPPING(MOUSE_LEAVE, "mouseleave")
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
// Visitor for traversing a canvas element hierarchy similar to the traversal
|
||||||
|
// of the DOM Level 3 Event Model
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "CanvasEvent.hxx"
|
||||||
|
#include "CanvasEventVisitor.hxx"
|
||||||
|
#include <simgear/canvas/elements/CanvasElement.hxx>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventVisitor::EventVisitor( TraverseMode mode,
|
||||||
|
const osg::Vec2f& pos,
|
||||||
|
const osg::Vec2f& delta ):
|
||||||
|
_traverse_mode( mode )
|
||||||
|
{
|
||||||
|
if( mode == TRAVERSE_DOWN )
|
||||||
|
{
|
||||||
|
EventTarget target = {ElementWeakPtr(), pos, delta};
|
||||||
|
_target_path.push_back(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
EventVisitor::~EventVisitor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool EventVisitor::traverse(Element& el)
|
||||||
|
{
|
||||||
|
if( _traverse_mode == TRAVERSE_UP )
|
||||||
|
return el.ascend(*this);
|
||||||
|
else
|
||||||
|
return el.traverse(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool EventVisitor::apply(Element& el)
|
||||||
|
{
|
||||||
|
// We only need to check for hits while traversing down
|
||||||
|
if( _traverse_mode == TRAVERSE_DOWN )
|
||||||
|
{
|
||||||
|
// Transform event to local coordinates
|
||||||
|
const osg::Matrix& m = el.getMatrixTransform()->getInverseMatrix();
|
||||||
|
const osg::Vec2f& pos = _target_path.back().local_pos;
|
||||||
|
const osg::Vec2f local_pos
|
||||||
|
(
|
||||||
|
m(0, 0) * pos[0] + m(1, 0) * pos[1] + m(3, 0),
|
||||||
|
m(0, 1) * pos[0] + m(1, 1) * pos[1] + m(3, 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Don't check collision with root element (2nd element in _target_path)
|
||||||
|
// do event listeners attached to the canvas itself (its root group)
|
||||||
|
// always get called even if no element has been hit.
|
||||||
|
if( _target_path.size() > 2 && !el.hitBound(pos, local_pos) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const osg::Vec2f& delta = _target_path.back().local_delta;
|
||||||
|
const osg::Vec2f local_delta
|
||||||
|
(
|
||||||
|
m(0, 0) * delta[0] + m(1, 0) * delta[1],
|
||||||
|
m(0, 1) * delta[0] + m(1, 1) * delta[1]
|
||||||
|
);
|
||||||
|
|
||||||
|
EventTarget target = {el.getWeakPtr(), local_pos, local_delta};
|
||||||
|
_target_path.push_back(target);
|
||||||
|
|
||||||
|
if( el.traverse(*this) || _target_path.size() <= 2 )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
_target_path.pop_back();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return el.ascend(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
const EventPropagationPath& EventVisitor::getPropagationPath() const
|
||||||
|
{
|
||||||
|
return _target_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// Visitor for traversing a canvas element hierarchy similar to the traversal
|
||||||
|
// of the DOM Level 3 Event Model
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_EVENT_VISITOR_HXX_
|
||||||
|
#define CANVAS_EVENT_VISITOR_HXX_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
#include "CanvasEventManager.hxx"
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class EventVisitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum TraverseMode
|
||||||
|
{
|
||||||
|
TRAVERSE_UP,
|
||||||
|
TRAVERSE_DOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
EventVisitor( TraverseMode mode,
|
||||||
|
const osg::Vec2f& pos,
|
||||||
|
const osg::Vec2f& delta );
|
||||||
|
virtual ~EventVisitor();
|
||||||
|
virtual bool traverse(Element& el);
|
||||||
|
virtual bool apply(Element& el);
|
||||||
|
|
||||||
|
const EventPropagationPath& getPropagationPath() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
TraverseMode _traverse_mode;
|
||||||
|
EventPropagationPath _target_path;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CANVAS_EVENTVISITOR_HXX_ */
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
// Canvas with 2D rendering API
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "CanvasMgr.hxx"
|
||||||
|
#include "Canvas.hxx"
|
||||||
|
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Canvas factory
|
||||||
|
*/
|
||||||
|
CanvasPtr canvasFactory(SGPropertyNode* node)
|
||||||
|
{
|
||||||
|
return CanvasPtr(new Canvas(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CanvasMgr::CanvasMgr( SGPropertyNode_ptr node,
|
||||||
|
SystemAdapterPtr system_adapter ):
|
||||||
|
PropertyBasedMgr(node, "texture", &canvasFactory),
|
||||||
|
_system_adapter(system_adapter)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CanvasPtr CanvasMgr::createCanvas(const std::string& name)
|
||||||
|
{
|
||||||
|
return boost::static_pointer_cast<Canvas>( createElement(name) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CanvasPtr CanvasMgr::getCanvas(size_t index) const
|
||||||
|
{
|
||||||
|
return boost::static_pointer_cast<Canvas>( getElement(index) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CanvasPtr CanvasMgr::getCanvas(const std::string& name) const
|
||||||
|
{
|
||||||
|
return boost::static_pointer_cast<Canvas>( getElement(name) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void CanvasMgr::elementCreated(PropertyBasedElementPtr element)
|
||||||
|
{
|
||||||
|
CanvasPtr canvas = boost::static_pointer_cast<Canvas>(element);
|
||||||
|
canvas->setSystemAdapter(_system_adapter);
|
||||||
|
canvas->setCanvasMgr(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
// Canvas with 2D rendering API
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef SG_CANVAS_MGR_H_
|
||||||
|
#define SG_CANVAS_MGR_H_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
#include <simgear/props/PropertyBasedMgr.hxx>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class CanvasMgr:
|
||||||
|
public PropertyBasedMgr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param node Root node of branch used to control canvasses
|
||||||
|
* @param system_adapter Adapter for connecting between canvas and
|
||||||
|
* application framework
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
CanvasMgr( SGPropertyNode_ptr node,
|
||||||
|
SystemAdapterPtr system_adapter );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new canvas
|
||||||
|
*
|
||||||
|
* @param name Name of the new canvas
|
||||||
|
*/
|
||||||
|
CanvasPtr createCanvas(const std::string& name = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ::Canvas by index
|
||||||
|
*
|
||||||
|
* @param index Index of texture node in /canvas/by-index/
|
||||||
|
*/
|
||||||
|
CanvasPtr getCanvas(size_t index) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ::Canvas by name
|
||||||
|
*
|
||||||
|
* @param name Value of child node "name" in
|
||||||
|
* /canvas/by-index/texture[i]/name
|
||||||
|
*/
|
||||||
|
CanvasPtr getCanvas(const std::string& name) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
SystemAdapterPtr _system_adapter;
|
||||||
|
|
||||||
|
virtual void elementCreated(PropertyBasedElementPtr element);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* SG_CANVAS_MGR_H_ */
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
// Base class for canvas placements
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#include "CanvasPlacement.hxx"
|
||||||
|
#include <simgear/props/props.hxx>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Placement::Placement(SGPropertyNode* node):
|
||||||
|
_node(node)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Placement::~Placement()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
SGConstPropertyNode_ptr Placement::getProps() const
|
||||||
|
{
|
||||||
|
return _node;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
SGPropertyNode_ptr Placement::getProps()
|
||||||
|
{
|
||||||
|
return _node;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool Placement::childChanged(SGPropertyNode* child)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
// Base class for canvas placements
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_PLACEMENT_HXX_
|
||||||
|
#define CANVAS_PLACEMENT_HXX_
|
||||||
|
|
||||||
|
#include <simgear/props/propsfwd.hxx>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class Placement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Placement(SGPropertyNode* node);
|
||||||
|
virtual ~Placement() = 0;
|
||||||
|
|
||||||
|
SGConstPropertyNode_ptr getProps() const;
|
||||||
|
SGPropertyNode_ptr getProps();
|
||||||
|
|
||||||
|
virtual bool childChanged(SGPropertyNode* child);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SGPropertyNode_ptr _node;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Placement(const Placement&) /* = delete */;
|
||||||
|
Placement& operator=(const Placement&) /* = delete */;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* CANVAS_PLACEMENT_HXX_ */
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
// Adapter for using the canvas with different applications
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef SG_CANVAS_SYSTEM_ADAPTER_HXX_
|
||||||
|
#define SG_CANVAS_SYSTEM_ADAPTER_HXX_
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
#include <simgear/nasal/nasal.h>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class SystemAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~SystemAdapter() {}
|
||||||
|
virtual FontPtr getFont(const std::string& name) const = 0;
|
||||||
|
virtual void addCamera(osg::Camera* camera) const = 0;
|
||||||
|
virtual void removeCamera(osg::Camera* camera) const = 0;
|
||||||
|
virtual osg::Image* getImage(const std::string& path) const = 0;
|
||||||
|
|
||||||
|
virtual naContext getNasalContext() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save passed reference to Nasal object from being deleted by the
|
||||||
|
* garbage collector.
|
||||||
|
*/
|
||||||
|
virtual int gcSave(naRef r) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release an object previously passed to ::gcSave to allow it being
|
||||||
|
* cleaned up by the garbage collector.
|
||||||
|
*/
|
||||||
|
virtual void gcRelease(int key) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call a Nasal function with the given environment and arguments.
|
||||||
|
*/
|
||||||
|
virtual naRef callMethod( naRef code,
|
||||||
|
naRef self,
|
||||||
|
int argc,
|
||||||
|
naRef* args,
|
||||||
|
naRef locals ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* SG_CANVAS_SYSTEM_ADAPTER_HXX_ */
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
// Mouse event
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef CANVAS_MOUSE_EVENT_HXX_
|
||||||
|
#define CANVAS_MOUSE_EVENT_HXX_
|
||||||
|
|
||||||
|
#include "CanvasEvent.hxx"
|
||||||
|
#include <osgGA/GUIEventAdapter>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
class MouseEvent:
|
||||||
|
public Event
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MouseEvent():
|
||||||
|
button(-1),
|
||||||
|
state(-1),
|
||||||
|
mod(-1),
|
||||||
|
click_count(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
osg::Vec2f getScreenPos() const { return screen_pos; }
|
||||||
|
osg::Vec2f getClientPos() const { return client_pos; }
|
||||||
|
osg::Vec2f getDelta() const { return delta; }
|
||||||
|
|
||||||
|
float getScreenX() const { return screen_pos.x(); }
|
||||||
|
float getScreenY() const { return screen_pos.y(); }
|
||||||
|
|
||||||
|
float getClientX() const { return client_pos.x(); }
|
||||||
|
float getClientY() const { return client_pos.y(); }
|
||||||
|
|
||||||
|
float getDeltaX() const { return delta.x(); }
|
||||||
|
float getDeltaY() const { return delta.y(); }
|
||||||
|
|
||||||
|
int getCurrentClickCount() const { return click_count; }
|
||||||
|
|
||||||
|
osg::Vec2f screen_pos, //<! Position in screen coordinates
|
||||||
|
client_pos, //<! Position in window/canvas coordinates
|
||||||
|
delta;
|
||||||
|
int button, //<! Button for this event
|
||||||
|
state, //<! Current button state
|
||||||
|
mod, //<! Keyboard modifier state
|
||||||
|
click_count; //<! Current click count
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif /* CANVAS_MOUSE_EVENT_HXX_ */
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
// Owner Drawn Gauge helper class
|
||||||
|
//
|
||||||
|
// Written by Harald JOHNSEN, started May 2005.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2005 Harald JOHNSEN
|
||||||
|
//
|
||||||
|
// Ported to OSG by Tim Moore - Jun 2007
|
||||||
|
//
|
||||||
|
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012
|
||||||
|
// Supports now multisampling/mipmapping, usage of the stencil buffer and placing
|
||||||
|
// the texture in the scene by certain filter criteria
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ODGauge.hxx"
|
||||||
|
#include "CanvasSystemAdapter.hxx"
|
||||||
|
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
|
|
||||||
|
#include <osg/Texture2D>
|
||||||
|
#include <osg/AlphaFunc>
|
||||||
|
#include <osg/BlendFunc>
|
||||||
|
#include <osg/Camera>
|
||||||
|
#include <osg/Matrix>
|
||||||
|
#include <osg/PolygonMode>
|
||||||
|
#include <osg/ShadeModel>
|
||||||
|
#include <osg/StateSet>
|
||||||
|
#include <osg/FrameBufferObject> // for GL_DEPTH_STENCIL_EXT on Windows
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
ODGauge::ODGauge():
|
||||||
|
_size_x( -1 ),
|
||||||
|
_size_y( -1 ),
|
||||||
|
_view_width( -1 ),
|
||||||
|
_view_height( -1 ),
|
||||||
|
_use_image_coords( false ),
|
||||||
|
_use_stencil( false ),
|
||||||
|
_use_mipmapping( false ),
|
||||||
|
_coverage_samples( 0 ),
|
||||||
|
_color_samples( 0 ),
|
||||||
|
rtAvailable( false )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
ODGauge::~ODGauge()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::setSystemAdapter(const SystemAdapterPtr& system_adapter)
|
||||||
|
{
|
||||||
|
_system_adapter = system_adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::setSize(int size_x, int size_y)
|
||||||
|
{
|
||||||
|
_size_x = size_x;
|
||||||
|
_size_y = size_y < 0 ? size_x : size_y;
|
||||||
|
|
||||||
|
if( serviceable() )
|
||||||
|
reinit();
|
||||||
|
else if( texture )
|
||||||
|
texture->setTextureSize(_size_x, _size_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::setViewSize(int width, int height)
|
||||||
|
{
|
||||||
|
_view_width = width;
|
||||||
|
_view_height = height < 0 ? width : height;
|
||||||
|
|
||||||
|
if( camera )
|
||||||
|
updateCoordinateFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::useImageCoords(bool use)
|
||||||
|
{
|
||||||
|
if( use == _use_image_coords )
|
||||||
|
return;
|
||||||
|
|
||||||
|
_use_image_coords = use;
|
||||||
|
|
||||||
|
if( texture )
|
||||||
|
updateCoordinateFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::useStencil(bool use)
|
||||||
|
{
|
||||||
|
if( use == _use_stencil )
|
||||||
|
return;
|
||||||
|
|
||||||
|
_use_stencil = use;
|
||||||
|
|
||||||
|
if( texture )
|
||||||
|
updateStencil();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::setSampling( bool mipmapping,
|
||||||
|
int coverage_samples,
|
||||||
|
int color_samples )
|
||||||
|
{
|
||||||
|
if( _use_mipmapping == mipmapping
|
||||||
|
&& _coverage_samples == coverage_samples
|
||||||
|
&& _color_samples == color_samples )
|
||||||
|
return;
|
||||||
|
|
||||||
|
_use_mipmapping = mipmapping;
|
||||||
|
|
||||||
|
if( color_samples > coverage_samples )
|
||||||
|
{
|
||||||
|
SG_LOG
|
||||||
|
(
|
||||||
|
SG_GL,
|
||||||
|
SG_WARN,
|
||||||
|
"ODGauge::setSampling: color_samples > coverage_samples not allowed!"
|
||||||
|
);
|
||||||
|
color_samples = coverage_samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
_coverage_samples = coverage_samples;
|
||||||
|
_color_samples = color_samples;
|
||||||
|
|
||||||
|
updateSampling();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::setRender(bool render)
|
||||||
|
{
|
||||||
|
// Only the far camera should trigger this texture to be rendered.
|
||||||
|
camera->setNodeMask(render ? simgear::BACKGROUND_BIT : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool ODGauge::serviceable(void)
|
||||||
|
{
|
||||||
|
return rtAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::allocRT(osg::NodeCallback* camera_cull_callback)
|
||||||
|
{
|
||||||
|
camera = new osg::Camera;
|
||||||
|
camera->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
|
camera->setRenderOrder(osg::Camera::PRE_RENDER);
|
||||||
|
camera->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f , 0.0f));
|
||||||
|
camera->setClearStencil(0);
|
||||||
|
camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT,
|
||||||
|
osg::Camera::FRAME_BUFFER );
|
||||||
|
|
||||||
|
if( camera_cull_callback )
|
||||||
|
camera->setCullCallback(camera_cull_callback);
|
||||||
|
|
||||||
|
setRender(true);
|
||||||
|
updateCoordinateFrame();
|
||||||
|
updateStencil();
|
||||||
|
|
||||||
|
osg::StateSet* stateSet = camera->getOrCreateStateSet();
|
||||||
|
stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
stateSet->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
|
||||||
|
stateSet->setMode(GL_FOG, osg::StateAttribute::OFF);
|
||||||
|
stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
||||||
|
stateSet->setAttributeAndModes(
|
||||||
|
new osg::PolygonMode( osg::PolygonMode::FRONT_AND_BACK,
|
||||||
|
osg::PolygonMode::FILL ),
|
||||||
|
osg::StateAttribute::ON );
|
||||||
|
stateSet->setAttributeAndModes(
|
||||||
|
new osg::AlphaFunc(osg::AlphaFunc::GREATER, 0.0f),
|
||||||
|
osg::StateAttribute::ON );
|
||||||
|
stateSet->setAttribute(new osg::ShadeModel(osg::ShadeModel::FLAT));
|
||||||
|
stateSet->setAttributeAndModes(
|
||||||
|
new osg::BlendFunc( osg::BlendFunc::SRC_ALPHA,
|
||||||
|
osg::BlendFunc::ONE_MINUS_SRC_ALPHA),
|
||||||
|
osg::StateAttribute::ON );
|
||||||
|
if( !texture )
|
||||||
|
{
|
||||||
|
texture = new osg::Texture2D;
|
||||||
|
texture->setTextureSize(_size_x, _size_y);
|
||||||
|
texture->setInternalFormat(GL_RGBA);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSampling();
|
||||||
|
|
||||||
|
if( _system_adapter )
|
||||||
|
_system_adapter->addCamera(camera.get());
|
||||||
|
|
||||||
|
rtAvailable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::reinit()
|
||||||
|
{
|
||||||
|
osg::NodeCallback* cull_callback = camera ? camera->getCullCallback() : 0;
|
||||||
|
clear();
|
||||||
|
allocRT(cull_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::clear()
|
||||||
|
{
|
||||||
|
if( camera.valid() && _system_adapter )
|
||||||
|
_system_adapter->removeCamera(camera.get());
|
||||||
|
camera.release();
|
||||||
|
texture.release();
|
||||||
|
|
||||||
|
rtAvailable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::updateCoordinateFrame()
|
||||||
|
{
|
||||||
|
assert( camera );
|
||||||
|
|
||||||
|
if( _view_width < 0 )
|
||||||
|
_view_width = _size_x;
|
||||||
|
if( _view_height < 0 )
|
||||||
|
_view_height = _size_y;
|
||||||
|
|
||||||
|
camera->setViewport(0, 0, _size_x, _size_y);
|
||||||
|
|
||||||
|
if( _use_image_coords )
|
||||||
|
camera->setProjectionMatrix(
|
||||||
|
osg::Matrix::ortho2D(0, _view_width, _view_height, 0)
|
||||||
|
);
|
||||||
|
else
|
||||||
|
camera->setProjectionMatrix(
|
||||||
|
osg::Matrix::ortho2D( -_view_width/2., _view_width/2.,
|
||||||
|
-_view_height/2., _view_height/2. )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::updateStencil()
|
||||||
|
{
|
||||||
|
assert( camera );
|
||||||
|
|
||||||
|
GLbitfield mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
|
||||||
|
|
||||||
|
if( _use_stencil)
|
||||||
|
{
|
||||||
|
camera->attach( osg::Camera::PACKED_DEPTH_STENCIL_BUFFER,
|
||||||
|
GL_DEPTH_STENCIL_EXT );
|
||||||
|
mask |= GL_STENCIL_BUFFER_BIT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
camera->detach(osg::Camera::PACKED_DEPTH_STENCIL_BUFFER);
|
||||||
|
}
|
||||||
|
|
||||||
|
camera->setClearMask(mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::updateSampling()
|
||||||
|
{
|
||||||
|
assert( camera );
|
||||||
|
assert( texture );
|
||||||
|
|
||||||
|
texture->setFilter(
|
||||||
|
osg::Texture2D::MIN_FILTER,
|
||||||
|
_use_mipmapping ? osg::Texture2D::LINEAR_MIPMAP_LINEAR
|
||||||
|
: osg::Texture2D::LINEAR
|
||||||
|
);
|
||||||
|
camera->attach(
|
||||||
|
osg::Camera::COLOR_BUFFER,
|
||||||
|
texture.get(),
|
||||||
|
0, 0,
|
||||||
|
_use_mipmapping,
|
||||||
|
_coverage_samples,
|
||||||
|
_color_samples
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
// Owner Drawn Gauge helper class
|
||||||
|
//
|
||||||
|
// Written by Harald JOHNSEN, started May 2005.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||||
|
//
|
||||||
|
// Ported to OSG by Tim Moore - Jun 2007
|
||||||
|
//
|
||||||
|
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012
|
||||||
|
// Supports now multisampling/mipmapping, usage of the stencil buffer and placing
|
||||||
|
// the texture in the scene by certain filter criteria
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#ifndef _SG_OD_GAUGE_HXX
|
||||||
|
#define _SG_OD_GAUGE_HXX
|
||||||
|
|
||||||
|
#include "canvas_fwd.hxx"
|
||||||
|
|
||||||
|
#include <osg/NodeCallback>
|
||||||
|
#include <osg/Group>
|
||||||
|
|
||||||
|
namespace osg
|
||||||
|
{
|
||||||
|
class Camera;
|
||||||
|
class Texture2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
namespace canvas
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Owner Drawn Gauge (aka render-to-texture) helper class
|
||||||
|
*/
|
||||||
|
class ODGauge
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
ODGauge();
|
||||||
|
virtual ~ODGauge();
|
||||||
|
|
||||||
|
void setSystemAdapter(const SystemAdapterPtr& system_adapter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the size of the render target.
|
||||||
|
*
|
||||||
|
* @param size_x X size
|
||||||
|
* @param size_y Y size. Defaults to size_x if not specified
|
||||||
|
*/
|
||||||
|
void setSize(int size_x, int size_y = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the size of the viewport
|
||||||
|
*
|
||||||
|
* @param width
|
||||||
|
* @param height Defaults to width if not specified
|
||||||
|
*/
|
||||||
|
void setViewSize(int width, int height = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DEPRECATED
|
||||||
|
*
|
||||||
|
* Get size of squared texture
|
||||||
|
*/
|
||||||
|
int size() const { return _size_x; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether to use image coordinates or not.
|
||||||
|
*
|
||||||
|
* Default: origin == center of texture
|
||||||
|
* Image Coords: origin == top left corner
|
||||||
|
*/
|
||||||
|
void useImageCoords(bool use = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable using a stencil buffer
|
||||||
|
*/
|
||||||
|
void useStencil(bool use = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sampling parameters for mipmapping and coverage sampling
|
||||||
|
* antialiasing.
|
||||||
|
*
|
||||||
|
* @note color_samples is not allowed to be higher than coverage_samples
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setSampling( bool mipmapping,
|
||||||
|
int coverage_samples = 0,
|
||||||
|
int color_samples = 0 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable updating the texture (If disabled the contents of the
|
||||||
|
* texture remains with the outcome of the last rendering pass)
|
||||||
|
*/
|
||||||
|
void setRender(bool render);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Say if we can render to a texture.
|
||||||
|
* @return true if rtt is available
|
||||||
|
*/
|
||||||
|
bool serviceable(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the OSG camera for drawing this gauge.
|
||||||
|
*/
|
||||||
|
osg::Camera* getCamera() const { return camera.get(); }
|
||||||
|
|
||||||
|
osg::Texture2D* getTexture() const { return texture.get(); }
|
||||||
|
|
||||||
|
// Real initialization function. Bad name.
|
||||||
|
void allocRT(osg::NodeCallback* camera_cull_callback = 0);
|
||||||
|
void reinit();
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
SystemAdapterPtr _system_adapter;
|
||||||
|
|
||||||
|
int _size_x,
|
||||||
|
_size_y,
|
||||||
|
_view_width,
|
||||||
|
_view_height;
|
||||||
|
bool _use_image_coords,
|
||||||
|
_use_stencil,
|
||||||
|
_use_mipmapping;
|
||||||
|
|
||||||
|
// Multisampling parameters
|
||||||
|
int _coverage_samples,
|
||||||
|
_color_samples;
|
||||||
|
|
||||||
|
bool rtAvailable;
|
||||||
|
osg::ref_ptr<osg::Camera> camera;
|
||||||
|
osg::ref_ptr<osg::Texture2D> texture;
|
||||||
|
|
||||||
|
void updateCoordinateFrame();
|
||||||
|
void updateStencil();
|
||||||
|
void updateSampling();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace canvas
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif // _SG_OD_GAUGE_HXX
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
===============================================================================
|
||||||
|
ShivaVG - an open-source LGPL ANSI C implementation of the OpenVG specification
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
Lead developer:
|
||||||
|
|
||||||
|
Ivan Leben <ivan.leben@gmail.com>
|
||||||
|
|
||||||
|
Occasional patches:
|
||||||
|
|
||||||
|
Daniel Turing
|
||||||
|
Vincenzo Pupillo
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user