diff --git a/mapview/LICENSE b/mapview/LICENSE new file mode 100644 index 0000000..151b262 --- /dev/null +++ b/mapview/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 roblevesque + +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. diff --git a/mapview/js/empiredata.json b/mapview/js/empiredata.json new file mode 100644 index 0000000..3d9c293 --- /dev/null +++ b/mapview/js/empiredata.json @@ -0,0 +1,1062 @@ +{ + "CU": { + "name": "Cardasian Union", + "color": 0xCC9933, + "cenx": -9337.944, + "ceny": 310, + "cenz": 20, + "rad": 100, + "bordervis": true, + "planets": { + "Cardassia Prime / Cardassia IV": { + "X": -9292.7, + "Y": 278.9, + "Z": 23.2 + }, + "Celtris III": { + "X": -9321.6, + "Y": 363.8, + "Z": 30.3 + }, + "Iure Prime": { + "X": -9149.3, + "Y": 346.133, + "Z": -18.218 + }, + "Kakrafoon": { + "X": -9303.8, + "Y": 327.4, + "Z": 119.1 + }, + "Kora II": { + "X": -9415.2, + "Y": 336.8, + "Z": 2.2 + }, + "Omekla III": { + "X": -9332.823, + "Y": 322.081, + "Z": 47.755 + }, + "Orias III": { + "X": -9374.8, + "Y": 280.8, + "Z": 3.1 + }, + "Prim II": { + "X": -9374.544, + "Y": 391, + "Z": 25.2 + }, + "Siltalk": { + "X": -9244.244, + "Y": 329.9, + "Z": 4.8 + }, + "Tohvun": { + "X": -9329.9, + "Y": 378, + "Z": 30 + }, + "Velos VII": { + "X": -9331.3, + "Y": 279.9, + "Z": 55 + }, + "Volan": { + "X": -9340.7, + "Y": 366.2, + "Z": 10.1 + } + }, + "bases": { + "Varohdan Nor": { + "X": -9292.744, + "Y": 278.9, + "Z": 23.2 + } + +} + }, + "UFP": { + "name": "United Federation Of Planets", + "color": 0x0000FF, + "cenx": -9197.944, + "ceny": 0, + "cenz": 0, + "rad": 240, + "bordervis": true, + "planets": { + "Alpha Centauri": { + "X": -9173.253664, + "Y": 62.558679, + "Z": -1.032124 + }, + "Andor": { + "X": -9172.144174, + "Y": 60.1, + "Z": -2.4 + }, + "Antos IV": { + "X": -9179.844174, + "Y": -20.4, + "Z": -6.1 + }, + "Argelius II": { + "X": -9352.644174, + "Y": -59.2, + "Z": -121.2 + }, + "Betazed": { + "X": -9386.244174, + "Y": -93.3, + "Z": -88.1 + }, + "Bynaus": { + "X": -9318.244174, + "Y": 98.9, + "Z": 146.3 + }, + "Cait ": { + "X": -9156.044174, + "Y": -228.3, + "Z": -12.6 + }, + "Daran V": { + "X": -9325.499174, + "Y": -139.232, + "Z": -19.774 + }, + "Darius III": { + "X": -9179.444174, + "Y": 200, + "Z": -22.1 + }, + "Delta ": { + "X": -9010.644174, + "Y": 89.9, + "Z": -17.3 + }, + "Draken IV": { + "X": -9133.537416, + "Y": -117.755082, + "Z": 32.526741 + }, + "Earth /Luna Terra": { + "X": -9174.044174, + "Y": 61.8, + "Z": 0 + }, + "Eeiauo": { + "X": -9159.944174, + "Y": -126, + "Z": 96 + }, + "Ekos": { + "X": -9125.144174, + "Y": -29.1, + "Z": -68.7 + }, + "Eminiar VII": { + "X": -9234.944174, + "Y": 222.3, + "Z": 25.1 + }, + "Freehaven": { + "X": -9337.244174, + "Y": 207, + "Z": -36.8 + }, + "Lissajous IV": { + "X": 6254.1768, + "Y": 6234.263658, + "Z": 26.301745 + }, + "Magna Roma": { + "X": -9330.044174, + "Y": -101.1, + "Z": -56.7 + }, + "Mars": { + "X": -9174.044166, + "Y": 61.799995, + "Z": 0.000001 + }, + "Melkot II": { + "X": -9274.862114, + "Y": -145.9967, + "Z": -12.7717 + }, + "New Fabrina/Yonada": { + "X": -9249.044174, + "Y": -93.6, + "Z": -91.4 + }, + "Organia": { + "X": -9310.544174, + "Y": 186.3, + "Z": -12.1 + }, + "Sivao": { + "X": -9097.226132, + "Y": -0.102246, + "Z": 146.784743 + }, + "Talos IV": { + "X": -9317.344174, + "Y": -43.7, + "Z": -24 + }, + "Taurus II": { + "X": -9264.444174, + "Y": 47.4, + "Z": 8.1 + }, + "Tellar": { + "X": -9172.944174, + "Y": 60.1, + "Z": 2.6 + }, + "Trill": { + "X": -9247.944174, + "Y": 75, + "Z": 66 + }, + "Usho Prime": { + "X": 7446.049, + "Y": -5376.047, + "Z": 131.501 + }, + "Vulcan": { + "X": -9178.444174, + "Y": 60, + "Z": -0.6 + } +}, + "bases": { + "Phoenix City": { + "X": -8977.944, + "Y": 260.00, + "Z": 60.00 + } + } + }, + "BFN": { + "name": "Bajoran Free Nation", + "color": 0xffaaaa, + "cenx": -9325.944, + "ceny": 221.7, + "cenz": -45.1, + "rad": 5, + "bordervis": true, + "planets": { + "Bajor/Jeraddo" : { + "X": -9325.944078, + "Y": 221.7, + "Z": -45.281517 + } + + }, + "bases": { + "Kainon Station" : { + "X": 6316.800, + "Y": 6324.7, + "Z": 10.50 + } + } + }, + "BC": { + "name": "Breen Confederacy", + "color": 0x00AAAA, + "cenx": 09376.050179, + "ceny": 203.150816, + "cenz": -46.281517, + "rad": 0, + "bordervis": false, + "planets": { + "Breen": { + "X": -9376.050179, + "Y": 203.150816, + "Z": -46.281517 + }, + "Dozaria": { + "X": -9359, + "Y": 213, + "Z": -30 + }, + "Portos V": { + "X": -9268.874, + "Y": 231.877, + "Z": 42.479 + } +}, + "bases": {} + }, + "KE": { + "name": "Klingon Empire", + "color": 0xFF0000, + "cenx": -9577.944, + "ceny": 120, + "cenz": -90.160, + "rad": 160, + "bordervis": true, + "planets": { + "Beeblebrox": { + "X": -9528.85, + "Y": -113.663, + "Z": -89.859 + }, + "Beta Lankal": { + "X": -9536.344174, + "Y": 248.8, + "Z": -96.4 + }, + "Beta Thoridar": { + "X": -9684.844174, + "Y": 118.1, + "Z": -140.1 + }, + "Boreth": { + "X": -9588.044174, + "Y": 130.9, + "Z": -100.5 + }, + "Gamma Eridon": { + "X": -9597.94, + "Y": -25, + "Z": -58 + }, + "Narendra III": { + "X": -9634.94, + "Y": -114, + "Z": -170 + }, + "QI'tomer": { + "X": -9439.94, + "Y": -42, + "Z": -28 + }, + "Qo'noS/No'Mat": { + "X": -9519.444174, + "Y": 48.6, + "Z": -87.9 + }, + "Ruby Prime": { + "X": 6206.705168, + "Y": 6212.501237, + "Z": -4.602359 + }, + "Rura Penthe": { + "X": -9444.844174, + "Y": 60, + "Z": -66.4 + }, + "Zansellquasure": { + "X": -9478.009867, + "Y": 311.638052, + "Z": -56.56095 + }, + "Zausta VI": { + "X": 7369.536, + "Y": -5276.597, + "Z": -49.229 + }, + "Hunter's Refuge / Safe Haven": { + "X": -9424.783, + "Y": 123.7, + "Z": 34.706 + } +}, + "bases": {} + }, + "RSE": { + "name": "Romulan Star Empire", + "color": 0x00ff00, + "cenx": -9477.00, + "ceny": -230.00, + "cenz": 10.00, + "rad": 120.00, + "bordervis": true, + "planets": { + "Addams IX": { + "X": -9484.058519, + "Y": 367.519852, + "Z": -105.792164 + }, + "ch'Havran": { + "X": -9384.244174, + "Y": -158.8, + "Z": -1.8 + }, + "ch'Nahir": { + "X": -9507.044174, + "Y": -128, + "Z": -19.1 + }, + "ch'Rihan": { + "X": -9384.244174, + "Y": -158.8, + "Z": -1.8 + }, + "Jeglae XI": { + "X": 7234.131, + "Y": -5189.726, + "Z": -55.079 + }, + "Levaeri Asteroids": { + "X": -9565.944174, + "Y": -302.2, + "Z": 13.2 + }, + "Marion III": { + "X": -9484.317611, + "Y": 368.050979, + "Z": -105.070637 + }, + "Nelvana III": { + "X": -9391.244174, + "Y": -148.7, + "Z": 16 + }, + "Nogark": { + "X": -9383.38, + "Y": -160.704, + "Z": 33.659 + }, + "Rhei'llhne": { + "X": -9444.944174, + "Y": -184, + "Z": 68 + }, + "Santraginus V": { + "X": -9507.774194, + "Y": 345.217185, + "Z": -125.827115 + }, + "Thieurrull": { + "X": -9433.944174, + "Y": -246, + "Z": -26 + } + }, + "bases": {} + }, + "GFA": { + "name": "Galactic Ferengal Alliance", + "color": 0xFFFF00, + "cenx": -8977.944, + "ceny": 260.00, + "cenz": -50.00, + "rad": 100.00, + "bordervis": true, + "planets": { + "Arcybite": { + "X": -8982.56543, + "Y": 240.626306, + "Z": -26.9401 + }, + "Artificier II": { + "X": 6287.573, + "Y": 6249.993, + "Z": 9.727 + }, + "Chemarra": { + "X": -8905.663399, + "Y": 266.258273, + "Z": -17.130635 + }, + "Fenalgar": { + "X": -8995.604111, + "Y": 302.521799, + "Z": -60.548258 + }, + "Ferenganor": { + "X": -8969.545098, + "Y": 292.579839, + "Z": -43.900428 + }, + "Golgafrincham XI": { + "X": -9075.838671, + "Y": -395.931128, + "Z": -1.302726 + }, + "Llystad": { + "X": -9038.221744, + "Y": 285.872559, + "Z": -47.785562 + }, + "Nausicaa": { + "X": -9022.786865, + "Y": 205.064703, + "Z": -20.937833 + }, + "Quinn's Moon": { + "X": -9023.031716, + "Y": 205.064976, + "Z": -20.849225 + }, + "Tolagor": { + "X": -8953.947696, + "Y": 276.884008, + "Z": -95.171788 + }, + "Zekit": { + "X": -9048.346357, + "Y": 223.15875, + "Z": -52.169469 + } + }, + "bases": {} + }, + "OA": { + "name": "Orion Alliance", + "color": 0x00FFFF, + "cenx": 0, + "ceny": 0, + "cenz": 0, + "rad": 0, + "bordervis": false, + "planets": { + "Aphrodite VIII": { + "X": 6191.658552, + "Y": 6227.973513, + "Z": 23.944103 + }, + "Gamora III": { + "X": -9410.744174, + "Y": 1.4, + "Z": -139 + }, + "Rigel VIII/XII": { + "X": -9407.844174, + "Y": 7.700001, + "Z": -135.999923 + }, + "Viltvodle VI": { + "X": -9514.000498, + "Y": -167.995678, + "Z": -93.458616 + } + }, + "bases": {} + }, + "DOM": { + "name": "Dominion", + "color": 0xA9FFEE, + "cenx": 0, + "ceny": 0, + "cenz": 0, + "rad": 0, + "bordervis": false, + "planets": { + "Callinon VII": { + "X": 6458.8, + "Y": 6286.2, + "Z": -32.4 + }, + "Ceranon": { + "X": 6554, + "Y": 6568.9, + "Z": -42.7 + }, + "D'ko Fafnir": { + "X": 6578.1, + "Y": 6459.8, + "Z": -19.5 + }, + "Domini": { + "X": 6707.8, + "Y": 6438.1, + "Z": 28.6 + }, + "Hardol": { + "X": 6597.4, + "Y": 6389.8, + "Z": 6.1 + }, + "Internment Camp 371": { + "X": 6367.272, + "Y": 6372.995, + "Z": 7.607 + }, + "Kaos": { + "X": 6330, + "Y": 6337.1, + "Z": 15.6 + }, + "Kareel Prime": { + "X": 6694.5, + "Y": 6519.4, + "Z": 73.6 + }, + "Karemma": { + "X": 6330.2, + "Y": 6336.9, + "Z": 15.3 + }, + "Kryseis": { + "X": 6643.9, + "Y": 6642.4, + "Z": 17.2 + }, + "Omaria": { + "X": 6500, + "Y": 6500, + "Z": 0 + }, + "Sumn'Kapta": { + "X": 6506.1, + "Y": 6670.7, + "Z": 20.2 + }, + "Vegan": { + "X": 6384.3, + "Y": 6439.8, + "Z": 101.7 + }, + "Veronica Prime": { + "X": 6304.524556, + "Y": 6288.311594, + "Z": -26.04592 + } + }, + "bases": {} + }, + "UNITY": { + "name": "The Unity", + "color": 0xFFA9EE, + "cenx": 0, + "ceny": 0, + "cenz": 0, + "rad": 0, + "bordervis": false, + "planets": { + "Angela V/USB Scream Factory": { + "X": 6125.35029, + "Y": 6126.116216, + "Z": -40.743949 + }, + "Charlotte X/Kainon Station": { + "X": 6316.8, + "Y": 6324.7, + "Z": 10.5 + }, + "Deneb III": { + "X": -9055.244174, + "Y": -143.4, + "Z": 382.5 + }, + "Donatu V": { + "X": -9404.544174, + "Y": 154.1, + "Z": -141 + }, + "Kelso II": { + "X": 6129.214991, + "Y": 6127.104155, + "Z": -26.014402 + }, + "Kelvira IX": { + "X": -9159, + "Y": 254, + "Z": -4 + }, + "Kildare V / Kildare IX / Kildare XI / USB Stormwatch": { + "X": 16800, + "Y": -7100, + "Z": 5500 + }, + "Krios": { + "X": -9423.944174, + "Y": 76, + "Z": 90 + }, + "Lily Yo II/USB Celestine Gate": { + "X": 7345.88, + "Y": -5452.994, + "Z": 45.441 + }, + "New Auria": { + "X": -9401.344174, + "Y": -290.4, + "Z": 227 + }, + "New Risa/USB Lothlorien": { + "X": -9327.944, + "Y": 49, + "Z": 17.5 + }, + "Nimbus III": { + "X": -9492.744174, + "Y": -49, + "Z": -35.6 + }, + "Old Risa/USB Khazad-Dum": { + "X": -9289.544174, + "Y": -86.7, + "Z": -215.9 + }, + "Sherman's Planet/USB Galadriel": { + "X": -9422.644174, + "Y": 214.5, + "Z": -100.7 + } + }, + "bases": { + "USB Milliways": { + "X": -8977.944, + "Y": 260, + "Z": 60 + } + } + }, + "TA": { + "name": "Tholian Assembly", + "color": 0xFEA901, + "cenx": -9107.944, + "ceny": -290.00, + "cenz": -10.00, + "rad": 50.00, + "bordervis": true, + "planets": { + "Celestia/Luna Celestia": { + "X": -9127.844174, + "Y": -307.2, + "Z": 0.9 + }, + "Crystal Moon": { + "X": -9107.944174, + "Y": -290, + "Z": -10 + }, + "Etheria": { + "X": -9104.944174, + "Y": -294, + "Z": -32 + }, + "Tholia": { + "X": -9108.94, + "Y": -285, + "Z": 29 + } + }, + "bases": {} + }, + "UQS": { + "name": "Unified Qvarne Systems", + "color": 0x990103, + "cenx": -9109.941, + "ceny": 228.477, + "cenz": -135.785, + "rad": 10, + "bordervis": true, + "planets": { + "Qvarne IV": { + "X": -9109.941898, + "Y": 228.477574, + "Z": -135.785688 + }, + "Un-named": { + "X": -9522.645877, + "Y": -73.543452, + "Z": -34.701889 + }, + "Flamarion II": { + "X": -9543.340008, + "Y": -108.565436, + "Z": -37.688798 + }, + "Munspelheim": { + "X": -9483.597022, + "Y": -74.09049, + "Z": -37.498596 + }, + "Pryan/Luna Kaigun": { + "X": -9522.645877, + "Y": -73.543452, + "Z": -34.701889 + }, + "Traal": { + "X": -9543.352014, + "Y": -39.594749, + "Z": -37.539687 + } + }, + "bases": { + "Aethermourne Station": { + "X": -9109.942, + "Y": 228.478, + "Z": -35.786 + }, + "New Neresia": { + "X": 7422, + "Y": -5502, + "Z": 114 + } + } + }, + "GORN": { + "name": "Gorn", + "color": 0xFF02FF, + "cenx": -9267.944, + "ceny": -330.00, + "cenz": 80.00, + "rad": 80.00, + "bordervis": true, + "planets": { + "Arkleseizure": { + "X": -9312.87731, + "Y": -247.150914, + "Z": 47.981427 + }, + "Cestus III": { + "X": -9188.553, + "Y": -344.2, + "Z": 119.601 + }, + "Ghdarin II": { + "X": -9310.236, + "Y": -270, + "Z": 109.31 + }, + "Ghehak VI": { + "X": -9206.632, + "Y": -283.7, + "Z": 60.456 + }, + "Gornar V": { + "X": -9272.366, + "Y": -332.2, + "Z": 81.114 + }, + "Gymine Prime": { + "X": -9284.976, + "Y": -395.4, + "Z": 37.375 + }, + "Troldar II": { + "X": -9267.729, + "Y": -389.4, + "Z": 69.348 + } + }, + "bases": {} + }, + "20": { + "abr": "UNK", + "color": 0xB3B3B3, + "cenx": 0, + "ceny": 0, + "cenz": 0, + "rad": 0, + "bordervis": false, + "planets": { + "Iuka IV": { + "X": -8703.226174, + "Y": -310.962, + "Z": -90.058 + }, + "Jesp IV": { + "X": -9280.787174, + "Y": -484.123, + "Z": 16.589 + }, + "Kloggen XI": { + "X": 7331.246, + "Y": -5592.223, + "Z": -34.348 + }, + "Krussel IX": { + "X": -9474.7, + "Y": -33.4, + "Z": 66.3 + }, + "Latinum Planet": { + "X": -9221.219174, + "Y": 47.222, + "Z": -328.813 + }, + "Meufie V": { + "X": -9461.384, + "Y": 424.385, + "Z": 28.043 + }, + "Lizrae XII": { + "X": 7317.001, + "Y": -5865.982, + "Z": -33.662 + }, + "Maust III": { + "X": 7312.568, + "Y": -5203.543, + "Z": 11.594 + }, + "Mitundri Prime": { + "X": -8991.803, + "Y": 45.101, + "Z": -124.125 + }, + "New Hallee": { + "X": -9473.974, + "Y": -35.679, + "Z": -133.042 + }, + "Odach VI": { + "X": -9298.308174, + "Y": -345.039, + "Z": -44.753 + }, + "Oglaroon": { + "X": -8944.871608, + "Y": 67.81059, + "Z": -46.850639 + }, + "Ohespae VII": { + "X": 7368.627, + "Y": -5391.671, + "Z": 140.684 + }, + "Ouble III": { + "X": -9687.353174, + "Y": -1.643, + "Z": 67.658 + }, + "Pluine IX": { + "X": 7740.842, + "Y": -5857.02, + "Z": 10.752 + }, + "Preria IV": { + "X": -8771.570174, + "Y": -233.347, + "Z": 41.478 + }, + "Prodaze IX": { + "X": 7020.577, + "Y": -5606.577, + "Z": 94.444 + }, + "Pruxav VII ": { + "X": 7323.553, + "Y": -4998.71, + "Z": 111.047 + }, + "Quegger X": { + "X": -9383.537174, + "Y": -453.175, + "Z": -98.263 + }, + "Quordlepleen II": { + "X": -8833.725186, + "Y": -217.429483, + "Z": 167.95219 + }, + "Salvo IX": { + "X": 6236.91337, + "Y": 6271.402476, + "Z": -17.03047 + }, + "Sniet VI": { + "X": 7145.044, + "Y": -5644.616, + "Z": -36.663 + }, + "Snozi III": { + "X": -8812.276174, + "Y": 256.804, + "Z": 22.529 + }, + "Spitzrath II": { + "X": -8701.338174, + "Y": -468.751, + "Z": 84.215 + }, + "Spoja V": { + "X": -8789.293, + "Y": -433.819, + "Z": 10.498 + }, + "Stobi III": { + "X": -8875.129174, + "Y": -49.772, + "Z": 42.84 + }, + "This Planet": { + "X": -8875.129, + "Y": -49.772, + "Z": 42.84 + }, + "Tuosho Prime": { + "X": 7601.996, + "Y": -5197.729, + "Z": -22.884 + }, + "Urss": { + "X": -9663.822, + "Y": 434.853, + "Z": 86.496 + }, + "Usho Prime": { + "X": 7446.049, + "Y": -5376, + "Z": 131.501 + }, + "Usubau VII": { + "X": -9000.986174, + "Y": 449.987, + "Z": -51.791 + }, + "Whousnod III": { + "X": -9499.273174, + "Y": -457.956, + "Z": -9.871 + }, + "Wosnav Prime": { + "X": 7551.731, + "Y": -5267.641, + "Z": -94.157 + }, + "Wroja III": { + "X": 7233.902, + "Y": -5371.594, + "Z": -3.391 + }, + "Xob VIII": { + "X": -8802.619174, + "Y": 130.684, + "Z": 44.825 + }, + "Xofu VII": { + "X": -8729.240174, + "Y": 70.156, + "Z": 4.162 + }, + "Yodixxo II": { + "X": 7265.834, + "Y": -5388.17, + "Z": -96.473 + }, + "Yoolu VI": { + "X": 7683.403, + "Y": -5113.28, + "Z": 47.527 + }, + "Yozerob VI": { + "X": 7111.099, + "Y": -5348.459, + "Z": -84.371 + }, + "Zarniwoop IV": { + "X": -8809.782656, + "Y": -61.478745, + "Z": -74.808896 + }, + "Zhara II": { + "X": 7739.851, + "Y": -5604.221, + "Z": -124.05 + } + }, + "bases": {} + } +}; diff --git a/mapview/js/mapviewgl.js b/mapview/js/mapviewgl.js new file mode 100644 index 0000000..9633af7 --- /dev/null +++ b/mapview/js/mapviewgl.js @@ -0,0 +1,164 @@ +// Load Data +var xmlhttp = new XMLHttpRequest(); +var url = "empiredata.json"; +var jsonEmpire; + +xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + jsonEmpire = JSON.parse(xmlhttp.responseText); + + } +}; +xmlhttp.open("GET", url, true); +xmlhttp.send(); + + +if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); +var camera, controls, scene, renderer; +var canvas_t=[]; +var context_t=[]; +var clock = new THREE.Clock(); +var WIDTH = window.innerWidth , HEIGHT = window.innerHeight +init(); +animate(); + +function init() { + scene = new THREE.Scene(); + //scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); + renderer = new THREE.WebGLRenderer(); + renderer.setSize( window.innerWidth, window.innerHeight ); + document.body.appendChild( renderer.domElement ); + + container = document.createElement( 'div' ); + document.body.appendChild( container ); + + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1e7); + /* controls = new THREE.TrackballControls( camera, renderer.domElement ); // I don't like how the Trackball controls work. + controls.rotateSpeed = 1.0; + controls.zoomSpeed = 1.2; + controls.panSpeed = 0.8; + controls.noZoom = false; + controls.noPan = true; + controls.staticMoving = true; + controls.dynamicDampingFactor = 0.3; + controls.keys = [ 65, 83, 68 ]; + camera.position.set(-8500,50,550); +/* camera.target = new THREE.Vector3().addVectors(/*new line for readability*/ + // new THREE.Vector3(-9800,200,0), camera.getWorldDirection()); */ + //camera.target = new THREE.Vector3(-9197,0,0); // END Trackball controls + + controls = new THREE.OrbitControls( camera, renderer.domElement ); + controls.enableDamping = true; + controls.dampingFactor = 0.25; + controls.enableZoom = true; + camera.position.set(-9300,50,550); + controls.addEventListener( 'change', render ); + + + +var borders=[]; +var geometry=[]; +var material=[]; +var planets=[]; +var labels=[]; +var bases=[]; +var Text2D = THREE_Text.Text2D; +var SpriteText2D = THREE_Text.SpriteText2D; +var textAlign = THREE_Text.textAlign +var raycaster = new THREE.Raycaster(); +var mouse = new THREE.Vector2(); + + + +for (var key in jsonEmpire) { + area=jsonEmpire[key]; + // Border Generation. If it's not visible, don't generate it, dummy. + if( area.bordervis) { + geometry[key] = new THREE.SphereGeometry( area.rad, 10, 10 ) + material[key] = new THREE.MeshBasicMaterial( { color: area.color, wireframe: true} ); + borders[key]= new THREE.Mesh( geometry[key], material[key] ); + borders[key].position.x=area.cenx; + borders[key].position.y=area.ceny; + borders[key].position.z=area.cenz; + scene.add( borders[key] ); + } + + // Planet Generation + for (var key in area["planets"]) { + var planet = area.planets[key]; + geometry[key] = new THREE.SphereGeometry( 1, 10, 10 ); + material[key] = new THREE.MeshBasicMaterial( { color: area.color, wireframe: false} ); + planets[key]= new THREE.Mesh( geometry[key], material[key] ); + planets[key].position.x=planet.X; + planets[key].position.y=planet.Y; + planets[key].position.z=planet.Z; + var text = new Text2D(key, { align: textAlign.right, font: '12px Arial', fillStyle: '#FFF' , antialias: false }); + text.material.alphaTest = 0.0; + text.position.set(planet.X,planet.Y,planet.Z); + text.scale.set(0.25,0.25,0.25); + scene.add(text); + scene.add( planets[key] ); + } + + // Base Generation + for (var key in area["bases"]) { + var base = area.bases[key]; + var TILE_SIZE = 0.5; + geometry[key] = new THREE.CylinderGeometry( 0.1, TILE_SIZE*3, TILE_SIZE*3, 4 ); + material[key] = new THREE.MeshBasicMaterial( { color: area.color, wireframe: false} ); + bases[key] = new THREE.Mesh( geometry[key], material[key] ); + bases[key].position.x=base.X; + bases[key].position.y=base.Y; + bases[key].position.z=base.Z; + scene.add( bases[key] ); + var text = new Text2D(key, { align: textAlign.left, font: '12px Arial', fillStyle: '#ABABAB' , antialias: false }); + text.material.alphaTest = 0.0; + text.position.set(base.X,base.Y+3,base.Z); + text.scale.set(0.20,0.20,0.20); + scene.add(text); + + + } + } + + // Initial Target spot. UFP for convinence. + controls.target.x = borders['UFP'].position.x; + controls.target.y = borders['UFP'].position.y; + controls.target.z = borders['UFP'].position.z; + + +} + +function onWindowResize() { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize( window.innerWidth, window.innerHeight ); + + controls.handleResize(); + + render(); + + } + +function animate() { + var delta = clock.getDelta(); + requestAnimationFrame( animate ); + + controls.update(delta); +} + + +function render () { + + requestAnimationFrame( animate ); + + renderer.render( scene, camera ); + +} + render(); + + + diff --git a/mapview/webviewgl.htm b/mapview/webviewgl.htm new file mode 100644 index 0000000..ee0ae59 --- /dev/null +++ b/mapview/webviewgl.htm @@ -0,0 +1,17 @@ + + + + + + + + + + +
+ + + diff --git a/webglmapview b/webglmapview deleted file mode 120000 index de3b739..0000000 --- a/webglmapview +++ /dev/null @@ -1 +0,0 @@ -../../webglmapview/ \ No newline at end of file