Compare commits
630 Commits
RELEASE_0_
...
RELEASE_0_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c44ef2126c | ||
|
|
e2bfb5633b | ||
|
|
064ee8ba8f | ||
|
|
a5c130446e | ||
|
|
4162817c0b | ||
|
|
81cab6e089 | ||
|
|
d78204d147 | ||
|
|
d8b523d067 | ||
|
|
c4cfad6069 | ||
|
|
5bddb88ce2 | ||
|
|
8c4ee69aeb | ||
|
|
b3a533f8ce | ||
|
|
a885314a39 | ||
|
|
0567a76445 | ||
|
|
d6dc2d6eab | ||
|
|
b75a694682 | ||
|
|
2e7e9b73a0 | ||
|
|
7a11523692 | ||
|
|
f85a9866fe | ||
|
|
9b05c27938 | ||
|
|
fd96729362 | ||
|
|
c57cc096f8 | ||
|
|
c8efd0a465 | ||
|
|
db60139845 | ||
|
|
cadefd323a | ||
|
|
baab88f42a | ||
|
|
767b74dd35 | ||
|
|
90e8287f43 | ||
|
|
d8b7e5b8fd | ||
|
|
7769447283 | ||
|
|
d6a790cf13 | ||
|
|
033c66363d | ||
|
|
3ff1789963 | ||
|
|
9737c0c4dd | ||
|
|
b201383a80 | ||
|
|
2253b82304 | ||
|
|
2581446d85 | ||
|
|
a6291b286c | ||
|
|
96a396bfcb | ||
|
|
0833a11686 | ||
|
|
9c7f7f3d32 | ||
|
|
7847fe8074 | ||
|
|
c57d25ac51 | ||
|
|
1341b5b9f8 | ||
|
|
fb54e9e103 | ||
|
|
3a835dde7d | ||
|
|
128a4a36ca | ||
|
|
255bb6dd07 | ||
|
|
786b1e3a30 | ||
|
|
d5f38a558e | ||
|
|
ce5d4b7db8 | ||
|
|
8c0b36fe9e | ||
|
|
c7e6459c64 | ||
|
|
86e31e696d | ||
|
|
be0b1bb994 | ||
|
|
03e74bfeb4 | ||
|
|
972223cd50 | ||
|
|
761b7b9354 | ||
|
|
6a3d1895d9 | ||
|
|
d1178a26ce | ||
|
|
8ffdfa3cb1 | ||
|
|
384e56b9b4 | ||
|
|
d198e962b0 | ||
|
|
0136fdadbb | ||
|
|
c616568830 | ||
|
|
995d2c1ede | ||
|
|
051a5e9a38 | ||
|
|
60d89097de | ||
|
|
6c35255549 | ||
|
|
c985d8846d | ||
|
|
9a8ab26381 | ||
|
|
711622fd5b | ||
|
|
96474823b5 | ||
|
|
bbf4b54613 | ||
|
|
9795c5dd6b | ||
|
|
addcace80d | ||
|
|
77e43a5fa8 | ||
|
|
b751188e56 | ||
|
|
1ad9a15864 | ||
|
|
d0d7878e0a | ||
|
|
be5d365348 | ||
|
|
a8e0002a64 | ||
|
|
bf75cf7225 | ||
|
|
c024b680bc | ||
|
|
c896475765 | ||
|
|
101fdb3598 | ||
|
|
b13505afdf | ||
|
|
9d96b171a0 | ||
|
|
8b5a0cde69 | ||
|
|
bed7593cdd | ||
|
|
9fed946567 | ||
|
|
4d0bc0ae39 | ||
|
|
f9824aa7de | ||
|
|
4d2522964a | ||
|
|
dbe4a59b8e | ||
|
|
918f8a3ed4 | ||
|
|
f645596606 | ||
|
|
d778dd081d | ||
|
|
f6ed02c3fb | ||
|
|
7fa5dd7a35 | ||
|
|
a3186af099 | ||
|
|
a2d95ac742 | ||
|
|
10715bbea7 | ||
|
|
89fcb12556 | ||
|
|
cc3d7ddee5 | ||
|
|
cc01f99acb | ||
|
|
62b75190bb | ||
|
|
520124c1be | ||
|
|
e251bfcbaf | ||
|
|
aef809348f | ||
|
|
2d4a8774b8 | ||
|
|
b55c8fd828 | ||
|
|
dfff091b5f | ||
|
|
47eb7efafa | ||
|
|
b2a7fff26e | ||
|
|
5f70123723 | ||
|
|
dd629da8d3 | ||
|
|
74f7d52d95 | ||
|
|
7a65a990ba | ||
|
|
fe0076e291 | ||
|
|
1a8bc06cc6 | ||
|
|
8c41081a5c | ||
|
|
5b40eed554 | ||
|
|
b1c4d34eef | ||
|
|
0152b607f8 | ||
|
|
ab6e72047b | ||
|
|
15399bfe95 | ||
|
|
0ff748987b | ||
|
|
58e0e7736b | ||
|
|
2d1b2ca938 | ||
|
|
9a4152eb2d | ||
|
|
6ab443545f | ||
|
|
98a9b4a10c | ||
|
|
a6251606dd | ||
|
|
c3b21e143c | ||
|
|
b496593883 | ||
|
|
4ef4b019ca | ||
|
|
a8021531ab | ||
|
|
93fd948978 | ||
|
|
a1b3740dc6 | ||
|
|
40920457cb | ||
|
|
5039c84fd0 | ||
|
|
220a43bf46 | ||
|
|
45d3e19c38 | ||
|
|
5bab565cfe | ||
|
|
319a4282c8 | ||
|
|
c6aa8bc8e9 | ||
|
|
6f1bfa202e | ||
|
|
6fa9f86d1c | ||
|
|
019a9527d2 | ||
|
|
d100ca485f | ||
|
|
35ab6900ee | ||
|
|
c8570302f5 | ||
|
|
74f10486bc | ||
|
|
2b12425a62 | ||
|
|
c600aad7a7 | ||
|
|
67b2f0a977 | ||
|
|
70c6b48a07 | ||
|
|
76084f8538 | ||
|
|
64c408d2b7 | ||
|
|
73b050ae34 | ||
|
|
59991393ca | ||
|
|
69b2717b62 | ||
|
|
f2a323e048 | ||
|
|
7d07e6ea51 | ||
|
|
7c846972bf | ||
|
|
4f76c258af | ||
|
|
eca2afb982 | ||
|
|
9ff6934c83 | ||
|
|
e04839765d | ||
|
|
d0c655109f | ||
|
|
b28b55abb1 | ||
|
|
c3a0db1aba | ||
|
|
5e929d7d01 | ||
|
|
17f113f8cd | ||
|
|
445cd4ccda | ||
|
|
55845bbbb9 | ||
|
|
1976481ba2 | ||
|
|
5f17edbc72 | ||
|
|
6f7fe4b481 | ||
|
|
66ebe6e690 | ||
|
|
a9cd67e0ce | ||
|
|
994a470fbf | ||
|
|
0ce0684dae | ||
|
|
377eb4782a | ||
|
|
f1a79e6b9f | ||
|
|
007a1e4659 | ||
|
|
fcb873b6dd | ||
|
|
a66d1ad855 | ||
|
|
76a5950f19 | ||
|
|
b7a91bdb03 | ||
|
|
e4bbc5c50b | ||
|
|
b481ccd749 | ||
|
|
e7b9e55599 | ||
|
|
05eaa7135f | ||
|
|
d063b319e8 | ||
|
|
be4fd56660 | ||
|
|
a406a3c00b | ||
|
|
c7295da5eb | ||
|
|
505f561e1c | ||
|
|
7bd8477fa1 | ||
|
|
36ef15940e | ||
|
|
f2ba7aefa6 | ||
|
|
73b58b0e87 | ||
|
|
6ce4f096b2 | ||
|
|
3e7ece7f5f | ||
|
|
48a219473e | ||
|
|
887ffd102f | ||
|
|
b1a719dd4c | ||
|
|
b4efe8f374 | ||
|
|
03f844d4be | ||
|
|
a212589865 | ||
|
|
29dfc5bd3c | ||
|
|
a6ac06c47a | ||
|
|
4d914db1db | ||
|
|
68572f106d | ||
|
|
c5ca4db94e | ||
|
|
3980f08cc5 | ||
|
|
f93fa4b613 | ||
|
|
06f2dba92c | ||
|
|
30a14741c9 | ||
|
|
2f39b688f4 | ||
|
|
724a2ef83b | ||
|
|
f7e0e46143 | ||
|
|
83acb47295 | ||
|
|
e5282caea5 | ||
|
|
6a481eed36 | ||
|
|
e145f903de | ||
|
|
2afd1c8663 | ||
|
|
948d02055d | ||
|
|
e2b4c0787a | ||
|
|
2d21e59b54 | ||
|
|
00ccafb90d | ||
|
|
b82e02b5ed | ||
|
|
096550f163 | ||
|
|
81e5963a5d | ||
|
|
14569e4fae | ||
|
|
6cc32a56b9 | ||
|
|
ebdb86c460 | ||
|
|
400c9d6a2d | ||
|
|
e9a1b06746 | ||
|
|
4f3aaa1ede | ||
|
|
187258cc3a | ||
|
|
dfbcb1566b | ||
|
|
e3b0a70eb9 | ||
|
|
790a40ec99 | ||
|
|
a824bec9e1 | ||
|
|
10db0c3c66 | ||
|
|
12620b6152 | ||
|
|
2294283506 | ||
|
|
cebcf6a4fc | ||
|
|
a79a78b6e6 | ||
|
|
c6ad744ce2 | ||
|
|
b430b3c8df | ||
|
|
0b316a8c5e | ||
|
|
b8e93e6099 | ||
|
|
a84a88bf09 | ||
|
|
02d54dd187 | ||
|
|
fb054c7f8d | ||
|
|
77da29b4f7 | ||
|
|
828a9a8c51 | ||
|
|
c680947db5 | ||
|
|
5348f4eafe | ||
|
|
7781498181 | ||
|
|
b8ce139b8a | ||
|
|
75911b6c64 | ||
|
|
bf0d95145d | ||
|
|
4326d560e9 | ||
|
|
65fa6f2f00 | ||
|
|
124629e1d9 | ||
|
|
557fade4a7 | ||
|
|
98a65b5d1d | ||
|
|
caaa35e5a7 | ||
|
|
a7459489ff | ||
|
|
87e59ff876 | ||
|
|
9d87c913e7 | ||
|
|
0e8c010645 | ||
|
|
470d01a508 | ||
|
|
c16b9ed25b | ||
|
|
d498199e8a | ||
|
|
013687dccd | ||
|
|
baf25ca7a7 | ||
|
|
6c28bd884b | ||
|
|
510091f082 | ||
|
|
7db44c113c | ||
|
|
6cbf4306e7 | ||
|
|
777386ea67 | ||
|
|
95e5e90791 | ||
|
|
a86868526e | ||
|
|
f1ab6e2533 | ||
|
|
9f516a8ccc | ||
|
|
e07af68018 | ||
|
|
a37d9a2d8e | ||
|
|
57811b5371 | ||
|
|
7ff9ba4fe6 | ||
|
|
fad34bdbc3 | ||
|
|
22b41d892a | ||
|
|
7a97c7575d | ||
|
|
b0e175ad3d | ||
|
|
0de60aa6aa | ||
|
|
933e10d8a0 | ||
|
|
2efac3d949 | ||
|
|
c33841329d | ||
|
|
f37800560f | ||
|
|
60e61a0627 | ||
|
|
260dbeb3d2 | ||
|
|
70f495b4e1 | ||
|
|
663db8f978 | ||
|
|
c412739040 | ||
|
|
8b13d71fcf | ||
|
|
1b129b289c | ||
|
|
a89ceb96b9 | ||
|
|
9af5f9f094 | ||
|
|
6776c2e536 | ||
|
|
4c3b4219fe | ||
|
|
a09806bb98 | ||
|
|
e175c8cc4d | ||
|
|
a53faf4565 | ||
|
|
dc653ac46c | ||
|
|
c544777d37 | ||
|
|
93a37df90a | ||
|
|
1da02cca4c | ||
|
|
4b1d777ad4 | ||
|
|
fb0916be0f | ||
|
|
806083cb25 | ||
|
|
5ba74e30b8 | ||
|
|
c39e08cb2a | ||
|
|
e4653be9a1 | ||
|
|
cd5765be1e | ||
|
|
c481b06451 | ||
|
|
91ba4618e7 | ||
|
|
fdc5521389 | ||
|
|
e88c915206 | ||
|
|
1e60698053 | ||
|
|
5702bd7ee8 | ||
|
|
8eef3eb582 | ||
|
|
31db353173 | ||
|
|
2c4a0dd998 | ||
|
|
7d7e41dacc | ||
|
|
453a53b372 | ||
|
|
ef68d18f64 | ||
|
|
ded1d2343f | ||
|
|
e6241a2f73 | ||
|
|
467254ec66 | ||
|
|
135e137921 | ||
|
|
e13a5b57d4 | ||
|
|
f1c00cdd18 | ||
|
|
8c3de351b0 | ||
|
|
0bcdb7eb70 | ||
|
|
a92b71fffc | ||
|
|
89960ab715 | ||
|
|
2a369803ae | ||
|
|
b0134a377e | ||
|
|
502c650cd9 | ||
|
|
a1bf8d2229 | ||
|
|
25b743bdec | ||
|
|
dbf7db02a2 | ||
|
|
8c998659c6 | ||
|
|
4e23b3dff5 | ||
|
|
159d3c4c6c | ||
|
|
612b5ae0bc | ||
|
|
60cbe9c1d4 | ||
|
|
4dadd29727 | ||
|
|
e4610b9baa | ||
|
|
926a0f2437 | ||
|
|
9325ec681e | ||
|
|
af383e6c39 | ||
|
|
b000691ab9 | ||
|
|
22812a0aae | ||
|
|
dda7ebfe0d | ||
|
|
9a211af659 | ||
|
|
82459a2802 | ||
|
|
1774fb2d02 | ||
|
|
f0081c7697 | ||
|
|
1e53bedca5 | ||
|
|
cf1c7e7378 | ||
|
|
5c3b569e97 | ||
|
|
cb29dcc238 | ||
|
|
d48b3f1e9a | ||
|
|
a4d60e7bd6 | ||
|
|
1a6e2509c7 | ||
|
|
8159b749f4 | ||
|
|
bec11c2939 | ||
|
|
8a189b6778 | ||
|
|
93c6845a6d | ||
|
|
b659c805fc | ||
|
|
15eaf8dc84 | ||
|
|
cafe89047c | ||
|
|
b5705ff47a | ||
|
|
1b07b25ad2 | ||
|
|
a46163bcd7 | ||
|
|
6531b1ebbc | ||
|
|
dc7bbdce11 | ||
|
|
a29cbc1112 | ||
|
|
afc2099865 | ||
|
|
7d251444e6 | ||
|
|
1c2289dacd | ||
|
|
044ac5d5d3 | ||
|
|
38167ed273 | ||
|
|
e15ffbc856 | ||
|
|
6cf2716615 | ||
|
|
0468b315d4 | ||
|
|
de66c74a91 | ||
|
|
7db73cd215 | ||
|
|
242eceb1c6 | ||
|
|
c2b84db5a2 | ||
|
|
487bee35ab | ||
|
|
9fabeb77bc | ||
|
|
bfea2dec4d | ||
|
|
2ed07850c6 | ||
|
|
b72d36d96f | ||
|
|
e3ff048ff6 | ||
|
|
ceef43681d | ||
|
|
3ec00676e4 | ||
|
|
e6575fb1db | ||
|
|
fa98d733d6 | ||
|
|
2981a10e62 | ||
|
|
551c06f885 | ||
|
|
a1c59071a1 | ||
|
|
13af443057 | ||
|
|
b8e2b0d0f9 | ||
|
|
53cd776bf6 | ||
|
|
180bba8767 | ||
|
|
377cf1662e | ||
|
|
420c747551 | ||
|
|
7c5b4a87f2 | ||
|
|
7ea241b412 | ||
|
|
1547d4ee2f | ||
|
|
3dde4113e7 | ||
|
|
205e6ef18f | ||
|
|
d53830076b | ||
|
|
296a01b7bd | ||
|
|
f47fdd63f7 | ||
|
|
b0b5f5035a | ||
|
|
629ece6e41 | ||
|
|
4c79263dcf | ||
|
|
856b6201dc | ||
|
|
f2160b1479 | ||
|
|
535f6a13b3 | ||
|
|
2ab760e456 | ||
|
|
8b75fbc1e6 | ||
|
|
82f410e955 | ||
|
|
68a19bd39f | ||
|
|
48689622b4 | ||
|
|
acc2075986 | ||
|
|
1984ae1583 | ||
|
|
427f309aea | ||
|
|
84482ad30d | ||
|
|
09b67e9440 | ||
|
|
80cf74d85f | ||
|
|
17e055a00e | ||
|
|
a8d8c9d24e | ||
|
|
99a59763f1 | ||
|
|
0fa3a329e8 | ||
|
|
5fbe532ec5 | ||
|
|
5f3de889d7 | ||
|
|
a8db14196a | ||
|
|
03b10d64a8 | ||
|
|
86892d87e9 | ||
|
|
41218272c4 | ||
|
|
8b5514fa9f | ||
|
|
f14de56712 | ||
|
|
ecc5c9865b | ||
|
|
929a56a6e8 | ||
|
|
4416df8c39 | ||
|
|
fc80610663 | ||
|
|
cb03bfcb80 | ||
|
|
35ed10e252 | ||
|
|
41fc1621b1 | ||
|
|
9fefaef31e | ||
|
|
689a942f19 | ||
|
|
cb9654f1f4 | ||
|
|
a8f8cef484 | ||
|
|
6cf51c3222 | ||
|
|
0d8ae0cabe | ||
|
|
49d6f93d8b | ||
|
|
5173d709e0 | ||
|
|
778c3ab25c | ||
|
|
aa17d9ac9a | ||
|
|
ffe1d9485e | ||
|
|
71abebe837 | ||
|
|
ca07b64af0 | ||
|
|
2fde2ce581 | ||
|
|
cb0da2ca5e | ||
|
|
c0422839b9 | ||
|
|
862b884f02 | ||
|
|
708e745cfd | ||
|
|
63c9dcdd96 | ||
|
|
770ec00901 | ||
|
|
4c6fe0328a | ||
|
|
bb882a1239 | ||
|
|
29e3a4e231 | ||
|
|
ca444b07bd | ||
|
|
510b9ef07a | ||
|
|
d59a6218ab | ||
|
|
5f26ba99bc | ||
|
|
8fcfb73a57 | ||
|
|
c9fb802b9e | ||
|
|
cbb1a37f5a | ||
|
|
42f9964e76 | ||
|
|
81c8f4c065 | ||
|
|
0703cb0027 | ||
|
|
2487e696b8 | ||
|
|
50227c435c | ||
|
|
256aaa362f | ||
|
|
2198498e29 | ||
|
|
46f79f17c8 | ||
|
|
ed870aac76 | ||
|
|
663964d94c | ||
|
|
8b1784e0d9 | ||
|
|
e6c07f088d | ||
|
|
6ef9ecdda0 | ||
|
|
aecea627e1 | ||
|
|
e2d428d8ba | ||
|
|
c0e1031a4a | ||
|
|
dea5eec440 | ||
|
|
23a8ff8a04 | ||
|
|
a3c95154f5 | ||
|
|
f9e52ea53d | ||
|
|
001a2c89e7 | ||
|
|
38631c9eb3 | ||
|
|
07e9467507 | ||
|
|
a9d109b3ce | ||
|
|
5cbbd7a14e | ||
|
|
424ef2f6e9 | ||
|
|
26a6fa864d | ||
|
|
01327ebd4c | ||
|
|
23be422477 | ||
|
|
1f47fbafff | ||
|
|
19f58936a8 | ||
|
|
0e7c76a38f | ||
|
|
193092ed67 | ||
|
|
ec8667a63c | ||
|
|
554581b099 | ||
|
|
31b3f10cc8 | ||
|
|
bbfd2f802b | ||
|
|
b7c12ea879 | ||
|
|
453b041f0d | ||
|
|
e45190bee4 | ||
|
|
e9ee8471a9 | ||
|
|
854bc45e59 | ||
|
|
4066df3229 | ||
|
|
7710f8f076 | ||
|
|
2dd9bcbd50 | ||
|
|
b6b93c74ea | ||
|
|
c68a524d35 | ||
|
|
3af8529843 | ||
|
|
798ae43c84 | ||
|
|
8a8bb3cf7e | ||
|
|
df79de455f | ||
|
|
978226a275 | ||
|
|
0c5a60713d | ||
|
|
20cf326fec | ||
|
|
3e386f51a1 | ||
|
|
28e2a0560c | ||
|
|
9797633e5c | ||
|
|
b6184dcf29 | ||
|
|
f28bfa6d62 | ||
|
|
f1f01451cc | ||
|
|
cb1bcb398a | ||
|
|
0e53f221cf | ||
|
|
1413fae16c | ||
|
|
fa9d78ffb6 | ||
|
|
327ccd93a4 | ||
|
|
24b5f05d5e | ||
|
|
ccc3af8937 | ||
|
|
b6b503a190 | ||
|
|
fdda5da598 | ||
|
|
86e571f18b | ||
|
|
7b3b55f6ef | ||
|
|
6b2bf2fa8e | ||
|
|
2640b43355 | ||
|
|
d201e9b5c5 | ||
|
|
8f0f79506c | ||
|
|
121d2f92cb | ||
|
|
87e641aeda | ||
|
|
27403e2fef | ||
|
|
b5ceef5e68 | ||
|
|
5d68470c95 | ||
|
|
e176b4d8b6 | ||
|
|
218821f694 | ||
|
|
a8f4a61dc2 | ||
|
|
9221604424 | ||
|
|
5bddbd0ca9 | ||
|
|
f8dde93e05 | ||
|
|
489b562232 | ||
|
|
294a0dde63 | ||
|
|
53fbb98d4f | ||
|
|
8a2c08a0c1 | ||
|
|
b15b40ea10 | ||
|
|
0c865f540f | ||
|
|
ef4a92859c | ||
|
|
2a7b06f648 | ||
|
|
6c2ca22b3f | ||
|
|
592690f8f2 | ||
|
|
1eb87e7c73 | ||
|
|
a0e40c1fc1 | ||
|
|
0363628a55 | ||
|
|
f2e7704853 | ||
|
|
66651d0648 | ||
|
|
5909595442 | ||
|
|
bf92d30877 | ||
|
|
9bd9645b3e | ||
|
|
5c5e4fff7b | ||
|
|
de235cc8be | ||
|
|
e4890297a6 | ||
|
|
13d4d0777f | ||
|
|
982d714749 | ||
|
|
4c18fbcafd | ||
|
|
37ec7421aa | ||
|
|
d289222b39 | ||
|
|
ad2947e407 | ||
|
|
41f441bdde | ||
|
|
e24203fb2f | ||
|
|
5997339730 | ||
|
|
b54a4d1f92 | ||
|
|
8f7a446ec8 | ||
|
|
3304526093 | ||
|
|
f711a02a62 | ||
|
|
5b779f5200 | ||
|
|
5bf6d83d2d | ||
|
|
7ea54d28cd | ||
|
|
268a59d0a9 | ||
|
|
9477aad950 | ||
|
|
8feb45fa72 | ||
|
|
b6f07f3058 | ||
|
|
5730a47b00 | ||
|
|
3c35a317d4 | ||
|
|
0c270d61d8 | ||
|
|
1b14d43341 |
8
.cvsignore
Normal file
8
.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
SimGear.spec
|
||||
aclocal.m4
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
139
Audio/CHANGES
139
Audio/CHANGES
@@ -1,139 +0,0 @@
|
||||
|
||||
/**********************************************\
|
||||
* *
|
||||
* W A R N I N G *
|
||||
* *
|
||||
* This file is now kept in reverse chronolog- *
|
||||
* ical order so recent changes are now at the *
|
||||
* top. *
|
||||
* *
|
||||
\**********************************************/
|
||||
|
||||
* 28th Sept 1889 -- Fixed a bug associated with exiting the
|
||||
program with sounds still playing.
|
||||
Fixed a bug associated with using the
|
||||
package in the absence of a sound card.
|
||||
Added a new member function "working"
|
||||
which is the opposite of "not_working",
|
||||
(as demanded by a bunch of rabid optimists)!
|
||||
Fixed a couple of typo's in the manual.
|
||||
|
||||
* 23rd Sept 1998 -- The Good News: Finally got around to
|
||||
getting the pitch envelope working. (Hooray)
|
||||
The Bad News: This costs quite a bit in
|
||||
performance - and it was a MAJOR rewrite
|
||||
of significant parts of the internals,
|
||||
so we may need some bug fixes.
|
||||
This version is 0.5
|
||||
|
||||
* 7th July 1998 -- Fixed some error checking in slSample.cxx and
|
||||
a missing declaration in sl.h
|
||||
|
||||
* 6th July 1998 -- Fixed an initialisation problem when
|
||||
slScheduler was not a static/global.
|
||||
|
||||
Tom Knienieder's port to SGI/IRIX is now
|
||||
working, documentation updated to reflect that.
|
||||
|
||||
* 16th June 1998 -- Added some slPortability.h fixes for
|
||||
FreeBSD and the Cygnus WIN32 compiler.
|
||||
Many thanks to Curt.
|
||||
|
||||
* 14th June 1998 -- Tom Knienieder's port to OpenBSD is now
|
||||
working, documentation updated to reflect that.
|
||||
Tom's improved Makefiles included, also some
|
||||
example sound samples that were accidentally
|
||||
left out of the release are now present.
|
||||
A couple of typo's in the WIN32 section
|
||||
have been fixed. The top level Makefile
|
||||
now requires you to type 'make linux',
|
||||
'make win' or 'make openbsd'.
|
||||
|
||||
* 13th June 1998 -- Tom Knienieder's port to WIN32 engine is now
|
||||
working, documentation updated to reflect that
|
||||
revised status. Some default constructor parameters
|
||||
have changed, slDSP no longer supports setRate/setBps/setStereo.
|
||||
You now have to delete the slDSP and recreate it with
|
||||
new parameters. This makes porting a little easier.
|
||||
'sound_test' renamed 'example'.
|
||||
|
||||
* 7th June 1998 -- Volume envelopes (and inverse volume envelopes)
|
||||
now work correctly. Pan envelopes won't work
|
||||
until stereo is implemented. Pitch and filter
|
||||
envelopes turn out to be a major pain to implement
|
||||
with the present slSceduler/slSamplePlayer interface,
|
||||
so some significant internal changes are to be
|
||||
expected.
|
||||
|
||||
Changed the CHANGES file to be in reverse
|
||||
chronological order.
|
||||
|
||||
This version is officially SL v0.3 (beta)
|
||||
|
||||
* 3rd June 1998 -- Moved sample program and it's data files into
|
||||
'example', moved documents into 'doc' and sources
|
||||
into 'src'. Final library goes into 'lib'.
|
||||
|
||||
The entire preempting mechanism was broken -
|
||||
now it's fixed.
|
||||
|
||||
Added a callback mechanism that allows
|
||||
applications to know when a sound
|
||||
loops, finishes playing, is pre-empted, etc.
|
||||
|
||||
New mechanisms added to stop/pause/resume a
|
||||
playing sample.
|
||||
|
||||
All the documentation - and some of the code -
|
||||
for slEnvelopes has been added, they don't
|
||||
work yet - so don't bother with them for now.
|
||||
|
||||
Made some code a little more bullet-proof.
|
||||
slSample's are now reference-counted so you
|
||||
can't accidentally delete one while it's
|
||||
playing without getting a FATAL error.
|
||||
|
||||
* 2nd June 1998 -- Fixed bug in initialisation that prevented SL
|
||||
from functioning correctly in the case were there
|
||||
is no sound card present.
|
||||
|
||||
This version is officially SL v0.2 (beta)
|
||||
|
||||
* 1st June 1998 -- Split library into two parts - libsm and
|
||||
libsl. libsm contains only the Mixer class
|
||||
since it is likely to be hard to port to
|
||||
a lot of non-OSS systems - and most programs
|
||||
won't need it anyway. Hence the documentation
|
||||
has blossomed into three files and all the
|
||||
'slMixer' references have turned into 'smMixer'.
|
||||
Also, I finally got a hold of the OSS documentation,
|
||||
which is a lot more complete - and straightened
|
||||
me out on a few points. slDSP has changed
|
||||
(internally) somewhat as a result and in particular,
|
||||
you can no longer mess with the sampling rate,
|
||||
stereo and bps settings after the slDSP or
|
||||
slScheduler has been created. This also allows the
|
||||
scheduler to enforce it's rule about only mono/8bps
|
||||
operations.
|
||||
|
||||
I also added an 'autoMatch' function to the slSample
|
||||
class to automagically match incoming samples to the
|
||||
current slDSP/slScheduler. This makes using the library
|
||||
a lot less painful and error-prone.
|
||||
|
||||
This version is officially SL v0.1 (beta)
|
||||
|
||||
We need a better name!
|
||||
|
||||
* 30th May 1998 -- Almost total rewrite, library can now
|
||||
play multiple sounds without interruption,
|
||||
supports '.WAV' and '.AU' file formats as
|
||||
well as raw binary files. Able to copy with
|
||||
much shorter safetyMargin on sound buffers,
|
||||
and play without using the 'stop' call.
|
||||
All class and external symbols now begin
|
||||
with 'sl' or 'SL'. HTML documentation now
|
||||
available.
|
||||
|
||||
* 27th May 1998 -- First hack
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
SUBDIRS = src example
|
||||
@@ -1,9 +0,0 @@
|
||||
NOTICE: This Sound Library (SL) distribution contains source code that is
|
||||
placed into the public domain without copyright. These programs are freely
|
||||
distributable without licensing fees. These programs are provided without
|
||||
guarantee or warrantee expressed or implied.
|
||||
|
||||
If you use SL in a commercial or shareware product, it would be nice if you
|
||||
gave credit where it is due. If you make any modifications or improvements
|
||||
to SL, I would greatly appreciate a copy of the improved code.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
Hi!
|
||||
|
||||
This is the fifth prototype of Steve's 'SL' sound library.
|
||||
|
||||
Check out 'CHANGES' and the new HTML documentation.
|
||||
|
||||
Steve
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
Building SL for Linux.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
% make freebsd
|
||||
% su root
|
||||
% make install
|
||||
|
||||
...that's all folks.
|
||||
|
||||
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
|
||||
Library file(s) go into /usr/lib
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
Building SL for Linux.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
% make linux
|
||||
% su root
|
||||
% make install
|
||||
|
||||
...that's all folks.
|
||||
|
||||
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
|
||||
Library file(s) go into /usr/lib
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
Building SL for OpenBSD.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
% make openbsd
|
||||
% su root
|
||||
% make install
|
||||
|
||||
...that's all folks.
|
||||
|
||||
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
|
||||
Library file(s) go into /usr/lib
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
Building SL for SGI.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
There are two options, depending on whether you want to use GCC or
|
||||
the standard SGI C++ compiler.
|
||||
|
||||
GNU G++:
|
||||
|
||||
% make sgigcc
|
||||
% su root
|
||||
% make install
|
||||
|
||||
SGI C++:
|
||||
|
||||
% make sgi
|
||||
% su root
|
||||
% make install
|
||||
|
||||
...that's all folks.
|
||||
|
||||
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
|
||||
Library file(s) go into /usr/lib
|
||||
|
||||
When you link, be sure to include to -laudio
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Building SL for UNIX
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If your UNIX box is Linux or OpenBSD then
|
||||
check out README.linux or README.openbsd.
|
||||
|
||||
If your UNIX box supports OSS (the Open
|
||||
Sound System) then in principal, you should
|
||||
only need to type:
|
||||
|
||||
% make oss
|
||||
% su root
|
||||
% make install
|
||||
|
||||
...however, your milage may vary. If you succeed
|
||||
in getting a non-Linux, non-OpenBSD version to
|
||||
work, I'd like to hear about it.
|
||||
|
||||
Steve Baker <sjbaker1@airmail.net>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
Building SL for win32 (msvc)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
C:>nmake win32
|
||||
|
||||
|
||||
don't forget to set the environment !
|
||||
|
||||
example:
|
||||
|
||||
set include=c:\msdev\include;
|
||||
set lib=c:\msdev\lib
|
||||
|
||||
path c:\msdev\bin;c:\bin;c:\winnt;......
|
||||
@@ -1,11 +0,0 @@
|
||||
noinst_LIBRARIES = libBucket.a
|
||||
|
||||
libBucket_a_SOURCES = newbucket.cxx newbucket.hxx
|
||||
|
||||
bin_PROGRAMS = testbucket
|
||||
|
||||
testbucket_SOURCES = testbucket.cxx
|
||||
|
||||
testbucket_LDADD = $(top_builddir)/Lib/Bucket/libBucket.a
|
||||
|
||||
INCLUDES += -I$(top_builddir)
|
||||
@@ -1,163 +0,0 @@
|
||||
/**************************************************************************
|
||||
* newbucket.hxx -- new bucket routines for better world modeling
|
||||
*
|
||||
* Written by Curtis L. Olson, started February 1999.
|
||||
*
|
||||
* Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id$
|
||||
* (Log is kept at end of this file)
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "newbucket.hxx"
|
||||
|
||||
|
||||
// Build the path name for this bucket
|
||||
string FGBucket::gen_base_path() const {
|
||||
// long int index;
|
||||
int top_lon, top_lat, main_lon, main_lat;
|
||||
char hem, pole;
|
||||
char path[256];
|
||||
|
||||
// index = gen_index();
|
||||
|
||||
path[0] = '\0';
|
||||
|
||||
top_lon = lon / 10;
|
||||
main_lon = lon;
|
||||
if ( (lon < 0) && (top_lon * 10 != lon) ) {
|
||||
top_lon -= 1;
|
||||
}
|
||||
top_lon *= 10;
|
||||
if ( top_lon >= 0 ) {
|
||||
hem = 'e';
|
||||
} else {
|
||||
hem = 'w';
|
||||
top_lon *= -1;
|
||||
}
|
||||
if ( main_lon < 0 ) {
|
||||
main_lon *= -1;
|
||||
}
|
||||
|
||||
top_lat = lat / 10;
|
||||
main_lat = lat;
|
||||
if ( (lat < 0) && (top_lat * 10 != lat) ) {
|
||||
top_lat -= 1;
|
||||
}
|
||||
top_lat *= 10;
|
||||
if ( top_lat >= 0 ) {
|
||||
pole = 'n';
|
||||
} else {
|
||||
pole = 's';
|
||||
top_lat *= -1;
|
||||
}
|
||||
if ( main_lat < 0 ) {
|
||||
main_lat *= -1;
|
||||
}
|
||||
|
||||
sprintf(path, "%c%03d%c%02d/%c%03d%c%02d",
|
||||
hem, top_lon, pole, top_lat,
|
||||
hem, main_lon, pole, main_lat);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
// find the bucket which is offset by the specified tile units in the
|
||||
// X & Y direction. We need the current lon and lat to resolve
|
||||
// ambiguities when going from a wider tile to a narrower one above or
|
||||
// below. This assumes that we are feeding in
|
||||
FGBucket fgBucketOffset( double dlon, double dlat, int dx, int dy ) {
|
||||
FGBucket result( dlon, dlat );
|
||||
double clat = result.get_center_lat() + dy * FG_BUCKET_SPAN;
|
||||
|
||||
// walk dy units in the lat direction
|
||||
result.set_bucket( dlon, clat );
|
||||
|
||||
// find the lon span for the new latitude
|
||||
double span = bucket_span( clat );
|
||||
|
||||
// walk dx units in the lon direction
|
||||
result.set_bucket( dlon + dx * span, clat );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// calculate the offset between two buckets
|
||||
void fgBucketDiff( const FGBucket& b1, const FGBucket& b2, int *dx, int *dy ) {
|
||||
|
||||
// Latitude difference
|
||||
double c1_lat = b1.get_center_lat();
|
||||
double c2_lat = b2.get_center_lat();
|
||||
double diff_lat = c2_lat - c1_lat;
|
||||
|
||||
#ifdef HAVE_RINT
|
||||
*dy = (int)rint( diff_lat / FG_BUCKET_SPAN );
|
||||
#else
|
||||
if ( diff_lat > 0 ) {
|
||||
*dy = (int)( diff_lat / FG_BUCKET_SPAN + 0.5 );
|
||||
} else {
|
||||
*dy = (int)( diff_lat / FG_BUCKET_SPAN - 0.5 );
|
||||
}
|
||||
#endif
|
||||
|
||||
// longitude difference
|
||||
double c1_lon = b1.get_center_lon();
|
||||
double c2_lon = b2.get_center_lon();
|
||||
double diff_lon = c2_lon - c1_lon;
|
||||
double span;
|
||||
if ( bucket_span(c1_lat) <= bucket_span(c2_lat) ) {
|
||||
span = bucket_span(c1_lat);
|
||||
} else {
|
||||
span = bucket_span(c2_lat);
|
||||
}
|
||||
|
||||
#ifdef HAVE_RINT
|
||||
*dx = (int)rint( diff_lon / span );
|
||||
#else
|
||||
if ( diff_lon > 0 ) {
|
||||
*dx = (int)( diff_lon / span + 0.5 );
|
||||
} else {
|
||||
*dx = (int)( diff_lon / span - 0.5 );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.4 1999/03/27 05:34:05 curt
|
||||
// Elimitated some const warnings from the compiler.
|
||||
//
|
||||
// Revision 1.3 1999/02/26 22:07:54 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.2 1999/02/11 01:09:33 curt
|
||||
// Added a routine to calculate the offset in bucket units between two buckets.
|
||||
//
|
||||
// Revision 1.1 1999/02/08 23:52:16 curt
|
||||
// Added a new "newbucket.[ch]xx" FGBucket class to replace the old
|
||||
// fgBUCKET struct and C routines. This FGBucket class adjusts the tile
|
||||
// width towards the poles to ensure the tiles are at least 8 miles wide.
|
||||
//
|
||||
|
||||
@@ -1,360 +0,0 @@
|
||||
/**************************************************************************
|
||||
* newbucket.hxx -- new bucket routines for better world modeling
|
||||
*
|
||||
* Written by Curtis L. Olson, started February 1999.
|
||||
*
|
||||
* Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id$
|
||||
* (Log is kept at end of this file)
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef _NEWBUCKET_HXX
|
||||
#define _NEWBUCKET_HXX
|
||||
|
||||
#include <Include/compiler.h>
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#ifdef FG_HAVE_STD_INCLUDES
|
||||
# include <cstdio> // sprintf()
|
||||
# include <iostream>
|
||||
#else
|
||||
# include <stdio.h> // sprintf()
|
||||
# include <iostream.h>
|
||||
#endif
|
||||
|
||||
FG_USING_STD(string);
|
||||
FG_USING_STD(ostream);
|
||||
|
||||
#include <Include/fg_constants.h>
|
||||
|
||||
|
||||
#define FG_BUCKET_SPAN 0.125 // 1/8 of a degree
|
||||
#define FG_HALF_BUCKET_SPAN 0.0625 // 1/2 of 1/8 of a degree = 1/16 = 0.0625
|
||||
|
||||
class FGBucket;
|
||||
ostream& operator<< ( ostream&, const FGBucket& );
|
||||
bool operator== ( const FGBucket&, const FGBucket& );
|
||||
|
||||
class FGBucket {
|
||||
|
||||
private:
|
||||
double cx, cy; // centerpoint (lon, lat) in degrees of bucket
|
||||
int lon; // longitude index (-180 to 179)
|
||||
int lat; // latitude index (-90 to 89)
|
||||
int x; // x subdivision (0 to 7)
|
||||
int y; // y subdivision (0 to 7)
|
||||
|
||||
public:
|
||||
|
||||
// default constructor
|
||||
FGBucket();
|
||||
|
||||
// create a bucket which would contain the specified lon/lat
|
||||
FGBucket(const double lon, const double lat);
|
||||
|
||||
// create a bucket based on "long int" index
|
||||
FGBucket(const long int bindex);
|
||||
|
||||
// create an impossible bucket if false
|
||||
FGBucket(const bool is_good);
|
||||
|
||||
~FGBucket();
|
||||
|
||||
// Set the bucket params for the specified lat and lon
|
||||
void set_bucket( double dlon, double dlat );
|
||||
|
||||
// Generate the unique scenery tile index for this bucket
|
||||
long int gen_index();
|
||||
string gen_index_str() const;
|
||||
|
||||
// Build the path name for this bucket
|
||||
string gen_base_path() const;
|
||||
|
||||
// return the center lon of a tile
|
||||
double get_center_lon() const;
|
||||
|
||||
// return width of the tile
|
||||
double get_width() const;
|
||||
|
||||
// return the center lat of a tile
|
||||
double get_center_lat() const;
|
||||
|
||||
// return height of the tile
|
||||
double get_height() const;
|
||||
|
||||
// Informational methods
|
||||
inline int get_lon() const { return lon; }
|
||||
inline int get_lat() const { return lat; }
|
||||
inline int get_x() const { return x; }
|
||||
inline int get_y() const { return y; }
|
||||
|
||||
// friends
|
||||
friend ostream& operator<< ( ostream&, const FGBucket& );
|
||||
friend bool operator== ( const FGBucket&, const FGBucket& );
|
||||
};
|
||||
|
||||
|
||||
// return the horizontal tile span factor based on latitude
|
||||
inline double bucket_span( double l ) {
|
||||
if ( l >= 89.0 ) {
|
||||
return 0.0;
|
||||
} else if ( l >= 88.0 ) {
|
||||
return 8.0;
|
||||
} else if ( l >= 86.0 ) {
|
||||
return 4.0;
|
||||
} else if ( l >= 83.0 ) {
|
||||
return 2.0;
|
||||
} else if ( l >= 76.0 ) {
|
||||
return 1.0;
|
||||
} else if ( l >= 62.0 ) {
|
||||
return 0.5;
|
||||
} else if ( l >= 22.0 ) {
|
||||
return 0.25;
|
||||
} else if ( l >= -22.0 ) {
|
||||
return 0.125;
|
||||
} else if ( l >= -62.0 ) {
|
||||
return 0.25;
|
||||
} else if ( l >= -76.0 ) {
|
||||
return 0.5;
|
||||
} else if ( l >= -83.0 ) {
|
||||
return 1.0;
|
||||
} else if ( l >= -86.0 ) {
|
||||
return 2.0;
|
||||
} else if ( l >= -88.0 ) {
|
||||
return 4.0;
|
||||
} else if ( l >= -89.0 ) {
|
||||
return 8.0;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the bucket params for the specified lat and lon
|
||||
inline void FGBucket::set_bucket( double dlon, double dlat ) {
|
||||
//
|
||||
// latitude first
|
||||
//
|
||||
double span = bucket_span( dlat );
|
||||
double diff = dlon - (double)(int)dlon;
|
||||
|
||||
// cout << "diff = " << diff << " span = " << span << endl;
|
||||
|
||||
if ( (dlon >= 0) || (fabs(diff) < FG_EPSILON) ) {
|
||||
lon = (int)dlon;
|
||||
} else {
|
||||
lon = (int)dlon - 1;
|
||||
}
|
||||
|
||||
// find subdivision or super lon if needed
|
||||
if ( span < FG_EPSILON ) {
|
||||
// polar cap
|
||||
lon = 0;
|
||||
x = 0;
|
||||
} else if ( span <= 1.0 ) {
|
||||
x = (int)((dlon - lon) / span);
|
||||
} else {
|
||||
if ( (dlon >= 0) || (fabs(diff) < FG_EPSILON) ) {
|
||||
lon = (int)( (int)(lon / span) * span);
|
||||
} else {
|
||||
// cout << " lon = " << lon
|
||||
// << " tmp = " << (int)((lon-1) / span) << endl;
|
||||
lon = (int)( (int)((lon + 1) / span) * span - span);
|
||||
if ( lon < -180 ) {
|
||||
lon = -180;
|
||||
}
|
||||
}
|
||||
x = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// then latitude
|
||||
//
|
||||
diff = dlat - (double)(int)dlat;
|
||||
|
||||
if ( (dlat >= 0) || (fabs(diff) < FG_EPSILON) ) {
|
||||
lat = (int)dlat;
|
||||
} else {
|
||||
lat = (int)dlat - 1;
|
||||
}
|
||||
y = (int)((dlat - lat) * 8);
|
||||
}
|
||||
|
||||
|
||||
// default constructor
|
||||
inline FGBucket::FGBucket() {}
|
||||
|
||||
|
||||
// constructor for specified location
|
||||
inline FGBucket::FGBucket(const double dlon, const double dlat) {
|
||||
set_bucket(dlon, dlat);
|
||||
}
|
||||
|
||||
// create an impossible bucket if false
|
||||
inline FGBucket::FGBucket(const bool is_good) {
|
||||
set_bucket(0.0, 0.0);
|
||||
if ( !is_good ) {
|
||||
lon = -1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parse a unique scenery tile index and find the lon, lat, x, and y
|
||||
inline FGBucket::FGBucket(const long int bindex) {
|
||||
long int index = bindex;
|
||||
|
||||
lon = index >> 14;
|
||||
index -= lon << 14;
|
||||
lon -= 180;
|
||||
|
||||
lat = index >> 6;
|
||||
index -= lat << 6;
|
||||
lat -= 90;
|
||||
|
||||
y = index >> 3;
|
||||
index -= y << 3;
|
||||
|
||||
x = index;
|
||||
}
|
||||
|
||||
|
||||
// default destructor
|
||||
inline FGBucket::~FGBucket() {}
|
||||
|
||||
|
||||
// Generate the unique scenery tile index for this bucket
|
||||
//
|
||||
// The index is constructed as follows:
|
||||
//
|
||||
// 9 bits - to represent 360 degrees of longitude (-180 to 179)
|
||||
// 8 bits - to represent 180 degrees of latitude (-90 to 89)
|
||||
//
|
||||
// Each 1 degree by 1 degree tile is further broken down into an 8x8
|
||||
// grid. So we also need:
|
||||
//
|
||||
// 3 bits - to represent x (0 to 7)
|
||||
// 3 bits - to represent y (0 to 7)
|
||||
|
||||
inline long int FGBucket::gen_index() {
|
||||
return ((lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x;
|
||||
}
|
||||
|
||||
inline string FGBucket::gen_index_str() const {
|
||||
char tmp[20];
|
||||
sprintf(tmp, "%ld",
|
||||
(((long)lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x);
|
||||
return (string)tmp;
|
||||
}
|
||||
|
||||
|
||||
// return the center lon of a tile
|
||||
inline double FGBucket::get_center_lon() const {
|
||||
double span = bucket_span( lat + y / 8.0 + FG_HALF_BUCKET_SPAN );
|
||||
|
||||
if ( span >= 1.0 ) {
|
||||
return lon + span / 2.0;
|
||||
} else {
|
||||
return lon + x * span + span / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return width of the tile
|
||||
inline double FGBucket::get_width() const {
|
||||
return bucket_span( get_center_lat() );
|
||||
}
|
||||
|
||||
|
||||
// return the center lat of a tile
|
||||
inline double FGBucket::get_center_lat() const {
|
||||
return lat + y / 8.0 + FG_HALF_BUCKET_SPAN;
|
||||
}
|
||||
|
||||
|
||||
// return height of the tile
|
||||
inline double FGBucket::get_height() const {
|
||||
return FG_BUCKET_SPAN;
|
||||
}
|
||||
|
||||
|
||||
// offset a bucket struct by the specified tile units in the X & Y
|
||||
// direction
|
||||
FGBucket fgBucketOffset( double dlon, double dlat, int x, int y );
|
||||
|
||||
|
||||
// calculate the offset between two buckets
|
||||
void fgBucketDiff( const FGBucket& b1, const FGBucket& b2, int *dx, int *dy );
|
||||
|
||||
|
||||
/*
|
||||
// Given a lat/lon, fill in the local tile index array
|
||||
void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height);
|
||||
*/
|
||||
|
||||
|
||||
inline ostream&
|
||||
operator<< ( ostream& out, const FGBucket& b )
|
||||
{
|
||||
return out << b.lon << ":" << b.x << ", " << b.lat << ":" << b.y;
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
operator== ( const FGBucket& b1, const FGBucket& b2 )
|
||||
{
|
||||
return ( b1.lon == b2.lon &&
|
||||
b1.lat == b2.lat &&
|
||||
b1.x == b2.x &&
|
||||
b1.y == b2.y );
|
||||
}
|
||||
|
||||
|
||||
#endif // _NEWBUCKET_HXX
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.8 1999/03/27 05:34:06 curt
|
||||
// Elimitated some const warnings from the compiler.
|
||||
//
|
||||
// Revision 1.7 1999/03/25 19:01:51 curt
|
||||
// Jettisoned old bucketutils.[ch] for newbucket.[ch]xx
|
||||
//
|
||||
// Revision 1.6 1999/03/15 17:58:41 curt
|
||||
// MSVC++ portability tweaks contributed by Bernie Bright.
|
||||
// Added using std::ostream declaration.
|
||||
// Added forward declarations to work around a MSVC bug.
|
||||
//
|
||||
// Revision 1.5 1999/03/12 22:51:18 curt
|
||||
// Added some informational methods.
|
||||
//
|
||||
// Revision 1.4 1999/03/02 01:01:43 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.3 1999/02/26 22:07:55 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.2 1999/02/11 01:09:34 curt
|
||||
// Added a routine to calculate the offset in bucket units between two buckets.
|
||||
//
|
||||
// Revision 1.1 1999/02/08 23:52:16 curt
|
||||
// Added a new "newbucket.[ch]xx" FGBucket class to replace the old
|
||||
// fgBUCKET struct and C routines. This FGBucket class adjusts the tile
|
||||
// width towards the poles to ensure the tiles are at least 8 miles wide.
|
||||
//
|
||||
@@ -1,32 +0,0 @@
|
||||
// test new bucket routines
|
||||
|
||||
#include "newbucket.cxx"
|
||||
|
||||
main() {
|
||||
double lat = 21.9625;
|
||||
double lon = -110.0 + 0.0625;
|
||||
|
||||
/*
|
||||
while ( lon < 180 ) {
|
||||
FGBucket b1( lon, lat );
|
||||
long int index = b1.gen_index();
|
||||
FGBucket b2( index );
|
||||
|
||||
cout << lon << "," << lat << " ";
|
||||
cout << b2 << " " << b2.get_center_lon() << ","
|
||||
<< b2.get_center_lat() << endl;
|
||||
|
||||
lon += 0.125;
|
||||
}
|
||||
*/
|
||||
|
||||
FGBucket b1;
|
||||
|
||||
for ( int j = 2; j >= -2; j-- ) {
|
||||
for ( int i = -2; i < 3; i++ ) {
|
||||
b1 = fgBucketOffset(lon, lat, i, j);
|
||||
cout << "(" << i << "," << j << ")" << b1 << "\t";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
481
COPYING
Normal file
481
COPYING
Normal file
@@ -0,0 +1,481 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,13 +0,0 @@
|
||||
# The "checkoutlist" file is used to support additional version controlled
|
||||
# administrative files in $CVSROOT/CVSROOT, such as template files.
|
||||
#
|
||||
# The first entry on a line is a filename which will be checked out from
|
||||
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
|
||||
# The remainder of the line is an error message to use if the file cannot
|
||||
# be checked out.
|
||||
#
|
||||
# File format:
|
||||
#
|
||||
# [<whitespace>]<filename><whitespace><error message><end-of-line>
|
||||
#
|
||||
# comment lines begin with '#'
|
||||
@@ -1,15 +0,0 @@
|
||||
# The "commitinfo" file is used to control pre-commit checks.
|
||||
# The filter on the right is invoked with the repository and a list
|
||||
# of files to check. A non-zero exit of the filter program will
|
||||
# cause the commit to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,22 +0,0 @@
|
||||
# This file describes wrappers and other binary files to CVS.
|
||||
#
|
||||
# Wrappers are the concept where directories of files are to be
|
||||
# treated as a single file. The intended use is to wrap up a wrapper
|
||||
# into a single tar such that the tar archive can be treated as a
|
||||
# single binary file in CVS.
|
||||
#
|
||||
# To solve the problem effectively, it was also necessary to be able to
|
||||
# prevent rcsmerge from merging these files.
|
||||
#
|
||||
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
|
||||
#
|
||||
# wildcard [option value][option value]...
|
||||
#
|
||||
# where option is one of
|
||||
# -f from cvs filter value: path to filter
|
||||
# -t to cvs filter value: path to filter
|
||||
# -m update methodology value: MERGE or COPY
|
||||
#
|
||||
# and value is a single-quote delimited value.
|
||||
#
|
||||
# For example:
|
||||
@@ -1,21 +0,0 @@
|
||||
# The "editinfo" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
@@ -1,19 +0,0 @@
|
||||
# The "loginfo" file is used to control where "cvs commit" log information is
|
||||
# sent. The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. For the first match that is found, the remainder of the line is a
|
||||
# filter program that should expect log information on its standard input
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in the
|
||||
# first field of this file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
#
|
||||
# The filter program may use one and only one "%s" modifier (ala printf). If
|
||||
# such a "%s" is specified in the filter program, a brief title is included
|
||||
# (as one argument, enclosed in single quotes) showing the relative directory
|
||||
# name and listing the modified file names.
|
||||
#
|
||||
# For example:
|
||||
#DEFAULT (echo ""; who am i; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
@@ -1,26 +0,0 @@
|
||||
# Three different line formats are valid:
|
||||
# key -a aliases...
|
||||
# key [options] directory
|
||||
# key [options] directory files...
|
||||
#
|
||||
# Where "options" are composed of:
|
||||
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
||||
# -o prog Run "prog" on "cvs checkout" of module.
|
||||
# -e prog Run "prog" on "cvs export" of module.
|
||||
# -t prog Run "prog" on "cvs rtag" of module.
|
||||
# -u prog Run "prog" on "cvs update" of module.
|
||||
# -d dir Place module in directory "dir" instead of module name.
|
||||
# -l Top-level directory only -- do not recurse.
|
||||
#
|
||||
# NOTE: If you change any of the "Run" options above, you'll have to
|
||||
# release and re-checkout any working directories of these modules.
|
||||
#
|
||||
# And "directory" is a path to a directory relative to $CVSROOT.
|
||||
#
|
||||
# The "-a" option specifies an alias. An alias is interpreted as if
|
||||
# everything on the right of the "-a" had been typed on the command line.
|
||||
#
|
||||
# You can encode a module within a module by using the special '&'
|
||||
# character to interpose another module into the current module. This
|
||||
# can be useful for creating a module that consists of many directories
|
||||
# spread out over the entire source repository.
|
||||
@@ -1,12 +0,0 @@
|
||||
# The "notify" file controls where notifications from watches set by
|
||||
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
|
||||
# a regular expression which is tested against the directory that the
|
||||
# change is being made to, relative to the $CVSROOT. If it matches,
|
||||
# then the remainder of the line is a filter program that should contain
|
||||
# one occurrence of %s for the user to notify, and information on its
|
||||
# standard input.
|
||||
#
|
||||
# "ALL" or "DEFAULT" can be used in place of the regular expression.
|
||||
#
|
||||
# For example:
|
||||
#ALL mail %s -s "CVS notification"
|
||||
@@ -1,13 +0,0 @@
|
||||
# The "rcsinfo" file is used to control templates with which the editor
|
||||
# is invoked on commit and import.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. For the first match that is found, then the remainder of the
|
||||
# line is the name of the file that contains the template.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,20 +0,0 @@
|
||||
# The "taginfo" file is used to control pre-tag checks.
|
||||
# The filter on the right is invoked with the following arguments:
|
||||
#
|
||||
# $1 -- tagname
|
||||
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
|
||||
# $3 -- repository
|
||||
# $4-> file revision [file revision ...]
|
||||
#
|
||||
# A non-zero exit of the filter program will cause the tag to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,11 +0,0 @@
|
||||
EXTRA_DIST = logtest.cxx
|
||||
|
||||
noinst_LIBRARIES = libDebug.a
|
||||
|
||||
libDebug_a_SOURCES = \
|
||||
debug_types.h \
|
||||
logstream.cxx logstream.hxx
|
||||
|
||||
# fg_debug.c fg_debug.h \
|
||||
|
||||
INCLUDES += -I$(top_builddir)
|
||||
@@ -1,37 +0,0 @@
|
||||
// NB: To add a dbg_class, add it here, and add it to the structure in
|
||||
// fg_debug.c
|
||||
|
||||
typedef enum {
|
||||
FG_NONE = 0x00000000,
|
||||
|
||||
FG_TERRAIN = 0x00000001,
|
||||
FG_ASTRO = 0x00000002,
|
||||
FG_FLIGHT = 0x00000004,
|
||||
FG_INPUT = 0x00000008,
|
||||
FG_GL = 0x00000010,
|
||||
FG_VIEW = 0x00000020,
|
||||
FG_COCKPIT = 0x00000040,
|
||||
FG_GENERAL = 0x00000080,
|
||||
FG_MATH = 0x00000100,
|
||||
FG_EVENT = 0x00000200,
|
||||
FG_AIRCRAFT = 0x00000400,
|
||||
FG_AUTOPILOT = 0x00000800,
|
||||
FG_SERIAL = 0x00001000,
|
||||
FG_CLIPPER = 0x00002000,
|
||||
FG_UNDEFD = 0x00004000, // For range checking
|
||||
|
||||
FG_ALL = 0xFFFFFFFF
|
||||
} fgDebugClass;
|
||||
|
||||
|
||||
// NB: To add a priority, add it here.
|
||||
typedef enum {
|
||||
FG_BULK, // For frequent messages
|
||||
FG_DEBUG, // Less frequent debug type messages
|
||||
FG_INFO, // Informatory messages
|
||||
FG_WARN, // Possible impending problem
|
||||
FG_ALERT // Very possible impending problem
|
||||
// FG_EXIT, // Problem (no core)
|
||||
// FG_ABORT // Abandon ship (core)
|
||||
} fgDebugPriority;
|
||||
|
||||
310
Debug/fg_debug.c
310
Debug/fg_debug.c
@@ -1,310 +0,0 @@
|
||||
/* -*- Mode: C++ -*-
|
||||
*
|
||||
* fg_debug.c -- Flight Gear debug utility functions
|
||||
*
|
||||
* Written by Paul Bleisch, started January 1998.
|
||||
*
|
||||
* Copyright (C) 1998 Paul Bleisch, pbleisch@acm.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id$
|
||||
* (Log is kept at end of this file)
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Include/cmdargs.h> // Line to command line arguments
|
||||
|
||||
#include "fg_debug.h"
|
||||
|
||||
|
||||
static int fg_DebugSem = 1;
|
||||
fgDebugClass fg_DebugClass = FG_NONE; // Need visibility for
|
||||
fgDebugPriority fg_DebugPriority = FG_INFO; // command line processing.
|
||||
static fgDebugCallback fg_DebugCallback = NULL;
|
||||
|
||||
FILE *fg_DebugOutput = NULL; // Visibility needed for command line processor.
|
||||
// This can be set to a FILE from the command
|
||||
// line. If not, it will be set to stderr.
|
||||
|
||||
/* TODO: Actually make this thing thread safe */
|
||||
#ifdef USETHREADS
|
||||
#define FG_GRABDEBUGSEM while( --fg_DebugSem < 0 ) { fg_DebugSem++; }
|
||||
#define FG_RELEASEDEBUGSEM fg_DebugSem++;
|
||||
#else
|
||||
#define FG_GRABDEBUGSEM
|
||||
#define FG_RELEASEDEBUGSEM
|
||||
#endif
|
||||
|
||||
/* Used for convienence initialization from env variables.
|
||||
*/
|
||||
static struct {
|
||||
char *str;
|
||||
fgDebugClass dbg_class;
|
||||
} fg_DebugClasses[] = {
|
||||
{ "FG_NONE", 0x00000000 },
|
||||
{ "FG_TERRAIN", 0x00000001 },
|
||||
{ "FG_ASTRO", 0x00000002 },
|
||||
{ "FG_FLIGHT", 0x00000004 },
|
||||
{ "FG_INPUT", 0x00000008 },
|
||||
{ "FG_GL", 0x00000010 },
|
||||
{ "FG_VIEW", 0x00000020 },
|
||||
{ "FG_COCKPIT", 0x00000040 },
|
||||
{ "FG_GENERAL", 0x00000080 },
|
||||
{ "FG_MATH", 0x00000100 },
|
||||
{ "FG_EVENT", 0x00000200 },
|
||||
{ "FG_AIRCRAFT", 0x00000400 },
|
||||
{ "FG_AUTOPILOT", 0x00000800 },
|
||||
|
||||
/* Do not edit below here, last entry should be null */
|
||||
{ "FG_ALL", 0xFFFFFFFF },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static fgDebugClass fgDebugStrToClass( char *str );
|
||||
|
||||
|
||||
/* fgInitDebug =============================================================*/
|
||||
void fgInitDebug( void ) {
|
||||
char *pszClass, *pszPrio, *pszFile;
|
||||
|
||||
// Support for log file/alt debug output via command line, environment or
|
||||
// reasonable default.
|
||||
|
||||
/*
|
||||
if( strlen( logArgbuf ) > 3) { // First check for command line option
|
||||
// Assumed that we will append.
|
||||
fg_DebugOutput = fopen(logArgbuf, "a+" );
|
||||
}
|
||||
*/
|
||||
|
||||
if( !fg_DebugOutput ) { // If not set on command line, environment?
|
||||
pszFile = getenv( "FG_DEBUGFILE" );
|
||||
if( pszFile ) { // There is such an environmental variable.
|
||||
fg_DebugOutput = fopen( pszFile, "a+" );
|
||||
}
|
||||
}
|
||||
|
||||
if( !fg_DebugOutput ) { // If neither command line nor environment
|
||||
fg_DebugOutput = stderr; // then we use the fallback position
|
||||
}
|
||||
|
||||
FG_GRABDEBUGSEM;
|
||||
fg_DebugSem = fg_DebugSem; /* shut up GCC */
|
||||
|
||||
// Test command line option overridge of debug priority. If the value
|
||||
// is in range (properly optioned) the we will override both defaults
|
||||
// and the environmental value.
|
||||
|
||||
/*
|
||||
if ((priorityArgValue >= FG_BULK) && (priorityArgValue <= FG_ABORT)) {
|
||||
fg_DebugPriority = priorityArgValue;
|
||||
} else { // Either not set or out of range. We will not warn the user.
|
||||
*/
|
||||
pszPrio = getenv( "FG_DEBUGPRIORITY" );
|
||||
if( pszPrio ) {
|
||||
fg_DebugPriority = atoi( pszPrio );
|
||||
fprintf( stderr,
|
||||
"fg_debug.c: Environment overrides default debug priority (%d)\n",
|
||||
fg_DebugPriority );
|
||||
}
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
if ((debugArgValue >= FG_ALL) && (debugArgValue < FG_UNDEFD)) {
|
||||
fg_DebugPriority = priorityArgValue;
|
||||
} else { // Either not set or out of range. We will not warn the user.
|
||||
*/
|
||||
pszClass = getenv( "FG_DEBUGCLASS" );
|
||||
if( pszClass ) {
|
||||
fg_DebugClass = fgDebugStrToClass( pszClass );
|
||||
fprintf( stderr,
|
||||
"fg_debug.c: Environment overrides default debug class (0x%08X)\n",
|
||||
fg_DebugClass );
|
||||
}
|
||||
/* } */
|
||||
|
||||
FG_RELEASEDEBUGSEM;
|
||||
}
|
||||
|
||||
/* fgDebugStrToClass ======================================================*/
|
||||
fgDebugClass fgDebugStrToClass( char *str ) {
|
||||
char *hex = "0123456789ABCDEF";
|
||||
char *hexl = "0123456789abcdef";
|
||||
char *pt, *p, *ph, ps = 1;
|
||||
unsigned int val = 0, i;
|
||||
|
||||
if( str == NULL ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check for 0xXXXXXX notation */
|
||||
p = strstr( str, "0x");
|
||||
if( p ) {
|
||||
p++; p++;
|
||||
while (*p) {
|
||||
ph = strchr(hex,*p);
|
||||
if ( ph ) {
|
||||
val <<= 4;
|
||||
val += ph-hex;
|
||||
p++;
|
||||
} else {
|
||||
ph = strchr(hexl,*p);
|
||||
if ( ph ) {
|
||||
val <<= 4;
|
||||
val += ph-hex;
|
||||
p++;
|
||||
} else {
|
||||
// fprintf( stderr, "Error in hex string '%s'\n", str );
|
||||
return FG_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Must be in string format */
|
||||
p = str;
|
||||
ps = 1;
|
||||
while( ps ) {
|
||||
while( *p && (*p==' ' || *p=='\t') ) p++; /* remove whitespace */
|
||||
pt = p; /* mark token */
|
||||
while( *p && (*p!='|') ) p++; /* find OR or EOS */
|
||||
ps = *p; /* save value at p so we can attempt to be bounds safe */
|
||||
*p++ = 0; /* terminate token */
|
||||
/* determine value for token */
|
||||
i=0;
|
||||
while( fg_DebugClasses[i].str &&
|
||||
strncmp( fg_DebugClasses[i].str, pt,
|
||||
strlen(fg_DebugClasses[i].str)) ) i++;
|
||||
if( fg_DebugClasses[i].str == NULL ) {
|
||||
fprintf( stderr,
|
||||
"fg_debug.c: Could not find message class '%s'\n",
|
||||
pt );
|
||||
} else {
|
||||
val |= fg_DebugClasses[i].dbg_class;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (fgDebugClass)val;
|
||||
}
|
||||
|
||||
|
||||
/* fgSetDebugOutput =======================================================*/
|
||||
void fgSetDebugOutput( FILE *out ) {
|
||||
FG_GRABDEBUGSEM;
|
||||
fflush( fg_DebugOutput );
|
||||
fg_DebugOutput = out;
|
||||
FG_RELEASEDEBUGSEM;
|
||||
}
|
||||
|
||||
|
||||
/* fgSetDebugLevels =======================================================*/
|
||||
void fgSetDebugLevels( fgDebugClass dbg_class, fgDebugPriority prio ) {
|
||||
FG_GRABDEBUGSEM;
|
||||
fg_DebugClass = dbg_class;
|
||||
fg_DebugPriority = prio;
|
||||
FG_RELEASEDEBUGSEM;
|
||||
}
|
||||
|
||||
|
||||
/* fgRegisterDebugCallback ================================================*/
|
||||
fgDebugCallback fgRegisterDebugCallback( fgDebugCallback callback ) {
|
||||
fgDebugCallback old;
|
||||
FG_GRABDEBUGSEM;
|
||||
old = fg_DebugCallback;
|
||||
fg_DebugCallback = callback;
|
||||
FG_RELEASEDEBUGSEM;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
/* fgPrintf ===============================================================*/
|
||||
int fgPrintf( fgDebugClass dbg_class, fgDebugPriority prio, char *fmt, ... ) {
|
||||
char szOut[1024+1];
|
||||
va_list ap;
|
||||
int ret = 0;
|
||||
|
||||
// If no action to take, then don't bother with the semaphore
|
||||
// activity Slight speed benefit.
|
||||
|
||||
// printf("dbg_class = %d fg_DebugClass = %d\n", dbg_class, fg_DebugClass);
|
||||
// printf("prio = %d fg_DebugPriority = %d\n", prio, fg_DebugPriority);
|
||||
|
||||
if( !(dbg_class & fg_DebugClass) ) {
|
||||
// Failed to match a specific debug class
|
||||
if ( prio < fg_DebugPriority ) {
|
||||
// priority is less than requested
|
||||
|
||||
// "ret" is zero anyway. But we might think about changing
|
||||
// it upon some error condition?
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
FG_GRABDEBUGSEM;
|
||||
|
||||
/* ret = vsprintf( szOut, fmt, (&fmt+1)); (but it didn't work, thus ... */
|
||||
va_start (ap, fmt);
|
||||
ret = vsprintf( szOut, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
if( fg_DebugCallback!=NULL && fg_DebugCallback(dbg_class, prio, szOut) ) {
|
||||
FG_RELEASEDEBUGSEM;
|
||||
return ret;
|
||||
} else {
|
||||
fprintf( fg_DebugOutput, szOut );
|
||||
FG_RELEASEDEBUGSEM;
|
||||
if( prio == FG_EXIT ) {
|
||||
exit(0);
|
||||
} else if( prio == FG_ABORT ) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.4 1998/06/01 17:49:44 curt
|
||||
/* Rewrote a slightly ambiguous code fragment (contributed by Charlie Hotchkiss)
|
||||
/*
|
||||
* Revision 1.3 1998/05/07 23:03:54 curt
|
||||
* Added an entry for AUTOPILOT.
|
||||
*
|
||||
* Revision 1.2 1998/04/21 17:03:45 curt
|
||||
* Prepairing for C++ integration.
|
||||
*
|
||||
* Revision 1.1 1998/04/18 03:52:04 curt
|
||||
* Moved to Lib directory and created a libDebug.
|
||||
*
|
||||
* Revision 1.10 1998/03/14 00:31:21 curt
|
||||
* Beginning initial terrain texturing experiments.
|
||||
*
|
||||
* Revision 1.9 1998/03/09 22:44:58 curt
|
||||
* Modified so that you can specify FG_DEBUGCLASS ***or*** FG_DEBUG_PRIORITY
|
||||
*
|
||||
* Revision 1.8 1998/03/09 22:11:00 curt
|
||||
* Processed through the format-o-matic.
|
||||
*
|
||||
* Revision 1.7 1998/02/16 13:39:43 curt
|
||||
* Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
|
||||
* tiles to occasionally be missing.
|
||||
*
|
||||
*/
|
||||
156
Debug/fg_debug.h
156
Debug/fg_debug.h
@@ -1,156 +0,0 @@
|
||||
/* -*- Mode: C++ -*-
|
||||
*
|
||||
* fg_debug.h -- Flight Gear debug utility functions
|
||||
*
|
||||
* Written by Paul Bleisch, started January 1998.
|
||||
*
|
||||
* Copyright (C) 1998 Paul Bleisch, pbleisch@acm.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* (Log is kept at end of this file)
|
||||
**************************************************************************/
|
||||
|
||||
#error "use logstream"
|
||||
|
||||
#ifndef _FG_DEBUG_H
|
||||
#define _FG_DEBUG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* NB: To add a dbg_class, add it here, and add it to the structure in
|
||||
fg_debug.c */
|
||||
typedef enum {
|
||||
FG_NONE = 0x00000000,
|
||||
|
||||
FG_TERRAIN = 0x00000001,
|
||||
FG_ASTRO = 0x00000002,
|
||||
FG_FLIGHT = 0x00000004,
|
||||
FG_INPUT = 0x00000008,
|
||||
FG_GL = 0x00000010,
|
||||
FG_VIEW = 0x00000020,
|
||||
FG_COCKPIT = 0x00000040,
|
||||
FG_GENERAL = 0x00000080,
|
||||
FG_MATH = 0x00000100,
|
||||
FG_EVENT = 0x00000200,
|
||||
FG_AIRCRAFT = 0x00000400,
|
||||
FG_AUTOPILOT = 0x00000800,
|
||||
FG_UNDEFD = 0x00001000, // For range checking
|
||||
|
||||
FG_ALL = 0xFFFFFFFF
|
||||
} fgDebugClass;
|
||||
|
||||
/* NB: To add a priority, add it here. */
|
||||
typedef enum {
|
||||
FG_BULK, /* For frequent messages */
|
||||
FG_DEBUG, /* Less frequent debug type messages */
|
||||
FG_INFO, /* Informatory messages */
|
||||
FG_WARN, /* Possible impending problem */
|
||||
FG_ALERT, /* Very possible impending problem */
|
||||
FG_EXIT, /* Problem (no core) */
|
||||
FG_ABORT /* Abandon ship (core) */
|
||||
} fgDebugPriority;
|
||||
|
||||
|
||||
/* Initialize the debuggin stuff. */
|
||||
void fgInitDebug( void );
|
||||
|
||||
|
||||
/* fgPrintf
|
||||
|
||||
Expects:
|
||||
class fgDebugClass mask for this message.
|
||||
prio fgDebugPriority of this message.
|
||||
fmt printf like string format
|
||||
... var args for fmt
|
||||
|
||||
Returns:
|
||||
number of items in fmt handled.
|
||||
|
||||
This function works like the standard C library function printf() with
|
||||
the addition of message classes and priorities (see fgDebugClasses
|
||||
and fgDebugPriorities). These additions allow us to classify messages
|
||||
and disable sets of messages at runtime. Only messages with a prio
|
||||
greater than or equal to fg_DebugPriority and in the current debug class
|
||||
(fg_DebugClass) are printed.
|
||||
*/
|
||||
int fgPrintf( fgDebugClass dbg_class, fgDebugPriority prio, char *fmt, ... );
|
||||
|
||||
|
||||
/* fgSetDebugLevels()
|
||||
|
||||
Expects:
|
||||
dbg_class Bitmask representing classes to display.
|
||||
prio Minimum priority of messages to display.
|
||||
*/
|
||||
void fgSetDebugLevels( fgDebugClass dbg_class, fgDebugPriority prio );
|
||||
|
||||
/* fgSetDebugOutput()
|
||||
|
||||
Expects:
|
||||
file A FILE* to a stream to send messages to.
|
||||
|
||||
It is assumed the file stream is open and writable. The system
|
||||
defaults to stderr. The current stream is flushed but not
|
||||
closed.
|
||||
*/
|
||||
void fgSetDebugOutput( FILE *out );
|
||||
|
||||
|
||||
/* fgRegisterDebugCallback
|
||||
|
||||
Expects:
|
||||
callback A function that takes parameters as defined by the
|
||||
fgDebugCallback type.
|
||||
|
||||
Returns:
|
||||
a pointer to the previously registered callback (if any)
|
||||
|
||||
Install a user defined debug log callback. This callback is called w
|
||||
whenever fgPrintf is called. The parameters passed to the callback are
|
||||
defined above by fgDebugCallback. outstr is the string that is to be
|
||||
printed. If callback returns nonzero, it is assumed that the message
|
||||
was handled fully by the callback and **fgPrintf need do no further
|
||||
processing of the message.** Only one callback may be installed at a
|
||||
time.
|
||||
*/
|
||||
|
||||
//typedef int (*fgDebugCallback)(fgDebugClass, fgDebugPriority, char *outstr);
|
||||
//fgDebugCallback fgRegisterDebugCallback( fgDebugCallback callback );
|
||||
|
||||
typedef int (*fgDebugCallback)( int DebugClass, int DebugPriority, char *outstr);
|
||||
fgDebugCallback fgRegisterDebugCallback( fgDebugCallback callback );
|
||||
|
||||
|
||||
// Leave these alone. Access intended for fg_debug and command line processing.
|
||||
//
|
||||
extern fgDebugClass fg_DebugClass;
|
||||
extern fgDebugPriority fg_DebugPriority;
|
||||
|
||||
extern FILE * fg_DebugOutput;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _FG_DEBUG_H */
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
// Stream based logging mechanism.
|
||||
//
|
||||
// Written by Bernie Bright, 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
#include "logstream.hxx"
|
||||
|
||||
bool logbuf::logging_enabled = true;
|
||||
fgDebugClass logbuf::logClass = FG_NONE;
|
||||
fgDebugPriority logbuf::logPriority = FG_INFO;
|
||||
streambuf* logbuf::sbuf = NULL;
|
||||
|
||||
logbuf::logbuf()
|
||||
{
|
||||
// if ( sbuf == NULL )
|
||||
// sbuf = cerr.rdbuf();
|
||||
}
|
||||
|
||||
logbuf::~logbuf()
|
||||
{
|
||||
if ( sbuf )
|
||||
sync();
|
||||
}
|
||||
|
||||
void
|
||||
logbuf::set_sb( streambuf* sb )
|
||||
{
|
||||
if ( sbuf )
|
||||
sync();
|
||||
|
||||
sbuf = sb;
|
||||
}
|
||||
|
||||
void
|
||||
logbuf::set_log_level( fgDebugClass c, fgDebugPriority p )
|
||||
{
|
||||
logClass = c;
|
||||
logPriority = p;
|
||||
}
|
||||
|
||||
void
|
||||
logstream::setLogLevels( fgDebugClass c, fgDebugPriority p )
|
||||
{
|
||||
logbuf::set_log_level( c, p );
|
||||
}
|
||||
|
||||
// $Log$
|
||||
// Revision 1.2 1999/01/19 20:53:34 curt
|
||||
// Portability updates by Bernie Bright.
|
||||
//
|
||||
// Revision 1.1 1998/11/06 21:20:41 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,228 +0,0 @@
|
||||
// Stream based logging mechanism.
|
||||
//
|
||||
// Written by Bernie Bright, 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
#ifndef _LOGSTREAM_H
|
||||
#define _LOGSTREAM_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <Include/compiler.h>
|
||||
|
||||
#ifdef FG_HAVE_STD_INCLUDES
|
||||
# include <streambuf>
|
||||
# include <iostream>
|
||||
#else
|
||||
# include <iostream.h>
|
||||
# include "Include/fg_traits.hxx"
|
||||
#endif
|
||||
|
||||
#include "debug_types.h"
|
||||
|
||||
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
|
||||
FG_USING_STD(streambuf);
|
||||
FG_USING_STD(ostream);
|
||||
FG_USING_STD(cerr);
|
||||
FG_USING_STD(endl);
|
||||
#endif
|
||||
|
||||
//
|
||||
// TODO:
|
||||
//
|
||||
// 1. Change output destination. Done.
|
||||
// 2. Make logbuf thread safe.
|
||||
// 3. Read environment for default debugClass and debugPriority.
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// logbuf is an output-only streambuf with the ability to disable sets of
|
||||
// messages at runtime. Only messages with priority >= logbuf::logPriority
|
||||
// and debugClass == logbuf::logClass are output.
|
||||
//
|
||||
class logbuf : public streambuf
|
||||
{
|
||||
public:
|
||||
|
||||
#ifndef FG_HAVE_STD_INCLUDES
|
||||
typedef char_traits<char> traits_type;
|
||||
typedef char_traits<char>::int_type int_type;
|
||||
typedef char_traits<char>::pos_type pos_type;
|
||||
typedef char_traits<char>::off_type off_type;
|
||||
#endif
|
||||
// logbuf( streambuf* sb ) : sbuf(sb) {}
|
||||
logbuf();
|
||||
~logbuf();
|
||||
|
||||
// Is logging enabled?
|
||||
bool enabled() { return logging_enabled; }
|
||||
|
||||
// Set the logging level of subsequent messages.
|
||||
void set_log_state( fgDebugClass c, fgDebugPriority p );
|
||||
|
||||
// Set the global logging level.
|
||||
static void set_log_level( fgDebugClass c, fgDebugPriority p );
|
||||
|
||||
//
|
||||
void set_sb( streambuf* sb );
|
||||
|
||||
protected:
|
||||
|
||||
inline virtual int sync();
|
||||
int_type overflow( int ch );
|
||||
// int xsputn( const char* s, istreamsize n );
|
||||
|
||||
private:
|
||||
|
||||
// The streambuf used for actual output. Defaults to cerr.rdbuf().
|
||||
static streambuf* sbuf;
|
||||
|
||||
static bool logging_enabled;
|
||||
static fgDebugClass logClass;
|
||||
static fgDebugPriority logPriority;
|
||||
|
||||
private:
|
||||
|
||||
// Not defined.
|
||||
logbuf( const logbuf& );
|
||||
void operator= ( const logbuf& );
|
||||
};
|
||||
|
||||
inline int
|
||||
logbuf::sync()
|
||||
{
|
||||
#ifdef FG_HAVE_STD_INCLUDES
|
||||
return sbuf->pubsync();
|
||||
#else
|
||||
return sbuf->sync();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void
|
||||
logbuf::set_log_state( fgDebugClass c, fgDebugPriority p )
|
||||
{
|
||||
logging_enabled = ((c & logClass) != 0 && p >= logPriority);
|
||||
}
|
||||
|
||||
inline logbuf::int_type
|
||||
logbuf::overflow( int c )
|
||||
{
|
||||
return logging_enabled ? sbuf->sputc(c) : (EOF == 0 ? 1: 0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// logstream manipulator for setting the log level of a message.
|
||||
//
|
||||
struct loglevel
|
||||
{
|
||||
loglevel( fgDebugClass c, fgDebugPriority p )
|
||||
: logClass(c), logPriority(p) {}
|
||||
|
||||
fgDebugClass logClass;
|
||||
fgDebugPriority logPriority;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// A helper class that ensures a streambuf and ostream are constructed and
|
||||
// destroyed in the correct order. The streambuf must be created before the
|
||||
// ostream but bases are constructed before members. Thus, making this class
|
||||
// a private base of logstream, declared to the left of ostream, we ensure the
|
||||
// correct order of construction and destruction.
|
||||
//
|
||||
struct logstream_base
|
||||
{
|
||||
// logstream_base( streambuf* sb ) : lbuf(sb) {}
|
||||
logstream_base() {}
|
||||
|
||||
logbuf lbuf;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
class logstream : private logstream_base, public ostream
|
||||
{
|
||||
public:
|
||||
// The default is to send messages to cerr.
|
||||
logstream( ostream& out )
|
||||
// : logstream_base(out.rdbuf()),
|
||||
: logstream_base(),
|
||||
ostream(&lbuf) { lbuf.set_sb(out.rdbuf());}
|
||||
|
||||
void set_output( ostream& out ) { lbuf.set_sb( out.rdbuf() ); }
|
||||
|
||||
// Set the global log class and priority level.
|
||||
void setLogLevels( fgDebugClass c, fgDebugPriority p );
|
||||
|
||||
// Output operator to capture the debug level and priority of a message.
|
||||
inline ostream& operator<< ( const loglevel& l );
|
||||
};
|
||||
|
||||
inline ostream&
|
||||
logstream::operator<< ( const loglevel& l )
|
||||
{
|
||||
lbuf.set_log_state( l.logClass, l.logPriority );
|
||||
return *this;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Return the one and only logstream instance.
|
||||
// We use a function instead of a global object so we are assured that cerr
|
||||
// has been initialised.
|
||||
//
|
||||
inline logstream&
|
||||
fglog()
|
||||
{
|
||||
static logstream logstrm( cerr );
|
||||
return logstrm;
|
||||
}
|
||||
|
||||
#ifdef FG_NDEBUG
|
||||
# define FG_LOG(C,P,M)
|
||||
#else
|
||||
# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl
|
||||
#endif
|
||||
|
||||
#endif // _LOGSTREAM_H
|
||||
|
||||
// $Log$
|
||||
// Revision 1.4 1999/03/02 01:01:47 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.3 1999/01/19 20:53:35 curt
|
||||
// Portability updates by Bernie Bright.
|
||||
//
|
||||
// Revision 1.2 1998/11/07 19:07:02 curt
|
||||
// Enable release builds using the --without-logging option to the configure
|
||||
// script. Also a couple log message cleanups, plus some C to C++ comment
|
||||
// conversion.
|
||||
//
|
||||
// Revision 1.1 1998/11/06 21:20:42 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,34 +0,0 @@
|
||||
#include <string>
|
||||
#include "Debug/logstream.hxx"
|
||||
|
||||
int
|
||||
main( int argc, char* argv[] )
|
||||
{
|
||||
fglog().setLogLevels( FG_ALL, FG_INFO );
|
||||
|
||||
FG_LOG( FG_TERRAIN, FG_BULK, "terrain::bulk" ); // shouldnt appear
|
||||
FG_LOG( FG_TERRAIN, FG_DEBUG, "terrain::debug" ); // shouldnt appear
|
||||
FG_LOG( FG_TERRAIN, FG_INFO, "terrain::info" );
|
||||
FG_LOG( FG_TERRAIN, FG_WARN, "terrain::warn" );
|
||||
FG_LOG( FG_TERRAIN, FG_ALERT, "terrain::alert" );
|
||||
|
||||
int i = 12345;
|
||||
long l = 54321L;
|
||||
double d = 3.14159;
|
||||
string s = "Hello world!";
|
||||
|
||||
FG_LOG( FG_EVENT, FG_INFO, "event::info "
|
||||
<< "i=" << i
|
||||
<< ", l=" << l
|
||||
<< ", d=" << d
|
||||
<< ", d*l=" << d*l
|
||||
<< ", s=\"" << s << "\"" );
|
||||
|
||||
// This shouldn't appear in log output:
|
||||
FG_LOG( FG_EVENT, FG_DEBUG, "event::debug "
|
||||
<< "- this should be seen - "
|
||||
<< "d=" << d
|
||||
<< ", s=\"" << s << "\"" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
806
Doxyfile
Normal file
806
Doxyfile
Normal file
@@ -0,0 +1,806 @@
|
||||
# Doxyfile 1.2.6
|
||||
|
||||
# This file describes the settings to be used by doxygen for a project
|
||||
#
|
||||
# All text after a hash (#) is considered a comment and will be ignored
|
||||
# The format is:
|
||||
# TAG = value [value, ...]
|
||||
# For lists items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (" ")
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# General configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
||||
# by quotes) that should identify the project.
|
||||
|
||||
PROJECT_NAME = SimGear
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.0.19pre2
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ../doxy
|
||||
|
||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
# information to generate all constant output in the proper language.
|
||||
# The default language is English, other supported languages are:
|
||||
# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese,
|
||||
# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian,
|
||||
# Polish, Portuguese and Slovene.
|
||||
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
||||
# documentation are documented, even if no documentation was available.
|
||||
# Private class members and static file members will be hidden unless
|
||||
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
||||
|
||||
EXTRACT_ALL = NO
|
||||
|
||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
||||
# will be included in the documentation.
|
||||
|
||||
EXTRACT_PRIVATE = NO
|
||||
|
||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||
# will be included in the documentation.
|
||||
|
||||
EXTRACT_STATIC = NO
|
||||
|
||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
|
||||
# undocumented members of documented classes, files or namespaces.
|
||||
# If set to NO (the default) these members will be included in the
|
||||
# various overviews, but no documentation section is generated.
|
||||
# This option has no effect if EXTRACT_ALL is enabled.
|
||||
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
|
||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
||||
# undocumented classes that are normally visible in the class hierarchy.
|
||||
# If set to NO (the default) these class will be included in the various
|
||||
# overviews. This option has no effect if EXTRACT_ALL is enabled.
|
||||
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
|
||||
# include brief member descriptions after the members that are listed in
|
||||
# the file and class documentation (similar to JavaDoc).
|
||||
# Set to NO to disable this.
|
||||
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
|
||||
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
|
||||
# the brief description of a member or function before the detailed description.
|
||||
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
|
||||
# brief descriptions will be completely suppressed.
|
||||
|
||||
REPEAT_BRIEF = YES
|
||||
|
||||
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
|
||||
# Doxygen will generate a detailed section even if there is only a brief
|
||||
# description.
|
||||
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
|
||||
# path before files name in the file list and in the header files. If set
|
||||
# to NO the shortest path that makes the file name unique will be used.
|
||||
|
||||
FULL_PATH_NAMES = NO
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
||||
# can be used to strip a user defined part of the path. Stripping is
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. It is allowed to use relative paths in the argument list.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
# The INTERNAL_DOCS tag determines if documentation
|
||||
# that is typed after a \internal command is included. If the tag is set
|
||||
# to NO (the default) then the documentation will be excluded.
|
||||
# Set it to YES to include the internal documentation.
|
||||
|
||||
INTERNAL_DOCS = NO
|
||||
|
||||
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
|
||||
# generate a class diagram (in Html and LaTeX) for classes with base or
|
||||
# super classes. Setting the tag to NO turns the diagrams off.
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
|
||||
# be generated. Documented entities will be cross-referenced with these sources.
|
||||
|
||||
SOURCE_BROWSER = YES
|
||||
|
||||
# Setting the INLINE_SOURCES tag to YES will include the body
|
||||
# of functions and classes directly in the documentation.
|
||||
|
||||
INLINE_SOURCES = NO
|
||||
|
||||
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
|
||||
# doxygen to hide any special comment blocks from generated source code
|
||||
# fragments. Normal C and C++ comments will always remain visible.
|
||||
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
|
||||
# file names in lower case letters. If set to YES upper case letters are also
|
||||
# allowed. This is useful if you have classes or files whose names only differ
|
||||
# in case and if your file system supports case sensitive file names. Windows
|
||||
# users are adviced to set this option to NO.
|
||||
|
||||
CASE_SENSE_NAMES = YES
|
||||
|
||||
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
|
||||
# will show members with their full class and namespace scopes in the
|
||||
# documentation. If set to YES the scope will be hidden.
|
||||
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
|
||||
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
|
||||
# will generate a verbatim copy of the header file for each class for
|
||||
# which an include is specified. Set to NO to disable this.
|
||||
|
||||
VERBATIM_HEADERS = YES
|
||||
|
||||
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
|
||||
# will put list of the files that are included by a file in the documentation
|
||||
# of that file.
|
||||
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
|
||||
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
|
||||
# will interpret the first line (until the first dot) of a JavaDoc-style
|
||||
# comment as the brief description. If set to NO, the JavaDoc
|
||||
# comments will behave just like the Qt-style comments (thus requiring an
|
||||
# explict @brief command for a brief description.
|
||||
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
|
||||
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
||||
# member inherits the documentation from any documented member that it
|
||||
# reimplements.
|
||||
|
||||
INHERIT_DOCS = YES
|
||||
|
||||
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
|
||||
# is inserted in the documentation for inline members.
|
||||
|
||||
INLINE_INFO = YES
|
||||
|
||||
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
|
||||
# will sort the (detailed) documentation of file and class members
|
||||
# alphabetically by member name. If set to NO the members will appear in
|
||||
# declaration order.
|
||||
|
||||
SORT_MEMBER_DOCS = YES
|
||||
|
||||
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
||||
# tag is set to YES, then doxygen will reuse the documentation of the first
|
||||
# member in the group (if any) for the other members of the group. By default
|
||||
# all members of a group must be documented explicitly.
|
||||
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
|
||||
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
|
||||
# Doxygen uses this value to replace tabs by spaces in code fragments.
|
||||
|
||||
TAB_SIZE = 8
|
||||
|
||||
# The ENABLE_SECTIONS tag can be used to enable conditional
|
||||
# documentation sections, marked by \if sectionname ... \endif.
|
||||
|
||||
ENABLED_SECTIONS =
|
||||
|
||||
# The GENERATE_TODOLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the todo list. This list is created by putting \todo
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TODOLIST = YES
|
||||
|
||||
# The GENERATE_TESTLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the test list. This list is created by putting \test
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TESTLIST = YES
|
||||
|
||||
# The GENERATE_BUGLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the bug list. This list is created by putting \bug
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_BUGLIST = YES
|
||||
|
||||
# This tag can be used to specify a number of aliases that acts
|
||||
# as commands in the documentation. An alias has the form "name=value".
|
||||
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
|
||||
# put the command \sideeffect (or @sideeffect) in the documentation, which
|
||||
# will result in a user defined paragraph with heading "Side Effects:".
|
||||
# You can put \n's in the value part of an alias to insert newlines.
|
||||
|
||||
ALIASES =
|
||||
|
||||
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
|
||||
# the initial value of a variable or define consist of for it to appear in
|
||||
# the documentation. If the initializer consists of more lines than specified
|
||||
# here it will be hidden. Use a value of 0 to hide initializers completely.
|
||||
# The appearance of the initializer of individual variables and defines in the
|
||||
# documentation can be controlled using \showinitializer or \hideinitializer
|
||||
# command in the documentation regardless of this setting.
|
||||
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C.
|
||||
# For instance some of the names that are used will be different. The list
|
||||
# of all members will be omitted, etc.
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
|
||||
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
|
||||
# at the bottom of the documentation of classes and structs. If set to YES the
|
||||
# list will mention the files that were used to generate the documentation.
|
||||
|
||||
SHOW_USED_FILES = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The QUIET tag can be used to turn on/off the messages that are generated
|
||||
# by doxygen. Possible values are YES and NO. If left blank NO is used.
|
||||
|
||||
QUIET = NO
|
||||
|
||||
# The WARNINGS tag can be used to turn on/off the warning messages that are
|
||||
# generated by doxygen. Possible values are YES and NO. If left blank
|
||||
# NO is used.
|
||||
|
||||
WARNINGS = YES
|
||||
|
||||
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
|
||||
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
|
||||
# automatically be disabled.
|
||||
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
|
||||
# The WARN_FORMAT tag determines the format of the warning messages that
|
||||
# doxygen can produce. The string should contain the $file, $line, and $text
|
||||
# tags, which will be replaced by the file and line number from which the
|
||||
# warning originated and the warning text.
|
||||
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
|
||||
# The WARN_LOGFILE tag can be used to specify a file to which warning
|
||||
# and error messages should be written. If left blank the output is written
|
||||
# to stderr.
|
||||
|
||||
WARN_LOGFILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like "myfile.cpp" or
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = \
|
||||
simgear/bucket \
|
||||
simgear/compiler.h \
|
||||
simgear/constants.h \
|
||||
simgear/debug \
|
||||
simgear/ephemeris \
|
||||
simgear/io \
|
||||
simgear/magvar \
|
||||
simgear/math \
|
||||
simgear/misc \
|
||||
simgear/route \
|
||||
simgear/screen \
|
||||
simgear/serial \
|
||||
simgear/sg_inlines.h \
|
||||
simgear/sg_traits.hxx \
|
||||
simgear/sg_zlib.h \
|
||||
simgear/sky \
|
||||
simgear/threads \
|
||||
simgear/timing \
|
||||
simgear/xml
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
# blank all files are included.
|
||||
|
||||
FILE_PATTERNS = *.h *.hxx *.c *.cxx *.cpp
|
||||
|
||||
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
|
||||
# should be searched for input files as well. Possible values are YES and NO.
|
||||
# If left blank NO is used.
|
||||
|
||||
RECURSIVE = YES
|
||||
|
||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = simgear/metakit simgear/zlib
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
|
||||
# certain files from those directories.
|
||||
|
||||
EXCLUDE_PATTERNS =
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH =
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
# blank all files are included.
|
||||
|
||||
EXAMPLE_PATTERNS =
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH =
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
# by executing (via popen()) the command <filter> <input-file>, where <filter>
|
||||
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
|
||||
# input file. Doxygen will then use the output that the filter program writes
|
||||
# to standard output.
|
||||
|
||||
INPUT_FILTER =
|
||||
|
||||
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
|
||||
# INPUT_FILTER) will be used to filter the input files when producing source
|
||||
# files to browse.
|
||||
|
||||
FILTER_SOURCE_FILES = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
|
||||
# of all compounds will be generated. Enable this if the project
|
||||
# contains a lot of classes, structs, unions or interfaces.
|
||||
|
||||
ALPHABETICAL_INDEX = NO
|
||||
|
||||
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
|
||||
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
||||
# in which this list will be split (can be a number in the range [1..20])
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all
|
||||
# classes will be put under the same header in the alphabetical index.
|
||||
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
||||
# should be ignored while generating the index headers.
|
||||
|
||||
IGNORE_PREFIX =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
|
||||
# generate HTML output.
|
||||
|
||||
GENERATE_HTML = YES
|
||||
|
||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `html' will be used as the default path.
|
||||
|
||||
HTML_OUTPUT = html
|
||||
|
||||
# The HTML_HEADER tag can be used to specify a personal HTML header for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard header.
|
||||
|
||||
HTML_HEADER =
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard footer.
|
||||
|
||||
HTML_FOOTER =
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet
|
||||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
||||
# files or namespaces will be aligned in HTML using tables. If set to
|
||||
# NO a bullet list will be used.
|
||||
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for tools like the
|
||||
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
||||
# of the generated HTML documentation.
|
||||
|
||||
GENERATE_HTMLHELP = NO
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
|
||||
# controls if a separate .chi index file is generated (YES) or that
|
||||
# it should be included in the master .chm file (NO).
|
||||
|
||||
GENERATE_CHI = NO
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
|
||||
# controls whether a binary table of contents is generated (YES) or a
|
||||
# normal table of contents (NO) in the .chm file.
|
||||
|
||||
BINARY_TOC = NO
|
||||
|
||||
# The TOC_EXPAND flag can be set YES to add extra items for group members
|
||||
# to the contents of the Html help documentation and to the tree view.
|
||||
|
||||
TOC_EXPAND = NO
|
||||
|
||||
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
|
||||
# top of each HTML page. The value NO (the default) enables the index and
|
||||
# the value YES disables it.
|
||||
|
||||
DISABLE_INDEX = NO
|
||||
|
||||
# This tag can be used to set the number of enum values (range [1..20])
|
||||
# that doxygen will group on one line in the generated HTML documentation.
|
||||
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
|
||||
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
|
||||
# generated containing a tree-like index structure (just like the one that
|
||||
# is generated for HTML Help). For this to work a browser that supports
|
||||
# JavaScript and frames is required (for instance Netscape 4.0+
|
||||
# or Internet explorer 4.0+).
|
||||
|
||||
GENERATE_TREEVIEW = NO
|
||||
|
||||
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
|
||||
# used to set the initial width (in pixels) of the frame in which the tree
|
||||
# is shown.
|
||||
|
||||
TREEVIEW_WIDTH = 250
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
|
||||
# generate Latex output.
|
||||
|
||||
GENERATE_LATEX = YES
|
||||
|
||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `latex' will be used as the default path.
|
||||
|
||||
LATEX_OUTPUT = latex
|
||||
|
||||
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
|
||||
# LaTeX documents. This may be useful for small projects and may help to
|
||||
# save some trees in general.
|
||||
|
||||
COMPACT_LATEX = NO
|
||||
|
||||
# The PAPER_TYPE tag can be used to set the paper type that is used
|
||||
# by the printer. Possible values are: a4, a4wide, letter, legal and
|
||||
# executive. If left blank a4wide will be used.
|
||||
|
||||
PAPER_TYPE = a4wide
|
||||
|
||||
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
|
||||
# packages that should be included in the LaTeX output.
|
||||
|
||||
EXTRA_PACKAGES =
|
||||
|
||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
|
||||
# the generated latex document. The header should contain everything until
|
||||
# the first chapter. If it is left blank doxygen will generate a
|
||||
# standard header. Notice: only use this tag if you know what you are doing!
|
||||
|
||||
LATEX_HEADER =
|
||||
|
||||
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
|
||||
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
|
||||
# contain links (just like the HTML output) instead of page references
|
||||
# This makes the output suitable for online browsing using a pdf viewer.
|
||||
|
||||
PDF_HYPERLINKS = NO
|
||||
|
||||
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
|
||||
# plain latex in the generated Makefile. Set this option to YES to get a
|
||||
# higher quality PDF documentation.
|
||||
|
||||
USE_PDFLATEX = NO
|
||||
|
||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
|
||||
# command to the generated LaTeX files. This will instruct LaTeX to keep
|
||||
# running if errors occur, instead of asking the user for help.
|
||||
# This option is also used when generating formulas in HTML.
|
||||
|
||||
LATEX_BATCHMODE = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
|
||||
# The RTF output is optimised for Word 97 and may not look very pretty with
|
||||
# other RTF readers or editors.
|
||||
|
||||
GENERATE_RTF = YES
|
||||
|
||||
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `rtf' will be used as the default path.
|
||||
|
||||
RTF_OUTPUT = rtf
|
||||
|
||||
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
|
||||
# RTF documents. This may be useful for small projects and may help to
|
||||
# save some trees in general.
|
||||
|
||||
COMPACT_RTF = NO
|
||||
|
||||
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
|
||||
# will contain hyperlink fields. The RTF file will
|
||||
# contain links (just like the HTML output) instead of page references.
|
||||
# This makes the output suitable for online browsing using a WORD or other.
|
||||
# programs which support those fields.
|
||||
# Note: wordpad (write) and others do not support links.
|
||||
|
||||
RTF_HYPERLINKS = NO
|
||||
|
||||
# Load stylesheet definitions from file. Syntax is similar to doxygen's
|
||||
# config file, i.e. a series of assigments. You only have to provide
|
||||
# replacements, missing definitions are set to their default value.
|
||||
|
||||
RTF_STYLESHEET_FILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
|
||||
# generate man pages
|
||||
|
||||
GENERATE_MAN = YES
|
||||
|
||||
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `man' will be used as the default path.
|
||||
|
||||
MAN_OUTPUT = man
|
||||
|
||||
# The MAN_EXTENSION tag determines the extension that is added to
|
||||
# the generated man pages (default is the subroutine's section .3)
|
||||
|
||||
MAN_EXTENSION = .3
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
|
||||
# evaluate all C-preprocessor directives found in the sources and include
|
||||
# files.
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
|
||||
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
|
||||
# names in the source code. If set to NO (the default) only conditional
|
||||
# compilation will be performed. Macro expansion can be done in a controlled
|
||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
||||
|
||||
MACRO_EXPANSION = NO
|
||||
|
||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||
# then the macro expansion is limited to the macros specified with the
|
||||
# PREDEFINED and EXPAND_AS_PREDEFINED tags.
|
||||
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
|
||||
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
||||
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
||||
|
||||
SEARCH_INCLUDES = YES
|
||||
|
||||
# The INCLUDE_PATH tag can be used to specify one or more directories that
|
||||
# contain include files that are not input files but should be processed by
|
||||
# the preprocessor.
|
||||
|
||||
INCLUDE_PATH =
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
# directories. If left blank, the patterns specified with FILE_PATTERNS will
|
||||
# be used.
|
||||
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
|
||||
# The PREDEFINED tag can be used to specify one or more macro names that
|
||||
# are defined before the preprocessor is started (similar to the -D option of
|
||||
# gcc). The argument of the tag is a list of macros of the form: name
|
||||
# or name=definition (no spaces). If the definition and the = are
|
||||
# omitted =1 is assumed.
|
||||
|
||||
PREDEFINED =
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
# The macro definition that is found in the sources will be used.
|
||||
# Use the PREDEFINED tag if you want to use a different macro definition.
|
||||
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The TAGFILES tag can be used to specify one or more tagfiles.
|
||||
|
||||
TAGFILES =
|
||||
|
||||
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
|
||||
# a tag file that is based on the input files it reads.
|
||||
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
|
||||
# in the class index. If set to NO only the inherited external classes
|
||||
# will be listed.
|
||||
|
||||
ALLEXTERNALS = NO
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of `which perl').
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||
# available from the path. This tool is part of Graphviz, a graph visualization
|
||||
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
|
||||
# have no effect if this option is set to NO (the default)
|
||||
|
||||
HAVE_DOT = NO
|
||||
|
||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect inheritance relations. Setting this tag to YES will force the
|
||||
# the CLASS_DIAGRAMS tag to NO.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
|
||||
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect implementation dependencies (inheritance, containment, and
|
||||
# class references variables) of the class with other documented classes.
|
||||
|
||||
COLLABORATION_GRAPH = YES
|
||||
|
||||
# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to
|
||||
# YES then doxygen will generate a graph for each documented file showing
|
||||
# the direct and indirect include dependencies of the file with other
|
||||
# documented files.
|
||||
|
||||
INCLUDE_GRAPH = YES
|
||||
|
||||
# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to
|
||||
# YES then doxygen will generate a graph for each documented header file showing
|
||||
# the documented files that directly or indirectly include this file
|
||||
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
|
||||
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
|
||||
# will graphical hierarchy of all classes instead of a textual one.
|
||||
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
|
||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
||||
# found. If left blank, it is assumed the dot tool can be found on the path.
|
||||
|
||||
DOT_PATH =
|
||||
|
||||
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
|
||||
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
|
||||
# generate a legend page explaining the meaning of the various boxes and
|
||||
# arrows in the dot generated graphs.
|
||||
|
||||
GENERATE_LEGEND = YES
|
||||
|
||||
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
|
||||
# remove the intermedate dot files that are used to generate
|
||||
# the various graphs.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The SEARCHENGINE tag specifies whether or not a search engine should be
|
||||
# used. If set to NO the values of all tags below this one will be ignored.
|
||||
|
||||
SEARCHENGINE = NO
|
||||
|
||||
# The CGI_NAME tag should be the name of the CGI script that
|
||||
# starts the search engine (doxysearch) with the correct parameters.
|
||||
# A script with this name will be generated by doxygen.
|
||||
|
||||
CGI_NAME = search.cgi
|
||||
|
||||
# The CGI_URL tag should be the absolute URL to the directory where the
|
||||
# cgi binaries are located. See the documentation of your http daemon for
|
||||
# details.
|
||||
|
||||
CGI_URL =
|
||||
|
||||
# The DOC_URL tag should be the absolute URL to the directory where the
|
||||
# documentation is located. If left blank the absolute path to the
|
||||
# documentation, with file:// prepended to it, will be used.
|
||||
|
||||
DOC_URL =
|
||||
|
||||
# The DOC_ABSPATH tag should be the absolute path to the directory where the
|
||||
# documentation is located. If left blank the directory on the local machine
|
||||
# will be used.
|
||||
|
||||
DOC_ABSPATH =
|
||||
|
||||
# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
|
||||
# is installed.
|
||||
|
||||
BIN_ABSPATH = /usr/local/bin/
|
||||
|
||||
# The EXT_DOC_PATHS tag can be used to specify one or more paths to
|
||||
# documentation generated for other projects. This allows doxysearch to search
|
||||
# the documentation for these projects as well.
|
||||
|
||||
EXT_DOC_PATHS =
|
||||
@@ -1,22 +0,0 @@
|
||||
if ENABLE_AUDIO_SUPPORT
|
||||
AUDIO_DIRS = Audio
|
||||
else
|
||||
AUDIO_DIRS =
|
||||
endif
|
||||
|
||||
if ENABLE_UNIX_SERIAL
|
||||
SERIAL_DIRS = Serial
|
||||
else
|
||||
SERIAL_DIRS =
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
$(AUDIO_DIRS) \
|
||||
Bucket \
|
||||
Debug \
|
||||
Math \
|
||||
Misc \
|
||||
PUI \
|
||||
$(SERIAL_DIRS) \
|
||||
XGL\
|
||||
zlib
|
||||
21
Makefile.am
Normal file
21
Makefile.am
Normal file
@@ -0,0 +1,21 @@
|
||||
EXTRA_DIST = \
|
||||
acinclude.m4 \
|
||||
autogen.sh \
|
||||
mksymlinks.sh \
|
||||
README.MSVC \
|
||||
README.metakit \
|
||||
README.zlib \
|
||||
SimGear.dsp \
|
||||
SimGear.dsw
|
||||
|
||||
SUBDIRS = src-libs simgear
|
||||
|
||||
dist-hook:
|
||||
(cd $(top_srcdir); $(HOME)/projects/FlightGear-0.7/admin/am2dsp.pl)
|
||||
|
||||
#
|
||||
# Rule to build RPM distribution package
|
||||
#
|
||||
rpm: dist
|
||||
rpm -ta $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
||||
168
Math/MAT3geom.c
168
Math/MAT3geom.c
@@ -1,168 +0,0 @@
|
||||
/* #include "HEADERS.h" */
|
||||
/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* This file contains routines that perform geometry-related operations
|
||||
* on matrices.
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
#include <Math/mat3defs.h>
|
||||
|
||||
/* -------------------------- Static Routines ---------------------------- */
|
||||
|
||||
/* ------------------------- Internal Routines --------------------------- */
|
||||
|
||||
/* -------------------------- Public Routines ---------------------------- */
|
||||
|
||||
/*
|
||||
* This takes a matrix used to transform points, and returns a corresponding
|
||||
* matrix that can be used to transform direction vectors (between points).
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3direction_matrix(register double (*result_mat)[4], register double (*mat)[4])
|
||||
{
|
||||
register int i;
|
||||
|
||||
MAT3copy(result_mat, mat);
|
||||
|
||||
for (i = 0; i < 4; i++) result_mat[i][3] = result_mat[3][i] = 0.0;
|
||||
|
||||
result_mat[3][3] = 1.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This takes a matrix used to transform points, and returns a corresponding
|
||||
* matrix that can be used to transform vectors that must remain perpendicular
|
||||
* to planes defined by the points. It is useful when you are transforming
|
||||
* some object that has both points and normals in its definition, and you
|
||||
* only have the transformation matrix for the points. This routine returns
|
||||
* FALSE if the normal matrix is uncomputable. Otherwise, it returns TRUE.
|
||||
*
|
||||
* Spike sez: "This is the adjoint for the non-homogeneous part of the
|
||||
* transformation."
|
||||
*/
|
||||
|
||||
int
|
||||
MAT3normal_matrix(register double (*result_mat)[4], register double (*mat)[4])
|
||||
{
|
||||
register int ret;
|
||||
MAT3mat tmp_mat;
|
||||
|
||||
MAT3direction_matrix(result_mat, mat);
|
||||
|
||||
if ( (ret = MAT3invert(tmp_mat, tmp_mat)) ) {
|
||||
MAT3transpose(result_mat, tmp_mat);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the given matrix to be a scale matrix for the given vector of
|
||||
* scale values.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3scale(double (*result_mat)[4], double *scale)
|
||||
{
|
||||
MAT3identity(result_mat);
|
||||
|
||||
result_mat[0][0] = scale[0];
|
||||
result_mat[1][1] = scale[1];
|
||||
result_mat[2][2] = scale[2];
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets up a matrix for a rotation about an axis given by the line from
|
||||
* (0,0,0) to axis, through an angle (in radians).
|
||||
* Looking along the axis toward the origin, the rotation is counter-clockwise.
|
||||
*/
|
||||
|
||||
#define SELECT .7071 /* selection constant (roughly .5*sqrt(2) */
|
||||
|
||||
void
|
||||
MAT3rotate(double (*result_mat)[4], double *axis, double angle_in_radians)
|
||||
{
|
||||
MAT3vec naxis, /* Axis of rotation, normalized */
|
||||
base2, /* 2nd unit basis vec, perp to axis */
|
||||
base3; /* 3rd unit basis vec, perp to axis & base2 */
|
||||
double dot;
|
||||
MAT3mat base_mat, /* Change-of-basis matrix */
|
||||
base_mat_trans; /* Inverse of c-o-b matrix */
|
||||
register int i;
|
||||
|
||||
/* Step 1: extend { axis } to a basis for 3-space: { axis, base2, base3 }
|
||||
* which is orthonormal (all three have unit length, and all three are
|
||||
* mutually orthogonal). Also should be oriented, i.e. axis cross base2 =
|
||||
* base3, rather than -base3.
|
||||
*
|
||||
* Method: Find a vector linearly independent from axis. For this we
|
||||
* either use the y-axis, or, if that is too close to axis, the
|
||||
* z-axis. 'Too close' means that the dot product is too near to 1.
|
||||
*/
|
||||
|
||||
MAT3_COPY_VEC(naxis, axis);
|
||||
MAT3_NORMALIZE_VEC(naxis, dot);
|
||||
|
||||
if (dot == 0.0) {
|
||||
/* ERR_ERROR(MAT3_errid, ERR_SEVERE,
|
||||
(ERR_S, "Zero-length axis vector given to MAT3rotate")); */
|
||||
return;
|
||||
}
|
||||
|
||||
MAT3perp_vec(base2, naxis, TRUE);
|
||||
MAT3cross_product(base3, naxis, base2);
|
||||
|
||||
/* Set up the change-of-basis matrix, and its inverse */
|
||||
MAT3identity(base_mat);
|
||||
MAT3identity(base_mat_trans);
|
||||
MAT3identity(result_mat);
|
||||
|
||||
for (i = 0; i < 3; i++){
|
||||
base_mat_trans[i][0] = base_mat[0][i] = naxis[i];
|
||||
base_mat_trans[i][1] = base_mat[1][i] = base2[i];
|
||||
base_mat_trans[i][2] = base_mat[2][i] = base3[i];
|
||||
}
|
||||
|
||||
/* If T(u) = uR, where R is base_mat, then T(x-axis) = naxis,
|
||||
* T(y-axis) = base2, and T(z-axis) = base3. The inverse of base_mat is
|
||||
* its transpose. OK?
|
||||
*/
|
||||
|
||||
result_mat[1][1] = result_mat[2][2] = cos(angle_in_radians);
|
||||
result_mat[2][1] = -(result_mat[1][2] = sin(angle_in_radians));
|
||||
|
||||
MAT3mult(result_mat, base_mat_trans, result_mat);
|
||||
MAT3mult(result_mat, result_mat, base_mat);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the given matrix to be a translation matrix for the given vector of
|
||||
* translation values.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3translate(double (*result_mat)[4], double *trans)
|
||||
{
|
||||
MAT3identity(result_mat);
|
||||
|
||||
result_mat[3][0] = trans[0];
|
||||
result_mat[3][1] = trans[1];
|
||||
result_mat[3][2] = trans[2];
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the given matrix to be a shear matrix for the given x and y shear
|
||||
* values.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3shear(double (*result_mat)[4], double xshear, double yshear)
|
||||
{
|
||||
MAT3identity(result_mat);
|
||||
|
||||
result_mat[2][0] = xshear;
|
||||
result_mat[2][1] = yshear;
|
||||
}
|
||||
|
||||
311
Math/MAT3inv.c
311
Math/MAT3inv.c
@@ -1,311 +0,0 @@
|
||||
/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* This file contains routines that operate solely on matrices.
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
#include <Math/mat3defs.h>
|
||||
|
||||
/* -------------------------- Static Routines ---------------------------- */
|
||||
|
||||
#define SMALL 1e-20 /* Small enough to be considered zero */
|
||||
|
||||
/*
|
||||
* Shuffles rows in inverse of 3x3. See comment in MAT3_inv3_second_col().
|
||||
*/
|
||||
|
||||
static void
|
||||
MAT3_inv3_swap( register double inv[3][3], int row0, int row1, int row2)
|
||||
{
|
||||
register int i, tempi;
|
||||
double temp;
|
||||
|
||||
#define SWAP_ROWS(a, b) \
|
||||
for (i = 0; i < 3; i++) SWAP(inv[a][i], inv[b][i], temp); \
|
||||
SWAP(a, b, tempi)
|
||||
|
||||
if (row0 != 0){
|
||||
if (row1 == 0) {
|
||||
SWAP_ROWS(row0, row1);
|
||||
}
|
||||
else {
|
||||
SWAP_ROWS(row0, row2);
|
||||
}
|
||||
}
|
||||
|
||||
if (row1 != 1) {
|
||||
SWAP_ROWS(row1, row2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Does Gaussian elimination on second column.
|
||||
*/
|
||||
|
||||
static int
|
||||
MAT3_inv3_second_col (register double source[3][3], register double inv[3][3], int row0)
|
||||
{
|
||||
register int row1, row2, i1, i2, i;
|
||||
double temp;
|
||||
double a, b;
|
||||
|
||||
/* Find which row to use */
|
||||
if (row0 == 0) i1 = 1, i2 = 2;
|
||||
else if (row0 == 1) i1 = 0, i2 = 2;
|
||||
else i1 = 0, i2 = 1;
|
||||
|
||||
/* Find which is larger in abs. val.:the entry in [i1][1] or [i2][1] */
|
||||
/* and use that value for pivoting. */
|
||||
|
||||
a = source[i1][1]; if (a < 0) a = -a;
|
||||
b = source[i2][1]; if (b < 0) b = -b;
|
||||
if (a > b) row1 = i1;
|
||||
else row1 = i2;
|
||||
row2 = (row1 == i1 ? i2 : i1);
|
||||
|
||||
/* Scale row1 in source */
|
||||
if ((source[row1][1] < SMALL) && (source[row1][1] > -SMALL)) return(FALSE);
|
||||
temp = 1.0 / source[row1][1];
|
||||
source[row1][1] = 1.0;
|
||||
source[row1][2] *= temp; /* source[row1][0] is zero already */
|
||||
|
||||
/* Scale row1 in inv */
|
||||
inv[row1][row1] = temp; /* it used to be a 1.0 */
|
||||
inv[row1][row0] *= temp;
|
||||
|
||||
/* Clear column one, source, and make corresponding changes in inv */
|
||||
|
||||
for (i = 0; i < 3; i++) if (i != row1) { /* for i = all rows but row1 */
|
||||
temp = -source[i][1];
|
||||
source[i][1] = 0.0;
|
||||
source[i][2] += temp * source[row1][2];
|
||||
|
||||
inv[i][row1] = temp * inv[row1][row1];
|
||||
inv[i][row0] += temp * inv[row1][row0];
|
||||
}
|
||||
|
||||
/* Scale row2 in source */
|
||||
if ((source[row2][2] < SMALL) && (source[row2][2] > -SMALL)) return(FALSE);
|
||||
temp = 1.0 / source[row2][2];
|
||||
source[row2][2] = 1.0; /* source[row2][*] is zero already */
|
||||
|
||||
/* Scale row2 in inv */
|
||||
inv[row2][row2] = temp; /* it used to be a 1.0 */
|
||||
inv[row2][row0] *= temp;
|
||||
inv[row2][row1] *= temp;
|
||||
|
||||
/* Clear column one, source, and make corresponding changes in inv */
|
||||
for (i = 0; i < 3; i++) if (i != row2) { /* for i = all rows but row2 */
|
||||
temp = -source[i][2];
|
||||
source[i][2] = 0.0;
|
||||
inv[i][row0] += temp * inv[row2][row0];
|
||||
inv[i][row1] += temp * inv[row2][row1];
|
||||
inv[i][row2] += temp * inv[row2][row2];
|
||||
}
|
||||
|
||||
/*
|
||||
* Now all is done except that the inverse needs to have its rows shuffled.
|
||||
* row0 needs to be moved to inv[0][*], row1 to inv[1][*], etc.
|
||||
*
|
||||
* We *didn't* do the swapping before the elimination so that we could more
|
||||
* easily keep track of what ops are needed to be done in the inverse.
|
||||
*/
|
||||
MAT3_inv3_swap(inv, row0, row1, row2);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fast inversion routine for 3 x 3 matrices. - Written by jfh.
|
||||
*
|
||||
* This takes 30 multiplies/divides, as opposed to 39 for Cramer's Rule.
|
||||
* The algorithm consists of performing fast gaussian elimination, by never
|
||||
* doing any operations where the result is guaranteed to be zero, or where
|
||||
* one operand is guaranteed to be zero. This is done at the cost of clarity,
|
||||
* alas.
|
||||
*
|
||||
* Returns 1 if the inverse was successful, 0 if it failed.
|
||||
*/
|
||||
|
||||
static int
|
||||
MAT3_invert3 (register double source[3][3], register double inv[3][3])
|
||||
{
|
||||
register int i, row0;
|
||||
double temp;
|
||||
double a, b, c;
|
||||
|
||||
inv[0][0] = inv[1][1] = inv[2][2] = 1.0;
|
||||
inv[0][1] = inv[0][2] = inv[1][0] = inv[1][2] = inv[2][0] = inv[2][1] = 0.0;
|
||||
|
||||
/* attempt to find the largest entry in first column to use as pivot */
|
||||
a = source[0][0]; if (a < 0) a = -a;
|
||||
b = source[1][0]; if (b < 0) b = -b;
|
||||
c = source[2][0]; if (c < 0) c = -c;
|
||||
|
||||
if (a > b) {
|
||||
if (a > c) row0 = 0;
|
||||
else row0 = 2;
|
||||
}
|
||||
else {
|
||||
if (b > c) row0 = 1;
|
||||
else row0 = 2;
|
||||
}
|
||||
|
||||
/* Scale row0 of source */
|
||||
if ((source[row0][0] < SMALL) && (source[row0][0] > -SMALL)) return(FALSE);
|
||||
temp = 1.0 / source[row0][0];
|
||||
source[row0][0] = 1.0;
|
||||
source[row0][1] *= temp;
|
||||
source[row0][2] *= temp;
|
||||
|
||||
/* Scale row0 of inverse */
|
||||
inv[row0][row0] = temp; /* other entries are zero -- no effort */
|
||||
|
||||
/* Clear column zero of source, and make corresponding changes in inverse */
|
||||
|
||||
for (i = 0; i < 3; i++) if (i != row0) { /* for i = all rows but row0 */
|
||||
temp = -source[i][0];
|
||||
source[i][0] = 0.0;
|
||||
source[i][1] += temp * source[row0][1];
|
||||
source[i][2] += temp * source[row0][2];
|
||||
inv[i][row0] = temp * inv[row0][row0];
|
||||
}
|
||||
|
||||
/*
|
||||
* We've now done gaussian elimination so that the source and
|
||||
* inverse look like this:
|
||||
*
|
||||
* 1 * * * 0 0
|
||||
* 0 * * * 1 0
|
||||
* 0 * * * 0 1
|
||||
*
|
||||
* We now proceed to do elimination on the second column.
|
||||
*/
|
||||
if (! MAT3_inv3_second_col(source, inv, row0)) return(FALSE);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Finds a new pivot for a non-simple 4x4. See comments in MAT3invert().
|
||||
*/
|
||||
|
||||
static int
|
||||
MAT3_inv4_pivot (register MAT3mat src, MAT3vec r, double *s, int *swap)
|
||||
{
|
||||
register int i, j;
|
||||
double temp, max;
|
||||
|
||||
*swap = -1;
|
||||
|
||||
if (MAT3_IS_ZERO(src[3][3])) {
|
||||
|
||||
/* Look for a different pivot element: one with largest abs value */
|
||||
max = 0.0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (src[i][3] > max) max = src[*swap = i][3];
|
||||
else if (src[i][3] < -max) max = -src[*swap = i][3];
|
||||
}
|
||||
|
||||
/* No pivot element available ! */
|
||||
if (*swap < 0) return(FALSE);
|
||||
|
||||
else for (j = 0; j < 4; j++) SWAP(src[*swap][j], src[3][j], temp);
|
||||
}
|
||||
|
||||
MAT3_SET_VEC (r, -src[0][3], -src[1][3], -src[2][3]);
|
||||
|
||||
*s = 1.0 / src[3][3];
|
||||
|
||||
src[0][3] = src[1][3] = src[2][3] = 0.0;
|
||||
src[3][3] = 1.0;
|
||||
|
||||
MAT3_SCALE_VEC(src[3], src[3], *s);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
src[0][i] += r[0] * src[3][i];
|
||||
src[1][i] += r[1] * src[3][i];
|
||||
src[2][i] += r[2] * src[3][i];
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* ------------------------- Internal Routines --------------------------- */
|
||||
|
||||
/* -------------------------- Public Routines ---------------------------- */
|
||||
|
||||
/*
|
||||
* This returns the inverse of the given matrix. The result matrix
|
||||
* may be the same as the one to invert.
|
||||
*
|
||||
* Fast inversion routine for 4 x 4 matrices, written by jfh.
|
||||
*
|
||||
* Returns 1 if the inverse was successful, 0 if it failed.
|
||||
*
|
||||
* This routine has been specially tweaked to notice the following:
|
||||
* If the matrix has the form
|
||||
* * * * 0
|
||||
* * * * 0
|
||||
* * * * 0
|
||||
* * * * 1
|
||||
*
|
||||
* (as do many matrices in graphics), then we compute the inverse of
|
||||
* the upper left 3x3 matrix and use this to find the general inverse.
|
||||
*
|
||||
* In the event that the right column is not 0-0-0-1, we do gaussian
|
||||
* elimination to make it so, then use the 3x3 inverse, and then do
|
||||
* our gaussian elimination.
|
||||
*/
|
||||
|
||||
int
|
||||
MAT3invert(double (*result_mat)[4], double (*mat)[4])
|
||||
{
|
||||
MAT3mat src, inv;
|
||||
register int i, j, simple;
|
||||
double m[3][3], inv3[3][3], s, temp;
|
||||
MAT3vec r, t;
|
||||
int swap;
|
||||
|
||||
MAT3copy(src, mat);
|
||||
MAT3identity(inv);
|
||||
|
||||
/* If last column is not (0,0,0,1), use special code */
|
||||
simple = (mat[0][3] == 0.0 && mat[1][3] == 0.0 &&
|
||||
mat[2][3] == 0.0 && mat[3][3] == 1.0);
|
||||
|
||||
if (! simple && ! MAT3_inv4_pivot(src, r, &s, &swap)) return(FALSE);
|
||||
|
||||
MAT3_COPY_VEC(t, src[3]); /* Translation vector */
|
||||
|
||||
/* Copy upper-left 3x3 matrix */
|
||||
for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) m[i][j] = src[i][j];
|
||||
|
||||
if (! MAT3_invert3(m, inv3)) return(FALSE);
|
||||
|
||||
for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) inv[i][j] = inv3[i][j];
|
||||
|
||||
for (i = 0; i < 3; i++) for (j = 0; j < 3; j++)
|
||||
inv[3][i] -= t[j] * inv3[j][i];
|
||||
|
||||
if (! simple) {
|
||||
|
||||
/* We still have to undo our gaussian elimination from earlier on */
|
||||
/* add r0 * first col to last col */
|
||||
/* add r1 * 2nd col to last col */
|
||||
/* add r2 * 3rd col to last col */
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
inv[i][3] += r[0] * inv[i][0] + r[1] * inv[i][1] + r[2] * inv[i][2];
|
||||
inv[i][3] *= s;
|
||||
}
|
||||
|
||||
if (swap >= 0)
|
||||
for (i = 0; i < 4; i++) SWAP(inv[i][swap], inv[i][3], temp);
|
||||
}
|
||||
|
||||
MAT3copy(result_mat, inv);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
116
Math/MAT3mat.c
116
Math/MAT3mat.c
@@ -1,116 +0,0 @@
|
||||
/* #include "HEADERS.h" */
|
||||
/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* This file contains routines that operate solely on matrices.
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# ifndef HAVE_STL_SGI_PORT
|
||||
# include <memory.h> /* required for memset() and memcpy() */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <Math/mat3defs.h>
|
||||
|
||||
MAT3mat identityMatrix = {
|
||||
{ 1.0, 0.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 0.0, 1.0 }
|
||||
};
|
||||
|
||||
/* #include "macros.h" */
|
||||
|
||||
/* -------------------------- Static Routines ---------------------------- */
|
||||
|
||||
/* ------------------------- Internal Routines --------------------------- */
|
||||
|
||||
/* -------------------------- Public Routines ---------------------------- */
|
||||
|
||||
|
||||
#if !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/*
|
||||
* This multiplies two matrices, producing a third, which may the same as
|
||||
* either of the first two.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3mult (double (*result_mat)[4], register double (*mat1)[4], register double (*mat2)[4])
|
||||
{
|
||||
register int i, j;
|
||||
MAT3mat tmp_mat;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
tmp_mat[i][j] = (mat1[i][0] * mat2[0][j] +
|
||||
mat1[i][1] * mat2[1][j] +
|
||||
mat1[i][2] * mat2[2][j] +
|
||||
mat1[i][3] * mat2[3][j]);
|
||||
MAT3copy (result_mat, tmp_mat);
|
||||
}
|
||||
#endif // !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/*
|
||||
* This returns the transpose of a matrix. The result matrix may be
|
||||
* the same as the one to transpose.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3transpose (double (*result_mat)[4], register double (*mat)[4])
|
||||
{
|
||||
register int i, j;
|
||||
MAT3mat tmp_mat;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
tmp_mat[i][j] = mat[j][i];
|
||||
|
||||
MAT3copy (result_mat, tmp_mat);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This prints the given matrix to the given file pointer.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3print(double (*mat)[4], FILE *fp)
|
||||
{
|
||||
MAT3print_formatted(mat, fp, CNULL, CNULL, CNULL, CNULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* This prints the given matrix to the given file pointer.
|
||||
* use the format string to pass to fprintf. head and tail
|
||||
* are printed at the beginning and end of each line.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3print_formatted(double (*mat)[4], FILE *fp, char *title, char *head, char *format, char *tail)
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
/* This is to allow this to be called easily from a debugger */
|
||||
if (fp == NULL) fp = stderr;
|
||||
|
||||
if (title == NULL) title = "MAT3 matrix:\n";
|
||||
if (head == NULL) head = " ";
|
||||
if (format == NULL) format = "%#8.4lf ";
|
||||
if (tail == NULL) tail = "\n";
|
||||
|
||||
(void) fprintf(fp, title);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
(void) fprintf(fp, head);
|
||||
for (j = 0; j < 4; j++) (void) fprintf(fp, format, mat[i][j]);
|
||||
(void) fprintf(fp, tail);
|
||||
}
|
||||
}
|
||||
154
Math/MAT3vec.c
154
Math/MAT3vec.c
@@ -1,154 +0,0 @@
|
||||
/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* This file contains routines that operate on matrices and vectors, or
|
||||
* vectors and vectors.
|
||||
* -------------------------------------------------------------------------*/
|
||||
|
||||
/* #include "sphigslocal.h" */
|
||||
|
||||
/* -------------------------- Static Routines ---------------------------- */
|
||||
|
||||
/* ------------------------- Internal Routines --------------------------- */
|
||||
|
||||
/* -------------------------- Public Routines ---------------------------- */
|
||||
|
||||
/*
|
||||
* Multiplies a vector by a matrix, setting the result vector.
|
||||
* It assumes all homogeneous coordinates are 1.
|
||||
* The two vectors involved may be the same.
|
||||
*/
|
||||
|
||||
#include <Math/mat3.h>
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
#if !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
void
|
||||
MAT3mult_vec(double *result_vec, register double *vec, register double (*mat)[4])
|
||||
{
|
||||
MAT3vec tempvec;
|
||||
register double *temp = tempvec;
|
||||
|
||||
temp[0] = vec[0] * mat[0][0] + vec[1] * mat[1][0] +
|
||||
vec[2] * mat[2][0] + mat[3][0];
|
||||
temp[1] = vec[0] * mat[0][1] + vec[1] * mat[1][1] +
|
||||
vec[2] * mat[2][1] + mat[3][1];
|
||||
temp[2] = vec[0] * mat[0][2] + vec[1] * mat[1][2] +
|
||||
vec[2] * mat[2][2] + mat[3][2];
|
||||
|
||||
MAT3_COPY_VEC(result_vec, temp);
|
||||
}
|
||||
#endif // !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/*
|
||||
* Multiplies a vector of size 4 by a matrix, setting the result vector.
|
||||
* The fourth element of the vector is the homogeneous coordinate, which
|
||||
* may or may not be 1. If the "normalize" parameter is TRUE, then the
|
||||
* result vector will be normalized so that the homogeneous coordinate is 1.
|
||||
* The two vectors involved may be the same.
|
||||
* This returns zero if the vector was to be normalized, but couldn't be.
|
||||
*/
|
||||
|
||||
int
|
||||
MAT3mult_hvec(double *result_vec, register double *vec, register double (*mat)[4], int normalize)
|
||||
{
|
||||
MAT3hvec tempvec;
|
||||
double norm_fac;
|
||||
register double *temp = tempvec;
|
||||
register int ret = TRUE;
|
||||
|
||||
temp[0] = vec[0] * mat[0][0] + vec[1] * mat[1][0] +
|
||||
vec[2] * mat[2][0] + vec[3] * mat[3][0];
|
||||
temp[1] = vec[0] * mat[0][1] + vec[1] * mat[1][1] +
|
||||
vec[2] * mat[2][1] + vec[3] * mat[3][1];
|
||||
temp[2] = vec[0] * mat[0][2] + vec[1] * mat[1][2] +
|
||||
vec[2] * mat[2][2] + vec[3] * mat[3][2];
|
||||
temp[3] = vec[0] * mat[0][3] + vec[1] * mat[1][3] +
|
||||
vec[2] * mat[2][3] + vec[3] * mat[3][3];
|
||||
|
||||
/* Normalize if asked for, possible, and necessary */
|
||||
if (normalize) {
|
||||
if (MAT3_IS_ZERO(temp[3])) {
|
||||
#ifndef THINK_C
|
||||
fprintf (stderr,
|
||||
"Can't normalize vector: homogeneous coordinate is 0");
|
||||
#endif
|
||||
ret = FALSE;
|
||||
}
|
||||
else {
|
||||
norm_fac = 1.0 / temp[3];
|
||||
MAT3_SCALE_VEC(result_vec, temp, norm_fac);
|
||||
result_vec[3] = 1.0;
|
||||
}
|
||||
}
|
||||
else MAT3_COPY_HVEC(result_vec, temp);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#if !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/*
|
||||
* Sets the first vector to be the cross-product of the last two vectors.
|
||||
*/
|
||||
|
||||
void
|
||||
MAT3cross_product(double *result_vec, register double *vec1, register double *vec2)
|
||||
{
|
||||
MAT3vec tempvec;
|
||||
register double *temp = tempvec;
|
||||
|
||||
temp[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
|
||||
temp[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
|
||||
temp[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
|
||||
|
||||
MAT3_COPY_VEC(result_vec, temp);
|
||||
}
|
||||
#endif // !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/*
|
||||
* Finds a vector perpendicular to vec and stores it in result_vec.
|
||||
* Method: take any vector (we use <0,1,0>) and subtract the
|
||||
* portion of it pointing in the vec direction. This doesn't
|
||||
* work if vec IS <0,1,0> or is very near it. So if this is
|
||||
* the case, use <0,0,1> instead.
|
||||
* If "is_unit" is TRUE, the given vector is assumed to be unit length.
|
||||
*/
|
||||
|
||||
#define SELECT .7071 /* selection constant (roughly .5*sqrt(2) */
|
||||
|
||||
void
|
||||
MAT3perp_vec(double *result_vec, double *vec, int is_unit)
|
||||
{
|
||||
MAT3vec norm;
|
||||
double dot;
|
||||
|
||||
MAT3_SET_VEC(result_vec, 0.0, 1.0, 0.0);
|
||||
|
||||
MAT3_COPY_VEC(norm, vec);
|
||||
|
||||
if (! is_unit) MAT3_NORMALIZE_VEC(norm, dot);
|
||||
|
||||
/* See if vector is too close to <0,1,0>. If so, use <0,0,1> */
|
||||
if ((dot = MAT3_DOT_PRODUCT(norm, result_vec)) > SELECT || dot < -SELECT) {
|
||||
result_vec[1] = 0.0;
|
||||
result_vec[2] = 1.0;
|
||||
dot = MAT3_DOT_PRODUCT(norm, result_vec);
|
||||
}
|
||||
|
||||
/* Subtract off non-perpendicular part */
|
||||
result_vec[0] -= dot * norm[0];
|
||||
result_vec[1] -= dot * norm[1];
|
||||
result_vec[2] -= dot * norm[2];
|
||||
|
||||
/* Make result unit length */
|
||||
MAT3_NORMALIZE_VEC(result_vec, dot);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
noinst_LIBRARIES = libMath.a
|
||||
|
||||
libMath_a_SOURCES = \
|
||||
MAT3geom.c \
|
||||
MAT3inv.c \
|
||||
MAT3mat.c \
|
||||
MAT3vec.c \
|
||||
fg_geodesy.cxx fg_geodesy.hxx \
|
||||
fg_random.c fg_random.h \
|
||||
interpolater.cxx interpolater.hxx \
|
||||
leastsqs.cxx leastsqs.hxx \
|
||||
mat3.h mat3defs.h mat3err.h \
|
||||
point3d.hxx \
|
||||
polar3d.cxx polar3d.hxx \
|
||||
vector.cxx vector.hxx
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
|
||||
@@ -1,301 +0,0 @@
|
||||
// fg_geodesy.cxx -- routines to convert between geodetic and geocentric
|
||||
// coordinate systems.
|
||||
//
|
||||
// Copied and adapted directly from LaRCsim/ls_geodesy.c
|
||||
//
|
||||
// See below for the complete original LaRCsim comments.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
#include "Include/compiler.h"
|
||||
#ifdef FG_HAVE_STD_INCLUDES
|
||||
# include <cmath>
|
||||
# include <cerrno>
|
||||
#else
|
||||
# include <math.h>
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#include <Include/fg_constants.h>
|
||||
#include <Math/fg_geodesy.hxx>
|
||||
#include <Math/point3d.hxx>
|
||||
|
||||
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
|
||||
FG_USING_STD(cout);
|
||||
#endif
|
||||
|
||||
// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator
|
||||
#define ONE_SECOND 4.848136811E-6
|
||||
|
||||
|
||||
// fgGeocToGeod(lat_geoc, radius, *lat_geod, *alt, *sea_level_r)
|
||||
// INPUTS:
|
||||
// lat_geoc Geocentric latitude, radians, + = North
|
||||
// radius C.G. radius to earth center (meters)
|
||||
//
|
||||
// OUTPUTS:
|
||||
// lat_geod Geodetic latitude, radians, + = North
|
||||
// alt C.G. altitude above mean sea level (meters)
|
||||
// sea_level_r radius from earth center to sea level at
|
||||
// local vertical (surface normal) of C.G. (meters)
|
||||
|
||||
|
||||
void fgGeocToGeod( double lat_geoc, double radius, double
|
||||
*lat_geod, double *alt, double *sea_level_r )
|
||||
{
|
||||
double t_lat, x_alpha, mu_alpha, delt_mu, r_alpha, l_point, rho_alpha;
|
||||
double sin_mu_a, denom,delt_lambda, lambda_sl, sin_lambda_sl;
|
||||
|
||||
if( ( (FG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole
|
||||
|| ( (FG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole
|
||||
{
|
||||
*lat_geod = lat_geoc;
|
||||
*sea_level_r = EQUATORIAL_RADIUS_M*E;
|
||||
*alt = radius - *sea_level_r;
|
||||
} else {
|
||||
t_lat = tan(lat_geoc);
|
||||
x_alpha = E*EQUATORIAL_RADIUS_M/sqrt(t_lat*t_lat + E*E);
|
||||
double tmp = RESQ_M - x_alpha * x_alpha;
|
||||
if ( tmp < 0.0 ) { tmp = 0.0; }
|
||||
mu_alpha = atan2(sqrt(tmp),E*x_alpha);
|
||||
if (lat_geoc < 0) mu_alpha = - mu_alpha;
|
||||
sin_mu_a = sin(mu_alpha);
|
||||
delt_lambda = mu_alpha - lat_geoc;
|
||||
r_alpha = x_alpha/cos(lat_geoc);
|
||||
l_point = radius - r_alpha;
|
||||
*alt = l_point*cos(delt_lambda);
|
||||
|
||||
// check for domain error
|
||||
if ( errno == EDOM ) {
|
||||
cout << "Domain ERROR in fgGeocToGeod!!!!\n";
|
||||
*alt = 0.0;
|
||||
}
|
||||
|
||||
denom = sqrt(1-EPS*EPS*sin_mu_a*sin_mu_a);
|
||||
rho_alpha = EQUATORIAL_RADIUS_M*(1-EPS)/
|
||||
(denom*denom*denom);
|
||||
delt_mu = atan2(l_point*sin(delt_lambda),rho_alpha + *alt);
|
||||
*lat_geod = mu_alpha - delt_mu;
|
||||
lambda_sl = atan( E*E * tan(*lat_geod) ); // SL geoc. latitude
|
||||
sin_lambda_sl = sin( lambda_sl );
|
||||
*sea_level_r =
|
||||
sqrt(RESQ_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl));
|
||||
|
||||
// check for domain error
|
||||
if ( errno == EDOM ) {
|
||||
cout << "Domain ERROR in fgGeocToGeod!!!!\n";
|
||||
*sea_level_r = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// fgGeodToGeoc( lat_geod, alt, *sl_radius, *lat_geoc )
|
||||
// INPUTS:
|
||||
// lat_geod Geodetic latitude, radians, + = North
|
||||
// alt C.G. altitude above mean sea level (meters)
|
||||
//
|
||||
// OUTPUTS:
|
||||
// sl_radius SEA LEVEL radius to earth center (meters)
|
||||
// (add Altitude to get true distance from earth center.
|
||||
// lat_geoc Geocentric latitude, radians, + = North
|
||||
//
|
||||
|
||||
|
||||
void fgGeodToGeoc( double lat_geod, double alt, double *sl_radius,
|
||||
double *lat_geoc )
|
||||
{
|
||||
double lambda_sl, sin_lambda_sl, cos_lambda_sl, sin_mu, cos_mu, px, py;
|
||||
|
||||
lambda_sl = atan( E*E * tan(lat_geod) ); // sea level geocentric latitude
|
||||
sin_lambda_sl = sin( lambda_sl );
|
||||
cos_lambda_sl = cos( lambda_sl );
|
||||
sin_mu = sin(lat_geod); // Geodetic (map makers') latitude
|
||||
cos_mu = cos(lat_geod);
|
||||
*sl_radius =
|
||||
sqrt(RESQ_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl));
|
||||
py = *sl_radius*sin_lambda_sl + alt*sin_mu;
|
||||
px = *sl_radius*cos_lambda_sl + alt*cos_mu;
|
||||
*lat_geoc = atan2( py, px );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
TITLE: ls_geodesy
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
FUNCTION: Converts geocentric coordinates to geodetic positions
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
MODULE STATUS: developmental
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
GENEALOGY: Written as part of LaRCSim project by E. B. Jackson
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
DESIGNED BY: E. B. Jackson
|
||||
|
||||
CODED BY: E. B. Jackson
|
||||
|
||||
MAINTAINED BY: E. B. Jackson
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
MODIFICATION HISTORY:
|
||||
|
||||
DATE PURPOSE BY
|
||||
|
||||
930208 Modified to avoid singularity near polar region. EBJ
|
||||
930602 Moved backwards calcs here from ls_step. EBJ
|
||||
931214 Changed erroneous Latitude and Altitude variables to
|
||||
*lat_geod and *alt in routine ls_geoc_to_geod. EBJ
|
||||
940111 Changed header files from old ls_eom.h style to ls_types,
|
||||
and ls_constants. Also replaced old DATA type with new
|
||||
SCALAR type. EBJ
|
||||
|
||||
CURRENT RCS HEADER:
|
||||
|
||||
$Header$
|
||||
$Log$
|
||||
Revision 1.6 1999/03/02 01:01:49 curt
|
||||
Tweaks for compiling with native SGI compilers.
|
||||
|
||||
Revision 1.5 1999/01/27 04:46:14 curt
|
||||
Portability tweaks by Bernie Bright.
|
||||
|
||||
Revision 1.4 1998/11/20 01:00:36 curt
|
||||
Patch in fgGeoc2Geod() to avoid a floating explosion.
|
||||
point3d.hxx include math.h for FreeBSD
|
||||
|
||||
Revision 1.3 1998/11/11 00:18:36 curt
|
||||
Check for domain error in fgGeoctoGeod()
|
||||
|
||||
Revision 1.2 1998/10/16 23:36:36 curt
|
||||
c++-ifying.
|
||||
|
||||
Revision 1.1 1998/10/16 19:30:40 curt
|
||||
Renamed .c -> .h so we can start adding c++ supporting routines.
|
||||
|
||||
Revision 1.6 1998/07/08 14:40:07 curt
|
||||
polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
|
||||
Updated fg_geodesy comments to reflect that routines expect and produce
|
||||
meters.
|
||||
|
||||
Revision 1.5 1998/04/25 22:06:23 curt
|
||||
Edited cvs log messages in source files ... bad bad bad!
|
||||
|
||||
Revision 1.4 1998/01/27 00:47:59 curt
|
||||
Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
||||
system and commandline/config file processing code.
|
||||
|
||||
Revision 1.3 1998/01/19 19:27:12 curt
|
||||
Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
||||
This should simplify things tremendously.
|
||||
|
||||
Revision 1.2 1997/12/15 23:54:54 curt
|
||||
Add xgl wrappers for debugging.
|
||||
Generate terrain normals on the fly.
|
||||
|
||||
Revision 1.1 1997/07/31 23:13:14 curt
|
||||
Initial revision.
|
||||
|
||||
Revision 1.1 1997/05/29 00:09:56 curt
|
||||
Initial Flight Gear revision.
|
||||
|
||||
* Revision 1.5 1994/01/11 18:47:05 bjax
|
||||
* Changed include files to use types and constants, not ls_eom.h
|
||||
* Also changed DATA type to SCALAR type.
|
||||
*
|
||||
* Revision 1.4 1993/12/14 21:06:47 bjax
|
||||
* Removed global variable references Altitude and Latitude. EBJ
|
||||
*
|
||||
* Revision 1.3 1993/06/02 15:03:40 bjax
|
||||
* Made new subroutine for calculating geodetic to geocentric; changed name
|
||||
* of forward conversion routine from ls_geodesy to ls_geoc_to_geod.
|
||||
*
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
REFERENCES:
|
||||
|
||||
[ 1] Stevens, Brian L.; and Lewis, Frank L.: "Aircraft
|
||||
Control and Simulation", Wiley and Sons, 1992.
|
||||
ISBN 0-471-61397-5
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
CALLED BY: ls_aux
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
CALLS TO:
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
INPUTS:
|
||||
lat_geoc Geocentric latitude, radians, + = North
|
||||
radius C.G. radius to earth center, ft
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
OUTPUTS:
|
||||
lat_geod Geodetic latitude, radians, + = North
|
||||
alt C.G. altitude above mean sea level, ft
|
||||
sea_level_r radius from earth center to sea level at
|
||||
local vertical (surface normal) of C.G.
|
||||
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.6 1999/03/02 01:01:49 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.5 1999/01/27 04:46:14 curt
|
||||
// Portability tweaks by Bernie Bright.
|
||||
//
|
||||
// Revision 1.4 1998/11/20 01:00:36 curt
|
||||
// Patch in fgGeoc2Geod() to avoid a floating explosion.
|
||||
// point3d.hxx include math.h for FreeBSD
|
||||
//
|
||||
// Revision 1.3 1998/11/11 00:18:36 curt
|
||||
// Check for domain error in fgGeoctoGeod()
|
||||
//
|
||||
// Revision 1.2 1998/10/16 23:36:36 curt
|
||||
// c++-ifying.
|
||||
//
|
||||
// Revision 1.1 1998/10/16 19:30:40 curt
|
||||
// Renamed .c -> .h so we can start adding c++ supporting routines.
|
||||
//
|
||||
// Revision 1.6 1998/07/08 14:40:07 curt
|
||||
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
|
||||
// Updated fg_geodesy comments to reflect that routines expect and produce
|
||||
// meters.
|
||||
//
|
||||
// Revision 1.5 1998/04/25 22:06:23 curt
|
||||
// Edited cvs log messages in source files ... bad bad bad!
|
||||
//
|
||||
// Revision 1.4 1998/01/27 00:47:59 curt
|
||||
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
||||
// system and commandline/config file processing code.
|
||||
//
|
||||
// Revision 1.3 1998/01/19 19:27:12 curt
|
||||
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
||||
// This should simplify things tremendously.
|
||||
//
|
||||
// Revision 1.2 1997/12/15 23:54:54 curt
|
||||
// Add xgl wrappers for debugging.
|
||||
// Generate terrain normals on the fly.
|
||||
//
|
||||
// Revision 1.1 1997/07/31 23:13:14 curt
|
||||
// Initial revision.
|
||||
//
|
||||
|
||||
114
Math/fg_random.c
114
Math/fg_random.c
@@ -1,114 +0,0 @@
|
||||
// fg_random.c -- routines to handle random number generation
|
||||
//
|
||||
// Written by Curtis Olson, started July 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> // for random(), srandom()
|
||||
#include <time.h> // for time() to seed srandom()
|
||||
|
||||
#include "fg_random.h"
|
||||
|
||||
#ifndef HAVE_RAND
|
||||
# ifdef sgi
|
||||
# undef RAND_MAX
|
||||
# define RAND_MAX 2147483647
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
extern "C" {
|
||||
long int random(void);
|
||||
void srandom(unsigned int seed);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Seed the random number generater with time() so we don't see the
|
||||
// same sequence every time
|
||||
void fg_srandom(void) {
|
||||
// fgPrintf( FG_MATH, FG_INFO, "Seeding random number generater\n");
|
||||
|
||||
#ifdef HAVE_RAND
|
||||
srand(time(NULL));
|
||||
#else
|
||||
srandom(time(NULL));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// return a random number between [0.0, 1.0)
|
||||
double fg_random(void) {
|
||||
#ifdef HAVE_RAND
|
||||
return(rand() / (double)RAND_MAX);
|
||||
#else
|
||||
return(random() / (double)RAND_MAX);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.10 1998/11/07 19:07:03 curt
|
||||
// Enable release builds using the --without-logging option to the configure
|
||||
// script. Also a couple log message cleanups, plus some C to C++ comment
|
||||
// conversion.
|
||||
//
|
||||
// Revision 1.9 1998/11/06 21:17:26 curt
|
||||
// Converted to new logstream debugging facility. This allows release
|
||||
// builds with no messages at all (and no performance impact) by using
|
||||
// the -DFG_NDEBUG flag.
|
||||
//
|
||||
// Revision 1.8 1998/04/25 22:06:23 curt
|
||||
// Edited cvs log messages in source files ... bad bad bad!
|
||||
//
|
||||
// Revision 1.7 1998/04/24 00:43:13 curt
|
||||
// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
|
||||
//
|
||||
// Revision 1.6 1998/04/18 03:53:42 curt
|
||||
// Miscellaneous Tweaks.
|
||||
//
|
||||
// Revision 1.5 1998/04/03 22:10:29 curt
|
||||
// Converting to Gnu autoconf system.
|
||||
//
|
||||
// Revision 1.4 1998/02/03 23:20:28 curt
|
||||
// Lots of little tweaks to fix various consistency problems discovered by
|
||||
// Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
|
||||
// passed arguments along to the real printf(). Also incorporated HUD changes
|
||||
// by Michele America.
|
||||
//
|
||||
// Revision 1.3 1998/01/27 00:47:59 curt
|
||||
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
||||
// system and commandline/config file processing code.
|
||||
//
|
||||
// Revision 1.2 1997/12/30 20:47:48 curt
|
||||
// Integrated new event manager with subsystem initializations.
|
||||
//
|
||||
// Revision 1.1 1997/07/30 16:04:09 curt
|
||||
// Moved random routines from Utils/ to Math/
|
||||
//
|
||||
// Revision 1.1 1997/07/19 22:31:57 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,70 +0,0 @@
|
||||
// fg_random.h -- routines to handle random number generation
|
||||
//
|
||||
// Written by Curtis Olson, started July 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#ifndef _FG_RANDOM_H
|
||||
#define _FG_RANDOM_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// Seed the random number generater with time() so we don't see the
|
||||
// same sequence every time
|
||||
void fg_srandom(void);
|
||||
|
||||
// return a random number between [0.0, 1.0)
|
||||
double fg_random(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _FG_RANDOM_H
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.4 1998/11/07 19:07:04 curt
|
||||
// Enable release builds using the --without-logging option to the configure
|
||||
// script. Also a couple log message cleanups, plus some C to C++ comment
|
||||
// conversion.
|
||||
//
|
||||
// Revision 1.3 1998/04/21 17:03:48 curt
|
||||
// Prepairing for C++ integration.
|
||||
//
|
||||
// Revision 1.2 1998/01/22 02:59:38 curt
|
||||
// Changed #ifdef FILE_H to #ifdef _FILE_H
|
||||
//
|
||||
// Revision 1.1 1997/07/30 16:04:09 curt
|
||||
// Moved random routines from Utils/ to Math/
|
||||
//
|
||||
// Revision 1.2 1997/07/23 21:52:28 curt
|
||||
// Put comments around the text after an #endif for increased portability.
|
||||
//
|
||||
// Revision 1.1 1997/07/19 22:31:57 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,131 +0,0 @@
|
||||
//
|
||||
// interpolater.cxx -- routines to handle linear interpolation from a table of
|
||||
// x,y The table must be sorted by "x" in ascending order
|
||||
//
|
||||
// Written by Curtis Olson, started April 1998.
|
||||
//
|
||||
// Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#include <Include/compiler.h>
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Include/fg_zlib.h>
|
||||
#include <Misc/fgstream.hxx>
|
||||
|
||||
#include "interpolater.hxx"
|
||||
|
||||
|
||||
// Constructor -- loads the interpolation table from the specified
|
||||
// file
|
||||
fgINTERPTABLE::fgINTERPTABLE( const string& file ) {
|
||||
FG_LOG( FG_MATH, FG_INFO, "Initializing Interpolator for " << file );
|
||||
|
||||
fg_gzifstream in( file );
|
||||
if ( !in ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << file );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
size = 0;
|
||||
in >> skipcomment;
|
||||
while ( ! in.eof() ){
|
||||
if ( size < MAX_TABLE_SIZE ) {
|
||||
in >> table[size][0] >> table[size][1];
|
||||
size++;
|
||||
} else {
|
||||
FG_LOG( FG_MATH, FG_ALERT,
|
||||
"fgInterpolateInit(): Exceed max table size = "
|
||||
<< MAX_TABLE_SIZE );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Given an x value, linearly interpolate the y value from the table
|
||||
double fgINTERPTABLE::interpolate(double x) {
|
||||
int i;
|
||||
double y;
|
||||
|
||||
i = 0;
|
||||
|
||||
while ( (x > table[i][0]) && (i < size) ) {
|
||||
i++;
|
||||
}
|
||||
|
||||
// printf ("i = %d ", i);
|
||||
|
||||
if ( (i == 0) && (x < table[0][0]) ) {
|
||||
FG_LOG( FG_MATH, FG_ALERT,
|
||||
"fgInterpolateInit(): lookup error, x to small = " << x );
|
||||
return(0.0);
|
||||
}
|
||||
|
||||
if ( x > table[i][0] ) {
|
||||
FG_LOG( FG_MATH, FG_ALERT,
|
||||
"fgInterpolateInit(): lookup error, x to big = " << x );
|
||||
return(0.0);
|
||||
}
|
||||
|
||||
// y = y1 + (y0 - y1)(x - x1) / (x0 - x1)
|
||||
y = table[i][1] +
|
||||
( (table[i-1][1] - table[i][1]) *
|
||||
(x - table[i][0]) ) /
|
||||
(table[i-1][0] - table[i][0]);
|
||||
|
||||
return(y);
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
fgINTERPTABLE::~fgINTERPTABLE( void ) {
|
||||
}
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.7 1999/02/26 22:08:03 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.6 1999/01/27 04:46:16 curt
|
||||
// Portability tweaks by Bernie Bright.
|
||||
//
|
||||
// Revision 1.5 1998/11/06 21:17:27 curt
|
||||
// Converted to new logstream debugging facility. This allows release
|
||||
// builds with no messages at all (and no performance impact) by using
|
||||
// the -DFG_NDEBUG flag.
|
||||
//
|
||||
// Revision 1.4 1998/05/13 18:24:25 curt
|
||||
// Wrapped zlib calls so zlib can be optionally disabled.
|
||||
//
|
||||
// Revision 1.3 1998/04/25 15:05:01 curt
|
||||
// Changed "r" to "rb" in gzopen() options. This fixes bad behavior in win32.
|
||||
//
|
||||
// Revision 1.2 1998/04/22 13:18:10 curt
|
||||
// C++ - ified comments. Make file open errors fatal.
|
||||
//
|
||||
// Revision 1.1 1998/04/21 19:14:23 curt
|
||||
// Modified Files:
|
||||
// Makefile.am Makefile.in
|
||||
// Added Files:
|
||||
// interpolater.cxx interpolater.hxx
|
||||
//
|
||||
@@ -1,87 +0,0 @@
|
||||
//
|
||||
// interpolater.hxx -- routines to handle linear interpolation from a table of
|
||||
// x,y The table must be sorted by "x" in ascending order
|
||||
//
|
||||
// Written by Curtis Olson, started April 1998.
|
||||
//
|
||||
// Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#ifndef _INTERPOLATER_H
|
||||
#define _INTERPOLATER_H
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#include "Include/compiler.h"
|
||||
|
||||
#include STL_STRING
|
||||
FG_USING_STD(string);
|
||||
|
||||
#define MAX_TABLE_SIZE 32
|
||||
|
||||
|
||||
class fgINTERPTABLE {
|
||||
int size;
|
||||
double table[MAX_TABLE_SIZE][2];
|
||||
|
||||
public:
|
||||
|
||||
// Constructor -- loads the interpolation table from the specified
|
||||
// file
|
||||
fgINTERPTABLE( const string& file );
|
||||
|
||||
// Given an x value, linearly interpolate the y value from the table
|
||||
double interpolate(double x);
|
||||
|
||||
// Destructor
|
||||
~fgINTERPTABLE( void );
|
||||
};
|
||||
|
||||
|
||||
#endif // _INTERPOLATER_H
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.6 1999/03/02 01:01:50 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.5 1999/02/26 22:08:05 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.4 1999/01/27 04:46:17 curt
|
||||
// Portability tweaks by Bernie Bright.
|
||||
//
|
||||
// Revision 1.3 1998/11/06 21:17:28 curt
|
||||
// Converted to new logstream debugging facility. This allows release
|
||||
// builds with no messages at all (and no performance impact) by using
|
||||
// the -DFG_NDEBUG flag.
|
||||
//
|
||||
// Revision 1.2 1998/04/22 13:18:10 curt
|
||||
// C++ - ified comments. Make file open errors fatal.
|
||||
//
|
||||
// Revision 1.1 1998/04/21 19:14:23 curt
|
||||
// Modified Files:
|
||||
// Makefile.am Makefile.in
|
||||
// Added Files:
|
||||
// interpolater.cxx interpolater.hxx
|
||||
//
|
||||
@@ -1,90 +0,0 @@
|
||||
// leastsqs.h -- Implements a simple linear least squares best fit routine
|
||||
//
|
||||
// Written by Curtis Olson, started September 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program 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 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
///
|
||||
|
||||
|
||||
#ifndef _LEASTSQS_H
|
||||
#define _LEASTSQS_H
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Least squares fit:
|
||||
|
||||
y = b0 + b1x
|
||||
|
||||
n*sum(xi*yi) - (sum(xi)*sum(yi))
|
||||
b1 = --------------------------------
|
||||
n*sum(xi^2) - (sum(xi))^2
|
||||
|
||||
|
||||
b0 = sum(yi)/n - b1*(sum(xi)/n)
|
||||
*/
|
||||
|
||||
void least_squares(double *x, double *y, int n, double *m, double *b);
|
||||
|
||||
/* incrimentally update existing values with a new data point */
|
||||
void least_squares_update(double x, double y, double *m, double *b);
|
||||
|
||||
|
||||
/*
|
||||
return the least squares error:
|
||||
|
||||
(y[i] - y_hat[i])^2
|
||||
-------------------
|
||||
n
|
||||
*/
|
||||
double least_squares_error(double *x, double *y, int n, double m, double b);
|
||||
|
||||
|
||||
/*
|
||||
return the maximum least squares error:
|
||||
|
||||
(y[i] - y_hat[i])^2
|
||||
*/
|
||||
double least_squares_max_error(double *x, double *y, int n, double m, double b);
|
||||
|
||||
|
||||
#endif // _LEASTSQS_H
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.1 1999/03/13 17:34:45 curt
|
||||
// Moved to math subdirectory.
|
||||
//
|
||||
// Revision 1.2 1998/04/21 17:03:42 curt
|
||||
// Prepairing for C++ integration.
|
||||
//
|
||||
// Revision 1.1 1998/04/08 22:57:25 curt
|
||||
// Adopted Gnu automake/autoconf system.
|
||||
//
|
||||
// Revision 1.1 1998/03/19 02:54:48 curt
|
||||
// Reorganized into a class lib called fgDEM.
|
||||
//
|
||||
// Revision 1.1 1997/10/13 17:02:35 curt
|
||||
// Initial revision.
|
||||
//
|
||||
208
Math/mat3.h
208
Math/mat3.h
@@ -1,208 +0,0 @@
|
||||
/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
Public MAT3 include file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef MAT3_HAS_BEEN_INCLUDED
|
||||
#define MAT3_HAS_BEEN_INCLUDED
|
||||
|
||||
/* ----------------------------- Constants ------------------------------ */
|
||||
|
||||
/*
|
||||
* Make sure the math library .h file is included, in case it wasn't.
|
||||
*/
|
||||
|
||||
#ifndef HUGE
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "Include/fg_memory.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define MAT3_DET0 -1 /* Indicates singular mat */
|
||||
#define MAT3_EPSILON 1e-12 /* Close enough to zero */
|
||||
|
||||
#ifdef M_PI
|
||||
# define MAT3_PI M_PI
|
||||
#else
|
||||
# define MAT3_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#define USE_XTRA_MAT3_INLINES
|
||||
|
||||
/* ------------------------------ Types --------------------------------- */
|
||||
|
||||
typedef double MAT3mat[4][4]; /* 4x4 matrix */
|
||||
typedef double MAT3vec[3]; /* Vector */
|
||||
typedef double MAT3hvec[4]; /* Vector with homogeneous coord */
|
||||
|
||||
/* ------------------------------ Macros -------------------------------- */
|
||||
|
||||
extern MAT3mat identityMatrix;
|
||||
|
||||
/* Tests if a number is within EPSILON of zero */
|
||||
#define MAT3_IS_ZERO(N) ((N) < MAT3_EPSILON && (N) > -MAT3_EPSILON)
|
||||
|
||||
/* Sets a vector to the three given values */
|
||||
#define MAT3_SET_VEC(V,X,Y,Z) ((V)[0]=(X), (V)[1]=(Y), (V)[2]=(Z))
|
||||
|
||||
/* Tests a vector for all components close to zero */
|
||||
#define MAT3_IS_ZERO_VEC(V) (MAT3_IS_ZERO((V)[0]) && \
|
||||
MAT3_IS_ZERO((V)[1]) && \
|
||||
MAT3_IS_ZERO((V)[2]))
|
||||
|
||||
/* Dot product of two vectors */
|
||||
#define MAT3_DOT_PRODUCT(V1,V2) \
|
||||
((V1)[0]*(V2)[0] + (V1)[1]*(V2)[1] + (V1)[2]*(V2)[2])
|
||||
|
||||
/* Copy one vector to other */
|
||||
#define MAT3_COPY_VEC(TO,FROM) ((TO)[0] = (FROM)[0], \
|
||||
(TO)[1] = (FROM)[1], \
|
||||
(TO)[2] = (FROM)[2])
|
||||
|
||||
/* Normalize vector to unit length, using TEMP as temporary variable.
|
||||
* TEMP will be zero if vector has zero length */
|
||||
#define MAT3_NORMALIZE_VEC(V,TEMP) \
|
||||
if ((TEMP = sqrt(MAT3_DOT_PRODUCT(V,V))) > MAT3_EPSILON) { \
|
||||
TEMP = 1.0 / TEMP; \
|
||||
MAT3_SCALE_VEC(V,V,TEMP); \
|
||||
} else TEMP = 0.0
|
||||
|
||||
/* Scale vector by given factor, storing result vector in RESULT_V */
|
||||
#define MAT3_SCALE_VEC(RESULT_V,V,SCALE) \
|
||||
MAT3_SET_VEC(RESULT_V, (V)[0]*(SCALE), (V)[1]*(SCALE), (V)[2]*(SCALE))
|
||||
|
||||
/* Adds vectors V1 and V2, storing result in RESULT_V */
|
||||
#define MAT3_ADD_VEC(RESULT_V,V1,V2) \
|
||||
MAT3_SET_VEC(RESULT_V, (V1)[0]+(V2)[0], (V1)[1]+(V2)[1], \
|
||||
(V1)[2]+(V2)[2])
|
||||
|
||||
/* Subtracts vector V2 from V1, storing result in RESULT_V */
|
||||
#define MAT3_SUB_VEC(RESULT_V,V1,V2) \
|
||||
MAT3_SET_VEC(RESULT_V, (V1)[0]-(V2)[0], (V1)[1]-(V2)[1], \
|
||||
(V1)[2]-(V2)[2])
|
||||
|
||||
/* Multiplies vectors V1 and V2, storing result in RESULT_V */
|
||||
#define MAT3_MULT_VEC(RESULT_V,V1,V2) \
|
||||
MAT3_SET_VEC(RESULT_V, (V1)[0]*(V2)[0], (V1)[1]*(V2)[1], \
|
||||
(V1)[2]*(V2)[2])
|
||||
|
||||
/* Sets RESULT_V to the linear combination of V1 and V2, scaled by
|
||||
* SCALE1 and SCALE2, respectively */
|
||||
#define MAT3_LINEAR_COMB(RESULT_V,SCALE1,V1,SCALE2,V2) \
|
||||
MAT3_SET_VEC(RESULT_V, (SCALE1)*(V1)[0] + (SCALE2)*(V2)[0], \
|
||||
(SCALE1)*(V1)[1] + (SCALE2)*(V2)[1], \
|
||||
(SCALE1)*(V1)[2] + (SCALE2)*(V2)[2])
|
||||
|
||||
/* Several of the vector macros are useful for homogeneous-coord vectors */
|
||||
#define MAT3_SET_HVEC(V,X,Y,Z,W) ((V)[0]=(X), (V)[1]=(Y), \
|
||||
(V)[2]=(Z), (V)[3]=(W))
|
||||
|
||||
#define MAT3_COPY_HVEC(TO,FROM) ((TO)[0] = (FROM)[0], \
|
||||
(TO)[1] = (FROM)[1], \
|
||||
(TO)[2] = (FROM)[2], \
|
||||
(TO)[3] = (FROM)[3])
|
||||
|
||||
#define MAT3_SCALE_HVEC(RESULT_V,V,SCALE) \
|
||||
MAT3_SET_HVEC(RESULT_V, (V)[0]*(SCALE), (V)[1]*(SCALE), \
|
||||
(V)[2]*(SCALE), (V)[3]*(SCALE))
|
||||
|
||||
#define MAT3_ADD_HVEC(RESULT_V,V1,V2) \
|
||||
MAT3_SET_HVEC(RESULT_V, (V1)[0]+(V2)[0], (V1)[1]+(V2)[1], \
|
||||
(V1)[2]+(V2)[2], (V1)[3]+(V2)[3])
|
||||
|
||||
#define MAT3_SUB_HVEC(RESULT_V,V1,V2) \
|
||||
MAT3_SET_HVEC(RESULT_V, (V1)[0]-(V2)[0], (V1)[1]-(V2)[1], \
|
||||
(V1)[2]-(V2)[2], (V1)[3]-(V2)[3])
|
||||
|
||||
#define MAT3_MULT_HVEC(RESULT_V,V1,V2) \
|
||||
MAT3_SET_HVEC(RESULT_V, (V1)[0]*(V2)[0], (V1)[1]*(V2)[1], \
|
||||
(V1)[2]*(V2)[2], (V1)[3]*(V2)[3])
|
||||
|
||||
/* ------------------------------ Entries ------------------------------- */
|
||||
|
||||
|
||||
#define MAT3identity(mat) fgmemcpy( mat, identityMatrix, sizeof(MAT3mat) )
|
||||
#define MAT3zero(mat) fgmemzero( mat, sizeof(MAT3mat) )
|
||||
#define MAT3copy(to, from) fgmemcpy( to, from, sizeof(MAT3mat) )
|
||||
|
||||
#if defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
# define MAT3mult_vec( result_vec, vec, mat) { \
|
||||
MAT3vec tempvec; \
|
||||
tempvec[0]=vec[0]*mat[0][0]+vec[1]*mat[1][0]+vec[2]*mat[2][0]+mat[3][0]; \
|
||||
tempvec[1]=vec[0]*mat[0][1]+vec[1]*mat[1][1]+vec[2]*mat[2][1]+mat[3][1]; \
|
||||
tempvec[2]=vec[0]*mat[0][2]+vec[1]*mat[1][2]+vec[2]*mat[2][2]+mat[3][2]; \
|
||||
result_vec[0] = tempvec[0]; \
|
||||
result_vec[1] = tempvec[1]; \
|
||||
result_vec[2] = tempvec[2]; \
|
||||
}
|
||||
|
||||
# define MAT3cross_product(result_vec, vec1, vec2) { \
|
||||
MAT3vec tempvec; \
|
||||
tempvec[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1]; \
|
||||
tempvec[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2]; \
|
||||
tempvec[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0]; \
|
||||
result_vec[0] = tempvec[0]; \
|
||||
result_vec[1] = tempvec[1]; \
|
||||
result_vec[2] = tempvec[2]; \
|
||||
}
|
||||
|
||||
# define MAT3mult( result_mat, mat1, mat2) { \
|
||||
register int i, j; \
|
||||
MAT3mat tmp_mat; \
|
||||
for (i = 0; i < 4; i++) \
|
||||
for (j = 0; j < 4; j++) \
|
||||
tmp_mat[i][j] = (mat1[i][0] * mat2[0][j] + \
|
||||
mat1[i][1] * mat2[1][j] + \
|
||||
mat1[i][2] * mat2[2][j] + \
|
||||
mat1[i][3] * mat2[3][j]); \
|
||||
fgmemcpy(result_mat, tmp_mat, sizeof(MAT3mat)); \
|
||||
}
|
||||
|
||||
#else // !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/* In MAT3mat.c */
|
||||
void MAT3mult(MAT3mat result, MAT3mat, MAT3mat);
|
||||
void MAT3mult_vec(MAT3vec result_vec, MAT3vec vec, MAT3mat mat);
|
||||
void MAT3cross_product(MAT3vec result,MAT3vec,MAT3vec);
|
||||
|
||||
#endif // defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
/* In MAT3geom.c */
|
||||
void MAT3direction_matrix (MAT3mat result_mat, MAT3mat mat);
|
||||
int MAT3normal_matrix (MAT3mat result_mat, MAT3mat mat);
|
||||
void MAT3rotate (MAT3mat result_mat, MAT3vec axis, double angle_in_radians);
|
||||
void MAT3translate (MAT3mat result_mat, MAT3vec trans);
|
||||
void MAT3scale (MAT3mat result_mat, MAT3vec scale);
|
||||
void MAT3shear(MAT3mat result_mat, double xshear, double yshear);
|
||||
|
||||
void MAT3transpose (MAT3mat result, MAT3mat);
|
||||
int MAT3invert (MAT3mat result, MAT3mat);
|
||||
void MAT3print (MAT3mat, FILE *fp);
|
||||
void MAT3print_formatted (MAT3mat, FILE *fp,
|
||||
char *title, char *head, char *format, char *tail);
|
||||
int MAT3equal( void );
|
||||
double MAT3trace( void );
|
||||
int MAT3power( void );
|
||||
int MAT3column_reduce( void );
|
||||
int MAT3kernel_basis( void );
|
||||
|
||||
/* In MAT3vec.c */
|
||||
int MAT3mult_hvec (MAT3hvec result_vec, MAT3hvec vec, MAT3mat mat, int normalize);
|
||||
void MAT3perp_vec(MAT3vec result_vec, MAT3vec vec, int is_unit);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* MAT3_HAS_BEEN_INCLUDED */
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */
|
||||
|
||||
|
||||
#ifndef _MAT3DEFS_H
|
||||
#define _MAT3DEFS_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
/* #include <Math/mat3err.h> */
|
||||
#include <Math/mat3.h>
|
||||
|
||||
/* ----------------------------- Constants ------------------------------ */
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define CNULL ((char *) NULL)
|
||||
|
||||
/* ------------------------------ Macros -------------------------------- */
|
||||
|
||||
#define ALLOCN(P,T,N,M) \
|
||||
if ((P = (T *) malloc((unsigned) (N) * sizeof(T))) == NULL) \
|
||||
ERR_ERROR(MAT3_errid, ERR_FATAL, (ERR_ALLOC1, M)); \
|
||||
else
|
||||
|
||||
#define FREE(P) free((char *) (P))
|
||||
|
||||
#define ABS(A) ((A) > 0 ? (A) : -(A))
|
||||
#define MIN(A,B) ((A) < (B) ? (A) : (B))
|
||||
#define MAX(A,B) ((A) > (B) ? (A) : (B))
|
||||
|
||||
#define SWAP(A,B,T) (T = A, A = B, B = T)
|
||||
|
||||
/* Is N within EPS of zero ? */
|
||||
#define IS_ZERO(N,EPS) ((N) < EPS && (N) > -EPS)
|
||||
|
||||
/* Macros for lu routines */
|
||||
#define LU_PERMUTE(p,i,j) { int LU_T; LU_T = p[i]; p[i] = p[j]; p[j] = LU_T; }
|
||||
|
||||
/* ------------------------- Internal Entries ---------------------------- */
|
||||
|
||||
/* ------------------------- Global Variables ---------------------------- */
|
||||
|
||||
/* extern ERRid *MAT3_errid; */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _MAT3DEFS_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef _MAT3ERR_H
|
||||
#define _MAT3ERR_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include "sph_errtypes.h"
|
||||
|
||||
#ifdef THINK_C
|
||||
/* We hide this from gnu's compiler, which doesn't understand it. */
|
||||
void SPH__error (int errtype, ...);
|
||||
#endif
|
||||
|
||||
|
||||
#define ERR_ERROR(A,B,C) \
|
||||
if (1) {char cstr[256]; sprintf C; SPH__error(ERR_MAT3_PACKAGE, cstr); } else
|
||||
|
||||
|
||||
#define ERR_S cstr,"%s\n"
|
||||
#define ERR_SI cstr,"%s: %d\n"
|
||||
#define ERR_SS cstr,"%s: %s\n"
|
||||
|
||||
#define ERR_SEVERE 0
|
||||
#define ERR_FATAL 0
|
||||
|
||||
#define ERR_ALLOC1 0
|
||||
|
||||
typedef int ERRid;
|
||||
|
||||
#define ERRregister_package(S) 100
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _MAT3ERR_H */
|
||||
110
Math/polar3d.cxx
110
Math/polar3d.cxx
@@ -1,110 +0,0 @@
|
||||
// polar.cxx -- routines to deal with polar math and transformations
|
||||
//
|
||||
// Written by Curtis Olson, started June 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Include/fg_constants.h>
|
||||
|
||||
#include "polar3d.hxx"
|
||||
|
||||
|
||||
// Find the Altitude above the Ellipsoid (WGS84) given the Earth
|
||||
// Centered Cartesian coordinate vector Distances are specified in
|
||||
// meters.
|
||||
double fgGeodAltFromCart(const Point3D& cp)
|
||||
{
|
||||
double t_lat, x_alpha, mu_alpha;
|
||||
double lat_geoc, radius;
|
||||
double result;
|
||||
|
||||
lat_geoc = FG_PI_2 - atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() );
|
||||
radius = sqrt( cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z() );
|
||||
|
||||
if( ( (FG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole
|
||||
|| ( (FG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole
|
||||
{
|
||||
result = radius - EQUATORIAL_RADIUS_M*E;
|
||||
} else {
|
||||
t_lat = tan(lat_geoc);
|
||||
x_alpha = E*EQUATORIAL_RADIUS_M/sqrt(t_lat*t_lat + E*E);
|
||||
mu_alpha = atan2(sqrt(RESQ_M - x_alpha*x_alpha),E*x_alpha);
|
||||
if (lat_geoc < 0) {
|
||||
mu_alpha = - mu_alpha;
|
||||
}
|
||||
result = (radius - x_alpha/cos(lat_geoc))*cos(mu_alpha - lat_geoc);
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.6 1999/01/27 04:46:19 curt
|
||||
// Portability tweaks by Bernie Bright.
|
||||
//
|
||||
// Revision 1.5 1998/10/18 01:17:13 curt
|
||||
// Point3D tweaks.
|
||||
//
|
||||
// Revision 1.4 1998/10/16 19:30:09 curt
|
||||
// C++-ified the comments.
|
||||
//
|
||||
// Revision 1.3 1998/10/16 00:50:29 curt
|
||||
// Added point3d.hxx to replace cheezy fgPoint3d struct.
|
||||
//
|
||||
// Revision 1.2 1998/08/24 20:04:11 curt
|
||||
// Various "inline" code optimizations contributed by Norman Vine.
|
||||
//
|
||||
// Revision 1.1 1998/07/08 14:40:08 curt
|
||||
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
|
||||
// Updated fg_geodesy comments to reflect that routines expect and produce
|
||||
// meters.
|
||||
//
|
||||
// Revision 1.2 1998/05/03 00:45:49 curt
|
||||
// Commented out a debugging printf.
|
||||
//
|
||||
// Revision 1.1 1998/05/02 01:50:11 curt
|
||||
// polar.[ch] renamed to polar3d.[ch]
|
||||
//
|
||||
// Revision 1.6 1998/04/25 22:06:23 curt
|
||||
// Edited cvs log messages in source files ... bad bad bad!
|
||||
//
|
||||
// Revision 1.5 1998/01/27 00:48:00 curt
|
||||
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
||||
// system and commandline/config file processing code.
|
||||
//
|
||||
// Revision 1.4 1998/01/19 19:27:12 curt
|
||||
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
||||
// This should simplify things tremendously.
|
||||
//
|
||||
// Revision 1.3 1997/12/15 23:54:54 curt
|
||||
// Add xgl wrappers for debugging.
|
||||
// Generate terrain normals on the fly.
|
||||
//
|
||||
// Revision 1.2 1997/07/31 22:52:27 curt
|
||||
// Working on redoing internal coordinate systems & scenery transformations.
|
||||
//
|
||||
// Revision 1.1 1997/07/07 21:02:36 curt
|
||||
// Initial revision.
|
||||
|
||||
120
Math/polar3d.hxx
120
Math/polar3d.hxx
@@ -1,120 +0,0 @@
|
||||
// polar.hxx -- routines to deal with polar math and transformations
|
||||
//
|
||||
// Written by Curtis Olson, started June 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#ifndef _POLAR_HXX
|
||||
#define _POLAR_HXX
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
|
||||
#include <Include/fg_constants.h>
|
||||
#include <Math/point3d.hxx>
|
||||
|
||||
|
||||
// Find the Altitude above the Ellipsoid (WGS84) given the Earth
|
||||
// Centered Cartesian coordinate vector Distances are specified in
|
||||
// meters.
|
||||
double fgGeodAltFromCart(const Point3D& cp);
|
||||
|
||||
|
||||
// Convert a polar coordinate to a cartesian coordinate. Lon and Lat
|
||||
// must be specified in radians. The FG convention is for distances
|
||||
// to be specified in meters
|
||||
inline Point3D fgPolarToCart3d(const Point3D& p) {
|
||||
double tmp = cos( p.lat() ) * p.radius();
|
||||
|
||||
return Point3D( cos( p.lon() ) * tmp,
|
||||
sin( p.lon() ) * tmp,
|
||||
sin( p.lat() ) * p.radius() );
|
||||
}
|
||||
|
||||
|
||||
// Convert a cartesian coordinate to polar coordinates (lon/lat
|
||||
// specified in radians. Distances are specified in meters.
|
||||
inline Point3D fgCartToPolar3d(const Point3D& cp) {
|
||||
return Point3D( atan2( cp.y(), cp.x() ),
|
||||
FG_PI_2 -
|
||||
atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ),
|
||||
sqrt(cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z()) );
|
||||
}
|
||||
|
||||
|
||||
#endif // _POLAR_HXX
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.5 1999/01/27 04:46:20 curt
|
||||
// Portability tweaks by Bernie Bright.
|
||||
//
|
||||
// Revision 1.4 1998/10/16 19:30:07 curt
|
||||
// C++-ified the comments.
|
||||
//
|
||||
// Revision 1.3 1998/10/16 00:50:30 curt
|
||||
// Added point3d.hxx to replace cheezy fgPoint3d struct.
|
||||
//
|
||||
// Revision 1.2 1998/08/24 20:04:12 curt
|
||||
// Various "inline" code optimizations contributed by Norman Vine.
|
||||
//
|
||||
// Revision 1.1 1998/07/08 14:40:09 curt
|
||||
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
|
||||
// Updated fg_geodesy comments to reflect that routines expect and produce
|
||||
// meters.
|
||||
//
|
||||
// Revision 1.1 1998/05/02 01:50:11 curt
|
||||
// polar.[ch] renamed to polar3d.[ch]
|
||||
//
|
||||
// Revision 1.9 1998/04/25 22:06:23 curt
|
||||
// Edited cvs log messages in source files ... bad bad bad!
|
||||
//
|
||||
// Revision 1.8 1998/04/21 17:03:50 curt
|
||||
// Prepairing for C++ integration.
|
||||
//
|
||||
// Revision 1.7 1998/01/27 00:48:00 curt
|
||||
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
||||
// system and commandline/config file processing code.
|
||||
//
|
||||
// Revision 1.6 1998/01/22 02:59:39 curt
|
||||
// Changed #ifdef FILE_H to #ifdef _FILE_H
|
||||
//
|
||||
// Revision 1.5 1998/01/19 19:27:13 curt
|
||||
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
||||
// This should simplify things tremendously.
|
||||
//
|
||||
// Revision 1.4 1997/12/15 23:54:55 curt
|
||||
// Add xgl wrappers for debugging.
|
||||
// Generate terrain normals on the fly.
|
||||
//
|
||||
// Revision 1.3 1997/07/31 22:52:28 curt
|
||||
// Working on redoing internal coordinate systems & scenery transformations.
|
||||
//
|
||||
// Revision 1.2 1997/07/23 21:52:21 curt
|
||||
// Put comments around the text after an #endif for increased portability.
|
||||
//
|
||||
// Revision 1.1 1997/07/07 21:02:37 curt
|
||||
// Initial revision.
|
||||
//
|
||||
|
||||
162
Math/vector.cxx
162
Math/vector.cxx
@@ -1,162 +0,0 @@
|
||||
// vector.cxx -- additional vector routines
|
||||
//
|
||||
// Written by Curtis Olson, started December 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// #include <Include/fg_types.h>
|
||||
|
||||
#include "vector.hxx"
|
||||
|
||||
#include "mat3.h"
|
||||
|
||||
|
||||
#if !defined( USE_XTRA_MAT3_INLINES )
|
||||
// Map a vector onto the plane specified by normal
|
||||
void map_vec_onto_cur_surface_plane(MAT3vec normal, MAT3vec v0, MAT3vec vec,
|
||||
MAT3vec result)
|
||||
{
|
||||
MAT3vec u1, v, tmp;
|
||||
|
||||
// calculate a vector "u1" representing the shortest distance from
|
||||
// the plane specified by normal and v0 to a point specified by
|
||||
// "vec". "u1" represents both the direction and magnitude of
|
||||
// this desired distance.
|
||||
|
||||
// u1 = ( (normal <dot> vec) / (normal <dot> normal) ) * normal
|
||||
|
||||
MAT3_SCALE_VEC( u1,
|
||||
normal,
|
||||
( MAT3_DOT_PRODUCT(normal, vec) /
|
||||
MAT3_DOT_PRODUCT(normal, normal)
|
||||
)
|
||||
);
|
||||
|
||||
// printf(" vec = %.2f, %.2f, %.2f\n", vec[0], vec[1], vec[2]);
|
||||
// printf(" v0 = %.2f, %.2f, %.2f\n", v0[0], v0[1], v0[2]);
|
||||
// printf(" u1 = %.2f, %.2f, %.2f\n", u1[0], u1[1], u1[2]);
|
||||
|
||||
// calculate the vector "v" which is the vector "vec" mapped onto
|
||||
// the plane specified by "normal" and "v0".
|
||||
|
||||
// v = v0 + vec - u1
|
||||
|
||||
MAT3_ADD_VEC(tmp, v0, vec);
|
||||
MAT3_SUB_VEC(v, tmp, u1);
|
||||
// printf(" v = %.2f, %.2f, %.2f\n", v[0], v[1], v[2]);
|
||||
|
||||
// Calculate the vector "result" which is "v" - "v0" which is a
|
||||
// directional vector pointing from v0 towards v
|
||||
|
||||
// result = v - v0
|
||||
|
||||
MAT3_SUB_VEC(result, v, v0);
|
||||
// printf(" result = %.2f, %.2f, %.2f\n",
|
||||
// result[0], result[1], result[2]);
|
||||
}
|
||||
#endif // !defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
|
||||
// Given a point p, and a line through p0 with direction vector d,
|
||||
// find the shortest distance from the point to the line
|
||||
double fgPointLine(MAT3vec p, MAT3vec p0, MAT3vec d) {
|
||||
MAT3vec u, u1, v;
|
||||
double ud, dd, tmp;
|
||||
|
||||
// u = p - p0
|
||||
MAT3_SUB_VEC(u, p, p0);
|
||||
|
||||
// calculate the projection, u1, of u along d.
|
||||
// u1 = ( dot_prod(u, d) / dot_prod(d, d) ) * d;
|
||||
ud = MAT3_DOT_PRODUCT(u, d);
|
||||
dd = MAT3_DOT_PRODUCT(d, d);
|
||||
tmp = ud / dd;
|
||||
|
||||
MAT3_SCALE_VEC(u1, d, tmp);;
|
||||
|
||||
// v = u - u1 = vector from closest point on line, p1, to the
|
||||
// original point, p.
|
||||
MAT3_SUB_VEC(v, u, u1);
|
||||
|
||||
return sqrt(MAT3_DOT_PRODUCT(v, v));
|
||||
}
|
||||
|
||||
|
||||
// Given a point p, and a line through p0 with direction vector d,
|
||||
// find the shortest distance (squared) from the point to the line
|
||||
double fgPointLineSquared(MAT3vec p, MAT3vec p0, MAT3vec d) {
|
||||
MAT3vec u, u1, v;
|
||||
double ud, dd, tmp;
|
||||
|
||||
// u = p - p0
|
||||
MAT3_SUB_VEC(u, p, p0);
|
||||
|
||||
// calculate the projection, u1, of u along d.
|
||||
// u1 = ( dot_prod(u, d) / dot_prod(d, d) ) * d;
|
||||
ud = MAT3_DOT_PRODUCT(u, d);
|
||||
dd = MAT3_DOT_PRODUCT(d, d);
|
||||
tmp = ud / dd;
|
||||
|
||||
MAT3_SCALE_VEC(u1, d, tmp);;
|
||||
|
||||
// v = u - u1 = vector from closest point on line, p1, to the
|
||||
// original point, p.
|
||||
MAT3_SUB_VEC(v, u, u1);
|
||||
|
||||
return ( MAT3_DOT_PRODUCT(v, v) );
|
||||
}
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.6 1999/03/25 19:02:28 curt
|
||||
// Minor optimization tweaks.
|
||||
//
|
||||
// Revision 1.5 1998/10/16 23:36:38 curt
|
||||
// c++-ifying.
|
||||
//
|
||||
// Revision 1.4 1998/10/16 00:50:31 curt
|
||||
// Added point3d.hxx to replace cheezy fgPoint3d struct.
|
||||
//
|
||||
// Revision 1.3 1998/08/24 20:04:12 curt
|
||||
// Various "inline" code optimizations contributed by Norman Vine.
|
||||
//
|
||||
// Revision 1.2 1998/07/24 21:34:38 curt
|
||||
// fgPointLine() rewritten into fgPointLineSquared() ... this ultimately saves
|
||||
// us from doing a sqrt().
|
||||
//
|
||||
// Revision 1.1 1998/07/08 14:40:10 curt
|
||||
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
|
||||
// Updated fg_geodesy comments to reflect that routines expect and produce
|
||||
// meters.
|
||||
//
|
||||
// Revision 1.3 1998/05/07 23:04:28 curt
|
||||
// Added a blank formating line!
|
||||
//
|
||||
// Revision 1.2 1998/01/19 19:27:13 curt
|
||||
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
||||
// This should simplify things tremendously.
|
||||
//
|
||||
// Revision 1.1 1997/12/22 04:13:17 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,94 +0,0 @@
|
||||
// vector.hxx -- additional vector routines
|
||||
//
|
||||
// Written by Curtis Olson, started December 1997.
|
||||
//
|
||||
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#ifndef _VECTOR_HXX
|
||||
#define _VECTOR_HXX
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
|
||||
#include "mat3.h"
|
||||
|
||||
|
||||
// Map a vector onto the plane specified by normal
|
||||
#if defined( USE_XTRA_MAT3_INLINES )
|
||||
# define map_vec_onto_cur_surface_plane(normal, v0, vec, result) { \
|
||||
double scale = ((normal[0]*vec[0]+normal[1]*vec[1]+normal[2]*vec[2]) / \
|
||||
(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2])); \
|
||||
result[0] = vec[0]-normal[0]*scale; \
|
||||
result[1] = vec[1]-normal[1]*scale; \
|
||||
result[2] = vec[2]-normal[2]*scale; \
|
||||
}
|
||||
#else
|
||||
void map_vec_onto_cur_surface_plane(MAT3vec normal, MAT3vec v0, MAT3vec vec,
|
||||
MAT3vec result);
|
||||
#endif //defined( USE_XTRA_MAT3_INLINES )
|
||||
|
||||
|
||||
// Given a point p, and a line through p0 with direction vector d,
|
||||
// find the shortest distance from the point to the line
|
||||
double fgPointLine(MAT3vec p, MAT3vec p0, MAT3vec d);
|
||||
|
||||
|
||||
// Given a point p, and a line through p0 with direction vector d,
|
||||
// find the shortest distance (squared) from the point to the line
|
||||
double fgPointLineSquared(MAT3vec p, MAT3vec p0, MAT3vec d);
|
||||
|
||||
|
||||
#endif // _VECTOR_HXX
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.4 1998/10/16 23:36:39 curt
|
||||
// c++-ifying.
|
||||
//
|
||||
// Revision 1.3 1998/08/24 20:04:13 curt
|
||||
// Various "inline" code optimizations contributed by Norman Vine.
|
||||
//
|
||||
// Revision 1.2 1998/07/24 21:34:38 curt
|
||||
// fgPointLine() rewritten into fgPointLineSquared() ... this ultimately saves
|
||||
// us from doing a sqrt().
|
||||
//
|
||||
// Revision 1.1 1998/07/08 14:40:10 curt
|
||||
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
|
||||
// Updated fg_geodesy comments to reflect that routines expect and produce
|
||||
// meters.
|
||||
//
|
||||
// Revision 1.4 1998/04/21 17:03:51 curt
|
||||
// Prepairing for C++ integration.
|
||||
//
|
||||
// Revision 1.3 1998/01/22 02:59:39 curt
|
||||
// Changed #ifdef FILE_H to #ifdef _FILE_H
|
||||
//
|
||||
// Revision 1.2 1998/01/19 19:27:14 curt
|
||||
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
||||
// This should simplify things tremendously.
|
||||
//
|
||||
// Revision 1.1 1997/12/22 04:13:18 curt
|
||||
// Initial revision.
|
||||
//
|
||||
|
||||
16
Misc/CREDITS
16
Misc/CREDITS
@@ -1,16 +0,0 @@
|
||||
The following files were unashamedly borrowed from other projects:
|
||||
|
||||
zfstream.hxx
|
||||
zfstream.cxx
|
||||
zlib/contrib/iostream
|
||||
|
||||
stopwatch.hxx was (blitz/time.h)
|
||||
blitz
|
||||
|
||||
Some modifications have been made to fit in with the FlightGear scheme of things.
|
||||
|
||||
As far as I'm aware they are all covered by GNU's licensing agreements.
|
||||
|
||||
Many thanks to their respective authors.
|
||||
|
||||
Bernie Bright (bbright@c031.aone.net.au)
|
||||
@@ -1,11 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
noinst_LIBRARIES = libMisc.a
|
||||
|
||||
libMisc_a_SOURCES = \
|
||||
fgstream.cxx fgstream.hxx \
|
||||
stopwatch.hxx \
|
||||
strutils.cxx strutils.hxx \
|
||||
zfstream.cxx zfstream.hxx
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib
|
||||
@@ -1,129 +0,0 @@
|
||||
// zlib input file stream wrapper.
|
||||
//
|
||||
// Written by Bernie Bright, 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
#ifndef _FGSTREAM_HXX
|
||||
#define _FGSTREAM_HXX
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Include/config.h"
|
||||
#endif
|
||||
|
||||
#include <Include/compiler.h>
|
||||
|
||||
#if defined( FG_HAVE_STD_INCLUDES )
|
||||
# include <istream>
|
||||
#elif defined ( FG_HAVE_NATIVE_SGI_COMPILERS )
|
||||
# include <CC/stream.h>
|
||||
#else
|
||||
# include <istream.h>
|
||||
#endif
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#include "zfstream.hxx"
|
||||
|
||||
FG_USING_STD(string);
|
||||
|
||||
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
|
||||
FG_USING_STD(istream);
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Envelope class for gzifstream.
|
||||
//
|
||||
class fg_gzifstream : private gzifstream_base, public istream
|
||||
{
|
||||
public:
|
||||
//
|
||||
fg_gzifstream();
|
||||
|
||||
// Attempt to open a file with and without ".gz" extension.
|
||||
fg_gzifstream( const string& name,
|
||||
ios_openmode io_mode = ios_in | ios_binary );
|
||||
|
||||
//
|
||||
fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
|
||||
|
||||
// Attempt to open a file with and without ".gz" extension.
|
||||
void open( const string& name,
|
||||
ios_openmode io_mode = ios_in|ios_binary );
|
||||
|
||||
void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
|
||||
|
||||
void close() { gzbuf.close(); }
|
||||
|
||||
bool is_open() { return gzbuf.is_open(); }
|
||||
|
||||
private:
|
||||
// Not defined!
|
||||
fg_gzifstream( const fg_gzifstream& );
|
||||
void operator= ( const fg_gzifstream& );
|
||||
};
|
||||
|
||||
// istream manipulator that skips to end of line.
|
||||
istream& skipeol( istream& in );
|
||||
|
||||
// istream manipulator that skips over white space.
|
||||
istream& skipws( istream& in );
|
||||
|
||||
// istream manipulator that skips comments and white space.
|
||||
// A comment starts with '#'.
|
||||
istream& skipcomment( istream& in );
|
||||
|
||||
|
||||
#endif /* _FGSTREAM_HXX */
|
||||
|
||||
// $Log$
|
||||
// Revision 1.9 1999/03/27 14:04:25 curt
|
||||
// Added is_open() so we can check if the open() succeeded.
|
||||
//
|
||||
// Revision 1.8 1999/03/02 01:01:55 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.7 1999/02/26 22:08:08 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.6 1999/01/19 20:41:46 curt
|
||||
// Portability updates contributed by Bernie Bright.
|
||||
//
|
||||
// Revision 1.5 1998/11/06 14:05:13 curt
|
||||
// More portability improvements by Bernie Bright.
|
||||
//
|
||||
// Revision 1.4 1998/10/16 00:50:56 curt
|
||||
// Remove leading _ from a couple defines.
|
||||
//
|
||||
// Revision 1.3 1998/10/13 00:10:06 curt
|
||||
// More portability changes to help with windoze compilation problems.
|
||||
//
|
||||
// Revision 1.2 1998/09/24 15:22:18 curt
|
||||
// Additional enhancements.
|
||||
//
|
||||
// Revision 1.1 1998/09/01 19:06:29 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,79 +0,0 @@
|
||||
// String utilities.
|
||||
//
|
||||
// Written by Bernie Bright, 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "strutils.hxx"
|
||||
|
||||
const string whitespace = " \n\r\t";
|
||||
|
||||
//
|
||||
string
|
||||
trimleft( const string& s, const string& trimmings )
|
||||
{
|
||||
string result;
|
||||
string::size_type pos = s.find_first_not_of( trimmings );
|
||||
if ( pos != string::npos )
|
||||
{
|
||||
result.assign( s.substr( pos ) );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string
|
||||
trimright( const string& s, const string& trimmings )
|
||||
{
|
||||
string result;
|
||||
|
||||
string::size_type pos = s.find_last_not_of( trimmings );
|
||||
if ( pos == string::npos )
|
||||
{
|
||||
// Not found, return the original string.
|
||||
result = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.assign( s.substr( 0, pos+1 ) );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string
|
||||
trim( const string& s, const string& trimmings )
|
||||
{
|
||||
return trimright( trimleft( s, trimmings ), trimmings );
|
||||
}
|
||||
|
||||
// $Log$
|
||||
// Revision 1.2 1998/10/18 01:17:15 curt
|
||||
// Point3D tweaks.
|
||||
//
|
||||
// Revision 1.1 1998/09/01 19:06:30 curt
|
||||
// Initial revision.
|
||||
//
|
||||
@@ -1,84 +0,0 @@
|
||||
// String utilities.
|
||||
//
|
||||
// Written by Bernie Bright, 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
#ifndef STRUTILS_H
|
||||
#define STRUTILS_H
|
||||
|
||||
#include <Include/compiler.h>
|
||||
#include STL_STRING
|
||||
|
||||
#ifdef FG_HAVE_STD_INCLUDES
|
||||
# include <cstdlib>
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
FG_USING_STD(string);
|
||||
|
||||
// Default characters to remove.
|
||||
extern const string whitespace;
|
||||
|
||||
// Returns a string with trailing characters removed.
|
||||
string trimleft( const string& s, const string& trimmings = whitespace );
|
||||
|
||||
// Returns a string with leading characters removed.
|
||||
string trimright( const string& s, const string& trimmings = whitespace );
|
||||
|
||||
// Returns a string with leading and trailing characters removed.
|
||||
string trim( const string& s, const string& trimmings = whitespace );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
inline double
|
||||
atof( const string& str )
|
||||
{
|
||||
return ::atof( str.c_str() );
|
||||
}
|
||||
|
||||
inline int
|
||||
atoi( const string& str )
|
||||
{
|
||||
return ::atoi( str.c_str() );
|
||||
}
|
||||
|
||||
#endif // STRUTILS_H
|
||||
|
||||
// $Log$
|
||||
// Revision 1.6 1999/03/02 01:01:56 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.5 1999/02/26 22:08:09 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.4 1999/01/19 20:41:47 curt
|
||||
// Portability updates contributed by Bernie Bright.
|
||||
//
|
||||
// Revision 1.3 1998/10/16 00:50:57 curt
|
||||
// Remove leading _ from a couple defines.
|
||||
//
|
||||
// Revision 1.2 1998/10/13 00:10:07 curt
|
||||
// More portability changes to help with windoze compilation problems.
|
||||
//
|
||||
// Revision 1.1 1998/09/01 19:06:31 curt
|
||||
// Initial revision.
|
||||
//
|
||||
230
NEWS
Normal file
230
NEWS
Normal file
@@ -0,0 +1,230 @@
|
||||
New in 0.0.19pre2
|
||||
* September 1, 2002
|
||||
|
||||
* Fixed various build problems (one show stopper with the interpreters
|
||||
subdir)
|
||||
|
||||
|
||||
New in 0.0.19pre1
|
||||
* August 31, 2002
|
||||
|
||||
* Modernized the autoconf/make scripts.
|
||||
* Removed efence support (in favor of valgrind.)
|
||||
|
||||
* Added a javascript interpreter.
|
||||
* SGSocket reimplimented on top of plib/net libs.
|
||||
* Added a new random number generation algorithm.
|
||||
* Total rewrite of the strutils package.
|
||||
|
||||
* Patch for the random number seed.
|
||||
* IA-64 w/ Intel compiler fixes.
|
||||
* MSVC/MINGW fixes.
|
||||
* Mac OS X fixes.
|
||||
* Irix fixes.
|
||||
* Code clean ups to remove warning messages.
|
||||
* Optimizations in sg_binobj to reduce the amout of memory copying
|
||||
needed when loading a binobj format file.
|
||||
* Fixed a couple places where variables could be used before they were
|
||||
initialized.
|
||||
* Various property manager fixes and improvements.
|
||||
* Fixes to cloud layer management code.
|
||||
* Made the sky dome more flexible to facilitate use in other applications.
|
||||
|
||||
|
||||
New in 0.0.18
|
||||
* April 20, 2002
|
||||
|
||||
* Created a src/libs subdirectory for several packages that need to be
|
||||
installed by the user but are used by many other packages and may already
|
||||
be installed. So we just bundle the source separately as a convenience
|
||||
if the user needs to build and install these.
|
||||
* Upgrade to zlib-1.1.4 (security fix)
|
||||
* Upgrade to metakit-2.4.2-32.tar.gz (latest upstream release)
|
||||
* Added support for point objects in the scenery file format.
|
||||
* Additions to the binary file format to make it *much* more flexible.
|
||||
For each major primative type: points, triangles, fans, and strips, you
|
||||
can specify an index list of vertices, normals, colors, and texture
|
||||
coordinates. You can skip any of these you like to save on space.
|
||||
* Added support for new file features in the binary -> ascii scenery file
|
||||
decoder.
|
||||
* Various code clean ups.
|
||||
* Separate XML I/O operations into a separate header file.
|
||||
* Major property manager rewrite, then lots of followup cleaning and
|
||||
improvements.
|
||||
|
||||
|
||||
New in 0.0.17 (final)
|
||||
* February 16, 2002
|
||||
|
||||
* Explicitely reset the glBlendFunc() after drawing the moon for the
|
||||
Voodoo2 linux driver since it seems to have a bug in glPopAttrib().
|
||||
|
||||
|
||||
New in 0.0.17pre2
|
||||
* February 13, 2002
|
||||
|
||||
* Replaced some cout's with SG_LOG's
|
||||
|
||||
|
||||
New in 0.0.17pre1
|
||||
* February 12, 2002
|
||||
|
||||
* Removed metakit and zlib from build process. Tarballs are still included
|
||||
for those who's systems don't provide these packages.
|
||||
* MSVC fixes.
|
||||
* IRIX fixes.
|
||||
* Mingwin fixes.
|
||||
* Mac OS X fixes.
|
||||
* FreeBSD fixes.
|
||||
* Added support for Intel's C++ compiler under Linux.
|
||||
* Attempt to build in support for various non-compatible automake/autoconf
|
||||
versions.
|
||||
* Fix for a problem that could lead to a bogus build for people with voodoo
|
||||
cards.
|
||||
* Added Norman's jpegfactory code which can create jpeg format screen shots
|
||||
of a live running application.
|
||||
* implemented set/get_log_classes and set/get_log_priority.
|
||||
* Socket library improvements.
|
||||
* Added a C++ exception abstraction.
|
||||
* Property manager fixes and improvements including node path caching
|
||||
and debug tracing of property reads/writes.
|
||||
* Updates/fixes to xml handling.
|
||||
|
||||
|
||||
New in 0.0.16
|
||||
* July 12, 2001
|
||||
* Various changes to the property manager implimentation to better support
|
||||
dumping out the desired portions of the property tree to file.
|
||||
* Don't compile the metakit demos by default (causes problems for Irix)'
|
||||
* Other various tweaks for Irix.
|
||||
* Added a virtual destructor to XMLVisitor to fix a warning message.
|
||||
* Check for valid hostname lookup in sg_socket.cxx
|
||||
* Add a function to return modified julian date without creating an
|
||||
entire SGTime class. This avoids an extraneous warning about not
|
||||
being able to find a timezone.
|
||||
* Created a mailing list for cvs commit messages.
|
||||
* Fixed a potential array under/over run bug in interpolator.cxx
|
||||
* Removed all references to SGValue from the property manager. Added
|
||||
support for an "archive" bit in the property manager to control
|
||||
which values get written out.
|
||||
* Added SGCommandState class so that commands can compile and save
|
||||
copies of their arguments for efficiency if they are called multiple
|
||||
times.
|
||||
* Added Brian Baul's "tr" tiled rendering low level support library.
|
||||
This along with some higher level code in flightgear allows us to do
|
||||
ultra-hires tiled screen dumps suitable for large format printers.
|
||||
(Norman Vine)
|
||||
|
||||
|
||||
New in 0.0.15
|
||||
* June 20, 2001
|
||||
* Various bug fixes, tweaks, and optimizations.
|
||||
* Added a command manager (analogous to the property manager)
|
||||
* Better Irix Mips support.
|
||||
* Various gcc-3.0 fixes.
|
||||
* Various MSVC fixes.
|
||||
* Added MSVC project files (automatically generated from the unix
|
||||
automake configuration files.)
|
||||
* Removed total size limitation on interpolation table module.
|
||||
* Various Cygwin fixes.
|
||||
* Added some convenience functions to point3d.
|
||||
* Various compiler warning fixes.
|
||||
* Added a thread wrapper class (currently only supports pthreads)
|
||||
* Added IO routines for a lowlevel, native simgear binary 3d file
|
||||
format optimized for TerraGear terrain.
|
||||
* Better endianness checking and support for the binary file
|
||||
read/write routines.
|
||||
* Added doxygen comments for all public interface code. Documentation
|
||||
can be accessed via the SimGear web page.
|
||||
* Many FG -> SG name space changes for better consistancy throughout
|
||||
this package.
|
||||
* Added property aliases, repeated name tags, and a general xml
|
||||
inclusion facilities. Many other property manager clean ups
|
||||
following a complete rewrite.
|
||||
* Fixed some critical null pointer bugs in property manager.
|
||||
* Magnetic variation can now be fetched for any arbitrary location.
|
||||
|
||||
|
||||
New in 0.0.14
|
||||
* December 14, 2000
|
||||
* Added a module to manage waypoints and routes, calculate bearing and
|
||||
distance to next waypoint, lateral distance off route, etc.
|
||||
* Moved some of the basic time management code over from flightgear.
|
||||
* Bucket dimensions can be returned in meters
|
||||
* Added SOCK_STREAM (TCP) socket support to the networking code.
|
||||
* Updated random number generator interface so application can provide
|
||||
it's own seed value as well as use the default time seed.
|
||||
* Added a routine to calculate the distance between a point and a line segment.
|
||||
* Updates to the property manager and the property list loader/saver.
|
||||
* Added an explanation of the rational behind our terrain texture coordinate
|
||||
generation code.
|
||||
* Fixed sky dome so that the color at the horizon will always match
|
||||
the specified fog color.
|
||||
* Did a fair amount of fg -> sg name space updating (lots left to do.)
|
||||
* Added support for KAI C++ on linux.
|
||||
* MSVC tweaks.
|
||||
* MacOS tweaks.
|
||||
* FreeBSD tweaks.
|
||||
|
||||
|
||||
New in 0.0.13
|
||||
* September 14, 2000
|
||||
* Added support for reading and writing xml files (easyxml)
|
||||
* Then updates to property manager and xml code.
|
||||
* Update magnetic variation code.
|
||||
* Sky code now uses glPushAttrib and glPopAttrib so it plays better with
|
||||
other ssg based apps.
|
||||
* MacOS tweaks.
|
||||
* MSVC tweaks.
|
||||
|
||||
|
||||
New in 0.0.12
|
||||
* July 19, 2000
|
||||
* Converted project license from GPL to LGPL.
|
||||
* Moved low level IO (socket, file, serial) code over to SimGear.
|
||||
* Moved ephemeral code into simgear
|
||||
* Moved basic world time code into simgear
|
||||
* Added a property manager (registry)
|
||||
* Some documentation added.
|
||||
|
||||
|
||||
New in 0.0.11
|
||||
* July 3, 2000
|
||||
* Replaced gdbm with metakit
|
||||
* Added drop in sky (depends on plib)
|
||||
* Added spherical course and dist given two points calculations
|
||||
* MSVC5 fixes
|
||||
* Math/bucket/tiling tweaks from Norman Vine
|
||||
|
||||
|
||||
New in 0.0.7
|
||||
* March 29, 2000
|
||||
* Added support for RedHat package building contributed by Habibie
|
||||
<habibie@MailandNews.com>
|
||||
* Added gdbm to SimGear. Many systems will already have gdbm installed so
|
||||
it is only built if it doesn't already exist on the user's platform.
|
||||
gdbm is a set of database routines that use extendible hashing and works
|
||||
similar to the standard UNIX dbm routines. This guarantees the availability
|
||||
of gdbm to any application that uses SimGear.
|
||||
* Optimizations and bullet proofing of magnetic variation code by Norman
|
||||
Vine and Ed Williams
|
||||
|
||||
|
||||
New in 0.0.6
|
||||
* March 27, 2000
|
||||
* Added Nima World Magnetic Model 2000 contributed by Ed Williams
|
||||
* Fixes for MSVC++
|
||||
|
||||
|
||||
New in 0.0.5
|
||||
* March 17, 2000
|
||||
* Restructured directory layout to facilitate windows/mac IDE builds.
|
||||
|
||||
|
||||
New in 0.0.4
|
||||
* Removed mat3.h and friends (we now use plib's sg lib for these sorts of
|
||||
things.)
|
||||
|
||||
|
||||
New in 0.0.3
|
||||
* Release that conincides with FlightGear-0.7.2
|
||||
@@ -1,24 +0,0 @@
|
||||
noinst_LIBRARIES = libPUI.a
|
||||
|
||||
EXTRA_DIST = complex.cxx simple.cxx
|
||||
|
||||
libPUI_a_SOURCES = \
|
||||
pu.h puLocal.h \
|
||||
pu.cxx \
|
||||
puBox.cxx \
|
||||
puButton.cxx \
|
||||
puButtonBox.cxx \
|
||||
puDialogBox.cxx \
|
||||
puFrame.cxx \
|
||||
puInput.cxx \
|
||||
puInterface.cxx \
|
||||
puMenuBar.cxx \
|
||||
puObject.cxx \
|
||||
puOneShot.cxx \
|
||||
puPopup.cxx \
|
||||
puPopupMenu.cxx \
|
||||
puSlider.cxx \
|
||||
puText.cxx
|
||||
|
||||
INCLUDES += -I$(top_builddir)
|
||||
|
||||
332
PUI/complex.cxx
332
PUI/complex.cxx
@@ -1,332 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
#include "pu.h"
|
||||
|
||||
/***********************************\
|
||||
* *
|
||||
* These are the PUI widget pointers *
|
||||
* *
|
||||
\***********************************/
|
||||
|
||||
puMenuBar *main_menu_bar ;
|
||||
puButton *hide_menu_button ;
|
||||
puDialogBox *dialog_box ;
|
||||
puText *dialog_box_message ;
|
||||
puOneShot *dialog_box_ok_button ;
|
||||
puText *timer_text ;
|
||||
puSlider *rspeedSlider;
|
||||
|
||||
|
||||
/***********************************\
|
||||
* *
|
||||
* This is a generic tumbling cube *
|
||||
* *
|
||||
\***********************************/
|
||||
|
||||
GLfloat light_diffuse [] = {0.0, 1.0, 0.0, 1.0} ; /* Red diffuse light. */
|
||||
GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0} ; /* Infinite light location. */
|
||||
|
||||
GLfloat cube_n[6][3] = /* Normals */
|
||||
{
|
||||
{-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0},
|
||||
{ 0.0,-1.0, 0.0}, {0.0, 0.0, 1.0}, {0.0, 0.0,-1.0}
|
||||
} ;
|
||||
|
||||
GLint cube_i[6][4] = /* Vertex indices */
|
||||
{
|
||||
{0, 1, 2, 3}, {3, 2, 6, 7}, {7, 6, 5, 4},
|
||||
{4, 5, 1, 0}, {5, 6, 2, 1}, {7, 4, 0, 3}
|
||||
} ;
|
||||
|
||||
GLfloat cube_v[8][3] = /* Vertices */
|
||||
{
|
||||
{-1.0,-1.0, 1.0}, {-1.0,-1.0,-1.0}, {-1.0, 1.0,-1.0}, {-1.0, 1.0, 1.0},
|
||||
{ 1.0,-1.0, 1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, { 1.0, 1.0, 1.0}
|
||||
} ;
|
||||
|
||||
|
||||
static int firsttime;
|
||||
|
||||
void drawCube (void)
|
||||
{
|
||||
|
||||
if ( firsttime )
|
||||
{
|
||||
/*
|
||||
Deliberately do this only once - it's a better test of
|
||||
PUI's attempts to leave the OpenGL state undisturbed
|
||||
*/
|
||||
|
||||
firsttime = FALSE ;
|
||||
glLightfv ( GL_LIGHT0, GL_DIFFUSE , light_diffuse ) ;
|
||||
glLightfv ( GL_LIGHT0, GL_POSITION, light_position ) ;
|
||||
glEnable ( GL_LIGHT0 ) ;
|
||||
glEnable ( GL_LIGHTING ) ;
|
||||
glEnable ( GL_DEPTH_TEST ) ;
|
||||
glMatrixMode ( GL_PROJECTION ) ;
|
||||
gluPerspective ( 40.0, 1.0, 1.0, 10.0 ) ;
|
||||
glMatrixMode ( GL_MODELVIEW ) ;
|
||||
gluLookAt ( 0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ) ;
|
||||
glTranslatef ( 0.0, 0.0, -1.0 ) ;
|
||||
glRotatef ( 60.0, 1.0, 0.0, 0.0 ) ;
|
||||
}
|
||||
|
||||
glCullFace ( GL_FRONT ) ;
|
||||
glEnable ( GL_CULL_FACE ) ;
|
||||
// glRotatef ( 1.0f, 0.0, 0.0, 1.0 ) ; /* Tumble that cube! */
|
||||
|
||||
glBegin ( GL_QUADS ) ;
|
||||
|
||||
for ( int i = 0 ; i < 6 ; i++ )
|
||||
{
|
||||
glNormal3fv ( &cube_n[i][0] ) ;
|
||||
glVertex3fv ( cube_v[cube_i[i][0]] ) ; glVertex3fv ( cube_v[cube_i[i][1]] ) ;
|
||||
glVertex3fv ( cube_v[cube_i[i][2]] ) ; glVertex3fv ( cube_v[cube_i[i][3]] ) ;
|
||||
}
|
||||
|
||||
glEnd () ;
|
||||
}
|
||||
|
||||
/********************************\
|
||||
* *
|
||||
* End of cube renderer in OpenGL *
|
||||
* *
|
||||
\********************************/
|
||||
|
||||
|
||||
/**************************************\
|
||||
* *
|
||||
* These three functions capture mouse *
|
||||
* and keystrokes (special and mundane) *
|
||||
* from GLUT and pass them on to PUI. *
|
||||
* *
|
||||
\**************************************/
|
||||
|
||||
static void specialfn ( int key, int, int )
|
||||
{
|
||||
puKeyboard ( key + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN ) ;
|
||||
glutPostRedisplay () ;
|
||||
}
|
||||
|
||||
static void keyfn ( unsigned char key, int, int )
|
||||
{
|
||||
puKeyboard ( key, PU_DOWN ) ;
|
||||
glutPostRedisplay () ;
|
||||
}
|
||||
|
||||
static void motionfn ( int x, int y )
|
||||
{
|
||||
puMouse ( x, y ) ;
|
||||
glutPostRedisplay () ;
|
||||
}
|
||||
|
||||
static void mousefn ( int button, int updown, int x, int y )
|
||||
{
|
||||
puMouse ( button, updown, x, y ) ;
|
||||
glutPostRedisplay () ;
|
||||
}
|
||||
|
||||
/**************************************\
|
||||
* *
|
||||
* This function redisplays the PUI and *
|
||||
* the tumbling cube, flips the double *
|
||||
* buffer and then asks GLUT to post a *
|
||||
* redisplay command - so we re-render *
|
||||
* at maximum rate. *
|
||||
* *
|
||||
\**************************************/
|
||||
|
||||
static void displayfn (void)
|
||||
{
|
||||
/* Clear the screen */
|
||||
|
||||
glClearColor ( 0.0, 0.0, 0.0, 1.0 ) ;
|
||||
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
|
||||
|
||||
/* Draw the tumbling cube */
|
||||
|
||||
float val ; rspeedSlider->getValue ( &val ) ;
|
||||
|
||||
glRotatef( 4*val, 15.0, 10.0 , 5.0 );
|
||||
|
||||
drawCube () ;
|
||||
|
||||
/* Update the 'timer' */
|
||||
|
||||
time_t t = time ( NULL ) ;
|
||||
timer_text -> setLabel ( ctime ( & t ) ) ;
|
||||
|
||||
/* Make PUI redraw */
|
||||
|
||||
puDisplay () ;
|
||||
|
||||
/* Off we go again... */
|
||||
|
||||
glutSwapBuffers () ;
|
||||
glutPostRedisplay () ;
|
||||
}
|
||||
|
||||
|
||||
/***********************************\
|
||||
* *
|
||||
* Here are the PUI widget callback *
|
||||
* functions. *
|
||||
* *
|
||||
\***********************************/
|
||||
|
||||
void hide_menu_cb ( puObject *cb )
|
||||
{
|
||||
if ( cb -> getValue () )
|
||||
{
|
||||
main_menu_bar -> reveal () ;
|
||||
hide_menu_button->setLegend ( "Hide Menu" ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
main_menu_bar -> hide () ;
|
||||
hide_menu_button->setLegend ( "Show Menu" ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void go_away_cb ( puObject * )
|
||||
{
|
||||
/*
|
||||
Delete the dialog box when its 'OK' button is pressed.
|
||||
|
||||
This seems to crash on MSVC compilers - probably because
|
||||
I delete dialog_box - whose member function is calling
|
||||
this function. Hence we return to something that is
|
||||
in a distinctly 'iffy' state.
|
||||
*/
|
||||
|
||||
delete dialog_box ;
|
||||
dialog_box = NULL ;
|
||||
}
|
||||
|
||||
void mk_dialog ( char *txt )
|
||||
{
|
||||
dialog_box = new puDialogBox ( 150, 50 ) ;
|
||||
{
|
||||
new puFrame ( 0, 0, 400, 100 ) ;
|
||||
dialog_box_message = new puText ( 10, 70 ) ;
|
||||
dialog_box_message -> setLabel ( txt ) ;
|
||||
dialog_box_ok_button = new puOneShot ( 180, 10, 240, 50 ) ;
|
||||
dialog_box_ok_button -> setLegend ( "OK" ) ;
|
||||
dialog_box_ok_button -> makeReturnDefault ( TRUE ) ;
|
||||
dialog_box_ok_button -> setCallback ( go_away_cb ) ;
|
||||
}
|
||||
dialog_box -> close () ;
|
||||
dialog_box -> reveal () ;
|
||||
}
|
||||
|
||||
void ni_cb ( puObject * )
|
||||
{
|
||||
mk_dialog ( "Sorry, that function isn't implemented" ) ;
|
||||
}
|
||||
|
||||
void about_cb ( puObject * )
|
||||
{
|
||||
mk_dialog ( "This is the PUI 'complex' program" ) ;
|
||||
}
|
||||
|
||||
void help_cb ( puObject * )
|
||||
{
|
||||
mk_dialog ( "Sorry, no help is available for this demo" ) ;
|
||||
}
|
||||
|
||||
void edit_cb ( puObject * )
|
||||
{
|
||||
}
|
||||
|
||||
void exit_cb ( puObject * )
|
||||
{
|
||||
fprintf ( stderr, "Exiting PUI demo program.\n" ) ;
|
||||
exit ( 1 ) ;
|
||||
}
|
||||
|
||||
/* Menu bar entries: */
|
||||
|
||||
char *file_submenu [] = { "Exit", "Close", "--------", "Print", "--------", "Save", "New", NULL } ;
|
||||
puCallback file_submenu_cb [] = { exit_cb, exit_cb, NULL, ni_cb , NULL, ni_cb, ni_cb, NULL } ;
|
||||
|
||||
char *edit_submenu [] = { "Edit text", NULL } ;
|
||||
puCallback edit_submenu_cb [] = { edit_cb, NULL } ;
|
||||
|
||||
char *help_submenu [] = { "About...", "Help", NULL } ;
|
||||
puCallback help_submenu_cb [] = { about_cb, help_cb, NULL } ;
|
||||
|
||||
|
||||
void sliderCB( puObject *sliderObj)
|
||||
{
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
firsttime = TRUE;
|
||||
|
||||
#ifdef VOODOO
|
||||
glutInitWindowPosition( 0, 0 ) ;
|
||||
#endif
|
||||
glutInitWindowSize ( 640, 480 ) ;
|
||||
glutInit ( &argc, argv ) ;
|
||||
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
|
||||
glutCreateWindow ( "Complex PUI Application" ) ;
|
||||
glutDisplayFunc ( displayfn ) ;
|
||||
glutKeyboardFunc ( keyfn ) ;
|
||||
glutSpecialFunc ( specialfn ) ;
|
||||
glutMouseFunc ( mousefn ) ;
|
||||
glutMotionFunc ( motionfn ) ;
|
||||
glutPassiveMotionFunc ( motionfn ) ;
|
||||
glutIdleFunc ( displayfn ) ;
|
||||
|
||||
puInit () ;
|
||||
|
||||
#ifdef VOODOO
|
||||
puShowCursor () ;
|
||||
#endif
|
||||
|
||||
puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ) ;
|
||||
puSetDefaultColourScheme ( 0.8, 0.8, 0.8 ) ;
|
||||
|
||||
timer_text = new puText ( 300, 10 ) ;
|
||||
timer_text -> setColour ( PUCOL_LABEL, 1.0, 1.0, 1.0 ) ;
|
||||
|
||||
/* Make a button to hide the menu bar */
|
||||
|
||||
hide_menu_button = new puButton ( 10, 10, 150, 50 ) ;
|
||||
hide_menu_button->setValue ( TRUE ) ;
|
||||
hide_menu_button->setLegend ( "Hide Menu" ) ;
|
||||
hide_menu_button->setCallback ( hide_menu_cb ) ;
|
||||
hide_menu_button->makeReturnDefault ( TRUE ) ;
|
||||
|
||||
/* Make the menu bar */
|
||||
|
||||
main_menu_bar = new puMenuBar () ;
|
||||
{
|
||||
main_menu_bar -> add_submenu ( "File", file_submenu, file_submenu_cb ) ;
|
||||
main_menu_bar -> add_submenu ( "Edit", edit_submenu, edit_submenu_cb ) ;
|
||||
main_menu_bar -> add_submenu ( "Help", help_submenu, help_submenu_cb ) ;
|
||||
}
|
||||
main_menu_bar -> close () ;
|
||||
|
||||
rspeedSlider = new puSlider (20,80,150,TRUE);
|
||||
rspeedSlider->setDelta(0.1);
|
||||
rspeedSlider->setCBMode( PUSLIDER_DELTA );
|
||||
rspeedSlider->setCallback(sliderCB);
|
||||
|
||||
glutMainLoop () ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
|
||||
332
PUI/pu.cxx
332
PUI/pu.cxx
@@ -1,332 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
#include <assert.h>
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
|
||||
#define PU_STRING_X_FUDGE 6
|
||||
#define PU_STRING_Y_FUDGE 6
|
||||
|
||||
int puRefresh = TRUE ;
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
|
||||
static int puWindowWidth = 400 ;
|
||||
static int puWindowHeight = 400 ;
|
||||
|
||||
int puGetWindowHeight () { return puWindowHeight ; }
|
||||
int puGetWindowWidth () { return puWindowWidth ; }
|
||||
|
||||
void puSetWindowSize ( int width, int height )
|
||||
{
|
||||
puWindowWidth = width ;
|
||||
puWindowHeight = height ;
|
||||
}
|
||||
|
||||
static int fontBase = 0;
|
||||
static int fontSize[257];
|
||||
#else
|
||||
|
||||
int puGetWindowHeight () { return glutGet ( (GLenum) GLUT_WINDOW_HEIGHT ) ; }
|
||||
int puGetWindowWidth () { return glutGet ( (GLenum) GLUT_WINDOW_WIDTH ) ; }
|
||||
|
||||
void puSetWindowSize ( int width, int height )
|
||||
{
|
||||
fprintf ( stderr, "PUI: puSetWindowSize shouldn't be used with GLUT.\n" ) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
puColour _puDefaultColourTable[] =
|
||||
{
|
||||
{ 0.5f, 0.5f, 0.5f, 1.0f }, /* PUCOL_FOREGROUND */
|
||||
{ 0.3f, 0.3f, 0.3f, 1.0f }, /* PUCOL_BACKGROUND */
|
||||
{ 0.7f, 0.7f, 0.7f, 1.0f }, /* PUCOL_HIGHLIGHT */
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f }, /* PUCOL_LABEL */
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, /* PUCOL_TEXT */
|
||||
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f } /* ILLEGAL */
|
||||
} ;
|
||||
|
||||
|
||||
puValue::~puValue () {}
|
||||
|
||||
static int _puCursor_enable = FALSE ;
|
||||
static int _puCursor_x = 0 ;
|
||||
static int _puCursor_y = 0 ;
|
||||
static float _puCursor_bgcolour [4] = { 1.0f, 1.0f, 1.0f, 1.0f } ;
|
||||
static float _puCursor_fgcolour [4] = { 0.0f, 0.0f, 0.0f, 1.0f } ;
|
||||
|
||||
void puHideCursor ( void ) { _puCursor_enable = FALSE ; }
|
||||
void puShowCursor ( void ) { _puCursor_enable = TRUE ; }
|
||||
int puCursorIsHidden ( void ) { return ! _puCursor_enable ; }
|
||||
|
||||
void puCursor ( int x, int y )
|
||||
{
|
||||
_puCursor_x = x ;
|
||||
_puCursor_y = y ;
|
||||
}
|
||||
|
||||
int puGetStringDescender ( void *fnt )
|
||||
{
|
||||
if ( fnt == NULL )
|
||||
fnt = PUFONT_9_BY_15 ;
|
||||
|
||||
if ( fnt == PUFONT_8_BY_13 ) return 2 ;
|
||||
if ( fnt == PUFONT_9_BY_15 ) return 3 ;
|
||||
if ( fnt == PUFONT_TIMES_ROMAN_10 ) return 2 ;
|
||||
if ( fnt == PUFONT_TIMES_ROMAN_24 ) return 5 ;
|
||||
if ( fnt == PUFONT_HELVETICA_10 ) return 2 ;
|
||||
if ( fnt == PUFONT_HELVETICA_12 ) return 3 ;
|
||||
if ( fnt == PUFONT_HELVETICA_18 ) return 4 ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int puGetStringHeight ( void *fnt )
|
||||
{
|
||||
/* Height *excluding* descender */
|
||||
if ( fnt == NULL )
|
||||
fnt = PUFONT_9_BY_15 ;
|
||||
|
||||
if ( fnt == PUFONT_8_BY_13 ) return 9 ;
|
||||
if ( fnt == PUFONT_9_BY_15 ) return 10 ;
|
||||
if ( fnt == PUFONT_TIMES_ROMAN_10 ) return 7 ;
|
||||
if ( fnt == PUFONT_TIMES_ROMAN_24 ) return 17 ;
|
||||
if ( fnt == PUFONT_HELVETICA_10 ) return 8 ;
|
||||
if ( fnt == PUFONT_HELVETICA_12 ) return 9 ;
|
||||
if ( fnt == PUFONT_HELVETICA_18 ) return 14 ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int puGetStringWidth ( void *fnt, char *str )
|
||||
{
|
||||
|
||||
if ( str == NULL )
|
||||
return 0 ;
|
||||
|
||||
int res = 0 ;
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
while ( *str != '\0' )
|
||||
{
|
||||
res += fontSize [ *str ] ;
|
||||
str++ ;
|
||||
}
|
||||
#else
|
||||
if ( fnt == NULL )
|
||||
fnt = PUFONT_9_BY_15 ;
|
||||
|
||||
while ( *str != '\0' )
|
||||
{
|
||||
res += glutBitmapWidth ( fnt, *str ) ;
|
||||
str++ ;
|
||||
}
|
||||
#endif
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
|
||||
void puDrawString ( void *fnt, char *str, int x, int y )
|
||||
{
|
||||
if ( str == NULL )
|
||||
return ;
|
||||
|
||||
glRasterPos2f((float)x, (float)y);
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
/*
|
||||
Display a string:
|
||||
indicate start of glyph display lists
|
||||
*/
|
||||
|
||||
glListBase (fontBase);
|
||||
|
||||
/* Now draw the characters in a string */
|
||||
|
||||
int len = strlen(str);
|
||||
glCallLists(len, GL_UNSIGNED_BYTE, str);
|
||||
glListBase(0);
|
||||
#else
|
||||
if ( fnt == NULL )
|
||||
fnt = PUFONT_9_BY_15 ;
|
||||
|
||||
while ( *str != '\0' )
|
||||
{
|
||||
glutBitmapCharacter ( fnt, *str ) ;
|
||||
str++ ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void puDrawCursor ( int x, int y )
|
||||
{
|
||||
glColor4fv ( _puCursor_bgcolour ) ;
|
||||
|
||||
glBegin ( GL_TRIANGLES ) ;
|
||||
glVertex2i ( x, y ) ;
|
||||
glVertex2i ( x + 13, y - 4 ) ;
|
||||
glVertex2i ( x + 4, y - 13 ) ;
|
||||
|
||||
glVertex2i ( x + 8, y - 3 ) ;
|
||||
glVertex2i ( x + 17, y - 12 ) ;
|
||||
glVertex2i ( x + 12, y - 17 ) ;
|
||||
|
||||
glVertex2i ( x + 12, y - 17 ) ;
|
||||
glVertex2i ( x + 3, y - 8 ) ;
|
||||
glVertex2i ( x + 8, y - 3 ) ;
|
||||
glEnd () ;
|
||||
|
||||
glColor4fv ( _puCursor_fgcolour ) ;
|
||||
|
||||
glBegin ( GL_TRIANGLES ) ;
|
||||
glVertex2i ( x+1, y-1 ) ;
|
||||
glVertex2i ( x + 11, y - 4 ) ;
|
||||
glVertex2i ( x + 4, y - 11 ) ;
|
||||
|
||||
glVertex2i ( x + 8, y - 5 ) ;
|
||||
glVertex2i ( x + 15, y - 12 ) ;
|
||||
glVertex2i ( x + 12, y - 15 ) ;
|
||||
|
||||
glVertex2i ( x + 12, y - 15 ) ;
|
||||
glVertex2i ( x + 5, y - 8 ) ;
|
||||
glVertex2i ( x + 8, y - 5 ) ;
|
||||
glEnd () ;
|
||||
}
|
||||
|
||||
void puInit ( void )
|
||||
{
|
||||
static int firsttime = TRUE ;
|
||||
|
||||
if ( firsttime )
|
||||
{
|
||||
puInterface *base_interface = new puInterface ( 0, 0 ) ;
|
||||
puPushInterface ( base_interface ) ;
|
||||
puPushLiveInterface ( base_interface ) ;
|
||||
firsttime = FALSE ;
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
|
||||
/* Create bitmaps for the device context font's first 256 glyphs */
|
||||
|
||||
fontBase = glGenLists(256);
|
||||
assert(fontBase);
|
||||
HDC hdc = wglGetCurrentDC();
|
||||
|
||||
/* Make the system font the device context's selected font */
|
||||
|
||||
SelectObject (hdc, GetStockObject (SYSTEM_FONT));
|
||||
|
||||
int *tempSize = &fontSize[1];
|
||||
|
||||
if ( ! GetCharWidth32 ( hdc, 1, 255, tempSize ) &&
|
||||
! GetCharWidth ( hdc, 1, 255, tempSize ) )
|
||||
{
|
||||
LPVOID lpMsgBuf ;
|
||||
|
||||
FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0, NULL ) ;
|
||||
|
||||
fprintf ( stderr, "PUI: Error: %s\n", (char *)lpMsgBuf ) ;
|
||||
LocalFree ( lpMsgBuf ) ;
|
||||
}
|
||||
|
||||
wglUseFontBitmaps ( hdc, 0, 256, fontBase ) ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void puSetOpenGLState ( void )
|
||||
{
|
||||
int w = puGetWindowWidth () ;
|
||||
int h = puGetWindowHeight () ;
|
||||
|
||||
glPushAttrib ( GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_TRANSFORM_BIT ) ;
|
||||
glDisable ( GL_LIGHTING ) ;
|
||||
glDisable ( GL_FOG ) ;
|
||||
glDisable ( GL_TEXTURE_2D ) ;
|
||||
glDisable ( GL_DEPTH_TEST ) ;
|
||||
glDisable ( GL_CULL_FACE ) ;
|
||||
|
||||
glViewport ( 0, 0, w, h ) ;
|
||||
glMatrixMode ( GL_PROJECTION ) ;
|
||||
glPushMatrix () ;
|
||||
glLoadIdentity () ;
|
||||
gluOrtho2D ( 0, w, 0, h ) ;
|
||||
glMatrixMode ( GL_MODELVIEW ) ;
|
||||
glPushMatrix () ;
|
||||
glLoadIdentity () ;
|
||||
}
|
||||
|
||||
static void puRestoreOpenGLState ( void )
|
||||
{
|
||||
glMatrixMode ( GL_PROJECTION ) ;
|
||||
glPopMatrix () ;
|
||||
glMatrixMode ( GL_MODELVIEW ) ;
|
||||
glPopMatrix () ;
|
||||
glPopAttrib () ;
|
||||
}
|
||||
|
||||
|
||||
void puDisplay ( void )
|
||||
{
|
||||
puSetOpenGLState () ;
|
||||
puGetUltimateLiveInterface () -> draw ( 0, 0 ) ;
|
||||
|
||||
int h = puGetWindowHeight () ;
|
||||
|
||||
if ( _puCursor_enable )
|
||||
puDrawCursor ( _puCursor_x,
|
||||
h - _puCursor_y ) ;
|
||||
|
||||
puRestoreOpenGLState () ;
|
||||
}
|
||||
|
||||
int puKeyboard ( int key, int updown )
|
||||
{
|
||||
return puGetBaseLiveInterface () -> checkKey ( key, updown ) ;
|
||||
}
|
||||
|
||||
|
||||
static int last_buttons = 0 ;
|
||||
int puMouse ( int button, int updown, int x, int y )
|
||||
{
|
||||
puCursor ( x, y ) ;
|
||||
|
||||
int h = puGetWindowHeight () ;
|
||||
|
||||
if ( updown == PU_DOWN )
|
||||
last_buttons |= ( 1 << button ) ;
|
||||
else
|
||||
last_buttons &= ~( 1 << button ) ;
|
||||
|
||||
return puGetBaseLiveInterface () -> checkHit ( button, updown, x,
|
||||
h - y ) ;
|
||||
}
|
||||
|
||||
int puMouse ( int x, int y )
|
||||
{
|
||||
puCursor ( x, y ) ;
|
||||
|
||||
if ( last_buttons == 0 )
|
||||
return FALSE ;
|
||||
|
||||
int button = (last_buttons & (1<<PU_LEFT_BUTTON )) ? PU_LEFT_BUTTON :
|
||||
(last_buttons & (1<<PU_MIDDLE_BUTTON)) ? PU_MIDDLE_BUTTON :
|
||||
(last_buttons & (1<<PU_RIGHT_BUTTON )) ? PU_RIGHT_BUTTON : 0 ;
|
||||
|
||||
int h = puGetWindowHeight () ;
|
||||
|
||||
return puGetBaseLiveInterface () -> checkHit ( button, PU_DRAG, x,
|
||||
h - y ) ;
|
||||
}
|
||||
|
||||
805
PUI/pu.h
805
PUI/pu.h
@@ -1,805 +0,0 @@
|
||||
#ifndef _PU_H_
|
||||
#define _PU_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
Webster's Dictionary (for American English) permits
|
||||
Color or Colour as acceptable spellings - but
|
||||
The Oxford English Dictionary (for English) only
|
||||
permits Colour.
|
||||
|
||||
Hence, the logical thing to do is to use 'colour',
|
||||
which *ought* to be acceptable on both sides of
|
||||
the atlantic.
|
||||
|
||||
However, as a concession to the illogical:
|
||||
*/
|
||||
|
||||
#define setColorScheme setColourScheme
|
||||
#define setColor setColour
|
||||
#define getColor getColour
|
||||
#define puColor puColour
|
||||
#define puSetColor puSetColour
|
||||
#define puSetDefaultColorScheme puSetDefaultColourScheme
|
||||
#define puGetDefaultColorScheme puGetDefaultColourScheme
|
||||
|
||||
|
||||
typedef void *puFont ;
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
#define PU_LEFT_BUTTON 0
|
||||
#define PU_LEFT_BUTTON 0
|
||||
#define PU_MIDDLE_BUTTON 1
|
||||
#define PU_RIGHT_BUTTON 2
|
||||
#define PU_DOWN 0
|
||||
#define PU_UP 1
|
||||
|
||||
#define PUFONT_8_BY_13 ((void*)3)
|
||||
#define PUFONT_9_BY_15 ((void*)2)
|
||||
#define PUFONT_TIMES_ROMAN_10 ((void*)4)
|
||||
#define PUFONT_TIMES_ROMAN_24 ((void*)5)
|
||||
#define PUFONT_HELVETICA_10 ((void*)6)
|
||||
#define PUFONT_HELVETICA_12 ((void*)7)
|
||||
#define PUFONT_HELVETICA_18 ((void*)8)
|
||||
|
||||
#else
|
||||
|
||||
#define PUFONT_8_BY_13 GLUT_BITMAP_8_BY_13
|
||||
#define PUFONT_9_BY_15 GLUT_BITMAP_9_BY_15
|
||||
#define PUFONT_TIMES_ROMAN_10 GLUT_BITMAP_TIMES_ROMAN_10
|
||||
#define PUFONT_TIMES_ROMAN_24 GLUT_BITMAP_TIMES_ROMAN_24
|
||||
#define PUFONT_HELVETICA_10 GLUT_BITMAP_HELVETICA_10
|
||||
#define PUFONT_HELVETICA_12 GLUT_BITMAP_HELVETICA_12
|
||||
#define PUFONT_HELVETICA_18 GLUT_BITMAP_HELVETICA_18
|
||||
|
||||
#define PU_LEFT_BUTTON GLUT_LEFT_BUTTON
|
||||
#define PU_MIDDLE_BUTTON GLUT_MIDDLE_BUTTON
|
||||
#define PU_RIGHT_BUTTON GLUT_RIGHT_BUTTON
|
||||
#define PU_DOWN GLUT_DOWN
|
||||
#define PU_UP GLUT_UP
|
||||
#endif // PU_NOT_USING_GLUT
|
||||
|
||||
#define PU_UP_AND_DOWN 254
|
||||
#define PU_DRAG 255
|
||||
#define PU_CONTINUAL PU_DRAG
|
||||
|
||||
#define PU_KEY_GLUT_SPECIAL_OFFSET 256
|
||||
|
||||
#ifdef PU_NOT_USING_GLUT
|
||||
#define PU_KEY_F1 (1 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F2 (2 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F3 (3 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F4 (4 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F5 (5 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F6 (6 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F7 (7 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F8 (8 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F9 (9 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F10 (10 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F11 (11 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F12 (12 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_LEFT (100 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_UP (101 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_RIGHT (102 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_DOWN (103 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_PAGE_UP (104 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_PAGE_DOWN (105 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_HOME (106 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_END (107 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_INSERT (108 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
|
||||
#else
|
||||
#define PU_KEY_F1 (GLUT_KEY_F1 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F2 (GLUT_KEY_F2 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F3 (GLUT_KEY_F3 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F4 (GLUT_KEY_F4 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F5 (GLUT_KEY_F5 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F6 (GLUT_KEY_F6 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F7 (GLUT_KEY_F7 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F8 (GLUT_KEY_F8 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F9 (GLUT_KEY_F9 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F10 (GLUT_KEY_F10 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F11 (GLUT_KEY_F11 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_F12 (GLUT_KEY_F12 + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_LEFT (GLUT_KEY_LEFT + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_UP (GLUT_KEY_UP + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_RIGHT (GLUT_KEY_RIGHT + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_DOWN (GLUT_KEY_DOWN + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_PAGE_UP (GLUT_KEY_PAGE_UP + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_PAGE_DOWN (GLUT_KEY_PAGE_DOWN + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_HOME (GLUT_KEY_HOME + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_END (GLUT_KEY_END + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#define PU_KEY_INSERT (GLUT_KEY_INSERT + PU_KEY_GLUT_SPECIAL_OFFSET)
|
||||
#endif // PU_NOT_USING_GLUT
|
||||
|
||||
#define PUPLACE_DEFAULT PUPLACE_RIGHT
|
||||
#define PUPLACE_ABOVE 0
|
||||
#define PUPLACE_BELOW 1
|
||||
#define PUPLACE_LEFT 2
|
||||
#define PUPLACE_RIGHT 3
|
||||
|
||||
#define PUCOL_FOREGROUND 0
|
||||
#define PUCOL_BACKGROUND 1
|
||||
#define PUCOL_HIGHLIGHT 2
|
||||
#define PUCOL_LABEL 3
|
||||
#define PUCOL_LEGEND 4
|
||||
#define PUCOL_MAX 5
|
||||
|
||||
#define PUSLIDER_CLICK 0
|
||||
#define PUSLIDER_ALWAYS 1
|
||||
#define PUSLIDER_DELTA 2
|
||||
|
||||
/* These styles may be negated to get 'highlighted' graphics */
|
||||
|
||||
#define PUSTYLE_DEFAULT PUSTYLE_SHADED
|
||||
#define PUSTYLE_NONE 0
|
||||
#define PUSTYLE_PLAIN 1
|
||||
#define PUSTYLE_BEVELLED 2
|
||||
#define PUSTYLE_BOXED 3
|
||||
#define PUSTYLE_DROPSHADOW 4
|
||||
#define PUSTYLE_SPECIAL_UNDERLINED 5
|
||||
#define PUSTYLE_SMALL_BEVELLED 6
|
||||
#define PUSTYLE_RADIO 7
|
||||
#define PUSTYLE_SHADED 8
|
||||
#define PUSTYLE_SMALL_SHADED 9
|
||||
#define PUSTYLE_MAX 10
|
||||
|
||||
/* These are the gaps that we try to leave around text objects */
|
||||
|
||||
#define PUSTR_TGAP 5
|
||||
#define PUSTR_BGAP 5
|
||||
#define PUSTR_LGAP 5
|
||||
#define PUSTR_RGAP 5
|
||||
#define PUSTR_MAX_HEIGHT ( 25 + PUSTR_TGAP + PUSTR_BGAP )
|
||||
|
||||
#define PU_RADIO_BUTTON_SIZE 16
|
||||
|
||||
extern int puRefresh ;
|
||||
|
||||
#define PUCLASS_VALUE 0x00000001
|
||||
#define PUCLASS_OBJECT 0x00000002
|
||||
#define PUCLASS_INTERFACE 0x00000004
|
||||
#define PUCLASS_FRAME 0x00000008
|
||||
#define PUCLASS_TEXT 0x00000010
|
||||
#define PUCLASS_BUTTON 0x00000020
|
||||
#define PUCLASS_ONESHOT 0x00000040
|
||||
#define PUCLASS_POPUP 0x00000080
|
||||
#define PUCLASS_POPUPMENU 0x00000100
|
||||
#define PUCLASS_MENUBAR 0x00000200
|
||||
#define PUCLASS_INPUT 0x00000400
|
||||
#define PUCLASS_BUTTONBOX 0x00000800
|
||||
#define PUCLASS_SLIDER 0x00001000
|
||||
#define PUCLASS_DIALOGBOX 0x00002000
|
||||
|
||||
/* This function is not required for GLUT programs */
|
||||
void puSetWindowSize ( int width, int height ) ;
|
||||
|
||||
int puGetWindowHeight () ;
|
||||
int puGetWindowWidth () ;
|
||||
|
||||
class puValue ;
|
||||
class puObject ;
|
||||
class puInterface ;
|
||||
class puButtonBox ;
|
||||
class puFrame ;
|
||||
class puText ;
|
||||
class puButton ;
|
||||
class puOneShot ;
|
||||
class puPopup ;
|
||||
class puPopupMenu ;
|
||||
class puMenuBar ;
|
||||
class puInput ;
|
||||
class puSlider ;
|
||||
|
||||
typedef float puColour [ 4 ] ; /* RGBA */
|
||||
|
||||
struct puBox
|
||||
{
|
||||
int min [ 2 ] ;
|
||||
int max [ 2 ] ;
|
||||
|
||||
void draw ( int dx, int dy, int style, puColour colour[], int am_default ) ;
|
||||
void extend ( puBox *bx ) ;
|
||||
|
||||
void empty ( void ) { min[0]=min[1]=1000000 ; max[0]=max[1]=-1000000 ; }
|
||||
int isEmpty ( void ) { return min[0]>max[0] || min[1]>max[1] ; }
|
||||
} ;
|
||||
|
||||
#define PUSTRING_MAX 80
|
||||
|
||||
/* If you change - or add to these, be sure to change _puDefaultColourTable */
|
||||
|
||||
extern puColour _puDefaultColourTable[] ;
|
||||
|
||||
|
||||
inline void puSetColour ( puColour dst, puColour src )
|
||||
{
|
||||
dst[0] = src[0] ; dst[1] = src[1] ; dst[2] = src[2] ; dst[3] = src[3] ;
|
||||
}
|
||||
|
||||
inline void puSetColour ( puColour c, float r, float g, float b, float a = 1.0f )
|
||||
{
|
||||
c [ 0 ] = r ; c [ 1 ] = g ; c [ 2 ] = b ; c [ 3 ] = a ;
|
||||
}
|
||||
|
||||
|
||||
void puInit ( void ) ;
|
||||
void puDisplay ( void ) ;
|
||||
int puMouse ( int button, int updown, int x, int y ) ;
|
||||
int puMouse ( int x, int y ) ;
|
||||
int puKeyboard ( int key, int updown ) ;
|
||||
void puHideCursor ( void ) ;
|
||||
void puShowCursor ( void ) ;
|
||||
int puCursorIsHidden ( void ) ;
|
||||
|
||||
void puDrawString ( puFont fnt, char *str, int x, int y ) ;
|
||||
int puGetStringWidth ( puFont fnt, char *str ) ;
|
||||
int puGetStringHeight ( puFont fnt = NULL ) ;
|
||||
int puGetStringDescender ( puFont fnt = NULL ) ;
|
||||
|
||||
class puValue
|
||||
{
|
||||
protected:
|
||||
int type ;
|
||||
int integer ;
|
||||
float floater ;
|
||||
char string [ PUSTRING_MAX ] ;
|
||||
public:
|
||||
puValue () { type = PUCLASS_VALUE ; clrValue () ; }
|
||||
|
||||
virtual ~puValue () ;
|
||||
|
||||
int getType ( void ) { return type ; }
|
||||
char *getTypeString ( void ) ;
|
||||
void clrValue ( void ) { setValue ( "" ) ; }
|
||||
|
||||
void setValue ( puValue *pv )
|
||||
{
|
||||
integer = pv -> integer ;
|
||||
floater = pv -> floater ;
|
||||
strcpy ( string, pv -> string ) ;
|
||||
puRefresh = TRUE ;
|
||||
}
|
||||
|
||||
void setValue ( int i ) { integer = i ; floater = (float) i ; sprintf ( string, "%d", i ) ; puRefresh = TRUE ; }
|
||||
void setValue ( float f ) { integer = (int) f ; floater = f ; sprintf ( string, "%g", f ) ; puRefresh = TRUE ; }
|
||||
void setValue ( char *s ) {
|
||||
if ( s == NULL || s[0] == '\0' )
|
||||
{
|
||||
integer = 0 ;
|
||||
floater = 0.0f ;
|
||||
s = "" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
integer = atoi(s) ;
|
||||
floater = (float)atof(s) ;
|
||||
|
||||
if ( string != s ) strcpy ( string, s ) ;
|
||||
}
|
||||
puRefresh = TRUE ;
|
||||
}
|
||||
|
||||
void getValue ( int *i ) { *i = integer ; }
|
||||
void getValue ( float *f ) { *f = floater ; }
|
||||
void getValue ( char **s ) { *s = string ; }
|
||||
void getValue ( char *s ) { strcpy ( s, string ) ; }
|
||||
|
||||
int getValue ( void ) { return integer ; }
|
||||
} ;
|
||||
|
||||
typedef void (*puCallback)(class puObject *) ;
|
||||
|
||||
void puSetDefaultStyle ( int style ) ;
|
||||
int puGetDefaultStyle ( void ) ;
|
||||
void puSetDefaultFonts ( puFont legendFont, puFont labelFont ) ;
|
||||
void puGetDefaultFonts ( puFont *legendFont, puFont *labelFont ) ;
|
||||
void puSetDefaultColourScheme ( float r, float g, float b, float a = 1.0 ) ;
|
||||
void puGetDefaultColourScheme ( float *r, float *g, float *b, float *a = NULL );
|
||||
|
||||
class puObject : public puValue
|
||||
{
|
||||
protected:
|
||||
puValue default_value ;
|
||||
|
||||
puBox bbox ; /* Bounding box of entire Object */
|
||||
puBox abox ; /* Active (clickable) area */
|
||||
puColour colour [ PUCOL_MAX ] ;
|
||||
puInterface *parent ;
|
||||
|
||||
int active_mouse_edge ; /* is it PU_UP or PU_DOWN (or both) that activates this? */
|
||||
int style ;
|
||||
int visible ;
|
||||
int active ;
|
||||
int highlighted ;
|
||||
int am_default ;
|
||||
|
||||
char *label ; puFont labelFont ; int labelPlace ;
|
||||
char *legend ; puFont legendFont ;
|
||||
|
||||
void *user_data ;
|
||||
puCallback cb ;
|
||||
|
||||
virtual void draw_label ( int dx, int dy ) ;
|
||||
virtual int isHit ( int x, int y ) { return isVisible() && isActive() &&
|
||||
x >= abox.min[0] &&
|
||||
x <= abox.max[0] &&
|
||||
y >= abox.min[1] &&
|
||||
y <= abox.max[1] ; }
|
||||
virtual void doHit ( int button, int updown, int x, int y ) ;
|
||||
|
||||
public:
|
||||
puObject ( int minx, int miny, int maxx, int maxy ) ;
|
||||
~puObject () ;
|
||||
|
||||
puObject *next ;
|
||||
puObject *prev ;
|
||||
|
||||
puBox *getBBox ( void ) { return & bbox ; }
|
||||
puBox *getABox ( void ) { return & abox ; }
|
||||
|
||||
void setPosition ( int x, int y )
|
||||
{
|
||||
if ( abox.isEmpty() )
|
||||
{
|
||||
abox.max[0] = abox.min[0] = x ;
|
||||
abox.max[1] = abox.min[1] = y ;
|
||||
}
|
||||
else
|
||||
{
|
||||
abox.max[0] += x - abox.min[0] ;
|
||||
abox.max[1] += y - abox.min[1] ;
|
||||
abox.min[0] = x ;
|
||||
abox.min[1] = y ;
|
||||
}
|
||||
recalc_bbox() ; puRefresh = TRUE ;
|
||||
}
|
||||
|
||||
void setSize ( int w, int h )
|
||||
{
|
||||
abox.max[0] = abox.min[0] + w ;
|
||||
abox.max[1] = abox.min[1] + h ;
|
||||
recalc_bbox() ; puRefresh = TRUE ;
|
||||
}
|
||||
|
||||
void getPosition ( int *x, int *y )
|
||||
{
|
||||
if ( abox . isEmpty () )
|
||||
{
|
||||
if ( x ) *x = 0 ;
|
||||
if ( y ) *y = 0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( x ) *x = abox.min[0] ;
|
||||
if ( y ) *y = abox.min[1] ;
|
||||
}
|
||||
}
|
||||
|
||||
void getSize ( int *w, int *h )
|
||||
{
|
||||
if ( abox . isEmpty () )
|
||||
{
|
||||
if ( w ) *w = 0 ;
|
||||
if ( h ) *h = 0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( w ) *w = abox.max[0] - abox.min[0] ;
|
||||
if ( h ) *h = abox.max[1] - abox.min[1] ;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void recalc_bbox ( void ) ;
|
||||
virtual int checkHit ( int button, int updown, int x, int y ) ;
|
||||
virtual int checkKey ( int key , int updown ) ;
|
||||
virtual void draw ( int dx, int dy ) = 0 ;
|
||||
|
||||
puInterface *getParent ( void ) { return parent ; }
|
||||
puObject *getNextObject ( void ) { return next ; }
|
||||
puObject *getPrevObject ( void ) { return prev ; }
|
||||
|
||||
void setCallback ( puCallback c ) { cb = c ; }
|
||||
puCallback getCallback ( void ) { return cb ; }
|
||||
void invokeCallback ( void ) { if ( cb ) (*cb)(this) ; }
|
||||
|
||||
void makeReturnDefault ( int def ) { am_default = def ; }
|
||||
int isReturnDefault ( void ) { return am_default ; }
|
||||
|
||||
void setActiveDirn ( int e ) { active_mouse_edge = e ; }
|
||||
int getActiveDirn ( void ) { return active_mouse_edge ; }
|
||||
|
||||
void setLegend ( char *l ) { legend = l ; recalc_bbox() ; puRefresh = TRUE ; }
|
||||
char *getLegend ( void ) { return legend ; }
|
||||
|
||||
void setLegendFont ( puFont f ) { legendFont = f ; recalc_bbox() ; puRefresh = TRUE ; }
|
||||
puFont getLegendFont ( void ) { return legendFont ; }
|
||||
|
||||
void setLabel ( char *l ) { label = l ; recalc_bbox() ; puRefresh = TRUE ; }
|
||||
char *getLabel ( void ) { return label ; }
|
||||
|
||||
void setLabelFont ( puFont f ) { labelFont = f ; recalc_bbox() ; puRefresh = TRUE ; }
|
||||
puFont getLabelFont ( void ) { return labelFont ; }
|
||||
|
||||
void setLabelPlace ( int lp ) { labelPlace = lp ; recalc_bbox() ; puRefresh = TRUE ; }
|
||||
int getLabelPlace ( void ) { return labelPlace ; }
|
||||
|
||||
void activate ( void ) { if ( ! active ) { active = TRUE ; puRefresh = TRUE ; } }
|
||||
void greyOut ( void ) { if ( active ) { active = FALSE ; puRefresh = TRUE ; } }
|
||||
int isActive ( void ) { return active ; }
|
||||
|
||||
void highlight ( void ) { if ( ! highlighted ) { highlighted = TRUE ; puRefresh = TRUE ; } }
|
||||
void lowlight ( void ) { if ( highlighted ) { highlighted = FALSE ; puRefresh = TRUE ; } }
|
||||
int isHighlighted( void ){ return highlighted ; }
|
||||
|
||||
void reveal ( void ) { if ( ! visible ) { visible = TRUE ; puRefresh = TRUE ; } }
|
||||
void hide ( void ) { if ( visible ) { visible = FALSE ; puRefresh = TRUE ; } }
|
||||
int isVisible ( void ) { return visible ; }
|
||||
|
||||
void setStyle ( int which )
|
||||
{
|
||||
style = which ;
|
||||
recalc_bbox () ;
|
||||
puRefresh = TRUE ;
|
||||
}
|
||||
|
||||
int getStyle ( void ) { return style ; }
|
||||
|
||||
void setColourScheme ( float r, float g, float b, float a = 1.0f ) ;
|
||||
|
||||
void setColour ( int which, float r, float g, float b, float a = 1.0f )
|
||||
{
|
||||
puSetColour ( colour [ which ], r, g, b, a ) ;
|
||||
puRefresh = TRUE ;
|
||||
}
|
||||
|
||||
void getColour ( int which, float *r, float *g, float *b, float *a = NULL )
|
||||
{
|
||||
if ( r ) *r = colour[which][0] ;
|
||||
if ( g ) *g = colour[which][1] ;
|
||||
if ( b ) *b = colour[which][2] ;
|
||||
if ( a ) *a = colour[which][3] ;
|
||||
}
|
||||
|
||||
void setUserData ( void *data ) { user_data = data ; }
|
||||
void *getUserData ( void ) { return user_data ; }
|
||||
|
||||
void defaultValue ( void ) { setValue ( & default_value ) ; }
|
||||
|
||||
void setDefaultValue ( int i ) { default_value . setValue ( i ) ; }
|
||||
void setDefaultValue ( float f ) { default_value . setValue ( f ) ; }
|
||||
void setDefaultValue ( char *s ) { default_value . setValue ( s ) ; }
|
||||
|
||||
void getDefaultValue ( int *i ) { default_value . getValue ( i ) ; }
|
||||
void getDefaultValue ( float *f ) { default_value . getValue ( f ) ; }
|
||||
void getDefaultValue ( char **s ) { default_value . getValue ( s ) ; }
|
||||
int getDefaultValue ( void ) { return default_value . getValue () ; }
|
||||
} ;
|
||||
|
||||
/*
|
||||
The 'live' interface stack is used for clicking and rendering.
|
||||
*/
|
||||
|
||||
void puPushLiveInterface ( puInterface *in ) ;
|
||||
void puPopLiveInterface ( void ) ;
|
||||
int puNoLiveInterface ( void ) ;
|
||||
puInterface *puGetBaseLiveInterface ( void ) ;
|
||||
puInterface *puGetUltimateLiveInterface ( void ) ;
|
||||
|
||||
/*
|
||||
The regular interface stack is used for adding widgets
|
||||
*/
|
||||
|
||||
void puPushInterface ( puInterface *in ) ;
|
||||
void puPopInterface ( void ) ;
|
||||
int puNoInterface ( void ) ;
|
||||
puInterface *puGetCurrInterface ( void ) ;
|
||||
|
||||
class puInterface : public puObject
|
||||
{
|
||||
protected:
|
||||
int num_children ;
|
||||
puObject *dlist ;
|
||||
|
||||
void doHit ( int button, int updown, int x, int y ) ;
|
||||
|
||||
public:
|
||||
|
||||
puInterface ( int x, int y ) : puObject ( x, y, x, y )
|
||||
{
|
||||
type |= PUCLASS_INTERFACE ;
|
||||
dlist = NULL ;
|
||||
num_children = 0 ;
|
||||
puPushInterface ( this ) ;
|
||||
puPushLiveInterface ( this ) ;
|
||||
}
|
||||
|
||||
~puInterface () ;
|
||||
|
||||
void recalc_bbox ( void ) ;
|
||||
virtual void add ( puObject *new_object ) ;
|
||||
virtual void remove ( puObject *old_object ) ;
|
||||
|
||||
void draw ( int dx, int dy ) ;
|
||||
int checkHit ( int button, int updown, int x, int y ) ;
|
||||
int checkKey ( int key , int updown ) ;
|
||||
|
||||
puObject *getFirstChild ( void ) { return dlist ; }
|
||||
int getNumChildren ( void ) { return num_children ; }
|
||||
|
||||
virtual void close ( void )
|
||||
{
|
||||
if ( puGetCurrInterface () != this )
|
||||
fprintf ( stderr, "PUI: puInterface::close() is mismatched!\n" ) ;
|
||||
else
|
||||
puPopInterface () ;
|
||||
}
|
||||
} ;
|
||||
|
||||
class puFrame : public puObject
|
||||
{
|
||||
protected:
|
||||
virtual int isHit ( int /* x */, int /* y */ ) { return FALSE ; }
|
||||
public:
|
||||
void draw ( int dx, int dy ) ;
|
||||
puFrame ( int minx, int miny, int maxx, int maxy ) :
|
||||
puObject ( minx, miny, maxx, maxy )
|
||||
{
|
||||
type |= PUCLASS_FRAME ;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
class puText : public puObject
|
||||
{
|
||||
protected:
|
||||
virtual int isHit ( int /* x */, int /* y */ ) { return FALSE ; }
|
||||
public:
|
||||
void draw ( int dx, int dy ) ;
|
||||
puText ( int x, int y ) : puObject ( x, y, x, y )
|
||||
{
|
||||
type |= PUCLASS_TEXT ;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
class puButton : public puObject
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
void doHit ( int button, int updown, int x, int y ) ;
|
||||
void draw ( int dx, int dy ) ;
|
||||
puButton ( int minx, int miny, char *l ) :
|
||||
puObject ( minx, miny,
|
||||
minx + puGetStringWidth ( NULL, l ) + PUSTR_LGAP + PUSTR_RGAP,
|
||||
miny + puGetStringHeight () + puGetStringDescender () + PUSTR_TGAP + PUSTR_BGAP )
|
||||
{
|
||||
type |= PUCLASS_BUTTON ;
|
||||
setLegend ( l ) ;
|
||||
}
|
||||
|
||||
puButton ( int minx, int miny, int maxx, int maxy ) :
|
||||
puObject ( minx, miny, maxx, maxy )
|
||||
{
|
||||
type |= PUCLASS_BUTTON ;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
class puSlider : public puObject
|
||||
{
|
||||
protected:
|
||||
int vert ;
|
||||
float last_cb_value ;
|
||||
float cb_delta ;
|
||||
int cb_mode ;
|
||||
float slider_fraction ;
|
||||
public:
|
||||
void doHit ( int button, int updown, int x, int y ) ;
|
||||
void draw ( int dx, int dy ) ;
|
||||
puSlider ( int minx, int miny, int sz, int vertical = FALSE ) :
|
||||
puObject ( minx, miny, vertical ?
|
||||
( minx + puGetStringWidth ( NULL, "W" ) +
|
||||
PUSTR_LGAP + PUSTR_RGAP ) :
|
||||
( minx + sz ),
|
||||
vertical ?
|
||||
( miny + sz ) :
|
||||
( miny + puGetStringHeight () +
|
||||
puGetStringDescender () +
|
||||
PUSTR_TGAP + PUSTR_BGAP )
|
||||
)
|
||||
{
|
||||
type |= PUCLASS_SLIDER ;
|
||||
slider_fraction = 0.1f ;
|
||||
getValue ( & last_cb_value ) ;
|
||||
vert = vertical ;
|
||||
cb_delta = 0.1f ;
|
||||
cb_mode = PUSLIDER_ALWAYS ;
|
||||
}
|
||||
|
||||
void setCBMode ( int m ) { cb_mode = m ; }
|
||||
float getCBMode ( void ) { return (float)cb_mode ; }
|
||||
|
||||
int isVertical ( void ) { return vert ; }
|
||||
|
||||
void setDelta ( float f ) { cb_delta = (f<=0.0f) ? 0.1f : (f>=1.0f) ? 0.9f : f ; }
|
||||
float getDelta ( void ) { return cb_delta ; }
|
||||
|
||||
void setSliderFraction ( float f ) { slider_fraction = (f<=0.0f) ? 0.1f : (f>=1.0f) ? 0.9f : f ; }
|
||||
float getSliderFraction ( void ) { return slider_fraction ; }
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class puOneShot : public puButton
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
void doHit ( int button, int updown, int x, int y ) ;
|
||||
|
||||
puOneShot ( int minx, int miny, char *l ) : puButton ( minx, miny, l )
|
||||
{
|
||||
type |= PUCLASS_ONESHOT ;
|
||||
}
|
||||
|
||||
puOneShot ( int minx, int miny, int maxx, int maxy ) :
|
||||
puButton ( minx, miny, maxx, maxy )
|
||||
{
|
||||
type |= PUCLASS_ONESHOT ;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class puPopup : public puInterface
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
puPopup ( int x, int y ) : puInterface ( x, y )
|
||||
{
|
||||
type |= PUCLASS_POPUP ;
|
||||
hide () ;
|
||||
}
|
||||
} ;
|
||||
|
||||
class puPopupMenu : public puPopup
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
puPopupMenu ( int x, int y ) : puPopup ( x, y )
|
||||
{
|
||||
type |= PUCLASS_POPUPMENU ;
|
||||
}
|
||||
|
||||
puObject *add_item ( char *str, puCallback cb ) ;
|
||||
int checkHit ( int button, int updown, int x, int y ) ;
|
||||
int checkKey ( int key , int updown ) ;
|
||||
void close ( void ) ;
|
||||
} ;
|
||||
|
||||
class puMenuBar : public puInterface
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
puMenuBar ( int h = -1 ) :
|
||||
|
||||
puInterface ( 0, h < 0 ? puGetWindowHeight() -
|
||||
( puGetStringHeight() + PUSTR_TGAP + PUSTR_BGAP ) : h )
|
||||
{
|
||||
type |= PUCLASS_MENUBAR ;
|
||||
}
|
||||
|
||||
void add_submenu ( char *str, char *items[], puCallback cb[] ) ;
|
||||
void close ( void ) ;
|
||||
} ;
|
||||
|
||||
|
||||
class puInput : public puObject
|
||||
{
|
||||
int accepting ;
|
||||
int cursor_position ;
|
||||
int select_start_position ;
|
||||
int select_end_position ;
|
||||
|
||||
void normalize_cursors ( void ) ;
|
||||
|
||||
public:
|
||||
void draw ( int dx, int dy ) ;
|
||||
void doHit ( int button, int updown, int x, int y ) ;
|
||||
int checkKey ( int key, int updown ) ;
|
||||
|
||||
int isAcceptingInput ( void ) { return accepting ; }
|
||||
void rejectInput ( void ) { accepting = FALSE ; }
|
||||
void acceptInput ( void ) { accepting = TRUE ;
|
||||
cursor_position = strlen ( string ) ;
|
||||
select_start_position = select_end_position = -1 ; }
|
||||
|
||||
int getCursor ( void ) { return cursor_position ; }
|
||||
void setCursor ( int c ) { cursor_position = c ; }
|
||||
|
||||
void setSelectRegion ( int s, int e )
|
||||
{
|
||||
select_start_position = s ;
|
||||
select_end_position = e ;
|
||||
}
|
||||
|
||||
void getSelectRegion ( int *s, int *e )
|
||||
{
|
||||
if ( s ) *s = select_start_position ;
|
||||
if ( e ) *e = select_end_position ;
|
||||
}
|
||||
|
||||
puInput ( int minx, int miny, int maxx, int maxy ) :
|
||||
puObject ( minx, miny, maxx, maxy )
|
||||
{
|
||||
type |= PUCLASS_INPUT ;
|
||||
|
||||
accepting = FALSE ;
|
||||
|
||||
cursor_position = 0 ;
|
||||
select_start_position = -1 ;
|
||||
select_end_position = -1 ;
|
||||
|
||||
setColourScheme ( 0.8f, 0.7f, 0.7f ) ; /* Yeukky Pink */
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
class puButtonBox : public puObject
|
||||
{
|
||||
protected:
|
||||
int one_only ;
|
||||
int num_kids ;
|
||||
char **button_labels ;
|
||||
|
||||
public:
|
||||
|
||||
puButtonBox ( int minx, int miny, int maxx, int maxy,
|
||||
char **labels, int one_button ) ;
|
||||
|
||||
int isOneButton ( void ) { return one_only ; }
|
||||
|
||||
int checkKey ( int key , int updown ) ;
|
||||
int checkHit ( int button, int updown, int x, int y ) ;
|
||||
void draw ( int dx, int dy ) ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class puDialogBox : public puPopup
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
|
||||
puDialogBox ( int x, int y ) : puPopup ( x, y )
|
||||
{
|
||||
type |= PUCLASS_DIALOGBOX ;
|
||||
}
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
319
PUI/puBox.cxx
319
PUI/puBox.cxx
@@ -1,319 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
#define PU_BEVEL 5
|
||||
#define PU_SMALL_BEVEL 2
|
||||
#define PU_DFLT_OFFSET 8
|
||||
#define PU_BOX_WIDTH 2
|
||||
#define PU_DROPSHADOW_OFFSET 5
|
||||
|
||||
void puBox::extend ( puBox *bx )
|
||||
{
|
||||
if ( bx -> isEmpty () ) return ;
|
||||
|
||||
if ( min[0]>bx->min[0] ) min[0] = bx->min[0] ;
|
||||
if ( min[1]>bx->min[1] ) min[1] = bx->min[1] ;
|
||||
if ( max[0]<bx->max[0] ) max[0] = bx->max[0] ;
|
||||
if ( max[1]<bx->max[1] ) max[1] = bx->max[1] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void puBox::draw ( int dx, int dy, int style, puColour colour[], int am_default )
|
||||
{
|
||||
int hi, mid, lo ;
|
||||
|
||||
/* Colour assignments */
|
||||
|
||||
switch ( style )
|
||||
{
|
||||
case PUSTYLE_NONE :
|
||||
return ;
|
||||
|
||||
case PUSTYLE_PLAIN :
|
||||
case PUSTYLE_DROPSHADOW :
|
||||
mid = PUCOL_FOREGROUND ;
|
||||
lo = PUCOL_BACKGROUND ;
|
||||
break ;
|
||||
|
||||
case PUSTYLE_SMALL_SHADED :
|
||||
case PUSTYLE_SHADED :
|
||||
case PUSTYLE_SMALL_BEVELLED :
|
||||
case PUSTYLE_BEVELLED :
|
||||
case PUSTYLE_BOXED :
|
||||
case PUSTYLE_SPECIAL_UNDERLINED :
|
||||
mid = PUCOL_FOREGROUND ;
|
||||
hi = PUCOL_HIGHLIGHT ;
|
||||
lo = PUCOL_BACKGROUND ;
|
||||
break ;
|
||||
|
||||
case PUSTYLE_RADIO :
|
||||
case -PUSTYLE_RADIO :
|
||||
hi = PUCOL_HIGHLIGHT ;
|
||||
lo = PUCOL_BACKGROUND ;
|
||||
break ;
|
||||
|
||||
case -PUSTYLE_PLAIN :
|
||||
case -PUSTYLE_DROPSHADOW :
|
||||
mid = PUCOL_HIGHLIGHT ;
|
||||
lo = PUCOL_BACKGROUND ;
|
||||
break ;
|
||||
|
||||
case -PUSTYLE_SMALL_BEVELLED :
|
||||
case -PUSTYLE_BEVELLED :
|
||||
case -PUSTYLE_SMALL_SHADED :
|
||||
case -PUSTYLE_SHADED :
|
||||
case -PUSTYLE_BOXED :
|
||||
case -PUSTYLE_SPECIAL_UNDERLINED :
|
||||
mid = PUCOL_FOREGROUND ;
|
||||
hi = PUCOL_BACKGROUND ;
|
||||
lo = PUCOL_HIGHLIGHT ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
fprintf ( stderr, "PUI: Unrecognised 'style' %d\n", style ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
switch ( abs(style) )
|
||||
{
|
||||
case PUSTYLE_PLAIN :
|
||||
glColor4fv ( colour [ mid ] ) ;
|
||||
glRecti ( dx + min[0], dy + min[1],
|
||||
dx + max[0], dy + max[1] ) ;
|
||||
break ;
|
||||
|
||||
case PUSTYLE_SMALL_BEVELLED :
|
||||
case PUSTYLE_SMALL_SHADED :
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL, dy + min[1] + PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0], dy + min[1] ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL, dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0], dy + max[1] ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL, dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0], dy + max[1] ) ;
|
||||
glEnd () ;
|
||||
glColor4fv ( colour [ lo ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0], dy + min[1] ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL, dy + min[1] + PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0], dy + min[1] ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL, dy + min[1] + PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0], dy + max[1] ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL, dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
glEnd () ;
|
||||
|
||||
if ( abs(style) == PUSTYLE_SMALL_BEVELLED )
|
||||
{
|
||||
glColor4fv ( colour [ mid ] ) ;
|
||||
glRecti ( dx + min[0] + PU_SMALL_BEVEL, dy + min[1] + PU_SMALL_BEVEL,
|
||||
dx + max[0] - PU_SMALL_BEVEL, dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBegin(GL_POLYGON);
|
||||
glColor4fv( colour [ mid ] );
|
||||
glVertex2i( dx + min[0] + PU_SMALL_BEVEL , dy + min[1] + PU_SMALL_BEVEL );
|
||||
if(style==PUSTYLE_SMALL_SHADED)
|
||||
glColor4f( colour [mid][0] + (colour[lo][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[lo][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[lo][2] - colour[mid][2])/2.0f,
|
||||
colour [lo][3] );
|
||||
else
|
||||
glColor4f( colour [mid][0] + (colour[hi][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[hi][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[hi][2] - colour[mid][2])/2.0f,
|
||||
colour [hi][3] );
|
||||
glVertex2i( dx + min[0] + PU_SMALL_BEVEL , dy + max[1] - PU_SMALL_BEVEL );
|
||||
glColor4fv( colour [ mid ] );
|
||||
glVertex2i( dx + max[0] - PU_SMALL_BEVEL , dy + max[1] - PU_SMALL_BEVEL );
|
||||
if(style==-PUSTYLE_SMALL_SHADED)
|
||||
glColor4f( colour [mid][0] + (colour[lo][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[lo][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[lo][2] - colour[mid][2])/2.0f,
|
||||
colour [lo][3] );
|
||||
else
|
||||
glColor4f( colour [mid][0] + (colour[hi][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[hi][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[hi][2] - colour[mid][2])/2.0f,
|
||||
colour [hi][3] );
|
||||
glVertex2i( dx + max[0] - PU_SMALL_BEVEL , dy + min[1] + PU_SMALL_BEVEL );
|
||||
glEnd();
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
if(style == -PUSTYLE_SMALL_SHADED)
|
||||
{
|
||||
glColor4fv ( colour [ lo ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL , dy + min[1] + PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL/2 , dy + min[1] + PU_SMALL_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL , dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL/2 , dy + max[1] - PU_SMALL_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL , dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL/2 , dy + max[1] - PU_SMALL_BEVEL/2 ) ;
|
||||
glEnd () ;
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL/2 , dy + min[1] + PU_SMALL_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_SMALL_BEVEL , dy + min[1] + PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL/2 , dy + min[1] + PU_SMALL_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL , dy + min[1] + PU_SMALL_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL/2 , dy + max[1] - PU_SMALL_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + max[0] - PU_SMALL_BEVEL , dy + max[1] - PU_SMALL_BEVEL ) ;
|
||||
glEnd () ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
|
||||
case PUSTYLE_BEVELLED :
|
||||
case PUSTYLE_SHADED :
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL, dy + min[1] + PU_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0], dy + min[1] ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL, dy + max[1] - PU_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0], dy + max[1] ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL, dy + max[1] - PU_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0], dy + max[1] ) ;
|
||||
glEnd () ;
|
||||
glColor4fv ( colour [ lo ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0], dy + min[1] ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL, dy + min[1] + PU_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0], dy + min[1] ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL, dy + min[1] + PU_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0], dy + max[1] ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL, dy + max[1] - PU_BEVEL ) ;
|
||||
glEnd () ;
|
||||
|
||||
if ( abs(style) == PUSTYLE_BEVELLED )
|
||||
{
|
||||
glColor4fv ( colour [ mid ] ) ;
|
||||
glRecti ( dx + min[0] + PU_BEVEL, dy + min[1] + PU_BEVEL,
|
||||
dx + max[0] - PU_BEVEL, dy + max[1] - PU_BEVEL ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBegin(GL_POLYGON);
|
||||
glColor4fv( colour [ mid ] );
|
||||
glVertex2i( dx + min[0] + PU_BEVEL , dy + min[1] + PU_BEVEL );
|
||||
if(style==PUSTYLE_SHADED)
|
||||
glColor4f( colour [mid][0] + (colour[lo][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[lo][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[lo][2] - colour[mid][2])/2.0f,
|
||||
colour [lo][3] );
|
||||
else
|
||||
glColor4f( colour [mid][0] + (colour[hi][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[hi][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[hi][2] - colour[mid][2])/2.0f,
|
||||
colour [hi][3] );
|
||||
glVertex2i( dx + min[0] + PU_BEVEL , dy + max[1] - PU_BEVEL );
|
||||
glColor4fv( colour [ mid ] );
|
||||
glVertex2i( dx + max[0] - PU_BEVEL , dy + max[1] - PU_BEVEL );
|
||||
if(style==-PUSTYLE_SHADED)
|
||||
glColor4f( colour [mid][0] + (colour[lo][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[lo][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[lo][2] - colour[mid][2])/2.0f,
|
||||
colour [lo][3] );
|
||||
else
|
||||
glColor4f( colour [mid][0] + (colour[hi][0] - colour[mid][0])/2.0f,
|
||||
colour [mid][1] + (colour[hi][1] - colour[mid][1])/2.0f,
|
||||
colour [mid][2] + (colour[hi][2] - colour[mid][2])/2.0f,
|
||||
colour [hi][3] );
|
||||
glVertex2i( dx + max[0] - PU_BEVEL , dy + min[1] + PU_BEVEL );
|
||||
glEnd();
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
if(style == -PUSTYLE_SHADED)
|
||||
{
|
||||
glColor4fv ( colour [ lo ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL , dy + min[1] + PU_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL/2 , dy + min[1] + PU_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL , dy + max[1] - PU_BEVEL ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL/2 , dy + max[1] - PU_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL , dy + max[1] - PU_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL/2 , dy + max[1] - PU_BEVEL/2 ) ;
|
||||
glEnd () ;
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glBegin ( GL_QUAD_STRIP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL/2 , dy + min[1] + PU_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_BEVEL , dy + min[1] + PU_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL/2 , dy + min[1] + PU_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL , dy + min[1] + PU_BEVEL ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL/2 , dy + max[1] - PU_BEVEL/2 ) ;
|
||||
glVertex2i ( dx + max[0] - PU_BEVEL , dy + max[1] - PU_BEVEL ) ;
|
||||
glEnd () ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
|
||||
case PUSTYLE_BOXED :
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glRecti ( dx + min[0], dy + min[1],
|
||||
dx + max[0], dy + max[1] ) ;
|
||||
glColor4fv ( colour [ mid ] ) ;
|
||||
glRecti ( dx + min[0]+PU_BOX_WIDTH, dy + min[1]+PU_BOX_WIDTH,
|
||||
dx + max[0]-PU_BOX_WIDTH, dy + max[1]-PU_BOX_WIDTH ) ;
|
||||
break ;
|
||||
|
||||
case PUSTYLE_RADIO :
|
||||
glColor4fv ( colour [ lo ] ) ;
|
||||
glBegin ( GL_LINE_LOOP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_RADIO_BUTTON_SIZE/2, dy + min[1] ) ;
|
||||
glVertex2i ( dx + min[0] + PU_RADIO_BUTTON_SIZE , dy + min[1] + PU_RADIO_BUTTON_SIZE/2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_RADIO_BUTTON_SIZE/2, dy + min[1] + PU_RADIO_BUTTON_SIZE ) ;
|
||||
glVertex2i ( dx + min[0] , dy + min[1] + PU_RADIO_BUTTON_SIZE/2 ) ;
|
||||
glEnd () ;
|
||||
|
||||
if ( style < 0 )
|
||||
{
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glBegin ( GL_QUADS ) ;
|
||||
glVertex2i ( dx + min[0] + PU_RADIO_BUTTON_SIZE/2, dy + min[1] + 2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_RADIO_BUTTON_SIZE-2, dy + min[1] + PU_RADIO_BUTTON_SIZE/2 ) ;
|
||||
glVertex2i ( dx + min[0] + PU_RADIO_BUTTON_SIZE/2, dy + min[1] + PU_RADIO_BUTTON_SIZE-2 ) ;
|
||||
glVertex2i ( dx + min[0] + 2 , dy + min[1] + PU_RADIO_BUTTON_SIZE/2 ) ;
|
||||
glEnd () ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case PUSTYLE_SPECIAL_UNDERLINED :
|
||||
glColor4fv ( colour [ hi ] ) ;
|
||||
glRecti ( dx + min[0], dy + min[1],
|
||||
dx + max[0], dy + min[1]+2 ) ;
|
||||
glColor4fv ( colour [ mid ] ) ;
|
||||
glRecti ( dx + min[0], dy + min[1]+1,
|
||||
dx + max[0], dy + max[1] ) ;
|
||||
break ;
|
||||
|
||||
case PUSTYLE_DROPSHADOW :
|
||||
glColor4fv ( colour [ lo ] ) ;
|
||||
glRecti ( dx + min[0] + PU_DROPSHADOW_OFFSET, dy + min[1] - PU_DROPSHADOW_OFFSET,
|
||||
dx + max[0] + PU_DROPSHADOW_OFFSET, dy + max[1] - PU_DROPSHADOW_OFFSET ) ;
|
||||
glColor4fv ( colour [ mid ] ) ;
|
||||
glRecti ( dx + min[0], dy + min[1],
|
||||
dx + max[0], dy + max[1] ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( am_default )
|
||||
{
|
||||
glColor4fv ( colour [ PUCOL_BACKGROUND ] ) ;
|
||||
glLineStipple ( 1, 0xF0F0 ) ;
|
||||
glEnable ( GL_LINE_STIPPLE ) ;
|
||||
glBegin ( GL_LINE_LOOP ) ;
|
||||
glVertex2i ( dx + min[0] + PU_DFLT_OFFSET, dy + min[1] + PU_DFLT_OFFSET ) ;
|
||||
glVertex2i ( dx + min[0] + PU_DFLT_OFFSET, dy + max[1] - PU_DFLT_OFFSET ) ;
|
||||
glVertex2i ( dx + max[0] - PU_DFLT_OFFSET, dy + max[1] - PU_DFLT_OFFSET ) ;
|
||||
glVertex2i ( dx + max[0] - PU_DFLT_OFFSET, dy + min[1] + PU_DFLT_OFFSET ) ;
|
||||
glEnd () ;
|
||||
glDisable ( GL_LINE_STIPPLE ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void puButton::draw ( int dx, int dy )
|
||||
{
|
||||
if ( !visible ) return ;
|
||||
|
||||
/* If button is pushed or highlighted - use inverse style for button itself */
|
||||
|
||||
int tempStyle;
|
||||
|
||||
if ( parent && ( ( parent->getType() & PUCLASS_POPUPMENU ) ||
|
||||
( parent->getType() & PUCLASS_MENUBAR ) ) )
|
||||
tempStyle = ( getValue() ^ highlighted ) ? PUSTYLE_SMALL_SHADED : style ;
|
||||
else
|
||||
tempStyle = ( getValue() ^ highlighted ) ? -style : style ;
|
||||
|
||||
abox . draw ( dx, dy, tempStyle, colour, isReturnDefault() ) ;
|
||||
|
||||
/* If greyed out then halve the opacity when drawing the label and legend */
|
||||
|
||||
if ( active )
|
||||
glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
|
||||
else
|
||||
glColor4f ( colour [ PUCOL_LEGEND ][0],
|
||||
colour [ PUCOL_LEGEND ][1],
|
||||
colour [ PUCOL_LEGEND ][2],
|
||||
colour [ PUCOL_LEGEND ][3] / 2.0f ) ; /* 50% more transparent */
|
||||
|
||||
int xx = ( abox.max[0] - abox.min[0] - puGetStringWidth(legendFont,legend) ) / 2 ;
|
||||
int yy = ( abox.max[1] - abox.min[1] - puGetStringHeight(legendFont) ) / 2 ;
|
||||
|
||||
puDrawString ( legendFont, legend,
|
||||
dx + abox.min[0] + xx,
|
||||
dy + abox.min[1] + yy ) ;
|
||||
|
||||
draw_label ( dx, dy ) ;
|
||||
}
|
||||
|
||||
|
||||
void puButton::doHit ( int button, int updown, int, int )
|
||||
{
|
||||
|
||||
|
||||
if ( button == PU_LEFT_BUTTON )
|
||||
{
|
||||
if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN )
|
||||
{
|
||||
lowlight () ;
|
||||
setValue ( (int) ! getValue () ) ;
|
||||
invokeCallback () ;
|
||||
}
|
||||
else
|
||||
highlight () ;
|
||||
}
|
||||
else
|
||||
lowlight () ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
puButtonBox::puButtonBox ( int minx, int miny, int maxx, int maxy,
|
||||
char **labels, int one_button ) :
|
||||
puObject ( minx, miny, maxx, maxy )
|
||||
{
|
||||
type |= PUCLASS_BUTTONBOX ;
|
||||
one_only = one_button ;
|
||||
|
||||
button_labels = labels ;
|
||||
|
||||
for ( num_kids = 0 ; button_labels [ num_kids ] != NULL ; num_kids++ )
|
||||
/* Count number of labels */ ;
|
||||
}
|
||||
|
||||
|
||||
int puButtonBox::checkKey ( int key, int updown )
|
||||
{
|
||||
if ( updown == PU_UP ||
|
||||
! isReturnDefault() ||
|
||||
( key != '\r' && key != '\n' ) )
|
||||
return FALSE ;
|
||||
|
||||
int v = getValue () ;
|
||||
|
||||
if ( ! one_only )
|
||||
v = ~v ;
|
||||
else
|
||||
if ( v++ > num_kids )
|
||||
v = 0 ;
|
||||
|
||||
setValue ( v ) ;
|
||||
invokeCallback() ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
||||
int puButtonBox::checkHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
if ( ! isHit ( x, y ) ||
|
||||
( updown != active_mouse_edge &&
|
||||
active_mouse_edge != PU_UP_AND_DOWN ) )
|
||||
return FALSE ;
|
||||
|
||||
int i = num_kids - 1 - (( y - abox.min[1] - PUSTR_BGAP ) * num_kids ) /
|
||||
( abox.max[1] - abox.min[1] - PUSTR_BGAP - PUSTR_TGAP ) ;
|
||||
|
||||
if ( i < 0 ) i = 0 ;
|
||||
if ( i >= num_kids ) i = num_kids - 1 ;
|
||||
|
||||
if ( one_only )
|
||||
setValue ( i ) ;
|
||||
else
|
||||
setValue ( getValue () ^ ( 1 << i ) ) ;
|
||||
|
||||
invokeCallback () ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
||||
void puButtonBox::draw ( int dx, int dy )
|
||||
{
|
||||
if ( !visible ) return ;
|
||||
|
||||
abox . draw ( dx, dy, style, colour, isReturnDefault() ) ;
|
||||
|
||||
for ( int i = 0 ; i < num_kids ; i++ )
|
||||
{
|
||||
puBox tbox ;
|
||||
|
||||
tbox . min [ 0 ] = abox.min [ 0 ] + PUSTR_LGAP + PUSTR_LGAP ;
|
||||
tbox . min [ 1 ] = abox.min [ 1 ] + ((abox.max[1]-abox.min[1]-PUSTR_TGAP-PUSTR_BGAP)/num_kids) * (num_kids-1-i) ;
|
||||
tbox . max [ 0 ] = tbox.min [ 0 ] ;
|
||||
tbox . max [ 1 ] = tbox.min [ 1 ] ;
|
||||
|
||||
if (( one_only && i == getValue() ) ||
|
||||
( !one_only && ((1<<i) & getValue() ) != 0 ) )
|
||||
tbox . draw ( dx, dy + PUSTR_BGAP + PUSTR_BGAP, -PUSTYLE_RADIO, colour, FALSE ) ;
|
||||
else
|
||||
tbox . draw ( dx, dy + PUSTR_BGAP + PUSTR_BGAP, PUSTYLE_RADIO, colour, FALSE ) ;
|
||||
|
||||
/* If greyed out then halve the opacity when drawing the label and legend */
|
||||
|
||||
if ( active )
|
||||
glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
|
||||
else
|
||||
glColor4f ( colour [ PUCOL_LEGEND ][0],
|
||||
colour [ PUCOL_LEGEND ][1],
|
||||
colour [ PUCOL_LEGEND ][2],
|
||||
colour [ PUCOL_LEGEND ][3] / 2.0f ) ; /* 50% more transparent */
|
||||
|
||||
puDrawString ( legendFont, button_labels[i],
|
||||
dx + tbox.min[0] + PU_RADIO_BUTTON_SIZE + PUSTR_LGAP,
|
||||
dy + tbox.min[1] + puGetStringDescender(legendFont) + PUSTR_BGAP + PUSTR_BGAP) ;
|
||||
}
|
||||
|
||||
draw_label ( dx, dy ) ;
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void puFrame::draw ( int dx, int dy )
|
||||
{
|
||||
if ( !visible ) return ;
|
||||
|
||||
abox . draw ( dx, dy, style, colour, FALSE ) ;
|
||||
|
||||
/* If greyed out then halve the opacity when drawing the label and legend */
|
||||
|
||||
if ( active )
|
||||
glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
|
||||
else
|
||||
glColor4f ( colour [ PUCOL_LEGEND ][0],
|
||||
colour [ PUCOL_LEGEND ][1],
|
||||
colour [ PUCOL_LEGEND ][2],
|
||||
colour [ PUCOL_LEGEND ][3] / 2.0f ) ; /* 50% more transparent */
|
||||
|
||||
int xx = ( abox.max[0] - abox.min[0] - puGetStringWidth ( legendFont, legend ) ) / 2 ;
|
||||
|
||||
puDrawString ( legendFont, legend,
|
||||
dx + abox.min[0] + xx,
|
||||
dy + abox.min[1] + puGetStringDescender ( legendFont ) + PUSTR_BGAP ) ;
|
||||
|
||||
draw_label ( dx, dy ) ;
|
||||
}
|
||||
|
||||
|
||||
226
PUI/puInput.cxx
226
PUI/puInput.cxx
@@ -1,226 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void puInput::normalize_cursors ( void )
|
||||
{
|
||||
char val [ PUSTRING_MAX ] ;
|
||||
getValue ( val ) ;
|
||||
int sl = strlen ( val ) ;
|
||||
|
||||
/* Clamp the positions to the limits of the text. */
|
||||
|
||||
if ( cursor_position < 0 ) cursor_position = 0 ;
|
||||
if ( select_start_position < 0 ) select_start_position = 0 ;
|
||||
if ( select_end_position < 0 ) select_end_position = 0 ;
|
||||
if ( cursor_position > sl ) cursor_position = sl ;
|
||||
if ( select_start_position > sl ) select_start_position = sl ;
|
||||
if ( select_end_position > sl ) select_end_position = sl ;
|
||||
|
||||
/* Swap the ends of the select window if they get crossed over */
|
||||
|
||||
if ( select_end_position < select_start_position )
|
||||
{
|
||||
int tmp = select_end_position ;
|
||||
select_end_position = select_start_position ;
|
||||
select_start_position = tmp ;
|
||||
}
|
||||
}
|
||||
|
||||
void puInput::draw ( int dx, int dy )
|
||||
{
|
||||
normalize_cursors () ;
|
||||
|
||||
if ( !visible ) return ;
|
||||
|
||||
/* 3D Input boxes look nicest if they are always in inverse style. */
|
||||
|
||||
abox . draw ( dx, dy, ( (style==PUSTYLE_SMALL_BEVELLED ||
|
||||
style==PUSTYLE_SMALL_SHADED) ) ? -style :
|
||||
(accepting ? -style : style ), colour, FALSE ) ;
|
||||
|
||||
int xx = puGetStringWidth ( legendFont, " " ) ;
|
||||
int yy = ( abox.max[1] - abox.min[1] - puGetStringHeight(legendFont) ) / 2 ;
|
||||
|
||||
if ( accepting )
|
||||
{
|
||||
char val [ PUSTRING_MAX ] ;
|
||||
getValue ( val ) ;
|
||||
|
||||
/* Highlight the select area */
|
||||
|
||||
if ( select_end_position > 0 &&
|
||||
select_end_position != select_start_position )
|
||||
{
|
||||
val [ select_end_position ] = '\0' ;
|
||||
int cpos2 = puGetStringWidth ( legendFont, val ) + xx + dx + abox.min[0] ;
|
||||
val [ select_start_position ] = '\0' ;
|
||||
int cpos1 = puGetStringWidth ( legendFont, val ) + xx + dx + abox.min[0] ;
|
||||
|
||||
glColor3f ( 1.0f, 1.0f, 0.7f ) ;
|
||||
glRecti ( cpos1, dy + abox.min[1] + 6 ,
|
||||
cpos2, dy + abox.max[1] - 6 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw the text */
|
||||
|
||||
{
|
||||
/* If greyed out then halve the opacity when drawing the label and legend */
|
||||
|
||||
if ( active )
|
||||
glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
|
||||
else
|
||||
glColor4f ( colour [ PUCOL_LEGEND ][0],
|
||||
colour [ PUCOL_LEGEND ][1],
|
||||
colour [ PUCOL_LEGEND ][2],
|
||||
colour [ PUCOL_LEGEND ][3] / 2.0f ) ; /* 50% more transparent */
|
||||
|
||||
char val [ PUSTRING_MAX ] ;
|
||||
getValue ( val ) ;
|
||||
|
||||
puDrawString ( legendFont, val,
|
||||
dx + abox.min[0] + xx,
|
||||
dy + abox.min[1] + yy ) ;
|
||||
|
||||
draw_label ( dx, dy ) ;
|
||||
}
|
||||
|
||||
if ( accepting )
|
||||
{
|
||||
char val [ PUSTRING_MAX ] ;
|
||||
getValue ( val ) ;
|
||||
|
||||
/* Draw the 'I' bar cursor. */
|
||||
|
||||
if ( cursor_position >= 0 )
|
||||
{
|
||||
val [ cursor_position ] = '\0' ;
|
||||
|
||||
int cpos = puGetStringWidth ( legendFont, val ) + xx + dx + abox.min[0] ;
|
||||
|
||||
glColor3f ( 0.1f, 0.1f, 1.0f ) ;
|
||||
glBegin ( GL_LINES ) ;
|
||||
glVertex2i ( cpos , dy + abox.min[1] + 7 ) ;
|
||||
glVertex2i ( cpos , dy + abox.max[1] - 7 ) ;
|
||||
glVertex2i ( cpos - 1, dy + abox.min[1] + 7 ) ;
|
||||
glVertex2i ( cpos - 1, dy + abox.max[1] - 7 ) ;
|
||||
glVertex2i ( cpos - 4, dy + abox.min[1] + 7 ) ;
|
||||
glVertex2i ( cpos + 3, dy + abox.min[1] + 7 ) ;
|
||||
glVertex2i ( cpos - 4, dy + abox.max[1] - 7 ) ;
|
||||
glVertex2i ( cpos + 3, dy + abox.max[1] - 7 ) ;
|
||||
glEnd () ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void puInput::doHit ( int button, int updown, int x, int /* y */ )
|
||||
{
|
||||
if ( button == PU_LEFT_BUTTON )
|
||||
{
|
||||
/* Most GUI's activate a button on button-UP not button-DOWN. */
|
||||
|
||||
if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN )
|
||||
{
|
||||
lowlight () ;
|
||||
|
||||
char *strval ;
|
||||
getValue ( & strval ) ;
|
||||
char *tmpval = new char [ strlen(strval) + 1 ] ;
|
||||
strcpy ( tmpval, strval ) ;
|
||||
|
||||
int i = strlen ( tmpval ) ;
|
||||
|
||||
while ( x <= puGetStringWidth ( legendFont, tmpval ) + abox.min[0] &&
|
||||
i >= 0 )
|
||||
tmpval[--i] = '\0' ;
|
||||
|
||||
accepting = TRUE ;
|
||||
cursor_position = i ;
|
||||
normalize_cursors () ;
|
||||
invokeCallback () ;
|
||||
}
|
||||
else
|
||||
highlight () ;
|
||||
}
|
||||
else
|
||||
lowlight () ;
|
||||
}
|
||||
|
||||
int puInput::checkKey ( int key, int updown )
|
||||
{
|
||||
(updown,updown);
|
||||
|
||||
if ( ! isAcceptingInput() || ! isActive () || ! isVisible () )
|
||||
return FALSE ;
|
||||
|
||||
normalize_cursors () ;
|
||||
|
||||
char *p ;
|
||||
|
||||
switch ( key )
|
||||
{
|
||||
case PU_KEY_PAGE_UP :
|
||||
case PU_KEY_PAGE_DOWN :
|
||||
case PU_KEY_INSERT : return FALSE ;
|
||||
|
||||
case PU_KEY_UP :
|
||||
case PU_KEY_DOWN :
|
||||
case 0x1B /* ESC */ :
|
||||
case '\t' :
|
||||
case '\r' :
|
||||
case '\n' : /* Carriage return/Line Feed/TAB -- End of input */
|
||||
rejectInput () ;
|
||||
normalize_cursors () ;
|
||||
invokeCallback () ;
|
||||
break ;
|
||||
|
||||
case '\b' : /* Backspace */
|
||||
if ( cursor_position > 0 )
|
||||
for ( p = & string [ --cursor_position ] ; *p != '\0' ; p++ )
|
||||
*p = *(p+1) ;
|
||||
break ;
|
||||
|
||||
case 0x7F : /* DEL */
|
||||
if ( select_start_position != select_end_position )
|
||||
{
|
||||
char *p1 = & string [ select_start_position ] ;
|
||||
char *p2 = & string [ select_end_position ] ;
|
||||
|
||||
while ( *p1 != '\0' )
|
||||
*p1++ = *p2++ ;
|
||||
|
||||
select_end_position = select_start_position ;
|
||||
}
|
||||
else
|
||||
for ( p = & string [ cursor_position ] ; *p != '\0' ; p++ )
|
||||
*p = *(p+1) ;
|
||||
break ;
|
||||
|
||||
case 0x15 /* ^U */ : string [ 0 ] = '\0' ; break ;
|
||||
case PU_KEY_HOME : cursor_position = 0 ; break ;
|
||||
case PU_KEY_END : cursor_position = PUSTRING_MAX ; break ;
|
||||
case PU_KEY_LEFT : cursor_position-- ; break ;
|
||||
case PU_KEY_RIGHT : cursor_position++ ; break ;
|
||||
|
||||
default:
|
||||
if ( key < ' ' || key > 127 ) return FALSE ;
|
||||
|
||||
if ( strlen ( string ) >= PUSTRING_MAX )
|
||||
return FALSE ;
|
||||
|
||||
for ( p = & string [ strlen(string) ] ;
|
||||
p != &string[cursor_position] ; p-- )
|
||||
*(p+1) = *p ;
|
||||
|
||||
*p = key ;
|
||||
cursor_position++ ;
|
||||
break ;
|
||||
}
|
||||
|
||||
setValue ( string ) ;
|
||||
normalize_cursors () ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
#define PUSTACK_MAX 100
|
||||
|
||||
static int currLiveInterface = -1 ;
|
||||
static puInterface *liveInterfaceStack [ PUSTACK_MAX ] ;
|
||||
static int currInterface = -1 ;
|
||||
static puInterface *interfaceStack [ PUSTACK_MAX ] ;
|
||||
|
||||
void puPushLiveInterface ( puInterface *in )
|
||||
{
|
||||
if ( currLiveInterface < PUSTACK_MAX )
|
||||
liveInterfaceStack [ ++currLiveInterface ] = in ;
|
||||
else
|
||||
fprintf ( stderr, "PUI: Too many live puInterfaces open at once!\n" ) ;
|
||||
}
|
||||
|
||||
void puPushInterface ( puInterface *in )
|
||||
{
|
||||
if ( currInterface < PUSTACK_MAX )
|
||||
interfaceStack [ ++currInterface ] = in ;
|
||||
else
|
||||
fprintf ( stderr, "PUI: Too many puInterfaces open at once!\n" ) ;
|
||||
}
|
||||
|
||||
void puPopLiveInterface ( void )
|
||||
{
|
||||
if ( currLiveInterface > 0 )
|
||||
--currLiveInterface ;
|
||||
else
|
||||
fprintf ( stderr, "PUI: Live puInterface stack is empty!\n" ) ;
|
||||
}
|
||||
|
||||
void puPopInterface ( void )
|
||||
{
|
||||
if ( currInterface > 0 )
|
||||
--currInterface ;
|
||||
else
|
||||
fprintf ( stderr, "PUI: puInterface stack is empty!\n" ) ;
|
||||
}
|
||||
|
||||
int puNoLiveInterface ( void )
|
||||
{
|
||||
return currLiveInterface < 0 ;
|
||||
}
|
||||
|
||||
int puNoInterface ( void )
|
||||
{
|
||||
return currInterface < 0 ;
|
||||
}
|
||||
|
||||
puInterface *puGetUltimateLiveInterface ( void )
|
||||
{
|
||||
if ( currLiveInterface < 0 )
|
||||
{
|
||||
fprintf ( stderr, "PUI: No Live Interface!\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
return liveInterfaceStack [ 0 ] ;
|
||||
}
|
||||
|
||||
|
||||
puInterface *puGetBaseLiveInterface ( void )
|
||||
{
|
||||
if ( currLiveInterface < 0 )
|
||||
{
|
||||
fprintf ( stderr, "PUI: No Live Interface!\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
Work down the interface stack until you
|
||||
either get to the bottom or find a block
|
||||
in the form of a puDialogBox.
|
||||
*/
|
||||
|
||||
for ( int i = currLiveInterface ; i > 0 ; i-- )
|
||||
if ( liveInterfaceStack [ i ] -> getType () & PUCLASS_DIALOGBOX )
|
||||
return liveInterfaceStack [ i ] ;
|
||||
|
||||
return liveInterfaceStack [ 0 ] ;
|
||||
}
|
||||
|
||||
puInterface *puGetCurrInterface ( void )
|
||||
{
|
||||
if ( currInterface < 0 )
|
||||
{
|
||||
fprintf ( stderr, "PUI: No Interface!\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
return interfaceStack [ currInterface ] ;
|
||||
}
|
||||
|
||||
void puInterface::remove ( puObject *obj )
|
||||
{
|
||||
if ( dlist == NULL )
|
||||
return ;
|
||||
|
||||
/* Are we the first object in the list */
|
||||
|
||||
if ( obj -> prev == NULL )
|
||||
dlist = obj -> next ;
|
||||
else
|
||||
obj -> prev -> next = obj -> next ;
|
||||
|
||||
/* Are we the last object in the list */
|
||||
|
||||
if ( obj -> next != NULL )
|
||||
obj -> next -> prev = obj -> prev ;
|
||||
|
||||
obj -> next = NULL ;
|
||||
obj -> prev = NULL ;
|
||||
|
||||
num_children-- ;
|
||||
recalc_bbox () ;
|
||||
}
|
||||
|
||||
void puInterface::add ( puObject *new_obj )
|
||||
{
|
||||
if ( dlist == NULL )
|
||||
{
|
||||
dlist = new_obj ;
|
||||
new_obj -> next = NULL ;
|
||||
new_obj -> prev = NULL ;
|
||||
}
|
||||
else
|
||||
{
|
||||
puObject *last ;
|
||||
|
||||
for ( last = dlist ; last->next != NULL ; last = last->next )
|
||||
/* Search for end of list. */ ;
|
||||
|
||||
last -> next = new_obj ;
|
||||
new_obj -> prev = last ;
|
||||
new_obj -> next = NULL ;
|
||||
}
|
||||
|
||||
num_children++ ;
|
||||
recalc_bbox () ;
|
||||
}
|
||||
|
||||
int puInterface::checkKey ( int key, int updown )
|
||||
{
|
||||
if ( dlist == NULL || ! isVisible () || ! isActive () )
|
||||
return FALSE ;
|
||||
|
||||
puObject *bo ;
|
||||
|
||||
/*
|
||||
We have to walk the list backwards to ensure that
|
||||
the click order is the same as the DRAW order.
|
||||
*/
|
||||
|
||||
for ( bo = dlist ; bo->next != NULL ; bo = bo->next )
|
||||
/* Find the last object in our list. */ ;
|
||||
|
||||
for ( ; bo != NULL ; bo = bo->prev )
|
||||
if ( bo -> checkKey ( key, updown ) )
|
||||
return TRUE ;
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
int puInterface::checkHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
if ( dlist == NULL || ! isVisible () || ! isActive () )
|
||||
return FALSE ;
|
||||
|
||||
/*
|
||||
This might be a bit redundant - but it's too hard to keep
|
||||
track of changing abox sizes when daughter objects are
|
||||
changing sizes.
|
||||
*/
|
||||
|
||||
recalc_bbox () ;
|
||||
|
||||
puObject *bo ;
|
||||
|
||||
x -= abox.min[0] ;
|
||||
y -= abox.min[1] ;
|
||||
|
||||
/*
|
||||
We have to walk the list backwards to ensure that
|
||||
the click order is the same as the DRAW order.
|
||||
*/
|
||||
|
||||
for ( bo = dlist ; bo->next != NULL ; bo = bo->next )
|
||||
/* Find the last object in our list. */ ;
|
||||
|
||||
for ( ; bo != NULL ; bo = bo->prev )
|
||||
if ( bo -> checkHit ( button, updown, x, y ) )
|
||||
return TRUE ;
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
void puInterface::draw ( int dx, int dy )
|
||||
{
|
||||
if ( ! isVisible () )
|
||||
return ;
|
||||
|
||||
for ( puObject *bo = dlist ; bo != NULL ; bo = bo->next )
|
||||
{
|
||||
/* June 16th, 98, Shammi :
|
||||
* The next if statement checks if the object is
|
||||
* a menu bar and makes sure it is repositioned
|
||||
* correctly.
|
||||
*/
|
||||
|
||||
if ( bo->getType() & PUCLASS_MENUBAR )
|
||||
{
|
||||
int obWidth, obHeight ;
|
||||
bo -> getSize ( &obWidth, &obHeight ) ;
|
||||
bo -> setPosition ( 0, puGetWindowHeight() - obHeight ) ;
|
||||
}
|
||||
|
||||
bo -> draw ( dx + abox.min[0], dy + abox.min[1] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void puInterface::recalc_bbox ( void )
|
||||
{
|
||||
puBox contents ;
|
||||
contents . empty () ;
|
||||
|
||||
for ( puObject *bo = dlist ; bo != NULL ; bo = bo->next )
|
||||
contents . extend ( bo -> getBBox() ) ;
|
||||
|
||||
if ( contents . isEmpty () )
|
||||
{
|
||||
abox . max[0] = abox . min[0] ;
|
||||
abox . max[1] = abox . min[1] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
abox . max[0] = abox . min[0] + contents . max[0] ;
|
||||
abox . max[1] = abox . min[1] + contents . max[1] ;
|
||||
}
|
||||
|
||||
puObject::recalc_bbox () ;
|
||||
}
|
||||
|
||||
|
||||
void puInterface::doHit ( int, int, int, int )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
puInterface::~puInterface ()
|
||||
{
|
||||
puPopLiveInterface () ;
|
||||
|
||||
puObject *bo = dlist ;
|
||||
|
||||
while ( bo != NULL ) {
|
||||
puObject *tmp_bo = bo->next ;
|
||||
delete bo ;
|
||||
bo = tmp_bo ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#ifndef PU_NOT_USING_GLUT
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#include "pu.h"
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void drop_down_the_menu ( puObject *b )
|
||||
{
|
||||
puPopupMenu *p = (puPopupMenu *) b -> getUserData () ;
|
||||
|
||||
if ( b -> getValue () )
|
||||
p->reveal () ;
|
||||
else
|
||||
p->hide () ;
|
||||
|
||||
for ( puObject *child = b -> getParent () -> getFirstChild () ;
|
||||
child != NULL ; child = child -> next )
|
||||
{
|
||||
if (( child -> getType() & PUCLASS_BUTTON ) != 0 && child != b ) child -> clrValue () ;
|
||||
if (( child -> getType() & PUCLASS_POPUPMENU ) != 0 && child != p ) child -> hide () ;
|
||||
}
|
||||
}
|
||||
|
||||
void puMenuBar::add_submenu ( char *str, char *items[], puCallback cb[] )
|
||||
{
|
||||
int w, h ;
|
||||
getSize ( &w, &h ) ;
|
||||
|
||||
puOneShot *b = new puOneShot ( w+10, 0, str ) ;
|
||||
b -> setStyle ( PUSTYLE_SPECIAL_UNDERLINED ) ;
|
||||
b -> setColourScheme ( colour[PUCOL_FOREGROUND][0],
|
||||
colour[PUCOL_FOREGROUND][1],
|
||||
colour[PUCOL_FOREGROUND][2],
|
||||
colour[PUCOL_FOREGROUND][3] ) ;
|
||||
b -> setCallback ( drop_down_the_menu ) ;
|
||||
b -> setActiveDirn ( PU_UP_AND_DOWN ) ;
|
||||
|
||||
puPopupMenu *p = new puPopupMenu ( w+10, 0 ) ;
|
||||
|
||||
b -> setUserData ( p ) ;
|
||||
|
||||
for ( int i = 0 ; items[i] != NULL ; i++ )
|
||||
p -> add_item ( items[i], cb[i] ) ;
|
||||
|
||||
p->close () ;
|
||||
recalc_bbox () ;
|
||||
}
|
||||
|
||||
void puMenuBar::close (void)
|
||||
{
|
||||
puInterface::close () ;
|
||||
|
||||
if ( dlist == NULL )
|
||||
return ;
|
||||
|
||||
int width = 0 ;
|
||||
puObject *ob ;
|
||||
|
||||
/*
|
||||
Use alternate objects - which gets the puOneShot/puPopupMenu pairs
|
||||
*/
|
||||
|
||||
for ( ob = dlist ; ob != NULL ; ob = ob -> next )
|
||||
{
|
||||
int w, h ;
|
||||
|
||||
/* Reposition the button so it looks nice */
|
||||
|
||||
ob -> getSize ( &w, &h ) ;
|
||||
ob -> setPosition ( width, 0 ) ;
|
||||
ob = ob -> next ;
|
||||
|
||||
/* Reposition the submenu so it sits under the button */
|
||||
|
||||
int w2, h2 ;
|
||||
ob -> getSize ( &w2, &h2 ) ;
|
||||
ob -> setPosition ( width, -h2 ) ;
|
||||
|
||||
/* Next please! */
|
||||
width += w ;
|
||||
}
|
||||
|
||||
recalc_bbox () ;
|
||||
}
|
||||
|
||||
|
||||
222
PUI/puObject.cxx
222
PUI/puObject.cxx
@@ -1,222 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
inline float clamp01 ( float x )
|
||||
{
|
||||
return (x >= 1.0f) ? 1.0f : x ;
|
||||
}
|
||||
|
||||
static void load_colour_scheme ( float col[][4], float r, float g,
|
||||
float b, float a )
|
||||
{
|
||||
puSetColour ( col [ PUCOL_FOREGROUND ], r, g, b, a ) ;
|
||||
puSetColour ( col [ PUCOL_BACKGROUND ], r/2, g/2, b/2, a ) ;
|
||||
puSetColour ( col [ PUCOL_HIGHLIGHT ], clamp01(r*1.3f), clamp01(g*1.3f),
|
||||
clamp01(b*1.3f), a ) ;
|
||||
|
||||
if ( 4 * g + 3 * r + b > 0.5 )
|
||||
puSetColour ( col [ PUCOL_LEGEND ], 0.0, 0.0, 0.0, a ) ;
|
||||
else
|
||||
puSetColour ( col [ PUCOL_LEGEND ], 1.0, 1.0, 1.0, a ) ;
|
||||
}
|
||||
|
||||
|
||||
static int defaultStyle = PUSTYLE_DEFAULT ;
|
||||
static puFont defaultLegendFont = NULL ;
|
||||
static puFont defaultLabelFont = NULL ;
|
||||
static float defaultColourScheme [ 4 ] ;
|
||||
|
||||
void puSetDefaultStyle ( int style ) { defaultStyle = style ; }
|
||||
int puGetDefaultStyle ( void ) { return defaultStyle ; }
|
||||
|
||||
void puSetDefaultFonts ( puFont legendFont, puFont labelFont )
|
||||
{
|
||||
defaultLegendFont = legendFont ;
|
||||
defaultLabelFont = labelFont ;
|
||||
}
|
||||
|
||||
void puGetDefaultFonts ( puFont *legendFont, puFont *labelFont )
|
||||
{
|
||||
if ( legendFont ) *legendFont = defaultLegendFont ;
|
||||
if ( labelFont ) *labelFont = defaultLabelFont ;
|
||||
}
|
||||
|
||||
void puSetDefaultColourScheme ( float r, float g, float b, float a )
|
||||
{
|
||||
defaultColourScheme[0] = r ;
|
||||
defaultColourScheme[1] = g ;
|
||||
defaultColourScheme[2] = b ;
|
||||
defaultColourScheme[3] = a ;
|
||||
load_colour_scheme ( _puDefaultColourTable, r, g, b, a ) ;
|
||||
}
|
||||
|
||||
void puGetDefaultColourScheme ( float *r, float *g, float *b, float *a )
|
||||
{
|
||||
if ( r ) *r = defaultColourScheme[0] ;
|
||||
if ( g ) *g = defaultColourScheme[1] ;
|
||||
if ( b ) *b = defaultColourScheme[2] ;
|
||||
if ( a ) *a = defaultColourScheme[3] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void puObject::setColourScheme ( float r, float g, float b, float a )
|
||||
{
|
||||
load_colour_scheme ( colour, r, g, b, a ) ;
|
||||
}
|
||||
|
||||
puObject::puObject ( int minx, int miny, int maxx, int maxy ) : puValue ()
|
||||
{
|
||||
type |= PUCLASS_OBJECT ;
|
||||
bbox.min[0] = abox.min[0] = minx ;
|
||||
bbox.min[1] = abox.min[1] = miny ;
|
||||
bbox.max[0] = abox.max[0] = maxx ;
|
||||
bbox.max[1] = abox.max[1] = maxy ;
|
||||
|
||||
active_mouse_edge = PU_UP ;
|
||||
style = defaultStyle ;
|
||||
visible = active = TRUE ;
|
||||
highlighted = FALSE ;
|
||||
am_default = FALSE ;
|
||||
|
||||
cb = NULL ;
|
||||
user_data = NULL ;
|
||||
next = prev = NULL ;
|
||||
label = NULL ;
|
||||
labelPlace = PUPLACE_DEFAULT ;
|
||||
labelFont = defaultLabelFont ;
|
||||
legend = NULL ;
|
||||
legendFont = defaultLegendFont ;
|
||||
|
||||
for ( int i = 0 ; i < PUCOL_MAX ; i++ )
|
||||
puSetColour ( colour[i], _puDefaultColourTable[i] ) ;
|
||||
|
||||
if ( ! puNoInterface() )
|
||||
{
|
||||
parent = puGetCurrInterface() ;
|
||||
parent -> add ( this ) ;
|
||||
}
|
||||
else
|
||||
parent = NULL ;
|
||||
}
|
||||
|
||||
|
||||
puObject::~puObject ()
|
||||
{
|
||||
if ( parent != this && parent != NULL )
|
||||
parent -> remove ( this ) ;
|
||||
}
|
||||
|
||||
void puObject::recalc_bbox ( void )
|
||||
{
|
||||
bbox = abox ;
|
||||
|
||||
if ( label != NULL )
|
||||
switch ( labelPlace )
|
||||
{
|
||||
case PUPLACE_ABOVE : bbox.max[1] += puGetStringHeight ( getLabelFont() ) + puGetStringDescender ( getLabelFont () ) + PUSTR_TGAP + PUSTR_BGAP ; break ;
|
||||
case PUPLACE_BELOW : bbox.min[1] -= puGetStringHeight ( getLabelFont() ) + puGetStringDescender ( getLabelFont () ) + PUSTR_TGAP + PUSTR_BGAP ; break ;
|
||||
case PUPLACE_LEFT : bbox.min[0] -= puGetStringWidth ( getLabelFont(), getLabel() ) + PUSTR_LGAP + PUSTR_RGAP ; break ;
|
||||
case PUPLACE_RIGHT : bbox.max[0] += puGetStringWidth ( getLabelFont(), getLabel() ) + PUSTR_LGAP + PUSTR_RGAP ; break ;
|
||||
}
|
||||
|
||||
if ( parent != NULL )
|
||||
parent -> recalc_bbox () ;
|
||||
}
|
||||
|
||||
void puObject::draw_label ( int dx, int dy )
|
||||
{
|
||||
if ( !visible ) return ;
|
||||
|
||||
/* If greyed out then halve the opacity when drawing the label */
|
||||
|
||||
if ( active )
|
||||
glColor4fv ( colour [ PUCOL_LABEL ] ) ;
|
||||
else
|
||||
glColor4f ( colour [ PUCOL_LABEL ][0],
|
||||
colour [ PUCOL_LABEL ][1],
|
||||
colour [ PUCOL_LABEL ][2],
|
||||
colour [ PUCOL_LABEL ][3] / 2.0f ) ; /* 50% more transparent */
|
||||
|
||||
switch ( labelPlace )
|
||||
{
|
||||
case PUPLACE_ABOVE : puDrawString ( labelFont, label, dx + abox.min[0] + PUSTR_LGAP, dy + abox.max[1] + puGetStringDescender(labelFont) + PUSTR_BGAP ) ; break ;
|
||||
case PUPLACE_BELOW : puDrawString ( labelFont, label, dx + abox.min[0] + PUSTR_LGAP, dy + bbox.min[1] + puGetStringDescender(labelFont) + PUSTR_BGAP ) ; break ;
|
||||
case PUPLACE_LEFT : puDrawString ( labelFont, label, dx + bbox.min[0] + PUSTR_LGAP, dy + abox.min[1] + puGetStringDescender(labelFont) + PUSTR_BGAP ) ; break ;
|
||||
case PUPLACE_RIGHT : puDrawString ( labelFont, label, dx + abox.max[0] + PUSTR_LGAP, dy + abox.min[1] + puGetStringDescender(labelFont) + PUSTR_BGAP ) ; break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int puObject::checkKey ( int key, int updown )
|
||||
{
|
||||
if ( updown == PU_UP )
|
||||
return FALSE ;
|
||||
|
||||
if ( isReturnDefault() && ( key == '\r' || key == '\n' ) )
|
||||
{
|
||||
checkHit ( PU_LEFT_BUTTON, PU_DOWN, (abox.min[0]+abox.max[0])/2,
|
||||
(abox.min[1]+abox.max[1])/2 ) ;
|
||||
checkHit ( PU_LEFT_BUTTON, PU_UP , (abox.min[0]+abox.max[0])/2,
|
||||
(abox.min[1]+abox.max[1])/2 ) ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
void puObject::doHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
(x,x);(y,y);
|
||||
|
||||
if ( button == PU_LEFT_BUTTON )
|
||||
{
|
||||
if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN )
|
||||
{
|
||||
lowlight () ;
|
||||
invokeCallback () ;
|
||||
}
|
||||
else
|
||||
highlight () ;
|
||||
}
|
||||
else
|
||||
lowlight () ;
|
||||
}
|
||||
|
||||
int puObject::checkHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
if ( isHit( x, y ) )
|
||||
{
|
||||
doHit ( button, updown, x, y ) ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
lowlight () ;
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
char *puValue::getTypeString ( void )
|
||||
{
|
||||
int i = getType () ;
|
||||
|
||||
if ( i & PUCLASS_DIALOGBOX ) return "puDialogBox" ;
|
||||
if ( i & PUCLASS_SLIDER ) return "puSlider" ;
|
||||
if ( i & PUCLASS_BUTTONBOX ) return "puButtonBox" ;
|
||||
if ( i & PUCLASS_INPUT ) return "puInput" ;
|
||||
if ( i & PUCLASS_MENUBAR ) return "puMenuBar" ;
|
||||
if ( i & PUCLASS_POPUPMENU ) return "puPopupMenu" ;
|
||||
if ( i & PUCLASS_POPUP ) return "puPopup" ;
|
||||
if ( i & PUCLASS_ONESHOT ) return "puOneShot" ;
|
||||
if ( i & PUCLASS_BUTTON ) return "puButton" ;
|
||||
if ( i & PUCLASS_TEXT ) return "puText" ;
|
||||
if ( i & PUCLASS_FRAME ) return "puFrame" ;
|
||||
if ( i & PUCLASS_INTERFACE ) return "puInterface" ;
|
||||
if ( i & PUCLASS_OBJECT ) return "puObject" ;
|
||||
if ( i & PUCLASS_VALUE ) return "puValue" ;
|
||||
|
||||
return "Unknown Object type." ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void puOneShot::doHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
puButton::doHit ( button, updown, x, y ) ;
|
||||
setValue ( 0 ) ;
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
#include "puLocal.h"
|
||||
|
||||
#define PUMENU_BUTTON_HEIGHT 25
|
||||
#define PUMENU_BUTTON_EXTRA_WIDTH 25
|
||||
|
||||
puObject *puPopupMenu::add_item ( char *str, puCallback cb )
|
||||
{
|
||||
int w, h ;
|
||||
getSize ( &w, &h ) ;
|
||||
puOneShot *b = new puOneShot ( 0, h, str ) ;
|
||||
b->setStyle ( PUSTYLE_PLAIN ) ;
|
||||
b->setColourScheme ( colour[PUCOL_FOREGROUND][0],
|
||||
colour[PUCOL_FOREGROUND][1],
|
||||
colour[PUCOL_FOREGROUND][2],
|
||||
colour[PUCOL_FOREGROUND][3] ) ;
|
||||
b->setCallback ( cb ) ;
|
||||
recalc_bbox () ;
|
||||
return b ;
|
||||
}
|
||||
|
||||
void puPopupMenu::close ( void )
|
||||
{
|
||||
puPopup::close () ;
|
||||
|
||||
int widest = 0 ;
|
||||
puObject *ob = dlist ;
|
||||
|
||||
/*
|
||||
* June 17th, 1998, Shammi
|
||||
* There seems to be some mismatch with the
|
||||
* #define pumenusize and the actual size
|
||||
* There seems to be some overlap resulting
|
||||
* in more than one option being highlighted.
|
||||
* By setting the size to the actual values,
|
||||
* the overlap area seems to be less now.
|
||||
*/
|
||||
|
||||
int w, h ;
|
||||
|
||||
for ( ob = dlist ; ob != NULL ; ob = ob -> next )
|
||||
{
|
||||
ob -> getSize ( &w, &h ) ;
|
||||
|
||||
if ( w > widest ) widest = w ;
|
||||
}
|
||||
|
||||
for ( ob = dlist ; ob != NULL ; ob = ob -> next )
|
||||
{
|
||||
ob -> getSize ( &w, &h ) ;
|
||||
ob -> setSize ( widest, h ) ;
|
||||
}
|
||||
|
||||
recalc_bbox () ;
|
||||
}
|
||||
|
||||
|
||||
int puPopupMenu::checkKey ( int key, int updown )
|
||||
{
|
||||
if ( dlist == NULL || ! isVisible () || ! isActive () )
|
||||
return FALSE ;
|
||||
|
||||
if ( updown == PU_DOWN )
|
||||
{
|
||||
hide () ;
|
||||
|
||||
/* Turn everything off ready for next time. */
|
||||
|
||||
for ( puObject *bo = dlist ; bo != NULL ; bo = bo->next )
|
||||
bo -> clrValue () ;
|
||||
}
|
||||
|
||||
puObject *bo ;
|
||||
|
||||
/*
|
||||
We have to walk the list backwards to ensure that
|
||||
the click order is the same as the DRAW order.
|
||||
*/
|
||||
|
||||
for ( bo = dlist ; bo->next != NULL ; bo = bo->next )
|
||||
/* Find the last object in our list. */ ;
|
||||
|
||||
for ( ; bo != NULL ; bo = bo->prev )
|
||||
if ( bo -> checkKey ( key, updown ) )
|
||||
return TRUE ;
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
int puPopupMenu::checkHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
if ( dlist == NULL || ! isVisible () || ! isActive () )
|
||||
return FALSE ;
|
||||
|
||||
/* Must test 'isHit' before making the menu invisible! */
|
||||
|
||||
int hit = isHit ( x, y ) ;
|
||||
|
||||
/*
|
||||
* June 17th, 1998, Shammi :
|
||||
* There seemed to be a miscalculation with the menus initially
|
||||
* Therefore I moved the recalculation stuff before the clearing.
|
||||
*/
|
||||
|
||||
/*
|
||||
This might be a bit redundant - but it's too hard to keep
|
||||
track of changing abox sizes when daughter objects are
|
||||
changing sizes.
|
||||
*/
|
||||
|
||||
recalc_bbox();
|
||||
x -= abox.min[0] ;
|
||||
y -= abox.min[1] ;
|
||||
|
||||
/*
|
||||
* June 17th, 1998, Shammi :
|
||||
* Also clear the menu when the dragging the mouse and not hit.
|
||||
*/
|
||||
|
||||
if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN ||
|
||||
( updown == PU_DRAG && !hit ) )
|
||||
{
|
||||
|
||||
/* June 17th, 1998, Shammi :
|
||||
* Do not hide the menu if mouse is dragged out
|
||||
*/
|
||||
|
||||
if ( updown != PU_DRAG )
|
||||
hide () ;
|
||||
|
||||
/* Turn everything off ready for next time. */
|
||||
|
||||
/* June 17th, 1998, Shammi:
|
||||
* Make sure we check for a hit, if the mouse is moved
|
||||
* out of the menu.
|
||||
*/
|
||||
|
||||
for ( puObject *bo = dlist ; bo != NULL ; bo = bo->next )
|
||||
{
|
||||
if ( ! hit )
|
||||
bo -> checkHit ( button, updown, x , y ) ;
|
||||
|
||||
bo -> clrValue () ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! hit )
|
||||
return FALSE ;
|
||||
|
||||
puObject *bo ;
|
||||
|
||||
/*
|
||||
We have to walk the list backwards to ensure that
|
||||
the click order is the same as the DRAW order.
|
||||
*/
|
||||
|
||||
/* June 17th, 1998, Shammi :
|
||||
* If the mouse is dragged and the menuItem is not hit,
|
||||
* clear it
|
||||
*/
|
||||
|
||||
for ( bo = dlist ; bo->next != NULL ; bo = bo->next )
|
||||
if ( updown == PU_DRAG && ! bo -> checkHit ( button, updown, x, y ) )
|
||||
bo -> clrValue () ;
|
||||
|
||||
/* Find the last object in our list. */ ;
|
||||
|
||||
for ( ; bo != NULL ; bo = bo->prev )
|
||||
if ( bo -> checkHit ( button, updown, x, y ) )
|
||||
return TRUE ;
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
107
PUI/puSlider.cxx
107
PUI/puSlider.cxx
@@ -1,107 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void puSlider::draw ( int dx, int dy )
|
||||
{
|
||||
if ( !visible ) return ;
|
||||
|
||||
abox . draw ( dx, dy,
|
||||
(style==PUSTYLE_BEVELLED||
|
||||
style==PUSTYLE_SHADED) ? -PUSTYLE_BOXED : -style,
|
||||
colour, FALSE ) ;
|
||||
|
||||
int sd, od ;
|
||||
|
||||
if ( isVertical() ) { sd = 1 ; od = 0 ; } else { sd = 0 ; od = 1 ; }
|
||||
|
||||
int sz = abox.max [sd] - abox.min [sd] ;
|
||||
|
||||
float val ;
|
||||
|
||||
getValue ( & val ) ;
|
||||
|
||||
if ( val < 0.0f ) val = 0.0f ;
|
||||
if ( val > 1.0f ) val = 1.0f ;
|
||||
|
||||
val *= (float) sz * (1.0f - slider_fraction) ;
|
||||
|
||||
puBox bx ;
|
||||
|
||||
bx . min [ sd ] = abox . min [ sd ] + (int) val ;
|
||||
bx . max [ sd ] = (int) ( (float) bx . min [ sd ] + (float) sz * slider_fraction ) ;
|
||||
bx . min [ od ] = abox . min [ od ] + 2 ;
|
||||
bx . max [ od ] = abox . max [ od ] - 2 ;
|
||||
|
||||
bx . draw ( dx, dy, PUSTYLE_SMALL_SHADED, colour, FALSE ) ;
|
||||
|
||||
/* If greyed out then halve the opacity when drawing the label and legend */
|
||||
|
||||
if ( active )
|
||||
glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
|
||||
else
|
||||
glColor4f ( colour [ PUCOL_LEGEND ][0],
|
||||
colour [ PUCOL_LEGEND ][1],
|
||||
colour [ PUCOL_LEGEND ][2],
|
||||
colour [ PUCOL_LEGEND ][3] / 2.0f ) ; /* 50% more transparent */
|
||||
|
||||
int xx = ( abox.max[0] - abox.min[0] - puGetStringWidth(legendFont,legend) ) / 2 ;
|
||||
int yy = ( abox.max[1] - abox.min[1] - puGetStringHeight(legendFont) ) / 2 ;
|
||||
|
||||
puDrawString ( legendFont, legend,
|
||||
dx + abox.min[0] + xx,
|
||||
dy + abox.min[1] + yy ) ;
|
||||
|
||||
draw_label ( dx, dy ) ;
|
||||
}
|
||||
|
||||
|
||||
void puSlider::doHit ( int button, int updown, int x, int y )
|
||||
{
|
||||
if ( button == PU_LEFT_BUTTON )
|
||||
{
|
||||
int sd = isVertical() ;
|
||||
int sz = abox.max [sd] - abox.min [sd] ;
|
||||
int coord = isVertical() ? y : x ;
|
||||
|
||||
float next_value ;
|
||||
|
||||
if ( sz == 0 )
|
||||
next_value = 0.5f ;
|
||||
else
|
||||
{
|
||||
next_value = ( (float)coord - (float)abox.min[sd] - (float)sz * slider_fraction / 2.0f ) /
|
||||
( (float) sz * (1.0f - slider_fraction) ) ;
|
||||
}
|
||||
|
||||
next_value = (next_value < 0.0f) ? 0.0f : (next_value > 1.0) ? 1.0f : next_value ;
|
||||
|
||||
setValue ( next_value ) ;
|
||||
|
||||
switch ( cb_mode )
|
||||
{
|
||||
case PUSLIDER_CLICK :
|
||||
if ( updown == active_mouse_edge )
|
||||
{
|
||||
last_cb_value = next_value ;
|
||||
invokeCallback () ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case PUSLIDER_DELTA :
|
||||
if ( fabs ( last_cb_value - next_value ) >= cb_delta )
|
||||
{
|
||||
last_cb_value = next_value ;
|
||||
invokeCallback () ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case PUSLIDER_ALWAYS :
|
||||
default :
|
||||
last_cb_value = next_value ;
|
||||
invokeCallback () ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
#include "puLocal.h"
|
||||
|
||||
void puText::draw ( int dx, int dy )
|
||||
{
|
||||
draw_label ( dx, dy ) ;
|
||||
}
|
||||
|
||||
24
README.MSVC
Normal file
24
README.MSVC
Normal file
@@ -0,0 +1,24 @@
|
||||
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.
|
||||
285
README.metakit
Normal file
285
README.metakit
Normal file
@@ -0,0 +1,285 @@
|
||||
For your convenience (and with the author's permission) a copy of the
|
||||
MetaKit source is bundled with SimGear in $(top_srcdir)/src-libs/.
|
||||
You must have metakit installed before you can build SimGear.
|
||||
|
||||
- Most linux distributions have a metakit package. For linux
|
||||
developers, we recommend ysou install your distributions package
|
||||
rather than building from source.
|
||||
|
||||
- For developers on most other platforms, you will have to build
|
||||
metakit from source and install it yourself. For your convenience a
|
||||
tar ball of the metakit source is included with the simgear source
|
||||
distribution. Untar the metakit source, and follow the included
|
||||
build and installation instructions.
|
||||
|
||||
Once metakit is installed you can return to configuring and building
|
||||
Simgear.
|
||||
|
||||
=============================================================================
|
||||
|
||||
Potentially important build note:
|
||||
|
||||
Later on when you are linking programs with -lmk4 (i.e. FlightGear or one
|
||||
of it's associated programs) if you come across an error similar to the
|
||||
following:
|
||||
|
||||
c++ -Wall -O2 -L/usr/local/lib -o gensimple gensimple.o libAirports.a
|
||||
-lsgdebug -lsgmisc -lmk4 -lz -lm
|
||||
/usr/local/lib/libmk4.a(view.o)(.text+0x1c8):view.cpp: multiple definition
|
||||
of `c4_View::~c4_View(void)'
|
||||
libAirports.a(simple.o)(.text$_$_7c4_View+0x0):simple.cxx: first defined
|
||||
here
|
||||
collect2: ld returned 1 exit status
|
||||
make[2]: *** [gensimple] Error 1
|
||||
make[2]: Leaving directory `/home/curt/FlightGear-0.7.7/src/Airports'
|
||||
make[1]: *** [all-recursive] Error 1
|
||||
make[1]: Leaving directory `/home/curt/FlightGear-0.7.7/src'
|
||||
make: *** [all-recursive] Error 1
|
||||
|
||||
Then you need to come back and rebuild Metakit with the -DNDEBUG flag.
|
||||
For unix/cygwin systems, modify the unix/Makefile file and add -DNDEBUG
|
||||
to the CFLAGS line.
|
||||
|
||||
Now we return you to the official metakit readme ... :-)
|
||||
|
||||
|
||||
The MetaKit Library 2.01 March 2000
|
||||
==============================================================================
|
||||
|
||||
|
||||
WHAT IT IS - MetaKit is an embeddable database which runs on Unix, Windows,
|
||||
Macintosh, and other platforms. It lets you build applications which
|
||||
store their data efficiently, in a portable way, and which will not need a
|
||||
complex runtime installation. In terms of the data model, MetaKit takes
|
||||
the middle ground between RDBMS, OODBMS, and flat-file databases - yet it
|
||||
is quite different from each of them.
|
||||
|
||||
WHAT IT ISN'T - MetaKit is not: 1) multi-user/-threading, 2) scalable to
|
||||
gigabytes, 3) proprietary software, 4) full of bugs, 5) just a toy.
|
||||
|
||||
TECHNOLOGY - Everything is stored variable-sized yet with efficient positional
|
||||
row access. Changing an existing datafile structure is as simple as re-
|
||||
opening it with that new structure. All changes are transacted. You can
|
||||
mix and match software written in C++, Python, and Tcl. Things can't get
|
||||
much more flexible...
|
||||
|
||||
CORE - The Metakit core library is written in C++. It has a code footprint of
|
||||
just over 100 Kb on Windows. It can be used as DLL, or linked statically.
|
||||
Debug builds include extensive assertion checks to catch problems early.
|
||||
|
||||
PYTHON - The binding for Python is called "Mk4py". It uses SCXX by Gordon
|
||||
McMillan as C++ glue interface. The source is in directory "python/".
|
||||
|
||||
TCL/TK - The MK extension for Tcl is called "Mk4tcl". It is being used in a
|
||||
number of commercial projects, for in-house use as well as in commercially
|
||||
distributed products. The source is in directory "tcl/".
|
||||
|
||||
LICENSE AND SUPPORT - MetaKit 2.01 is distributed as open source software (the
|
||||
X/MIT-style license is at the end of this document). Commercial support
|
||||
is available through an Enterprise License, see the URL mentioned below.
|
||||
|
||||
DOCUMENTATION - All documentation uses HTML. The main page is "MetaKit.html",
|
||||
which leads to the rest of the documentation in the "doc/" directory.
|
||||
|
||||
WEBSITE URLS - The main pages on the world wide web, for news and downloads:
|
||||
Homepage: http://www.equi4.com/metakit/
|
||||
Python news: http://www.equi4.com/metakit/python.html
|
||||
Tcl/Tk news: http://www.equi4.com/metakit/tcl.html
|
||||
License info: http://www.equi4.com/metakit/license.html
|
||||
Contact info: http://www.equi4.com/contact.html
|
||||
|
||||
|
||||
INSTALLATION
|
||||
============
|
||||
|
||||
Starting with this release, all platform builds and language bindings are now
|
||||
designed to work from a single common "builds/" directory. It turns out to
|
||||
be impossible to keep build side-effects limited to *just* this directory
|
||||
(CodeWarrior can't be told where to place its temp data, and Visual C++ still
|
||||
alters a few files next to the project ".dsw" file, to name two offenders).
|
||||
|
||||
UNIX
|
||||
|
||||
It is no longer advised to build the Unix code in the "unix/" directory.
|
||||
Instead, you should perform the following steps:
|
||||
% cd builds
|
||||
% ../unix/configure
|
||||
% make
|
||||
% make test
|
||||
And optionally (this only installs the core lib, not script extensions):
|
||||
% make install
|
||||
|
||||
By switching to the "builds/" directory, you will keep the distribution
|
||||
directory tree 100% unaltered. All changes are made in this subdir, and
|
||||
all final build results are left behind in this same subdir.
|
||||
|
||||
Nastiness: if you build Mk4tcl, please do a "make Mk4tcl.so" as well.
|
||||
And if you intend to create the Python extension, do a "make Mk4py.so".
|
||||
The "libmk4tcl.so.0.0.0" and "libMk4py.so.0.0.0" targets are bogus ones.
|
||||
|
||||
You will probably have to make changes in the makefile to locate the
|
||||
proper includes and libs for Python (Tcl has been fixed, see "--with-tcl).
|
||||
You probably only need to adjust "CXX_SWITCHES_PY" to find the headers.
|
||||
|
||||
To build with STL containers and strings, you can do the following:
|
||||
make CXXFLAGS='-Dq4_STD' test # add -O3 etc, as needed
|
||||
This passes the test suite on Linux RedHat 5.2 with gcc 2.95-2.
|
||||
|
||||
See below for some platform-specific build notes.
|
||||
|
||||
WINDOWS
|
||||
|
||||
There is a "win/" directory which contains subdirectories for a number of
|
||||
compiler systems. MetaKit has been built with many different compilers
|
||||
in the past (Microsoft, Borland, Watcom, Symantec, Metrowerks, Optima),
|
||||
but to preserve my sanity (there are 12 configurations for MSVC6 alone!),
|
||||
I am limiting myself to MSVC6, MWCW5, Borland C++ Builder 4, and Cygwin.
|
||||
|
||||
The MS Visual C++ 6.0 project is "win/msvc60/mksrc.dsw", with subprojects
|
||||
for the C++ demo (mkdemo), building dll's (mkdll), static libs (mklib),
|
||||
regression tests (mktest), as well as Tcl (mktcl) and Python (mkpython).
|
||||
It has been set up to place all intermediate files and final results in
|
||||
the "builds/" subdirectory, even though you'll launch it from "win/".
|
||||
|
||||
To build with STL containers and strings under MSVC, define "q4_STD".
|
||||
To build with MFC containers and strings under MSVC, define "q4_MFC".
|
||||
|
||||
The Metrowerks Codewarrior project is in the "mac/" directory, and can be
|
||||
used to build both Mac and Windows versions (on either Mac *or* Windows).
|
||||
The core libraries are built with "mac/cw5.mcp", demos / tests are built
|
||||
with "cw5apps.mcp", Tcl is "cw5tcl.mcp", and Python is "cw5python.mcp".
|
||||
|
||||
The Borland C++ Builder projects have not yet been incorporated in this
|
||||
release, but the "KitViewer" application is an example of how to use BCB.
|
||||
|
||||
The Cygwin build (B20.1 / gcc 2.95.2) is different, because it uses the
|
||||
unix autoconf system, and must be launched as described above for UNIX.
|
||||
I have upgraded to the latest development of libtool to be able to build
|
||||
DLL's with Cygwin. You can build the "-mno-cygwin" version by editing
|
||||
the Makefile by hand and adding that option to CXXFLAGS.
|
||||
|
||||
Rob Bloodgood adds that the following GCC options are for maximum code
|
||||
efficiency on x86 hardware: "-O2 -m486 -malign-loops=2 -malign-jumps=2".
|
||||
I have not yet tried this myself, but am passing on the tip.
|
||||
|
||||
MACINTOSH
|
||||
|
||||
The Mac version requires Metrowerks CodeWarrior 5. See the info above
|
||||
in the Windows section (MWCW is multi-platform). The projects are all
|
||||
located in the "mac/" folder, which is also where MWCW will place its own
|
||||
"... Data" folders with intermediate results. As with all other setups,
|
||||
final results are made to end up in the "builds/" directory.
|
||||
|
||||
Static 68K builds appear to work fine, the 68K CFM variants will need
|
||||
some more work (I couldn't get the libraries to export their symbols).
|
||||
|
||||
|
||||
PLATFORM-SPECIFIC NOTES
|
||||
=======================
|
||||
|
||||
* Linux RH 5.2 / gcc 2.95.2
|
||||
|
||||
Builds with gcc 2.95.2 work out of the box. The Tcl extension ends up as
|
||||
".libs/libmk4tcl.so.0.0.0" (to please libtool), and should be renamed to
|
||||
"Mk4tcl.so". Similarly, ".libs/libMk4py.so.0.0.0" is in fact the Python
|
||||
extension, and *must* be renamed to "Mk4py.so" to call it from Python.
|
||||
|
||||
The core MK libs end up as ".libs/libmk4.a" and ".libs/libmk4.so.0.0.0".
|
||||
|
||||
* Solaris 2.6 / gcc 2.8.1
|
||||
|
||||
The Solaris builds are nasty for several reasons:
|
||||
|
||||
- I do not own such a machine, and often have to make arrangements
|
||||
(or fight limited space on one of the machines I can telnet to).
|
||||
- The gcc 2.8.1 optimizer appears to be buggy, I have had to turn off
|
||||
the default "-O3" flag to prevent compiler crashes (several files).
|
||||
This problems appears to be resolved with gcc 2.95.
|
||||
- Locking on Solaris (especially w.r.t NFS) remains a mystery to me.
|
||||
The Tcl and Python extensions both use locking (the core not yet).
|
||||
See tcl/Mk4tcl.cpp around line 520, and python/PyStorage.cpp around
|
||||
line 80 for details. It's all pretty messy, and not 100% correct.
|
||||
|
||||
Despite this, I'm doing my best to resolve these issues. Having a solid
|
||||
build of the core *and* of Tcl / Python extensions is quite important.
|
||||
|
||||
* Other Unix systems
|
||||
|
||||
No further notes, though many systems will build fine out of the box.
|
||||
|
||||
* Windows
|
||||
|
||||
MSVC 6 builds MK as static lib and as DLL (universal config, I have not
|
||||
yet created build versions with MFC or STL, mainly because MK can now be
|
||||
used in all contexts regardless of how it was built). The Python and Tcl
|
||||
extensions build as dynamic extensions (a static build is easy to add).
|
||||
|
||||
MWCW 5 builds MK as static lib and as DLL (interestingly enough, the DLL
|
||||
is slightly smaller than MSVC 6 - 102 vs 108 Kb - when their runtimes are
|
||||
linked in dynamically as well). I have not added Win builds for Tcl or
|
||||
Python, since MSVC 6 has those already.
|
||||
|
||||
Cygwin B20.1, with gcc 2.95.2 ugrade, also builds MK as static lib and as
|
||||
DLL. Both "pure" Cygwin (i.e. requiring cygwin1.dll) and mingw32 (using
|
||||
the -mno-cygwin flag) build, but there are some hairy include issues when
|
||||
it comes to choosing the right locking model for Tcl and Python. These
|
||||
issues have not been resolved fully.
|
||||
|
||||
* Macintosh
|
||||
|
||||
MWCW 5 builds PPC shared libs, PPC static libs, and 68K static libraries.
|
||||
|
||||
Building 68K CFM libraries leads to a "MetaKit 68K.shlb" which comes out
|
||||
of the linker without errors, but the result does not seem to have any
|
||||
export symbols defined (despite the fact that the library is over 200 K).
|
||||
Because of that, I've been unable to build apps or Mk4tcl/Mk4py so far.
|
||||
|
||||
The other three configurations build, but for some reason MK's regression
|
||||
test stops at L03 (everything up to that point looks ok, i.e. over 90%).
|
||||
|
||||
The Mk4tcl PPC extension appears to work (quick manual test), and so does
|
||||
the Python extension, "Mk4py.PPC.slb". I have not yet given these two
|
||||
a serious workout, hoping to have a basic test harness in place soon.
|
||||
|
||||
* VMS, BeOS, ...
|
||||
|
||||
No news yet, please report your findings with any other platform builds.
|
||||
|
||||
|
||||
WHAT'S MISSING HERE
|
||||
===================
|
||||
|
||||
- a section on basic concepts (or maybe it doesn't belong here?)
|
||||
- a section on getting started (C++, Python, Tcl all differ - point to
|
||||
the respective intro pages)
|
||||
- maybe a small sample for each of C++ / Tcl / Python, to give an idea
|
||||
- mention TclKit, scripted docs (WiKit/Tequila?), VFS?
|
||||
- I forgot... please tell me :)
|
||||
|
||||
|
||||
LICENSE AND COPYRIGHT STATEMENT
|
||||
===============================
|
||||
|
||||
Copyright (c) 1996-2000 Jean-Claude Wippler
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
==============================================================================
|
||||
-- Jean-Claude Wippler <jcw@equi4.com>
|
||||
@@ -1,7 +1,33 @@
|
||||
zlib 1.1.3 is a general purpose data compression library. All the code
|
||||
For your convenience and allowed by zlib's license terms:
|
||||
http://www.gzip.org/zlib/zlib_license.html a copy of the zlib source
|
||||
is bundled with SimGear in $(top_srcdir)/src-libs/. You must have
|
||||
zlib installed before you can build SimGear.
|
||||
|
||||
- Most linux distributions have a zlib package. For linux
|
||||
developers, we recommend ysou install your distributions package
|
||||
rather than building from source.
|
||||
|
||||
- Cygwin installs zlib automatically.
|
||||
|
||||
- For developers on most other platforms, you will have to build
|
||||
zlib from source and install it yourself. For your convenience a
|
||||
tar ball of the zlib source is included with the simgear source
|
||||
distribution. Untar the zlib source, and follow the included
|
||||
build and installation instructions.
|
||||
|
||||
Once zlib is installed you can return to configuring and building
|
||||
Simgear.
|
||||
|
||||
We now send you to the official zlib README ...
|
||||
|
||||
|
||||
=============================================================================
|
||||
|
||||
|
||||
zlib 1.1.4 is a general purpose data compression library. All the code
|
||||
is thread safe. The data format used by the zlib library
|
||||
is described by RFCs (Request for Comments) 1950 to 1952 in the files
|
||||
ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
|
||||
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
|
||||
format) and rfc1952.txt (gzip format). These documents are also available in
|
||||
other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
|
||||
|
||||
@@ -14,51 +40,50 @@ except example.c and minigzip.c.
|
||||
|
||||
To compile all files and run the test program, follow the instructions
|
||||
given at the top of Makefile. In short "make test; make install"
|
||||
should work for most machines. For Unix: "configure; make test; make install"
|
||||
should work for most machines. For Unix: "./configure; make test; make install"
|
||||
For MSDOS, use one of the special makefiles such as Makefile.msc.
|
||||
For VMS, use Make_vms.com or descrip.mms.
|
||||
|
||||
Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov>, or to
|
||||
Questions about zlib should be sent to <zlib@gzip.org>, or to
|
||||
Gilles Vollant <info@winimage.com> for the Windows DLL version.
|
||||
The zlib home page is http://www.cdrom.com/pub/infozip/zlib/
|
||||
The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/
|
||||
Before reporting a problem, please check those sites to verify that
|
||||
The zlib home page is http://www.zlib.org or http://www.gzip.org/zlib/
|
||||
Before reporting a problem, please check this site to verify that
|
||||
you have the latest version of zlib; otherwise get the latest version and
|
||||
check whether the problem still exists or not.
|
||||
|
||||
Mark Nelson <markn@tiny.com> wrote an article about zlib for the Jan. 1997
|
||||
PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html
|
||||
before asking for help.
|
||||
|
||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available in
|
||||
http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
|
||||
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
|
||||
|
||||
The changes made in version 1.1.3 are documented in the file ChangeLog.
|
||||
The main changes since 1.1.2 are:
|
||||
The changes made in version 1.1.4 are documented in the file ChangeLog.
|
||||
The only changes made since 1.1.3 are bug corrections:
|
||||
|
||||
- fix "an inflate input buffer bug that shows up on rare but persistent
|
||||
occasions" (Mark)
|
||||
- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
|
||||
- fix gzseek(..., SEEK_SET) in write mode
|
||||
- fix crc check after a gzeek (Frank Faubert)
|
||||
- fix miniunzip when the last entry in a zip file is itself a zip file
|
||||
(J Lillge)
|
||||
- add contrib/asm586 and contrib/asm686 (Brian Raiter)
|
||||
See http://www.muppetlabs.com/~breadbox/software/assembly.html
|
||||
- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
|
||||
- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
|
||||
- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
|
||||
- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
|
||||
- added a FAQ file
|
||||
- ZFREE was repeated on same allocation on some error conditions.
|
||||
This creates a security problem described in
|
||||
http://www.zlib.org/advisory-2002-03-11.txt
|
||||
- Returned incorrect error (Z_MEM_ERROR) on some invalid data
|
||||
- Avoid accesses before window for invalid distances with inflate window
|
||||
less than 32K.
|
||||
- force windowBits > 8 to avoid a bug in the encoder for a window size
|
||||
of 256 bytes. (A complete fix will be available in 1.1.5).
|
||||
|
||||
The beta version 1.1.5beta includes many more changes. A new official
|
||||
version 1.1.5 will be released as soon as extensive testing has been
|
||||
completed on it.
|
||||
|
||||
plus many changes for portability.
|
||||
|
||||
Unsupported third party contributions are provided in directory "contrib".
|
||||
|
||||
A Java implementation of zlib is available in the Java Development Kit 1.1
|
||||
A Java implementation of zlib is available in the Java Development Kit
|
||||
http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
|
||||
See the zlib home page http://www.cdrom.com/pub/infozip/zlib/ for details.
|
||||
See the zlib home page http://www.zlib.org for details.
|
||||
|
||||
A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
|
||||
is in the CPAN (Comprehensive Perl Archive Network) sites, such as:
|
||||
ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
|
||||
is in the CPAN (Comprehensive Perl Archive Network) sites
|
||||
http://www.cpan.org/modules/by-module/Compress/
|
||||
|
||||
A Python interface to zlib written by A.M. Kuchling <amk@magnet.com>
|
||||
is available in Python 1.5 and later versions, see
|
||||
@@ -117,7 +142,7 @@ Acknowledgments:
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-1998 Jean-loup Gailly and Mark Adler
|
||||
(C) 1995-2002 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -1,13 +0,0 @@
|
||||
bin_PROGRAMS = testserial
|
||||
|
||||
noinst_LIBRARIES = libSerial.a
|
||||
|
||||
libSerial_a_SOURCES = serial.cxx serial.hxx
|
||||
|
||||
testserial_SOURCES = testserial.cxx
|
||||
|
||||
testserial_LDADD = \
|
||||
$(top_builddir)/Lib/Serial/libSerial.a \
|
||||
$(top_builddir)/Lib/Debug/libDebug.a
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib
|
||||
@@ -1,112 +0,0 @@
|
||||
// serial.hxx -- Unix serial I/O support
|
||||
//
|
||||
// Written by Curtis Olson, started November 1998.
|
||||
//
|
||||
// Copyright (C) 1998 Curtis L. Olson - curt@flightgear.org
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id$
|
||||
// (Log is kept at end of this file)
|
||||
|
||||
|
||||
#ifndef _SERIAL_HXX
|
||||
#define _SERIAL_HXX
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <Include/compiler.h>
|
||||
#include STL_STRING
|
||||
FG_USING_STD(string);
|
||||
|
||||
// if someone know how to do this all with C++ streams let me know
|
||||
// #include <stdio.h>
|
||||
|
||||
|
||||
class fgSERIAL
|
||||
{
|
||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
||||
typedef HANDLE fd_type;
|
||||
#else
|
||||
typedef int fd_type;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
fd_type fd;
|
||||
bool dev_open;
|
||||
|
||||
public:
|
||||
|
||||
fgSERIAL();
|
||||
fgSERIAL(const string& device, int baud);
|
||||
|
||||
~fgSERIAL();
|
||||
|
||||
bool open_port(const string& device);
|
||||
bool close_port();
|
||||
bool set_baud(int baud);
|
||||
string read_port();
|
||||
int write_port(const string& value);
|
||||
|
||||
inline bool is_enabled() { return dev_open; }
|
||||
};
|
||||
|
||||
|
||||
#endif // _SERIAL_HXX
|
||||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.5 1999/03/02 01:01:58 curt
|
||||
// Tweaks for compiling with native SGI compilers.
|
||||
//
|
||||
// Revision 1.4 1999/02/26 22:08:13 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
// Revision 1.3 1999/02/02 20:13:24 curt
|
||||
// MSVC++ portability changes by Bernie Bright:
|
||||
//
|
||||
// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
|
||||
// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
|
||||
// Simulator/Cockpit/hud.cxx: Added Standard headers
|
||||
// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
|
||||
// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
|
||||
// Simulator/Main/fg_init.cxx:
|
||||
// Simulator/Main/GLUTmain.cxx:
|
||||
// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
|
||||
// Simulator/Objects/material.hxx:
|
||||
// Simulator/Time/timestamp.hxx: VC++ friend kludge
|
||||
// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
|
||||
// Simulator/Main/views.hxx: Added a constant
|
||||
//
|
||||
// Revision 1.2 1998/11/30 17:15:30 curt
|
||||
// Having the class destructor close the fd was a bad idea ... especially if you
|
||||
// ever make a copy of the instance and then subsequently destroy either.
|
||||
// close_port() is now a separate member function.
|
||||
//
|
||||
// Revision 1.1 1998/11/16 13:53:02 curt
|
||||
// Initial revision.
|
||||
//
|
||||
2036
SimGear.dsp
Normal file
2036
SimGear.dsp
Normal file
File diff suppressed because it is too large
Load Diff
53
SimGear.dsw
Normal file
53
SimGear.dsw
Normal file
@@ -0,0 +1,53 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "SimGear"=".\SimGear.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "mklib"=".\SimGear\metakit-2.4.3\win\msvc60\mklib.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "zlib"=".\SimGear\zlib.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
76
SimGear.spec.in
Normal file
76
SimGear.spec.in
Normal file
@@ -0,0 +1,76 @@
|
||||
%define ver @VERSION@
|
||||
%define rel 1
|
||||
%define prefix /usr
|
||||
|
||||
Summary: Simulator Construction Gear.
|
||||
Name: @PACKAGE@
|
||||
Version: %ver
|
||||
Release: %rel
|
||||
Copyright: LGPL
|
||||
Group: Libraries/Graphics
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
#URL:
|
||||
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
|
||||
Packager: Fill In As You Wish
|
||||
Docdir: %{prefix}/doc
|
||||
|
||||
%description
|
||||
This package contains a tools and libraries useful for constructing
|
||||
simulation and visualization applications such as FlightGear or TerraGear.
|
||||
|
||||
Authors:
|
||||
N/A
|
||||
|
||||
%prep
|
||||
%setup -n %{name}-%{version}
|
||||
|
||||
|
||||
%build
|
||||
# Needed for snapshot releases.
|
||||
if [ ! -f configure ]; then
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix
|
||||
else
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix
|
||||
fi
|
||||
|
||||
if [ "$SMP" != "" ]; then
|
||||
JSMP = '"MAKE=make -k -j $SMP"'
|
||||
fi
|
||||
|
||||
make ${JSMP};
|
||||
|
||||
|
||||
%install
|
||||
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
|
||||
|
||||
make prefix=${RPM_BUILD_ROOT}%{prefix} install
|
||||
|
||||
#
|
||||
# Generating file lists and store them in file-lists
|
||||
# Starting with the directory listings
|
||||
#
|
||||
find ${RPM_BUILD_ROOT}%{prefix}/{bin,include,lib} -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" > file-lists
|
||||
%{?ETCDR:find ${RPM_BUILD_ROOT}%{!?SYSCF:%{prefix}}/etc -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" >> file-lists}
|
||||
|
||||
#
|
||||
# Then, the file listings
|
||||
#
|
||||
echo "%defattr (-, root, root)" >> file-lists
|
||||
%{?ETCDR:find ${RPM_BUILD_ROOT}%{!?SYSCF:%{prefix}}/etc/%{name}.conf -type f | sed -e "s#^${RPM_BUILD_ROOT}#%config #g" >> file-lists}
|
||||
find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> file-lists
|
||||
|
||||
|
||||
%clean
|
||||
(cd ..; rm -rf %{name}-%{version} ${RPM_BUILD_ROOT})
|
||||
|
||||
|
||||
%files -f file-lists
|
||||
%defattr (-, root, root)
|
||||
%doc AUTHORS
|
||||
%doc COPYING
|
||||
%doc ChangeLog
|
||||
%doc INSTALL
|
||||
%doc NEWS
|
||||
%doc README
|
||||
%doc %{name}.spec.in
|
||||
|
||||
184
Thanks
Normal file
184
Thanks
Normal file
@@ -0,0 +1,184 @@
|
||||
A very special thanks is due to the following people and groups.
|
||||
|
||||
Note: as hard as we've tried, it is impossible to perfectly maintain
|
||||
this file. If you are aware of someone who you think should be
|
||||
included here, PLEASE let me know. Projects like this are made
|
||||
possible only by the help and hard work of others. I want to properly
|
||||
credit everyone who has contributed to this project.
|
||||
|
||||
|
||||
Raul Alonzo <amil@las.es>
|
||||
Mr. Alonzo is the author of Ssystem and provided his kind permission
|
||||
for using the moon texture. I also used parts of his code as a template
|
||||
when adding the texture. Ssystem Homepage can be found at:
|
||||
http://www1.las.es/~amil/ssystem
|
||||
|
||||
|
||||
Paul Bleisch <pbleisch@acm.org>
|
||||
Paul redid the "debug" system so that it would be much more flexible,
|
||||
so it could be easily disabled for production system, and so that
|
||||
messages for certain subsystems could be selectively enabled.
|
||||
Also contributed a first stab at a config file/command line parsing
|
||||
system.
|
||||
|
||||
|
||||
Bernie Bright <bbright@c031.aone.net.au>
|
||||
Many C++ style, usage, and implementation improvements.
|
||||
STL portability, tons o' stuff. :-)
|
||||
Currently trying to get a BeOS port together but life keeps getting
|
||||
in the way!
|
||||
|
||||
|
||||
Gene Buckle <geneb@deltasoft.com>
|
||||
Gene has done a lot of work getting FG to compile with the MSVC++
|
||||
compiler. Also, he has pushed, proded, and bugged me endlessly to
|
||||
do my stuff right. (I mean that in a good way, because sometimes
|
||||
when the little nudge in the right direction isn't working, I need
|
||||
a good hard shove.) :-)
|
||||
|
||||
|
||||
John Check <j4strngs@rockfish.net>
|
||||
Cloud textures
|
||||
|
||||
|
||||
Jean-Francois Doue
|
||||
Vector 2D, 3D, 4D and Matrix 3D and 4D inlined C++ classes. (Based on
|
||||
Graphics Gems IV ed. Paul S. Heckbert)
|
||||
http://www.animats.com/simpleppp/ftp/public_html/topics/developers.html
|
||||
|
||||
|
||||
Bruce Finney <bfinney@gte.net>
|
||||
MSVC5 compatibility.
|
||||
|
||||
|
||||
Jean-loup Gailly and Mark Adler <zlib@gzip.org>
|
||||
Authors of the zlib library. Used for on-the-fly compression and
|
||||
decompression routines.
|
||||
http://www.cdrom.com/pub/infozip/zlib/
|
||||
|
||||
|
||||
Thomas Gellekum <tg@ihf.rwth-aachen.de>
|
||||
Changes and updates for compiling on FreeBSD
|
||||
|
||||
|
||||
Habibie <habibie@MailandNews.com>
|
||||
RedHat package building changes for SimGear.
|
||||
|
||||
|
||||
Bruce Jackson of NASA <e.b.jackson@larc.nasa.gov>
|
||||
Developed the LaRCsim code under funding by NASA which we use to provide
|
||||
the flight model. Bruce has patiently answered my many, many questions.
|
||||
http://dcb.larc.nasa.gov/www/DCBStaff/ebj/ebj.html
|
||||
|
||||
|
||||
Richard Kaszeta <bofh@me.umn.edu>
|
||||
Contributed screen buffer to ppm screen shot routine.
|
||||
Rich has also helped in the early development of the Flight Gear "altitude
|
||||
hold autopilot module" by teaching Curt Olson the basics of Control Theory
|
||||
and helping him code and debug early versions. Curt's "Boss" Bob Hain
|
||||
also contributed <bob@me.umn.edu>. Further details available at:
|
||||
http://www.menet.umn.edu/~curt/fgfs/Docs/Autopilot/AltitudeHold/AltitudeHold.html
|
||||
Rich's Homepage: http://www.menet.umn.edu/~kaszeta
|
||||
|
||||
|
||||
Tom Knienieder <tom@knienieder.com>
|
||||
Ported Steve's Audio library first to OpenBSD and IRIX and
|
||||
after that also to Win32
|
||||
|
||||
|
||||
David Megginson <david@megginson.com>
|
||||
SimGear property manager/registry
|
||||
|
||||
|
||||
Curt Olson <curt@flightgear.org>
|
||||
Curt is responsible for overall project and source code management.
|
||||
He has his hands in many of the areas.
|
||||
|
||||
|
||||
Petter Reinholdtsen <pere@games.no>
|
||||
Incorporated the Gnu automake/autoconf system (with libtool).
|
||||
This should streamline and standardize the build process for all
|
||||
Unix-like platforms. It should have little effect on IDE type
|
||||
environments since the don't use the Unix make system.
|
||||
|
||||
|
||||
Paul Schlyter <pausch@saaf.se>
|
||||
Mr. Schlyter provided Durk Talsma with all the information
|
||||
he needed to write the astro code. Mr. S. is also willing
|
||||
to answer astro-related questions whenever one needs to.
|
||||
http://welcome.to/pausch
|
||||
|
||||
|
||||
Durk Talsma <d.talsma@chello.nl>
|
||||
Accurate Sun, Moon, and Planets.
|
||||
Sun changes color based on position in sky.
|
||||
Moon has correct phase and blends well into the sky.
|
||||
Planets are correctly positioned and have proper magnitude.
|
||||
Added time zone support in the SGTime class.
|
||||
Help with time functions, gui, and other misc stuff.
|
||||
http://people.a2000.nl/dtals
|
||||
|
||||
|
||||
Mark Vallevand <Mark.Vallevand@UNISYS.com>
|
||||
Contributed some METAR parsing code.
|
||||
Contributed some win32 screen printing routines.
|
||||
|
||||
|
||||
Gary R. Van Sickle <tiberius@braemarinc.com>
|
||||
Contributed some initial GameGLUT support and other fixes.
|
||||
Has done some interesting preliminary work on a binary file format
|
||||
http://www.woodsoup.org/projs/ORKiD/fgfs.htm
|
||||
|
||||
Has set up a 'Cygwin Tips' site that has been very helpful to many
|
||||
people in getting a Cygwin Unix-on-Windows build environment set up
|
||||
so they can build FG effectively.
|
||||
http://www.woodsoup.org/projs/ORKiD/cygwin.htm
|
||||
|
||||
|
||||
Norman Vine <nhv@yahoo.com>
|
||||
Provided more than uncountable URL's to the "FlightGear Community".
|
||||
Many performance optimizations throughout the code.
|
||||
Lots of windoze related contributions.
|
||||
Contributed wgs84 distance and course routines.
|
||||
Contributed a great circle route autopilot mode based on wgs84 routines.
|
||||
|
||||
|
||||
Ed Williams <Ed_Williams@compuserve.com>
|
||||
Contributed magnetic variation code (impliments Nima WMM 2000)
|
||||
We've also borrowed from Ed's wonderful aviation formulary at various
|
||||
times as well.
|
||||
http://www.best.com/~williams/index.html
|
||||
|
||||
|
||||
Jean-Claude Wippler <jcw@equi4.com>
|
||||
Author of MetaKit - a portable, embeddible database with a portable
|
||||
data file format. This software is not GPL'd but the author is kindly
|
||||
allowing us to bundle MetaKit with our code. MetaKit has a liberal
|
||||
X/MIT-style license. Please see the following URL for more info:
|
||||
http://www.equi4.com/metakit
|
||||
|
||||
|
||||
WoodSoup Project http://www.woodsoup.org
|
||||
Provided computing resources and services so that the Flight Gear
|
||||
project could have real home. This includes, web services,
|
||||
ftp services, shell accounts, email lists, dns services, etc.
|
||||
|
||||
|
||||
Robert Allan Zeh <raz@cmg.FCNBD.COM>
|
||||
Helped me tremendously in figuring out the Cygnus win32 compiler and
|
||||
how to link with .dll's. With out him the first runable win32
|
||||
version of FG would have been impossible.
|
||||
|
||||
|
||||
|
||||
NOTE:
|
||||
----
|
||||
|
||||
THIS DOCUMENT WAS INITIALLY WRITTEN BY
|
||||
Curt L. Olson <curt@flightgear.org>
|
||||
|
||||
|
||||
05 Jul 2000 Removed non-SimGear entries (CLO)
|
||||
|
||||
08 Mar 2000 CONTENTS RESEARCHED AND UPDATED by
|
||||
Oliver Delise <delise@mail.isis.de>
|
||||
@@ -1,5 +0,0 @@
|
||||
lib_LIBRARIES = libXGL.a
|
||||
|
||||
libXGL_a_SOURCES = xgl.c xgl.h xglUtils.c
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Simulator
|
||||
415
acinclude.m4
Normal file
415
acinclude.m4
Normal file
@@ -0,0 +1,415 @@
|
||||
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${subexdirr}"
|
||||
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])
|
||||
39
am2dsp.cfg
Normal file
39
am2dsp.cfg
Normal file
@@ -0,0 +1,39 @@
|
||||
type = StaticLibrary,Multithreaded,
|
||||
exclude_dir = threads
|
||||
|
||||
include_path = .
|
||||
include_path = ..
|
||||
include_path = .\SimGear
|
||||
include_path = .\SimGear\metakit-2.4.3\include
|
||||
include_path = ..\SimGear\zlib-1.1.4
|
||||
|
||||
define = HAVE_CONFIG_H
|
||||
|
||||
add_project = .\SimGear\metakit-2.4.3\win\msvc60\mklib.dsp,mklib
|
||||
add_project = .\SimGear\zlib.dsp,zlib
|
||||
|
||||
# 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\
|
||||
|
||||
66
autogen.sh
Executable file
66
autogen.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSTYPE=`uname -s`
|
||||
MACHINE=`uname -m`
|
||||
AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[0-9]$//' | sed -e 's/\.//'`
|
||||
|
||||
echo "Host info: $OSTYPE $MACHINE"
|
||||
echo -n " automake: `automake --version | head -1 | awk '{print $4}'`"
|
||||
echo " ($AUTO_MAKE_VERSION)"
|
||||
echo ""
|
||||
|
||||
ACLOCAL_OPTS=""
|
||||
if [ $AUTO_MAKE_VERSION -ge 14 ]; then
|
||||
if [ $OSTYPE = "IRIX" -o $OSTYPE = "IRIX64" ]; then echo " -I ."
|
||||
ACLOCAL_OPTS="-I ."
|
||||
fi
|
||||
fi
|
||||
echo "Running aclocal $ACLOCAL_OPTS"
|
||||
aclocal $ACLOCAL_OPTS
|
||||
|
||||
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 -n "Running automake"
|
||||
if [ $OSTYPE = "IRIX" -o $OSTYPE = "IRIX64" ]; then
|
||||
echo " --add-missing --include-deps"
|
||||
automake --add-missing --include-deps
|
||||
else
|
||||
echo " --add-missing"
|
||||
automake --add-missing
|
||||
fi
|
||||
|
||||
echo "Running autoconf"
|
||||
autoconf
|
||||
|
||||
if [ ! -e configure ]; then
|
||||
echo "ERROR: configure was not created!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# fixup Makefiles for Irix
|
||||
if test "$OSTYPE" = "IRIX" -o "$OSTYPE" = "IRIX64"; then
|
||||
echo "Fixing Makefiles for Irix"
|
||||
for n in `find . -name Makefile.in`; do \
|
||||
mv -f $n $n.ar-new; \
|
||||
sed 's/$(AR) cru /$(AR) -o /g' $n.ar-new > $n; \
|
||||
rm -f $n.ar-new; \
|
||||
done;
|
||||
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 "======================================"
|
||||
389
configure.ac
Normal file
389
configure.ac
Normal file
@@ -0,0 +1,389 @@
|
||||
dnl Process this file with aclocal ; automake -a ; autoconf to produce a
|
||||
dnl working configure script.
|
||||
dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
|
||||
|
||||
# Require at least automake 2.52
|
||||
AC_PREREQ(2.52)
|
||||
|
||||
dnl Initialize the automake stuff
|
||||
AM_INIT_AUTOMAKE(SimGear, 0.0.19pre2)
|
||||
|
||||
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
|
||||
])
|
||||
|
||||
echo CXX = $CXX
|
||||
echo CC = $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
|
||||
|
||||
AR="ar"
|
||||
OS=`uname -s`
|
||||
if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
|
||||
if test "$CXX" = "CC"; then
|
||||
AR="CC -ar"
|
||||
AC_SUBST(AR)
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# Determine version of automake ... important because of
|
||||
# incompatibilities between versions
|
||||
AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//'`
|
||||
AM_CONDITIONAL(ANCIENT_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 14)
|
||||
AM_CONDITIONAL(OLD_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 15)
|
||||
|
||||
# set logging default value
|
||||
# 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")
|
||||
|
||||
|
||||
dnl Check for MS Windows environment
|
||||
AC_CHECK_HEADER(windows.h)
|
||||
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __MINGW32__
|
||||
yes
|
||||
#endif
|
||||
],is_mingw=yes, is_mingw=no)
|
||||
|
||||
echo "IS_MINGW = $is_mingw"
|
||||
AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
|
||||
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __CYGWIN__
|
||||
yes
|
||||
#endif
|
||||
],is_cygwin=yes, is_cygwin=no)
|
||||
|
||||
echo "IS_CYGWIN = $is_cygwin"
|
||||
AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
|
||||
|
||||
if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
|
||||
dnl extra library and include directories
|
||||
EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
|
||||
|
||||
if test -d /opt/X11R6 ; then
|
||||
EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
|
||||
fi
|
||||
fi
|
||||
|
||||
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, don't want to use it if it is.
|
||||
if test "x$HOSTTYPE" != "xmacintosh" ; then
|
||||
dnl Check for X11 (fancy)
|
||||
AC_PATH_XTRA
|
||||
fi
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
null_LIBS="$LIBS"
|
||||
|
||||
AC_CHECK_LIB(m, cos)
|
||||
|
||||
base_LIBS="$LIBS"
|
||||
|
||||
dnl Thread related checks
|
||||
AC_CHECK_LIB(pthread, pthread_exit)
|
||||
AC_CHECK_HEADER(pthread.h)
|
||||
if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
|
||||
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
|
||||
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
|
||||
dnl X11 might be installed, but we don't want to use it for OSX -dw-
|
||||
if test "x$HOSTTYPE" != "xmacintosh" ; then
|
||||
AC_CHECK_LIB(X11, XCreateWindow)
|
||||
AC_CHECK_LIB(Xext, XShmCreateImage)
|
||||
AC_CHECK_LIB(Xi, XGetExtensionVersion)
|
||||
AC_CHECK_LIB(ICE, IceOpenConnection)
|
||||
AC_CHECK_LIB(SM, SmcOpenConnection)
|
||||
AC_CHECK_LIB(Xt, XtMalloc)
|
||||
AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
|
||||
fi
|
||||
|
||||
dnl check for OpenGL related libraries
|
||||
|
||||
if test "x$HOSTTYPE" = "xmacintosh" ; then
|
||||
dnl Macintosh OSX
|
||||
LIBS="$LIBS -framework OpenGL -framework GLUT"
|
||||
elif test "x$ac_cv_header_windows_h" != "xyes" ; then
|
||||
dnl Reasonable stuff for X-Windows based machines
|
||||
|
||||
AC_CHECK_LIB(GLcore, glNewList)
|
||||
if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
|
||||
dnl if no GLcore, check for GL
|
||||
AC_CHECK_LIB(GL, glNewList)
|
||||
if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
|
||||
dnl if no GL, check for MesaGL
|
||||
AC_CHECK_LIB(MesaGL, glNewList)
|
||||
fi
|
||||
else
|
||||
dnl if GLcore found, then also check for GL
|
||||
AC_CHECK_LIB(GL, glXCreateContext)
|
||||
fi
|
||||
|
||||
dnl if using mesa, check for xmesa.h
|
||||
if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; 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_CHECK_LIB(GLU, gluLookAt)
|
||||
if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
|
||||
dnl if no GLU, check for MesaGLU
|
||||
AC_CHECK_LIB(MesaGLU, gluLookAt)
|
||||
fi
|
||||
|
||||
dnl check for glut
|
||||
AC_CHECK_LIB(glut, glutGetModifiers)
|
||||
|
||||
dnl test for glutGameModeString, but avoid adding glut a second time into
|
||||
dnl the list of libraries
|
||||
save_LIBS="$LIBS"
|
||||
AC_CHECK_LIB(glut, glutGameModeString)
|
||||
LIBS="$save_LIBS"
|
||||
else
|
||||
dnl Win32 libs
|
||||
|
||||
echo Win32 specific hacks...
|
||||
AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
|
||||
|
||||
dnl just define these to true and hope for the best
|
||||
ac_cv_lib_glut_glutGetModifiers="yes"
|
||||
ac_cv_lib_glut_glutGameModeString="yes"
|
||||
|
||||
if test "x$with_sgi_opengl" = "xyes" ; then
|
||||
echo "Building with glut.dll, glu.dll, and opengl.dll"
|
||||
WIN32_GLUT=glut
|
||||
WIN32_GLU=glu
|
||||
WIN32_OPENGL=opengl
|
||||
else
|
||||
echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
|
||||
WIN32_GLUT=glut32
|
||||
WIN32_GLU=glu32
|
||||
WIN32_OPENGL=opengl32
|
||||
fi
|
||||
|
||||
LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
|
||||
LIBS="$LIBS -luser32 -lgdi32"
|
||||
if test "x$is_mingw" = "xyes" ; then
|
||||
EXTRA_DIRS="${EXTRA_DIRS}"
|
||||
fi
|
||||
echo "Will link apps with $LIBS"
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
|
||||
echo
|
||||
echo "Unable to find the necessary OpenGL or GLUT libraries."
|
||||
echo "See config.log for automated test details and results ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
|
||||
echo
|
||||
echo "Your version of glut doesn't support game mode."
|
||||
echo "You need to install the latest version of glut. If your"
|
||||
echo "distribution doesn't provide a newer version, you can get the source"
|
||||
echo "code from:"
|
||||
echo
|
||||
echo " http://reality.sgi.com/opengl/glut3/glut3.html"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
opengl_LIBS="$LIBS"
|
||||
LIBS="$base_LIBS"
|
||||
|
||||
AC_SUBST(base_LIBS)
|
||||
AC_SUBST(opengl_LIBS)
|
||||
|
||||
AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
|
||||
|
||||
# The following are C++ items that need to be tested for with the c++
|
||||
# compiler
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
|
||||
dnl Check for "plib" without which we cannot go on
|
||||
AC_CHECK_HEADER(plib/pu.h)
|
||||
if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
|
||||
echo
|
||||
echo "You *must* have the plib library installed on your system to build"
|
||||
echo "the FGFS simulator!"
|
||||
echo
|
||||
echo "Please see README.plib for more details."
|
||||
echo
|
||||
echo "configure aborted."
|
||||
exit
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(plib/ssgaLensFlare.h)
|
||||
if test "x$ac_cv_header_plib_ssgaLensFlare_h" = "xyes"; then
|
||||
AC_DEFINE([FG_CHEESY_LENS_FLARE], 1, [Define for cheesy lens flare effect])
|
||||
fi
|
||||
|
||||
dnl Check for system installed metakit
|
||||
AC_CHECK_HEADER(mk4.h)
|
||||
if test "x$ac_cv_header_mk4_h" != "xyes"; then
|
||||
echo
|
||||
echo "Metakit not found, you will need to install this first."
|
||||
echo "Please read the README.metakit for more information."
|
||||
exit
|
||||
fi
|
||||
|
||||
AC_LANG_POP
|
||||
|
||||
dnl Specify if we want logging (testing build) or not (release build)
|
||||
|
||||
dnl Check for system installed zlib
|
||||
AC_CHECK_HEADER(zlib.h)
|
||||
if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
||||
echo
|
||||
echo "zlib not found, you will need to install this first."
|
||||
echo "Please read the README.zlib for more information."
|
||||
exit
|
||||
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 windows.h winbase.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_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
dnl Checks for library functions.
|
||||
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 )
|
||||
|
||||
AM_CONFIG_HEADER(simgear/simgear_config.h)
|
||||
|
||||
AC_CONFIG_FILES([ \
|
||||
Makefile \
|
||||
SimGear.spec \
|
||||
src-libs/Makefile \
|
||||
simgear/Makefile \
|
||||
simgear/version.h \
|
||||
simgear/bucket/Makefile \
|
||||
simgear/debug/Makefile \
|
||||
simgear/ephemeris/Makefile \
|
||||
simgear/interpreter/Makefile \
|
||||
simgear/io/Makefile \
|
||||
simgear/magvar/Makefile \
|
||||
simgear/math/Makefile \
|
||||
simgear/metar/Makefile \
|
||||
simgear/misc/Makefile \
|
||||
simgear/route/Makefile \
|
||||
simgear/screen/Makefile \
|
||||
simgear/serial/Makefile \
|
||||
simgear/sky/Makefile \
|
||||
simgear/threads/Makefile \
|
||||
simgear/timing/Makefile \
|
||||
simgear/xgl/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: ($AUTO_MAKE_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_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
|
||||
echo "Threads: pthread lib found."
|
||||
else
|
||||
echo "Threads: no threads (pthread lib not found.)"
|
||||
fi
|
||||
@@ -1,17 +0,0 @@
|
||||
bin_PROGRAMS = example
|
||||
|
||||
example_SOURCES = example.cxx
|
||||
|
||||
example_LDADD = \
|
||||
$(top_builddir)/Lib/Audio/src/libsl.a \
|
||||
$(top_builddir)/Lib/Audio/src/libsm.a
|
||||
|
||||
INCLUDES += -I$(top_builddir)/Lib/Audio/src
|
||||
|
||||
if ENABLE_IRIX_AUDIO
|
||||
LIBS += -laudio
|
||||
endif
|
||||
|
||||
if ENABLE_WIN32_AUDIO
|
||||
LIBS += -lwinmm
|
||||
endif
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
|
||||
#include "sl.h"
|
||||
#include "sm.h"
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
Construct a sound scheduler and a mixer.
|
||||
*/
|
||||
|
||||
slScheduler sched ( 8000 ) ;
|
||||
smMixer mixer ;
|
||||
|
||||
int main ()
|
||||
{
|
||||
mixer . setMasterVolume ( 30 ) ;
|
||||
sched . setSafetyMargin ( 0.128 ) ;
|
||||
|
||||
/* Just for fun, let's make a one second synthetic engine sample... */
|
||||
|
||||
Uchar buffer [ 8000 ] ;
|
||||
|
||||
for ( int i = 0 ; i < 8000 ; i++ )
|
||||
{
|
||||
/* Sum some sin waves and convert to range 0..1 */
|
||||
|
||||
float level = ( sin ( (double) i * 2.0 * M_PI / (8000.0/ 50.0) ) +
|
||||
sin ( (double) i * 2.0 * M_PI / (8000.0/149.0) ) +
|
||||
sin ( (double) i * 2.0 * M_PI / (8000.0/152.0) ) +
|
||||
sin ( (double) i * 2.0 * M_PI / (8000.0/192.0) )
|
||||
) / 8.0f + 0.5f ;
|
||||
|
||||
/* Convert to unsigned byte */
|
||||
|
||||
buffer [ i ] = (Uchar) ( level * 255.0 ) ;
|
||||
}
|
||||
|
||||
/* Set up four samples and a loop */
|
||||
|
||||
slSample *s = new slSample ( buffer, 8000 ) ;
|
||||
slSample *s1 = new slSample ( "scream.ub", & sched ) ;
|
||||
slSample *s2 = new slSample ( "zzap.wav" , & sched ) ;
|
||||
slSample *s3 = new slSample ( "cuckoo.au", & sched ) ;
|
||||
slSample *s4 = new slSample ( "wheeee.ub", & sched ) ;
|
||||
|
||||
/* Mess about with some of the samples... */
|
||||
|
||||
s1 -> adjustVolume ( 2.2 ) ;
|
||||
s2 -> adjustVolume ( 0.5 ) ;
|
||||
s3 -> adjustVolume ( 0.2 ) ;
|
||||
|
||||
/* Play the engine sample continuously. */
|
||||
|
||||
sched . loopSample ( s ) ;
|
||||
|
||||
int tim = 0 ; /* My periodic event timer. */
|
||||
|
||||
while ( SL_TRUE )
|
||||
{
|
||||
tim++ ; /* Time passes */
|
||||
|
||||
if ( tim % 200 == 0 ) sched.playSample ( s1 ) ;
|
||||
if ( tim % 180 == 0 ) sched.playSample ( s2 ) ;
|
||||
if ( tim % 150 == 0 ) sched.playSample ( s3 ) ;
|
||||
if ( tim % 120 == 0 ) sched.playSample ( s4 ) ;
|
||||
|
||||
/*
|
||||
For the sake of realism, I'll delay for 1/30th second to
|
||||
simulate a graphics update process.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
Sleep ( 1000 / 30 ) ; /* 30Hz */
|
||||
#elif defined(sgi)
|
||||
sginap( 3 ); /* ARG */
|
||||
#else
|
||||
usleep ( 1000000 / 30 ) ; /* 30Hz */
|
||||
#endif
|
||||
|
||||
/*
|
||||
This would normally be called just before the graphics buffer swap
|
||||
- but it could be anywhere where it's guaranteed to get called
|
||||
fairly often.
|
||||
*/
|
||||
|
||||
sched . update () ;
|
||||
}
|
||||
}
|
||||
|
||||
42
mksymlinks.sh
Executable file
42
mksymlinks.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo ""
|
||||
echo "running $0 to rebuild simgear include links"
|
||||
|
||||
# toast the old directory
|
||||
rm -rf src/simgear
|
||||
mkdir src/simgear
|
||||
mkdir src/simgear/bucket
|
||||
mkdir src/simgear/debug
|
||||
mkdir src/simgear/math
|
||||
mkdir src/simgear/misc
|
||||
mkdir src/simgear/screen
|
||||
mkdir src/simgear/serial
|
||||
mkdir src/simgear/xgl
|
||||
mkdir src/simgear/zlib
|
||||
|
||||
# build new links
|
||||
ln -s ../include/compiler.h src/simgear/compiler.h
|
||||
ln -s ../include/constants.h src/simgear/constants.h
|
||||
ln -s ../include/fg_traits.hxx src/simgear/fg_traits.hxx
|
||||
ln -s ../include/fg_zlib.h src/simgear/fg_zlib.h
|
||||
ln -s ../include/version.h src/simgear/version.h
|
||||
|
||||
ln -s ../../bucket/newbucket.hxx src/simgear/bucket/newbucket.hxx
|
||||
|
||||
ln -s ../../debug/debug_types.h src/simgear/debug/debug_types.h
|
||||
ln -s ../../debug/logstream.hxx src/simgear/debug/logstream.hxx
|
||||
|
||||
ln -s ../../math/fg_memory.h src/simgear/math/fg_memory.h
|
||||
ln -s ../../math/fg_types.hxx src/simgear/math/fg_types.hxx
|
||||
ln -s ../../math/point3d.hxx src/simgear/math/point3d.hxx
|
||||
ln -s ../../math/polar3d.hxx src/simgear/math/polar3d.hxx
|
||||
|
||||
ln -s ../../misc/fgpath.hxx src/simgear/misc/fgpath.hxx
|
||||
ln -s ../../misc/fgstream.hxx src/simgear/misc/fgstream.hxx
|
||||
ln -s ../../misc/zfstream.hxx src/simgear/misc/zfstream.hxx
|
||||
|
||||
ln -s ../../xgl/xgl.h src/simgear/xgl/xgl.h
|
||||
|
||||
ln -s ../../zlib/zlib.h src/simgear/zlib/zlib.h
|
||||
ln -s ../../zlib/zconf.h src/simgear/zlib/zconf.h
|
||||
7
simgear/.cvsignore
Normal file
7
simgear/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
simgear_config.h
|
||||
simgear_config.h.in
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
version.h
|
||||
33
simgear/Makefile.am
Normal file
33
simgear/Makefile.am
Normal file
@@ -0,0 +1,33 @@
|
||||
if HAVE_THREADS
|
||||
SGTHREAD_DIR = threads
|
||||
else
|
||||
SGTHREAD_DIR =
|
||||
endif
|
||||
|
||||
# METAR_DIRS =
|
||||
METAR_DIRS = metar
|
||||
|
||||
EXTRA_DIST = simgear_config.h.vc5 version.h.in
|
||||
|
||||
include_HEADERS = \
|
||||
compiler.h constants.h sg_inlines.h sg_traits.hxx sg_zlib.h version.h
|
||||
|
||||
SUBDIRS = \
|
||||
xml \
|
||||
debug \
|
||||
misc \
|
||||
bucket \
|
||||
ephemeris \
|
||||
io \
|
||||
magvar \
|
||||
math \
|
||||
$(METAR_DIRS) \
|
||||
route \
|
||||
screen \
|
||||
serial \
|
||||
sky \
|
||||
$(SGTHREAD_DIR) \
|
||||
timing \
|
||||
xgl
|
||||
|
||||
DIST_SUBDIRS = $(SUBDIRS) interpreter
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user