Merge branch 'master' into feature/asset-meta-update

This commit is contained in:
Alexander Bock
2020-10-10 12:01:56 +02:00
202 changed files with 6092 additions and 2292 deletions

View File

@@ -31,7 +31,6 @@ set(OPENSPACE_VERSION_MINOR 15)
set(OPENSPACE_VERSION_PATCH 2)
set(OPENSPACE_VERSION_STRING "Beta-7")
set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}")
set(OPENSPACE_CMAKE_EXT_DIR "${OPENSPACE_BASE_DIR}/support/cmake")
set(GHOUL_BASE_DIR "${OPENSPACE_BASE_DIR}/ext/ghoul")
@@ -134,6 +133,11 @@ if (MSVC)
set(GHOUL_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS ${OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS} CACHE BOOL "" FORCE)
endif ()
if (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
endif ()
include(src/CMakeLists.txt)
##########################################################################################

4
Jenkinsfile vendored
View File

@@ -100,8 +100,10 @@ linux: {
gitHelper.checkoutGit(url, branch);
}
stage('linux/build') {
def cmakeBuildingOptionLinux = moduleMakeFlags()
cmakeBuildingOptionLinux += '-DMAKE_BUILD_TYPE=Release'
// Not sure why the linking of OpenSpaceTest takes so long
compileHelper.build(compileHelper.Make(), compileHelper.Gcc(), moduleCMakeFlags(), 'OpenSpace', 'build-all');
compileHelper.build(compileHelper.Make(), compileHelper.Gcc(), cmakeBuildingOptionLinux, 'OpenSpace', 'build-all');
}
stage('linux/warnings') {
// compileHelper.recordCompileIssues(compileHelper.Gcc());

View File

@@ -23,6 +23,8 @@ asset.require('scene/milkyway/milkyway/volume')
asset.require('scene/milkyway/constellations/constellation_art')
asset.require('scene/milkyway/constellations/constellation_keybinds')
assetHelper.requireAll(asset, 'scene/milkyway/exoplanets')
assetHelper.requireAll(asset, 'scene/digitaluniverse')
-- Load default key bindings applicable to most scenes

View File

@@ -5,11 +5,11 @@ local images = asset.syncedResource({
Name = "Constellation Images",
Type = "HttpSynchronization",
Identifier = "constellation_images",
Version = 1
Version = 2
})
--function that reads the file
local createConstellations = function (guiPath, constellationfile)
local createConstellations = function (baseIdentifier, guiPath, constellationfile)
local genConstellations = {};
--skip the first line
local notFirstLine = false;
@@ -33,7 +33,8 @@ local createConstellations = function (guiPath, constellationfile)
group = (group == '' and globe or group)
local aconstellation = {
Identifier = guiPath .. '-' .. name,
-- Identifier = guiPath .. '-' .. name,
Identifier = baseIdentifier .. '-' .. abbreviation,
Parent = transforms.SolarSystemBarycenter.Identifier,
Transform = {
Translation = {
@@ -83,7 +84,7 @@ local nodes = {}
asset.onInitialize(function ()
local constellationsCSV = images .. "/constellation_data.csv"
nodes = createConstellations('Constellation Art', constellationsCSV)
nodes = createConstellations('ConstellationArt', 'Constellation Art', constellationsCSV)
for _, n in ipairs(nodes) do
openspace.addSceneGraphNode(n);
end

View File

@@ -1,85 +0,0 @@
Data about Constellations columns are: group, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar
normal,Ori,Orion,-550.8742,-259.3621,-188.9620,1.5,Ori.png,1.128407,1.058407,1.668407,HD37128
zodiac,Tau,Taurus,-18.7277,-0.3175,-6.9092,1.2,Tau.png,1.198407,0.908407,1.378407,Aldebran
zodiac,Ari,Aries,-13.2892,9.4519,-11.9378,0.8,Ari.png,0.668407,0.538407,0.518407,Hamal
zodiac,Gem,Gemini,-362.5493,-102.2245,79.4030,0.85,Gem.png,-0.731593,2.268407,-0.451593,Mekbuda
zodiac,Cnc,Cancer,-30.9209,-16.4584,22.6601,0.8,Cnc.png,-1.151593,1.888407,-1.041593,HD74442
zodiac,Leo,Leo,-17.9030,-13.2719,31.4196,1.33,Leo.png,-0.131593,2.448407,0.418407,HD89484
zodiac,Vir,Virgo,36.5809,-35.1877,62.3341,1.5,Vir.png,-0.371593,3.138407,0.518407,HD116658
zodiac,Lib,Libra,17.5393,-6.2768,14.5916,1.0,Lib.png,-1.011593,3.138407,1.318407,HD130819
zodiac,Sco,Scorpius,137.4378,-19.4456,37.3606,1.2,Sco.png,1.698407,-1.001593,-1.751593,HD148478
zodiac,Sgr,Sagittarius,66.2304,11.1498,-14.8095,1.2,Sgr.png,1.728407,-1.321593,-1.751593,HD175191
zodiac,Cap,Capricornus,32.9799,20.0621,-29.3945,1.3,Cap.png,1.158407,-0.881593,-0.561593,HD200761
zodiac,Aqr,Aquarius,86.5090,149.4078,-155.8102,1.2,Aqr.png,-2.921593,-2.391593,-2.551593,-2.511593
zodiac,Psc,Pisces,-28.0235,45.3150,-76.8893,1.6,Psc.png,0.458407,-0.001593,0.618407,HD4656
northern,Uma,Ursa Major,-12.0503,7.1931,19.8974,1.6,UMa.png,0.748407,2.398407,0.658407,HD95418
northern,Dra,Draco,-1.4340,20.6566,23.5098,1.9,Dra.png,0.658407,-2.541593,1.058407,HD137759
southern,Ant,Antila,-0.2233,-103.8908,42.7940,1.3,Ant.png,1.848407,0.198407,-3.141593,HD90610
southern,Crv,Corvus,8.0442,-16.8858,19.3984,1.1,Crv.png,2.198407,-0.041593,-2.221593,HD108767
southern,Cet,Cetus,-28.7960,7.2425,-73.6693,1.5,Cet.png,0.238407,0.368407,0.688407,HD11353
southern,Cha,Chameleon,53.5121,-108.3624,-38.1807,1.1,Cha.png,-1.801593,2.738407,0.448407,HD92305
northern,Cam,Camelopardalis,-304.8155,179.0620,71.1454,1.7,Cam.png,2.128407,1.228407,1.478407,HD31910
equatorial,Aql,Aquila,11.7741,9.7467,-1.6418,1.0,Aql.png,-2.601593,-2.511593,-3.141593,HD182640
southern,Aps,Apus,31.6370,-32.5620,-16.5786,1.1,Aps.png,-1.691593,-2.281593,0.838407,HD149324
northern,Lyn,Lynx,-98.3174,4.4830,67.2289,1.2,Lyn.png,1.688407,1.768407,1.668407,HD70272
southern,Phe,Phoenix,5.0172,-4.2096,-22.8088,1.5,Phe.png,-3.141593,3.138407,-3.141593,HD6595
northern,Cyg,Cygnus,78.7445,375.2440,12.4995,1.4,Cyg.png,1.668407,-0.931593,-0.261593,HD194093
southern,Cen,Centaurus,20.1398,-33.1830,9.5915,2.7,Cen.png,-1.291593,3.088407,0.458407,HD110304
northern,Aur,Auriga,-12.3062,3.8595,1.0302,1.5,Aur.png,1.378407,1.108407,1.178407,HD34029
northern,Peg,Pegasus,0.9791,32.5947,-27.7339,2.42,Peg.png,0.918407,-0.221593,-0.191593,HD218045
southern,Hya,Hydra,-2.9043,-33.5496,25.8962,3,Hya.png,-0.531593,2.838407,0.368407,HD93813
southern,Oct,Octans,22.0434,-27.8601,-24.3108,1.0,Oct.png,-0.911593,0.398407,1.198407,HD214846
southern,Nor,Norma,34.9251,-17.5643,0.0068,1.0,Nor.png,-1.631593,-2.421593,1.298407,HD146686
southern,Mus,Musca,48.8888,-79.2952,-10.2828,1.25,Mus.png,-1.871593,3.138407,0.358407,HD109668
southern,Hyi,Hydrus,3.2767,-4.7183,-4.7829,1.1,Hyi.png,2.438407,-3.141593,-2.381593,HD2151
northern,Lac,Lacerta,-6.0878,30.5794,-3.6064,1.0,Lac.png,-1.521593,-2.391593,3.138407,HD213558
equatorial,Lep,Lepus,-212.6297,-184.4909,-132.1156,1.0,Lep.png,-1.801593,-2.351593,-0.861593,HD36673
southern,Lup,Lupus,129.1166,-102.2983,33.3251,1.2,Lup.png,-1.191593,-2.391593,0.798407,HD129056
southern,Men,Mensa,2.4149,-8.5586,-4.8892,1.0,Men.png,-2.101593,-2.781593,0.828407,HD43834
southern,Mic,Microscopium,51.0335,11.1671,-44.3692,1.0,Mic.png,0.728407,-0.831593,-0.561593,HD199951
equatorial,Mon,Monoceros,-93.0725,-66.8909,8.6548,1.2,Mon.png,-1.331593,1.988407,-0.891593,HD55185
southern,Pav,Pavo,4.4549,-2.5959,-3.2739,1.3,Pav.png,-2.391593,-2.171593,1.648407,HD190248
southern,Ind,Indus,133.6149,-53.5569,-115.9552,1.5,Ind.png,-2.031593,-1.491593,1.758407,HD198700
northern,LMi,Leo Minor,-23.3948,-2.5770,38.0756,1.1,LMi.png,-3.141593,0.478407,-2.201593,HD90537
northern,Lyr,Lyra,2.8086,6.7630,2.5555,1.0,Lyr.png,-1.831593,-2.091593,3.141500,HD172167
northern,Her,Hercules,14.0526,14.9773,12.5478,1.3,Her.png,-1.511593,-1.811593,2.288407,HD156164
southern,Gru,Grus,18.6528,-3.2893,-24.6602,1.3,Gru.png,-3.141593,-2.511593,-2.901593,HD209952
southern,Crt,Crater,1.5886,-43.9831,40.3390,1.3,Crt.png,-0.521593,3.140000,0.588407,HD98430
northern,Del,Delphinus,14.8599,24.6150,-8.0550,1.2,Del.png,1.308407,-0.951593,-0.241593,HD196524
southern,Dor,Dorado,-0.6460,-9.3172,-6.9654,1.2,Dor.png,2.118407,1.768407,-2.901593,HD33262
northern,Equ,Equuleus,27.7363,41.7071,-27.4371,1.2,Equ.png,-1.801593,-2.511593,2.558407,HD202447
southern,Eri,Eridanus,-37.5153,-23.5231,-65.6368,2.1,Eri.png,0.128407,0.698407,0.998407,HD20720
southern,For,Fornax,-14.0351,-17.8282,-46.5514,1.4,For.png,3.138407,2.678407,-2.351593,HD17652
southern,Hor,Horologium,2.1021,-27.1310,-40.5136,1.2,Hor.png,-3.141593,2.468407,-2.191593,HD16920
southern,Pyx,Pyxis,-66.7424,-248.9639,26.0445,1.2,Pyx.png,1.838407,-1.651593,2.708407,HD74575
southern,Ret,Reticulum,2.8130,-37.2904,-33.2644,1.5,Ret.png,1.998407,2.188407,-2.591593,HD27256
northern,Sge,Sagitta,44.3886,70.9446,-7.6264,1.2,Sge.png,-0.741593,-2.231593,2.108407,HD189319
southern,Scl,Sculptor,21.6545,-6.8861,-166.5240,1.3,Scl.png,-0.071593,-0.221593,0.638407,HD2429
southern,Sct,Scutum,48.8939,21.5158,-0.1629,1.2,Sct.png,1.188407,-1.271593,-0.971593,HD171443
southern,Tuc,Tucana,35.3950,-20.2535,-45.2324,1.1,Tuc.png,-0.351593,-0.161593,0.308407,HD211416
northern,Tri,Triangulum,-26.6263,21.9119,-16.2254,1.2,Tri.png,1.168407,0.218407,0.558407,HD13161
southern,TrA,Triangulum Australe,96.2283,-76.4459,-33.5257,1.2,TrA.png,-1.991593,-2.491593,1.128407,HD150798
southern,Tel,Telescopium,72.3444,-14.5016,-20.0248,1.2,Tel.png,-0.461593,-1.731593,0.298407,HD169467
southern,Ara,Ara,164.9273,-75.6246,-35.3100,1.1,Ara.png,-1.381593,-2.131593,1.048407,HD157244
southern,Cae,Caelum,-6.0961,-13.7926,-13.3392,1.0,Cae.png,-0.661593,0.948407,0.418407,HD29875
southern,CMa,Canis Major,-1.7693,-1.9125,-0.4074,1.3,CMa.png,1.128407,1.048407,1.878407,HD48915
northern,CMi,Canis Minor,-2.8348,-1.8906,0.7881,1.2,CMi.png,2.538407,1.138407,-3.141593,HD61421
southern,Vol,Volans,37.6000,-182.7856,-62.6559,1.2,Vol.png,-2.441593,1.988407,-0.351593,HD68520
northern,UMi,Ursa Minor,-11.3527,27.2100,25.1835,1.3,UMi.png,-2.491593,-0.581593,-2.381593,HD131873
northern,And,Andromdeda,-32.8276,43.3946,-27.8475,1.6,And.png,-2.021593,-3.141593,-2.521593,HD6860
northern,Boo,Bootes,11.2468,14.9864,30.4945,2.0,Boo.png,-3.141593,-0.601593,-2.361593,HD135722
northern,Vul,Vulpecula,46.7540,77.7780,5.3953,1.1,Vul.png,-2.301593,-2.061593,-3.141593,HD131873
northern,CVn,Canes Venatici,-3.1198,5.7935,33.1368,1.3,CVn.png,0.148407,3.138407,0.428407,HD112413
southern,Cir,Circinus,11.4255,-11.6937,-1.3129,1.0,Cir.png,1.448407,-0.391593,-2.211593,HD128898
northern,Com,Coma Berenices,1.9257,-1.2062,12.2465,1.4,Com.png,3.138407,-0.051593,-2.711593,HD114378
southern,CrA,Corona Australis,146.1322,-4.7492,-53.7124,1.0,CrA.png,-3.141593,-2.021593,-3.141593,HD178345
northern,CrB,Corona Borealis,33.5737,32.0314,52.9729,1.3,CrB.png,-3.141593,-0.601593,-2.271593,HD143107
northern,Cas,Cassiopeia,-36.3073,59.4424,-7.6926,1.4,Cas.png,-1.431593,3.128407,-2.331593,HD3712
northern,Cep,Cepheus,-2.8178,14.4985,2.3848,1.7,Cep.png,-1.331593,-2.291593,-2.931593,HD203280
southern,Car,Carina Vela Puppis,14.1325,-188.6018,-42.2785,2.0,Car.png,2.078407,1.048407,-3.111593,HD71129
northern,Col,Columba,-11.2568,-20.5973,-11.9895,1.0,Col.png,2.518407,1.358407,-2.981593,HD39425
northern,Per,Perseus,-139.8202,79.8063,-16.2631,1.3,Per.png,-1.751593,2.428407,-2.411593,HD22928
northern,Oph,Ophiuchus,127.9419,14.0822,56.2015,3.2,Oph.png,2.178407,-0.781593,-1.681593,HD149757
southern,PsA,Piscis Austrinus,99.9977,47.6679,-199.6345,1.0,PsA.png,3.138407,-2.541593,-2.881593,HD214748
southern,Cru,Crux,49.3509,-85.0446,-0.6223,1.1,Cru.png,1.718407,0.048407,-2.741593,HD108248
southern,Pic,Pictor,-4.5417,-45.5649,-27.1768,1.0,Pic.png,2.568407,2.138407,-2.081593,HD39523
1 Data about Constellations columns are: group, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar
2 normal,Ori,Orion,-550.8742,-259.3621,-188.9620,1.5,Ori.png,1.128407,1.058407,1.668407,HD37128
3 zodiac,Tau,Taurus,-18.7277,-0.3175,-6.9092,1.2,Tau.png,1.198407,0.908407,1.378407,Aldebran
4 zodiac,Ari,Aries,-13.2892,9.4519,-11.9378,0.8,Ari.png,0.668407,0.538407,0.518407,Hamal
5 zodiac,Gem,Gemini,-362.5493,-102.2245,79.4030,0.85,Gem.png,-0.731593,2.268407,-0.451593,Mekbuda
6 zodiac,Cnc,Cancer,-30.9209,-16.4584,22.6601,0.8,Cnc.png,-1.151593,1.888407,-1.041593,HD74442
7 zodiac,Leo,Leo,-17.9030,-13.2719,31.4196,1.33,Leo.png,-0.131593,2.448407,0.418407,HD89484
8 zodiac,Vir,Virgo,36.5809,-35.1877,62.3341,1.5,Vir.png,-0.371593,3.138407,0.518407,HD116658
9 zodiac,Lib,Libra,17.5393,-6.2768,14.5916,1.0,Lib.png,-1.011593,3.138407,1.318407,HD130819
10 zodiac,Sco,Scorpius,137.4378,-19.4456,37.3606,1.2,Sco.png,1.698407,-1.001593,-1.751593,HD148478
11 zodiac,Sgr,Sagittarius,66.2304,11.1498,-14.8095,1.2,Sgr.png,1.728407,-1.321593,-1.751593,HD175191
12 zodiac,Cap,Capricornus,32.9799,20.0621,-29.3945,1.3,Cap.png,1.158407,-0.881593,-0.561593,HD200761
13 zodiac,Aqr,Aquarius,86.5090,149.4078,-155.8102,1.2,Aqr.png,-2.921593,-2.391593,-2.551593,-2.511593
14 zodiac,Psc,Pisces,-28.0235,45.3150,-76.8893,1.6,Psc.png,0.458407,-0.001593,0.618407,HD4656
15 northern,Uma,Ursa Major,-12.0503,7.1931,19.8974,1.6,UMa.png,0.748407,2.398407,0.658407,HD95418
16 northern,Dra,Draco,-1.4340,20.6566,23.5098,1.9,Dra.png,0.658407,-2.541593,1.058407,HD137759
17 southern,Ant,Antila,-0.2233,-103.8908,42.7940,1.3,Ant.png,1.848407,0.198407,-3.141593,HD90610
18 southern,Crv,Corvus,8.0442,-16.8858,19.3984,1.1,Crv.png,2.198407,-0.041593,-2.221593,HD108767
19 southern,Cet,Cetus,-28.7960,7.2425,-73.6693,1.5,Cet.png,0.238407,0.368407,0.688407,HD11353
20 southern,Cha,Chameleon,53.5121,-108.3624,-38.1807,1.1,Cha.png,-1.801593,2.738407,0.448407,HD92305
21 northern,Cam,Camelopardalis,-304.8155,179.0620,71.1454,1.7,Cam.png,2.128407,1.228407,1.478407,HD31910
22 equatorial,Aql,Aquila,11.7741,9.7467,-1.6418,1.0,Aql.png,-2.601593,-2.511593,-3.141593,HD182640
23 southern,Aps,Apus,31.6370,-32.5620,-16.5786,1.1,Aps.png,-1.691593,-2.281593,0.838407,HD149324
24 northern,Lyn,Lynx,-98.3174,4.4830,67.2289,1.2,Lyn.png,1.688407,1.768407,1.668407,HD70272
25 southern,Phe,Phoenix,5.0172,-4.2096,-22.8088,1.5,Phe.png,-3.141593,3.138407,-3.141593,HD6595
26 northern,Cyg,Cygnus,78.7445,375.2440,12.4995,1.4,Cyg.png,1.668407,-0.931593,-0.261593,HD194093
27 southern,Cen,Centaurus,20.1398,-33.1830,9.5915,2.7,Cen.png,-1.291593,3.088407,0.458407,HD110304
28 northern,Aur,Auriga,-12.3062,3.8595,1.0302,1.5,Aur.png,1.378407,1.108407,1.178407,HD34029
29 northern,Peg,Pegasus,0.9791,32.5947,-27.7339,2.42,Peg.png,0.918407,-0.221593,-0.191593,HD218045
30 southern,Hya,Hydra,-2.9043,-33.5496,25.8962,3,Hya.png,-0.531593,2.838407,0.368407,HD93813
31 southern,Oct,Octans,22.0434,-27.8601,-24.3108,1.0,Oct.png,-0.911593,0.398407,1.198407,HD214846
32 southern,Nor,Norma,34.9251,-17.5643,0.0068,1.0,Nor.png,-1.631593,-2.421593,1.298407,HD146686
33 southern,Mus,Musca,48.8888,-79.2952,-10.2828,1.25,Mus.png,-1.871593,3.138407,0.358407,HD109668
34 southern,Hyi,Hydrus,3.2767,-4.7183,-4.7829,1.1,Hyi.png,2.438407,-3.141593,-2.381593,HD2151
35 northern,Lac,Lacerta,-6.0878,30.5794,-3.6064,1.0,Lac.png,-1.521593,-2.391593,3.138407,HD213558
36 equatorial,Lep,Lepus,-212.6297,-184.4909,-132.1156,1.0,Lep.png,-1.801593,-2.351593,-0.861593,HD36673
37 southern,Lup,Lupus,129.1166,-102.2983,33.3251,1.2,Lup.png,-1.191593,-2.391593,0.798407,HD129056
38 southern,Men,Mensa,2.4149,-8.5586,-4.8892,1.0,Men.png,-2.101593,-2.781593,0.828407,HD43834
39 southern,Mic,Microscopium,51.0335,11.1671,-44.3692,1.0,Mic.png,0.728407,-0.831593,-0.561593,HD199951
40 equatorial,Mon,Monoceros,-93.0725,-66.8909,8.6548,1.2,Mon.png,-1.331593,1.988407,-0.891593,HD55185
41 southern,Pav,Pavo,4.4549,-2.5959,-3.2739,1.3,Pav.png,-2.391593,-2.171593,1.648407,HD190248
42 southern,Ind,Indus,133.6149,-53.5569,-115.9552,1.5,Ind.png,-2.031593,-1.491593,1.758407,HD198700
43 northern,LMi,Leo Minor,-23.3948,-2.5770,38.0756,1.1,LMi.png,-3.141593,0.478407,-2.201593,HD90537
44 northern,Lyr,Lyra,2.8086,6.7630,2.5555,1.0,Lyr.png,-1.831593,-2.091593,3.141500,HD172167
45 northern,Her,Hercules,14.0526,14.9773,12.5478,1.3,Her.png,-1.511593,-1.811593,2.288407,HD156164
46 southern,Gru,Grus,18.6528,-3.2893,-24.6602,1.3,Gru.png,-3.141593,-2.511593,-2.901593,HD209952
47 southern,Crt,Crater,1.5886,-43.9831,40.3390,1.3,Crt.png,-0.521593,3.140000,0.588407,HD98430
48 northern,Del,Delphinus,14.8599,24.6150,-8.0550,1.2,Del.png,1.308407,-0.951593,-0.241593,HD196524
49 southern,Dor,Dorado,-0.6460,-9.3172,-6.9654,1.2,Dor.png,2.118407,1.768407,-2.901593,HD33262
50 northern,Equ,Equuleus,27.7363,41.7071,-27.4371,1.2,Equ.png,-1.801593,-2.511593,2.558407,HD202447
51 southern,Eri,Eridanus,-37.5153,-23.5231,-65.6368,2.1,Eri.png,0.128407,0.698407,0.998407,HD20720
52 southern,For,Fornax,-14.0351,-17.8282,-46.5514,1.4,For.png,3.138407,2.678407,-2.351593,HD17652
53 southern,Hor,Horologium,2.1021,-27.1310,-40.5136,1.2,Hor.png,-3.141593,2.468407,-2.191593,HD16920
54 southern,Pyx,Pyxis,-66.7424,-248.9639,26.0445,1.2,Pyx.png,1.838407,-1.651593,2.708407,HD74575
55 southern,Ret,Reticulum,2.8130,-37.2904,-33.2644,1.5,Ret.png,1.998407,2.188407,-2.591593,HD27256
56 northern,Sge,Sagitta,44.3886,70.9446,-7.6264,1.2,Sge.png,-0.741593,-2.231593,2.108407,HD189319
57 southern,Scl,Sculptor,21.6545,-6.8861,-166.5240,1.3,Scl.png,-0.071593,-0.221593,0.638407,HD2429
58 southern,Sct,Scutum,48.8939,21.5158,-0.1629,1.2,Sct.png,1.188407,-1.271593,-0.971593,HD171443
59 southern,Tuc,Tucana,35.3950,-20.2535,-45.2324,1.1,Tuc.png,-0.351593,-0.161593,0.308407,HD211416
60 northern,Tri,Triangulum,-26.6263,21.9119,-16.2254,1.2,Tri.png,1.168407,0.218407,0.558407,HD13161
61 southern,TrA,Triangulum Australe,96.2283,-76.4459,-33.5257,1.2,TrA.png,-1.991593,-2.491593,1.128407,HD150798
62 southern,Tel,Telescopium,72.3444,-14.5016,-20.0248,1.2,Tel.png,-0.461593,-1.731593,0.298407,HD169467
63 southern,Ara,Ara,164.9273,-75.6246,-35.3100,1.1,Ara.png,-1.381593,-2.131593,1.048407,HD157244
64 southern,Cae,Caelum,-6.0961,-13.7926,-13.3392,1.0,Cae.png,-0.661593,0.948407,0.418407,HD29875
65 southern,CMa,Canis Major,-1.7693,-1.9125,-0.4074,1.3,CMa.png,1.128407,1.048407,1.878407,HD48915
66 northern,CMi,Canis Minor,-2.8348,-1.8906,0.7881,1.2,CMi.png,2.538407,1.138407,-3.141593,HD61421
67 southern,Vol,Volans,37.6000,-182.7856,-62.6559,1.2,Vol.png,-2.441593,1.988407,-0.351593,HD68520
68 northern,UMi,Ursa Minor,-11.3527,27.2100,25.1835,1.3,UMi.png,-2.491593,-0.581593,-2.381593,HD131873
69 northern,And,Andromdeda,-32.8276,43.3946,-27.8475,1.6,And.png,-2.021593,-3.141593,-2.521593,HD6860
70 northern,Boo,Bootes,11.2468,14.9864,30.4945,2.0,Boo.png,-3.141593,-0.601593,-2.361593,HD135722
71 northern,Vul,Vulpecula,46.7540,77.7780,5.3953,1.1,Vul.png,-2.301593,-2.061593,-3.141593,HD131873
72 northern,CVn,Canes Venatici,-3.1198,5.7935,33.1368,1.3,CVn.png,0.148407,3.138407,0.428407,HD112413
73 southern,Cir,Circinus,11.4255,-11.6937,-1.3129,1.0,Cir.png,1.448407,-0.391593,-2.211593,HD128898
74 northern,Com,Coma Berenices,1.9257,-1.2062,12.2465,1.4,Com.png,3.138407,-0.051593,-2.711593,HD114378
75 southern,CrA,Corona Australis,146.1322,-4.7492,-53.7124,1.0,CrA.png,-3.141593,-2.021593,-3.141593,HD178345
76 northern,CrB,Corona Borealis,33.5737,32.0314,52.9729,1.3,CrB.png,-3.141593,-0.601593,-2.271593,HD143107
77 northern,Cas,Cassiopeia,-36.3073,59.4424,-7.6926,1.4,Cas.png,-1.431593,3.128407,-2.331593,HD3712
78 northern,Cep,Cepheus,-2.8178,14.4985,2.3848,1.7,Cep.png,-1.331593,-2.291593,-2.931593,HD203280
79 southern,Car,Carina Vela Puppis,14.1325,-188.6018,-42.2785,2.0,Car.png,2.078407,1.048407,-3.111593,HD71129
80 northern,Col,Columba,-11.2568,-20.5973,-11.9895,1.0,Col.png,2.518407,1.358407,-2.981593,HD39425
81 northern,Per,Perseus,-139.8202,79.8063,-16.2631,1.3,Per.png,-1.751593,2.428407,-2.411593,HD22928
82 northern,Oph,Ophiuchus,127.9419,14.0822,56.2015,3.2,Oph.png,2.178407,-0.781593,-1.681593,HD149757
83 southern,PsA,Piscis Austrinus,99.9977,47.6679,-199.6345,1.0,PsA.png,3.138407,-2.541593,-2.881593,HD214748
84 southern,Cru,Crux,49.3509,-85.0446,-0.6223,1.1,Cru.png,1.718407,0.048407,-2.741593,HD108248
85 southern,Pic,Pictor,-4.5417,-45.5649,-27.1768,1.0,Pic.png,2.568407,2.138407,-2.081593,HD39523

View File

@@ -4,9 +4,9 @@ local Keybindings = {
{
Key = "c",
Name = "Show Constellation Art",
Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0);" ..
"openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', true);" ..
"openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0.1, 2);",
Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0);" ..
"openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Enabled', true);" ..
"openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0.1, 2);",
Documentation = "Enables and fades up constellation art work",
GuiPath = "/Rendering",
Local = false
@@ -14,7 +14,7 @@ local Keybindings = {
{
Key = "SHIFT+c",
Name = "Hide Constellation Art",
Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0, 2);",
Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0, 2);",
Documentation = "Fades out constellation artwork",
GuiPath = "/Rendering",
Local = false
@@ -22,7 +22,7 @@ local Keybindings = {
{
Key = "CTRL+c",
Name = "Disable Constellation Art",
Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', false);",
Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Enabled', false);",
Documentation = "Disable constellation artwork",
GuiPath = "/Rendering",
Local = false

View File

@@ -0,0 +1,7 @@
local DataPath = asset.syncedResource({
Name = "Exoplanet Data Files",
Type = "HttpSynchronization",
Identifier = "exoplanets_data",
Version = 1
})
asset.export("DataPath", DataPath)

View File

@@ -0,0 +1,7 @@
local TexturesPath = asset.syncedResource({
Name = "Exoplanet Textures",
Type = "HttpSynchronization",
Identifier = "exoplanets_textures",
Version = 1
})
asset.export("TexturesPath", TexturesPath)

View File

@@ -1,22 +1,30 @@
#Version
1.0
#Asset
base
scene/solarsystem/planets/earth/earth earthAsset
scene/solarsystem/planets/earth/satellites/satellites
#Property
setPropertyValue {earth_satellites}.Renderable.Enabled false
#Time
relative -1d
#Camera
goToGeo earthAsset.Earth.Identifier 58.5877 16.1924 20000000
#MarkNodes
Earth
Mars
Moon
Sun
{
"version": {
"major": 1,
"minor": 0
},
"assets": [
"base",
"scene/solarsystem/planets/earth/earth",
"scene/solarsystem/planets/earth/satellites/satellites"
],
"properties": [
{
"type": "setPropertyValue",
"name": "{earth_satellites}.Renderable.Enabled",
"value": "false"
}
],
"time": {
"type": "relative",
"value": "-1d"
},
"camera": {
"type": "goToGeo",
"anchor": "Earth",
"latitude": 58.5877,
"longitude": 16.1924,
"altitude": 20000000
},
"mark_nodes": [ "Earth", "Mars", "Moon", "Sun" ]
}

View File

@@ -0,0 +1,12 @@
local dataFolder = "${BASE}/modules/exoplanets"
return {
{
Type = "ExoplanetsCsvToBinTask",
InputCSV = dataFolder .. "/exoplanets.csv",
InputSPECK = "${SYNC}/http/digitaluniverse_exoplanets_speck/1/expl.speck",
TeffToBvFile = "${SYNC}/http/exoplanets_data/1/teff_bv.txt",
OutputBIN = dataFolder .. "/exoplanets_data.bin",
OutputLUT = dataFolder .. "/lookup.txt"
}
}

View File

@@ -0,0 +1,7 @@
return {
{
Type = "ConvertRecFormatTask",
InputFilePath = "../../recordings/input",
OutputFilePath = "../../recordings/output"
}
}

View File

@@ -50,10 +50,13 @@ public:
struct CameraPose {
glm::dvec3 position = glm::dvec3(0.0);
glm::quat rotation = glm::quat(1.f, 0.f, 0.f, 0.f);
glm::quat rotation = glm::quat(0.f, 0.f, 0.f, 0.f);
std::string focusNode;
float scale;
bool followFocusNodeRotation;
float scale = 1.f;
bool followFocusNodeRotation = false;
CameraPose() = default;
CameraPose(datamessagestructures::CameraKeyframe&& kf);
};
/**

View File

@@ -33,11 +33,24 @@
namespace openspace::interaction {
class SessionRecording : public properties::PropertyOwner {
public:
enum class RecordedDataMode {
inline static const std::string FileHeaderTitle = "OpenSpace_record/playback";
inline static const std::string HeaderCameraAscii = "camera";
inline static const std::string HeaderTimeAscii = "time";
inline static const std::string HeaderScriptAscii = "script";
inline static const std::string HeaderCommentAscii = "#";
inline static const char HeaderCameraBinary = 'c';
inline static const char HeaderTimeBinary = 't';
inline static const char HeaderScriptBinary = 's';
inline static const std::string FileExtensionBinary = ".osrec";
inline static const std::string FileExtensionAscii = ".osrectxt";
enum class DataMode {
Ascii = 0,
Binary
Binary,
Unknown
};
enum class SessionState {
@@ -46,6 +59,24 @@ public:
Playback
};
struct Timestamps {
double timeOs;
double timeRec;
double timeSim;
};
static const size_t FileHeaderVersionLength = 5;
static constexpr char FileHeaderVersion[FileHeaderVersionLength] = {
'0', '0', '.', '8', '5'
};
static const char DataFormatAsciiTag = 'A';
static const char DataFormatBinaryTag = 'B';
static const size_t keyframeHeaderSize_bytes = 33;
static const size_t saveBufferCameraSize_min = 82;
static const size_t saveBufferStringSize_max = 500;
static const size_t _saveBufferMaxSize_bytes = keyframeHeaderSize_bytes +
+ saveBufferCameraSize_min + saveBufferStringSize_max;
using CallbackHandle = int;
using StateChangeCallback = std::function<void()>;
@@ -101,7 +132,7 @@ public:
*
* \return \c true if recording to file starts without errors
*/
void setRecordDataFormat(RecordedDataMode dataMode);
void setRecordDataFormat(DataMode dataMode);
/**
* Used to stop a recording in progress. If open, the recording file will be closed,
@@ -215,6 +246,195 @@ public:
*/
std::vector<std::string> playbackList() const;
/**
* Reads a camera keyframe from a binary format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a camera keyframe which contains camera details
* \param file an ifstream reference to the playback file being read
* \param lineN keyframe number in playback file where this keyframe resides
*/
static void readCameraKeyframeBinary(Timestamps& times,
datamessagestructures::CameraKeyframe& kf, std::ifstream& file, int lineN);
/**
* Reads a camera keyframe from an ascii format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a camera keyframe which contains camera details
* \param currentParsingLine string containing the most current line that was read
* \param lineN line number in playback file where this keyframe resides
*/
static void readCameraKeyframeAscii(Timestamps& times,
datamessagestructures::CameraKeyframe& kf, std::string currentParsingLine,
int lineN);
/**
* Reads a time keyframe from a binary format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a time keyframe which contains time details
* \param file an ifstream reference to the playback file being read
* \param lineN keyframe number in playback file where this keyframe resides
*/
static void readTimeKeyframeBinary(Timestamps& times,
datamessagestructures::TimeKeyframe& kf, std::ifstream& file, int lineN);
/**
* Reads a time keyframe from an ascii format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a time keyframe which contains time details
* \param currentParsingLine string containing the most current line that was read
* \param lineN line number in playback file where this keyframe resides
*/
static void readTimeKeyframeAscii(Timestamps& times,
datamessagestructures::TimeKeyframe& kf, std::string currentParsingLine,
int lineN);
/**
* Reads a script keyframe from a binary format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a script keyframe which contains the size of the script
* (in chars) and the text itself
* \param file an ifstream reference to the playback file being read
* \param lineN keyframe number in playback file where this keyframe resides
*/
static void readScriptKeyframeBinary(Timestamps& times,
datamessagestructures::ScriptMessage& kf, std::ifstream& file, int lineN);
/**
* Reads a script keyframe from an ascii format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a script keyframe which contains the size of the script
* (in chars) and the text itself
* \param currentParsingLine string containing the most current line that was read
* \param lineN line number in playback file where this keyframe resides
*/
static void readScriptKeyframeAscii(Timestamps& times,
datamessagestructures::ScriptMessage& kf, std::string currentParsingLine,
int lineN);
/**
* Writes a camera keyframe to a binary format recording file using a CameraKeyframe
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a camera keyframe which contains the camera details
* \param kfBuffer a buffer temporarily used for preparing data to be written
* \param file an ofstream reference to the recording file being written-to
*/
static void saveCameraKeyframeBinary(Timestamps times,
datamessagestructures::CameraKeyframe& kf, unsigned char* kfBuffer,
std::ofstream& file);
/**
* Writes a camera keyframe to an ascii format recording file using a CameraKeyframe
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a camera keyframe which contains the camera details
* \param file an ofstream reference to the recording file being written-to
*/
static void saveCameraKeyframeAscii(Timestamps times,
datamessagestructures::CameraKeyframe& kf, std::ofstream& file);
/**
* Writes a time keyframe to a binary format recording file using a TimeKeyframe
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a time keyframe which contains the time details
* \param kfBuffer a buffer temporarily used for preparing data to be written
* \param file an ofstream reference to the recording file being written-to
*/
static void saveTimeKeyframeBinary(Timestamps times,
datamessagestructures::TimeKeyframe& kf, unsigned char* kfBuffer,
std::ofstream& file);
/**
* Writes a time keyframe to an ascii format recording file using a TimeKeyframe
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a time keyframe which contains the time details
* \param file an ofstream reference to the recording file being written-to
*/
static void saveTimeKeyframeAscii(Timestamps times,
datamessagestructures::TimeKeyframe& kf, std::ofstream& file);
/**
* Writes a script keyframe to a binary format recording file using a ScriptMessage
*
* \param times reference to a timestamps structure which contains recorded times
* \param sm reference to a ScriptMessage object which contains the script details
* \param smBuffer a buffer temporarily used for preparing data to be written
* \param file an ofstream reference to the recording file being written-to
*/
static void saveScriptKeyframeBinary(Timestamps times,
datamessagestructures::ScriptMessage& sm, unsigned char* smBuffer,
std::ofstream& file);
/**
* Writes a script keyframe to an ascii format recording file using a ScriptMessage
*
* \param times reference to a timestamps structure which contains recorded times
* \param sm reference to a ScriptMessage which contains the script details
* \param file an ofstream reference to the recording file being written-to
*/
static void saveScriptKeyframeAscii(Timestamps times,
datamessagestructures::ScriptMessage& sm, std::ofstream& file);
/**
* Reads header information from a session recording file
*
* \param stream reference to ifstream that contains the session recording file data
* \param readLen_chars number of characters to be read, which may be the expected
* length of the header line, or an arbitrary number of characters within it
*/
static std::string readHeaderElement(std::ifstream& stream, size_t readLen_chars);
/**
* Writes a header to a binary recording file buffer
*
* \param times reference to a timestamps structure which contains recorded times
* \param type single character signifying the keyframe type
* \param kfBuffer the char buffer holding the recording info to be written
* \param idx index into write buffer (this is updated with the num of chars written)
*/
static void saveHeaderBinary(Timestamps times, char type, unsigned char* kfBuffer,
size_t& idx);
/**
* Writes a header to an ascii recording file buffer
*
* \param times reference to a timestamps structure which contains recorded times
* \param type string signifying the keyframe type
* \param line the stringstream buffer being written to
*/
static void saveHeaderAscii(Timestamps times, const std::string& type,
std::stringstream& line);
/**
* Saves a keyframe to an ascii recording file
*
* \param entry the ascii string version of the keyframe (any type)
* \param file ofstream object to write to
*/
static void saveKeyframeToFile(std::string entry, std::ofstream& file);
/**
* Checks if a specified recording file ends with a particular file extension
*
* \param filename the name of the file to record to
* \param extension the file extension to check for
*/
static bool hasFileExtension(std::string filename, std::string extension);
private:
properties::BoolProperty _renderPlaybackInformation;
@@ -238,25 +458,25 @@ private:
double appropriateTimestamp(double timeOs, double timeRec, double timeSim);
double equivalentSimulationTime(double timeOs, double timeRec, double timeSim);
double equivalentApplicationTime(double timeOs, double timeRec, double timeSim);
void playbackCamera();
void playbackTimeChange();
void playbackScript();
bool handleRecordingFile(std::string filenameIn);
bool playbackCamera();
bool playbackTimeChange();
bool playbackScript();
bool playbackAddEntriesToTimeline();
void signalPlaybackFinishedForComponent(RecordedType type);
void writeToFileBuffer(double src);
void writeToFileBuffer(std::vector<char>& cvec);
void writeToFileBuffer(unsigned char c);
void writeToFileBuffer(bool b);
void saveStringToFile(const std::string& s);
void saveKeyframeToFileBinary(unsigned char* bufferSource, size_t size);
void findFirstCameraKeyframeInTimeline();
void saveKeyframeToFile(std::string entry);
static void saveStringToFile(const std::string& s, unsigned char* kfBuffer,
size_t& idx, std::ofstream& file);
static void saveKeyframeToFileBinary(unsigned char* bufferSource, size_t size,
std::ofstream& file);
void addKeyframe(double timestamp,
interaction::KeyframeNavigator::CameraPose keyframe);
void addKeyframe(double timestamp, datamessagestructures::TimeKeyframe keyframe);
void addKeyframe(double timestamp, std::string scriptToQueue);
bool addKeyframe(double timestamp,
interaction::KeyframeNavigator::CameraPose keyframe, int lineNum);
bool addKeyframe(double timestamp, datamessagestructures::TimeKeyframe keyframe,
int lineNum);
bool addKeyframe(double timestamp, std::string scriptToQueue, int lineNum);
bool addKeyframeToTimeline(RecordedType type, size_t indexIntoTypeKeyframes,
double timestamp, int lineNum);
void moveAheadInTime();
void lookForNonCameraKeyframesThatHaveComeDue(double currTime);
void updateCameraWithOrWithoutNewKeyframes(double currTime);
@@ -276,7 +496,12 @@ private:
double getPrevTimestamp();
void cleanUpPlayback();
RecordedDataMode _recordingDataMode = RecordedDataMode::Binary;
static void writeToFileBuffer(unsigned char* buf, size_t& idx, double src);
static void writeToFileBuffer(unsigned char* buf, size_t& idx, std::vector<char>& cv);
static void writeToFileBuffer(unsigned char* buf, size_t& idx, unsigned char c);
static void writeToFileBuffer(unsigned char* buf, size_t& idx, bool b);
DataMode _recordingDataMode = DataMode::Binary;
SessionState _state = SessionState::Idle;
SessionState _lastState = SessionState::Idle;
std::string _playbackFilename;
@@ -296,14 +521,7 @@ private:
double _saveRenderingDeltaTime = 1.0 / 30.0;
double _saveRenderingCurrentRecordedTime;
static const size_t keyframeHeaderSize_bytes = 33;
static const size_t saveBufferCameraSize_min = 82;
static const size_t saveBufferStringSize_max = 500;
static const size_t _saveBufferMaxSize_bytes = keyframeHeaderSize_bytes +
+ saveBufferCameraSize_min
+ saveBufferStringSize_max;
unsigned char _keyframeBuffer[_saveBufferMaxSize_bytes];
size_t _bufferIndex = 0;
bool _cleanupNeeded = false;

View File

@@ -55,4 +55,11 @@ T prevKeyframeObj(unsigned int index, const std::vector<T>& keyframeContainer) {
}
}
template <typename T>
T readFromPlayback(std::ifstream& stream) {
T res;
stream.read(reinterpret_cast<char*>(&res), sizeof(T));
return res;
}
} // namespace openspace::interaction

View File

@@ -0,0 +1,68 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___CONVERTRECFORMATTASK___H__
#define __OPENSPACE_CORE___CONVERTRECFORMATTASK___H__
#include <openspace/util/task.h>
#include <openspace/interaction/sessionrecording.h>
#include <ghoul/glm.h>
#include <string>
namespace openspace::interaction {
class ConvertRecFormatTask : public Task {
public:
enum class ConversionDirection {
ToAscii = 0,
ToBinary
};
ConvertRecFormatTask(const ghoul::Dictionary& dictionary);
~ConvertRecFormatTask();
std::string description() override;
void perform(const Task::ProgressCallback& progressCallback) override;
static documentation::Documentation documentation();
void convert();
private:
void convertToAscii();
void convertToBinary();
void determineFormatType();
std::string addFileSuffix(const std::string& filePath, const std::string& suffix);
std::string _inFilePath;
std::string _outFilePath;
std::ifstream _iFile;
std::ofstream _oFile;
SessionRecording::DataMode _fileFormatType;
std::string _valueFunctionLua;
};
} // namespace openspace::interaction
#endif //__OPENSPACE_CORE___CONVERTRECFORMATTASK___H__

View File

@@ -26,10 +26,13 @@
#define __OPENSPACE_CORE___MESSAGESTRUCTURES___H__
#include <ghoul/glm.h>
#include <algorithm>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <fstream>
namespace openspace::datamessagestructures {
@@ -167,6 +170,26 @@ struct CameraKeyframe {
out.write(reinterpret_cast<const char*>(&_timestamp), sizeof(_timestamp));
};
void write(std::stringstream& out) const {
// Add camera position
out << std::fixed << std::setprecision(7) << _position.x << ' '
<< std::fixed << std::setprecision(7) << _position.y << ' '
<< std::fixed << std::setprecision(7) << _position.z << ' ';
// Add camera rotation
out << std::fixed << std::setprecision(7) << _rotation.x << ' '
<< std::fixed << std::setprecision(7) << _rotation.y << ' '
<< std::fixed << std::setprecision(7) << _rotation.z << ' '
<< std::fixed << std::setprecision(7) << _rotation.w << ' ';
out << std::scientific << _scale << ' ';
if (_followNodeRotation) {
out << "F ";
}
else {
out << "- ";
}
out << _focusNode;
};
void read(std::istream* in) {
// Read position
in->read(reinterpret_cast<char*>(&_position), sizeof(_position));
@@ -194,6 +217,22 @@ struct CameraKeyframe {
// Read timestamp
in->read(reinterpret_cast<char*>(&_timestamp), sizeof(_timestamp));
};
void read(std::istringstream& iss) {
std::string rotationFollowing;
iss >> _position.x
>> _position.y
>> _position.z
>> _rotation.x
>> _rotation.y
>> _rotation.z
>> _rotation.w
>> _scale
>> rotationFollowing
>> _focusNode;
_followNodeRotation = (rotationFollowing == "F");
};
};
struct TimeKeyframe {
@@ -226,9 +265,35 @@ struct TimeKeyframe {
out->write(reinterpret_cast<const char*>(this), sizeof(TimeKeyframe));
};
void write(std::stringstream& out) const {
out << ' ' << _dt;
if (_paused) {
out << " P";
}
else {
out << " R";
}
if (_requiresTimeJump) {
out << " J";
}
else {
out << " -";
}
};
void read(std::istream* in) {
in->read(reinterpret_cast<char*>(this), sizeof(TimeKeyframe));
};
void read(std::istringstream& iss) {
std::string paused, jump;
iss >> _dt
>> paused
>> jump;
_paused = (paused == "P");
_requiresTimeJump = (jump == "J");
};
};
struct TimeTimeline {
@@ -308,6 +373,12 @@ struct ScriptMessage {
double _timestamp = 0.0;
void serialize(std::vector<char>& buffer) const {
size_t strLen = _script.size();
size_t writeSize_bytes = sizeof(size_t);
unsigned char const *p = reinterpret_cast<unsigned char const*>(&strLen);
buffer.insert(buffer.end(), p, p + writeSize_bytes);
buffer.insert(buffer.end(), _script.begin(), _script.end());
};
@@ -319,6 +390,29 @@ struct ScriptMessage {
out->write(_script.c_str(), _script.size());
};
void write(unsigned char* buf, size_t& idx, std::ofstream& file) const {
size_t strLen = _script.size();
size_t writeSize_bytes = sizeof(size_t);
unsigned char const *p = reinterpret_cast<unsigned char const*>(&strLen);
memcpy((buf + idx), p, writeSize_bytes);
idx += static_cast<unsigned int>(writeSize_bytes);
memcpy((buf + idx), _script.c_str(), _script.size());
idx += static_cast<unsigned int>(strLen);
file.write(reinterpret_cast<char*>(buf), idx);
//Write directly to file because some scripts can be very long
file.write(_script.c_str(), _script.size());
};
void write(std::stringstream& ss) const {
unsigned int numLinesInScript = static_cast<unsigned int>(
std::count(_script.begin(), _script.end(), '\n')
);
ss << ' ' << (numLinesInScript + 1) << ' ';
ss << _script;
}
void read(std::istream* in) {
size_t strLen;
//Read string length from file
@@ -331,6 +425,25 @@ struct ScriptMessage {
_script.erase();
_script = temp.data();
};
void read(std::istringstream& iss) {
int numScriptLines;
iss >> numScriptLines;
if (numScriptLines < 0) {
numScriptLines = 0;
}
std::string tmpReadbackScript;
_script.erase();
for (int i = 0; i < numScriptLines; ++i) {
std::getline(iss, tmpReadbackScript);
size_t start = tmpReadbackScript.find_first_not_of(" ");
tmpReadbackScript = tmpReadbackScript.substr(start);
_script.append(tmpReadbackScript);
if (i < (numScriptLines - 1)) {
_script.append("\n");
}
}
};
};
} // namespace openspace::messagestructures

View File

@@ -29,6 +29,7 @@
#include <openspace/interaction/navigationhandler.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/util/keys.h>
#include <ghoul/misc/exception.h>
#include <optional>
#include <string>
#include <variant>
@@ -40,6 +41,14 @@ namespace scripting { struct LuaLibrary; }
class Profile {
public:
struct ParsingError : public ghoul::RuntimeError {
enum class Severity { Info, Warning, Error };
explicit ParsingError(Severity severity, std::string msg);
Severity severity;
};
// Version
struct Version {
int major = 0;
@@ -47,20 +56,16 @@ public:
};
struct Module {
std::string name;
std::string loadedInstruction;
std::string notLoadedInstruction;
std::optional<std::string> loadedInstruction;
std::optional<std::string> notLoadedInstruction;
};
struct Meta {
std::string name;
std::string version;
std::string description;
std::string author;
std::string url;
std::string license;
};
struct Asset {
std::string path;
std::string name;
std::optional<std::string> name;
std::optional<std::string> version;
std::optional<std::string> description;
std::optional<std::string> author;
std::optional<std::string> url;
std::optional<std::string> license;
};
struct Property {
enum class SetType {
@@ -87,13 +92,13 @@ public:
};
Type type;
std::string time;
std::string value;
};
struct CameraNavState {
static constexpr const char* Type = "setNavigationState";
std::string anchor;
std::string aim;
std::optional<std::string> aim;
std::string referenceFrame;
glm::dvec3 position;
std::optional<glm::dvec3> up;
@@ -109,9 +114,9 @@ public:
std::optional<double> altitude;
};
using CameraType = std::variant<CameraNavState, CameraGoToGeo>;
Profile() = default;
Profile(const std::vector<std::string>& content);
explicit Profile(const std::string& content);
std::string serialize() const;
std::string convertToScene() const;
@@ -147,7 +152,7 @@ private:
Version version = CurrentVersion;
std::vector<Module> modules;
std::optional<Meta> meta;
std::vector<Asset> assets;
std::vector<std::string> assets;
std::vector<Property> properties;
std::vector<Keybinding> keybindings;
std::optional<Time> time;

View File

@@ -27,6 +27,8 @@
namespace openspace::distanceconstants {
constexpr double EarthRadius = 6371;
constexpr double JupiterRadius = 7.1492E7;
constexpr double SolarRadius = 6.95700E8;
constexpr double LightYear = 9.4607304725808E15;
constexpr double LightMonth = LightYear / 12;
constexpr double LightDay = LightYear / 365;

View File

@@ -120,6 +120,7 @@ public:
void removeDeltaTimeChangeCallback(CallbackHandle handle);
void removeDeltaTimeStepsChangeCallback(CallbackHandle handle);
void triggerPlaybackStart();
void stopPlayback();
void removeTimeJumpCallback(CallbackHandle handle);
void removeTimelineChangeCallback(CallbackHandle handle);

View File

@@ -206,12 +206,6 @@ documentation::Documentation RenderableLabels::Documentation() {
Optional::Yes,
LabelColorInfo.description,
},
{
LabelColorInfo.identifier,
new DoubleVector4Verifier,
Optional::Yes,
LabelColorInfo.description,
},
{
LabelTextInfo.identifier,
new StringVerifier,
@@ -397,7 +391,7 @@ RenderableLabels::RenderableLabels(const ghoul::Dictionary& dictionary)
_labelColor.setViewOption(properties::Property::ViewOptions::Color);
if (dictionary.hasKey(LabelColorInfo.identifier)) {
_labelColor = dictionary.value<glm::vec4>(LabelColorInfo.identifier);
_labelColor = dictionary.value<glm::vec3>(LabelColorInfo.identifier);
}
addProperty(_labelColor);

View File

@@ -850,7 +850,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
if (_hasPolygon) {
glBindTexture(GL_TEXTURE_2D, _pTexture);
}
else {
else if (_spriteTexture) {
_spriteTexture->bind();
}
_program->setUniform(_uniformCache.spriteTexture, textureUnit);
@@ -867,7 +867,6 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
global::renderEngine.openglStateCache().resetBlendState();
global::renderEngine.openglStateCache().resetDepthState();
}
void RenderableBillboardsCloud::renderLabels(const RenderData& data,
@@ -902,7 +901,7 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data,
}
glm::vec4 textColor = glm::vec4(
glm::vec3(_textColor),
glm::vec3(_textColor),
_textOpacity * fadeInVariable
);

View File

@@ -0,0 +1,55 @@
##########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2020 #
# #
# 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. #
##########################################################################################
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetshelper.h
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.h
${CMAKE_CURRENT_SOURCE_DIR}/tasks/exoplanetscsvtobintask.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetshelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tasks/exoplanetscsvtobintask.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_vs.glsl
)
source_group("Shader Files" FILES ${SHADER_FILES})
create_new_module(
"Exoplanets"
exoplanets_module
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)

View File

@@ -0,0 +1,127 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include <modules/exoplanets/exoplanetshelper.h>
#include <string_view>
namespace openspace::exoplanets {
std::string_view speckStarName(std::string_view csvName) {
if (csvName == "HD 1237") { return "GJ 3021"; }
if (csvName == "MOA-2009-BLG-387L") { return "MOA 2009-BLG-387L"; }
if (csvName == "HD 126614 A") { return "HD 126614"; }
if (csvName == "epsilon Ret") { return "HD 27442"; }
if (csvName == "PH-1") { return "PH1"; }
if (csvName == "gamma Leo A") { return "gam 1 Leo"; }
if (csvName == "OGLE-2007-BLG-368L") { return "OGLE 2007-BLG-368L"; }
if (csvName == "alpha Ari") { return "alf Ari"; }
if (csvName == "mu Ara") { return "HD 160691"; }
if (csvName == "OGLE-05-169L") { return "OGLE 2005-BLG-169L"; }
if (csvName == "tau Gru") { return "HD 216435"; }
if (csvName == "iota Hor") { return "HR 810"; }
if (csvName == "OGLE-05-071L") { return "OGLE 2005-BLG-71L"; }
if (csvName == "OGLE235-MOA53") { return "OGLE 2003-BLG-235L"; }
if (csvName == "MOA-2008-BLG-310L") { return "MOA 2008-BLG-310L"; }
if (csvName == "KIC 11442793") { return "KOI-351"; }
if (csvName == "OGLE-2006-BLG-109L") { return "OGLE 2006-BLG-109L"; }
if (csvName == "HD 137388") { return "HD 137388 A"; }
if (csvName == "kappa CrB") { return "kap CrB"; }
if (csvName == "XO-2") { return "XO-2 N"; }
if (csvName == "epsilon Tau") { return "eps Tau"; }
if (csvName == "epsilon Eri") { return "eps Eri"; }
if (csvName == "Kepler-448") { return "KOI-12"; }
if (csvName == "omega Ser") { return "ome Ser"; }
if (csvName == "MOA-2010-BLG-477L") { return "MOA 2010-BLG-477L"; }
if (csvName == "GJ 176") { return "HD 285968"; }
if (csvName == "HIP 2247") { return "BD-17 63"; }
if (csvName == "MOA-2009-BLG-266L") { return "MOA 2009-BLG-266L"; }
if (csvName == "Kepler-89") { return "KOI-94"; }
if (csvName == "iota Dra") { return "HIP 75458"; }
if (csvName == "MOA-2007-BLG-400L") { return "MOA 2007-BLG-400L"; }
if (csvName == "upsilon And") { return "ups And"; }
if (csvName == "OGLE-2011-BLG-0251") { return "OGLE 2011-BLG-251L"; }
if (csvName == "OGLE-05-390L") { return "OGLE 2005-BLG-390L"; }
if (csvName == "Kepler-420") { return "KOI-1257"; }
if (csvName == "beta Pic") { return "bet Pic"; }
if (csvName == "gamma Cep") { return "gam Cep"; }
if (csvName == "MOA-2007-BLG-192L") { return "MOA 2007-BLG-192L"; }
if (csvName == "MOA-2009-BLG-319L") { return "MOA 2009-BLG-319L"; }
if (csvName == "omicron CrB") { return "omi CrB"; }
if (csvName == "beta Gem") { return "HD 62509"; }
if (csvName == "epsilon CrB") { return "eps CrB"; }
if (csvName == "omicron UMa") { return "omi UMa"; }
if (csvName == "HD 142022") { return "HD 142022 A"; }
return csvName;
}
std::string_view csvStarName(std::string_view name) {
if (name == "GJ 3021") { return "HD 1237"; }
if (name == "MOA 2009-BLG-387L") { return "MOA-2009-BLG-387L"; }
if (name == "HD 126614") { return "HD 126614 A"; }
if (name == "HD 27442") { return "epsilon Ret"; }
if (name == "PH1") { return "PH-1"; }
if (name == "gam 1 Leo") { return "gamma Leo A"; }
if (name == "OGLE 2007-BLG-368L") { return "OGLE-2007-BLG-368L"; }
if (name == "alf Ari") { return "alpha Ari"; }
if (name == "HD 160691") { return "mu Ara"; }
if (name == "OGLE 2005-BLG-169L") { return "OGLE-05-169L"; }
if (name == "HD 216435") { return "tau Gru"; }
if (name == "HR 810") { return "iota Hor"; }
if (name == "OGLE 2005-BLG-71L") { return "OGLE-05-071L"; }
if (name == "OGLE 2003-BLG-235L") { return "OGLE235-MOA53"; }
if (name == "MOA 2008-BLG-310L") { return "MOA-2008-BLG-310L"; }
if (name == "KOI-351") { return "KIC 11442793"; }
if (name == "OGLE 2006-BLG-109L") { return "OGLE-2006-BLG-109L"; }
if (name == "HD 137388 A") { return "HD 137388"; }
if (name == "kap CrB") { return "kappa CrB"; }
if (name == "XO-2 N") { return "XO-2"; }
if (name == "eps Tau") { return "epsilon Tau"; }
if (name == "eps Eri") { return "epsilon Eri"; }
if (name == "KOI-12") { return "Kepler-448"; }
if (name == "ome Ser") { return "omega Ser"; }
if (name == "MOA 2010-BLG-477L") { return "MOA-2010-BLG-477L"; }
if (name == "HD 285968") { return "GJ 176"; }
if (name == "BD-17 63") { return "HIP 2247"; }
if (name == "MOA 2009-BLG-266L") { return "MOA-2009-BLG-266L"; }
if (name == "KOI-94") { return "Kepler-89"; }
if (name == "HIP 75458") { return "iota Dra"; }
if (name == "MOA 2007-BLG-400L") { return "MOA-2007-BLG-400L"; }
if (name == "ups And") { return "upsilon And"; }
if (name == "OGLE 2011-BLG-251L") { return "OGLE-2011-BLG-0251"; }
if (name == "OGLE 2005-BLG-390L") { return "OGLE-05-390L"; }
if (name == "KOI-1257") { return "Kepler-420"; }
if (name == "bet Pic") { return "beta Pic"; }
if (name == "gam Cep") { return "gamma Cep"; }
if (name == "MOA 2007-BLG-192L") { return "MOA-2007-BLG-192L"; }
if (name == "MOA 2009-BLG-319L") { return "MOA-2009-BLG-319L"; }
if (name == "omi CrB") { return "omicron CrB"; }
if (name == "HD 62509") { return "beta Gem"; }
if (name == "eps CrB") { return "epsilon CrB"; }
if (name == "omi UMa") { return "omicron UMa"; }
if (name == "HD 142022 A") { return "HD 142022"; }
return name;
}
} // namespace openspace::exoplanets

View File

@@ -0,0 +1,85 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_EXOPLANETS___EXOPLANET_HELPER___H__
#define __OPENSPACE_MODULE_EXOPLANETS___EXOPLANET_HELPER___H__
#include <string>
namespace openspace::exoplanets {
struct Exoplanet {
float a; // Orbital semi-major axis in AU
double aUpper; // Upper uncertainty of orbital semi-major axis
double aLower; // Lower uncertainty of orbital semi-major axis
double ua; // Uncertainty of orbital semi-major axis
float bigOm; // Longitude of ascending node in degrees
float bigOmUpper; // Upper uncertainty of longitude of ascending node
float bigOmLower; // Lower uncertainty of longitude of ascending node
float uBigOm; // Uncertainty of longitude of ascending node
bool binary; // Star known to be binary?
float bmv; // B V color
float ecc; // Orbital eccentricity
float eccUpper; // Upper uncertainty of orbital eccentricity
float eccLower; // Lower uncertainty of orbital eccentricity
float uEcc; // Uncertainty of orbital eccentricity
float i; // Orbital inclination in degrees (for transiting systems only)
float iUpper; // Upper uncertainty of orbital inclination
float iLower; // Lower uncertainty of orbital inclination
float ui; // Uncertainty of orbital inclination
int nComp; // Number of planetary companions known
float om; // Argument of periastron in degrees
float omUpper; // Upper uncertainty of argument of periastron
float omLower; // Lower uncertainty of argument of periastron
float uOm; // Uncertainty of argument of periastron
double per; // Orbital period in days
float perUpper; // Upper uncertainty of period
float perLower; // Lower uncertainty of period
float uPer; // Uncertainty of period
double r; // Radius of the planet in Jupiter radii
double rUpper; // Upper uncertainty of radius of the planet
double rLower; // Lower uncertainty of radius of the planet
double ur; // Uncertainty of radius of the planet
float rStar; // Estimated radius of the star in solar radii
float rStarUpper; // Upper uncertainty of estimated star radius
float rStarLower; // Lower uncertainty of estimated star radius
float urStar; // Uncertainty of estimated star radius
double tt; // Epoch of transit center in HJD-2440000
float ttUpper; // Upper uncertainty of epoch of transit center
float ttLower; // Lower uncertainty of epoch of transit center
float uTt; // Uncertainty of epoch of transit center
float positionX; // Star position's X-coordinate in parsec
float positionY; // Star position's Y-coordinate in parsec
float positionZ; // Star position's Z-coordinate in parsec
};
// Convert csv-file specific names to the corresponding name in the speck data file
std::string_view speckStarName(std::string_view name);
// Convert speck-file specific names to the corresponding name in the csv data file
std::string_view csvStarName(std::string_view name);
} // namespace openspace::exoplanets
#endif // __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSMODULE___H__

View File

@@ -0,0 +1,93 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include <modules/exoplanets/exoplanetsmodule.h>
#include <modules/exoplanets/rendering/renderableorbitdisc.h>
#include <modules/exoplanets/tasks/exoplanetscsvtobintask.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/globalscallbacks.h>
#include <openspace/interaction/navigationhandler.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scene/scene.h>
#include <openspace/util/factorymanager.h>
#include <thread>
#include <chrono>
#include "exoplanetsmodule_lua.inl"
namespace openspace {
using namespace exoplanets;
ExoplanetsModule::ExoplanetsModule() : OpenSpaceModule(Name) {}
scripting::LuaLibrary ExoplanetsModule::luaLibrary() const {
scripting::LuaLibrary res;
res.name = "exoplanets";
res.functions = {
{
"addExoplanetSystem",
&exoplanets::luascriptfunctions::addExoplanetSystem,
{},
"string",
"Add the exoplanet system specified by the input string, including "
"information about the host star and planets."
},
{
"removeExoplanetSystem",
&exoplanets::luascriptfunctions::removeExoplanetSystem,
{},
"string",
"Removes the nodes of the specified exoplanet system from the scene graph."
},
{
"listAvailableExoplanetSystems",
&exoplanets::luascriptfunctions::listAvailableExoplanetSystems,
{},
"",
"Prints a list with the names of all exoplanet systems that can be added to "
"the scene graph to the OpenSpace Log. "
}
};
return res;
}
void ExoplanetsModule::internalInitialize(const ghoul::Dictionary&) {
auto fTask = FactoryManager::ref().factory<Task>();
auto fRenderable = FactoryManager::ref().factory<Renderable>();
ghoul_assert(fTask, "No task factory existed");
fTask->registerClass<ExoplanetsCsvToBinTask>("ExoplanetsCsvToBinTask");
fRenderable->registerClass<RenderableOrbitDisc>("RenderableOrbitDisc");
}
std::vector<documentation::Documentation> ExoplanetsModule::documentations() const {
return {
ExoplanetsCsvToBinTask::documentation()
};
}
} // namespace openspace

View File

@@ -0,0 +1,50 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSMODULE___H__
#define __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSMODULE___H__
#include <openspace/util/openspacemodule.h>
#include <openspace/documentation/documentation.h>
namespace openspace {
class ExoplanetsModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "Exoplanets";
ExoplanetsModule();
virtual ~ExoplanetsModule() = default;
scripting::LuaLibrary luaLibrary() const override;
std::vector<documentation::Documentation> documentations() const override;
protected:
void internalInitialize(const ghoul::Dictionary&) override;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSMODULE___H__

View File

@@ -0,0 +1,562 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include <modules/exoplanets/exoplanetshelper.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/query/query.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/util/distanceconstants.h>
#include <openspace/util/spicemanager.h>
#include <openspace/util/timeconversion.h>
#include <openspace/util/timemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/fmt.h>
#include <ghoul/glm.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/assert.h>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/transform.hpp>
#include <cfloat>
#include <cmath>
#include <fstream>
#include <iostream>
#include <sstream>
namespace {
constexpr const char* _loggerCat = "ExoplanetsModule";
} // namespace
namespace openspace::exoplanets::luascriptfunctions {
constexpr const char* ExoplanetsGuiPath = "/Milky Way/Exoplanets/Exoplanet Systems/";
constexpr const char* LookUpTablePath = "${SYNC}/http/exoplanets_data/1/lookup.txt";
constexpr const char* ExoplanetsDataPath =
"${SYNC}/http/exoplanets_data/1/exoplanets_data.bin";
constexpr const char* StarTextureFile = "${SYNC}/http/exoplanets_textures/1/sun.jpg";
constexpr const char* DiscTextureFile =
"${SYNC}/http/exoplanets_textures/1/disc_texture.png";
constexpr const char* BvColormapPath = "${SYNC}/http/stars_colormap/2/colorbv.cmap";
std::string starColor(float bv, std::ifstream& colormap) {
const int t = static_cast<int>(round(((bv + 0.4) / (2.0 + 0.4)) * 255));
std::string color;
for (int i = 0; i < t + 12; i++) {
getline(colormap, color);
}
colormap.close();
std::istringstream colorStream(color);
std::string r, g, b;
getline(colorStream, r, ' ');
getline(colorStream, g, ' ');
getline(colorStream, b, ' ');
return fmt::format("{{ {}, {}, {} }}", r, g, b);
}
glm::dmat4 computeOrbitPlaneRotationMatrix(float i, float bigom, float om) {
// Exoplanet defined inclination changed to be used as Kepler defined inclination
const glm::dvec3 ascendingNodeAxisRot = glm::dvec3(0.0, 0.0, 1.0);
const glm::dvec3 inclinationAxisRot = glm::dvec3(1.0, 0.0, 0.0);
const glm::dvec3 argPeriapsisAxisRot = glm::dvec3(0.0, 0.0, 1.0);
const double asc = glm::radians(bigom);
const double inc = glm::radians(i);
const double per = glm::radians(om);
const glm::dmat4 orbitPlaneRotation =
glm::rotate(asc, glm::dvec3(ascendingNodeAxisRot)) *
glm::rotate(inc, glm::dvec3(inclinationAxisRot)) *
glm::rotate(per, glm::dvec3(argPeriapsisAxisRot));
return orbitPlaneRotation;
}
// Rotate the original coordinate system (where x is pointing to First Point of Aries)
// so that x is pointing from star to the sun.
// Modified from "http://www.opengl-tutorial.org/intermediate-tutorials/
// tutorial-17-quaternions/ #how-do-i-find-the-rotation-between-2-vectors"
glm::dmat3 exoplanetSystemRotation(glm::dvec3 start, glm::dvec3 end) {
glm::quat rotationQuat;
glm::dvec3 rotationAxis;
const float cosTheta = static_cast<float>(glm::dot(start, end));
constexpr float Epsilon = 1E-3f;
if (cosTheta < -1.f + Epsilon) {
// special case when vectors in opposite directions:
// there is no "ideal" rotation axis
// So guess one; any will do as long as it's perpendicular to start vector
rotationAxis = glm::cross(glm::dvec3(0.0, 0.0, 1.0), start);
if (length2(rotationAxis) < 0.01f) {
// bad luck, they were parallel, try again!
rotationAxis = glm::cross(glm::dvec3(1.0, 0.0, 0.0), start);
}
rotationAxis = glm::normalize(rotationAxis);
rotationQuat = glm::quat(glm::radians(180.f), rotationAxis);
return glm::dmat3(toMat4(rotationQuat));
}
rotationAxis = glm::cross(start, end);
const float s = sqrt((1.f + cosTheta) * 2.f);
const float invs = 1.f / s;
rotationQuat = glm::quat(
s * 0.5f,
rotationAxis.x * invs,
rotationAxis.y * invs,
rotationAxis.z * invs
);
return glm::dmat3(glm::toMat4(rotationQuat));
}
// Create an identifier without whitespaces
std::string createIdentifier(std::string name) {
std::replace(name.begin(), name.end(), ' ', '_');
return name;
}
int addExoplanetSystem(lua_State* L) {
const int StringLocation = -1;
const std::string starName = luaL_checkstring(L, StringLocation);
// If user have given name as in EOD, change it to speck-name
const std::string starNameSpeck = std::string(speckStarName(starName));
const std::string starIdentifier = createIdentifier(starNameSpeck);
const std::string guiPath = ExoplanetsGuiPath + starNameSpeck;
SceneGraphNode* existingStarNode = sceneGraphNode(starIdentifier);
if (existingStarNode) {
return ghoul::lua::luaError(
L,
"Adding of exoplanet system failed. The system has already been added."
);
}
std::ifstream data(absPath(ExoplanetsDataPath), std::ios::in | std::ios::binary);
if (!data.good()) {
return ghoul::lua::luaError(L, "Failed to open exoplanets data file");
}
std::ifstream lut(absPath(LookUpTablePath));
if (!lut.good()) {
return ghoul::lua::luaError(L, "Failed to open exoplanets look-up table file");
}
// 1. search lut for the starname and return the corresponding location
// 2. go to that location in the data file
// 3. read sizeof(exoplanet) bytes into an exoplanet object.
Exoplanet p;
std::string line;
bool found = false;
std::vector<Exoplanet> planetSystem;
std::vector<std::string> planetNames;
while (getline(lut, line)) {
std::istringstream ss(line);
std::string name;
getline(ss, name, ',');
if (name.compare(0, name.length() - 2, starNameSpeck) == 0) {
std::string location_s;
getline(ss, location_s);
long location = std::stol(location_s.c_str());
data.seekg(location);
data.read(reinterpret_cast<char*>(&p), sizeof(Exoplanet));
planetNames.push_back(name);
planetSystem.push_back(p);
found = true;
}
}
data.close();
lut.close();
if (!found) {
return ghoul::lua::luaError(
L,
"No star with the provided name was found."
);
}
bool notEnoughData = std::isnan(p.positionX) || std::isnan(p.a) || std::isnan(p.per);
if (notEnoughData) {
return ghoul::lua::luaError(
L,
"Insufficient data available for representing the exoplanet system."
);
}
const glm::dvec3 starPosition = glm::dvec3(
p.positionX * distanceconstants::Parsec,
p.positionY * distanceconstants::Parsec,
p.positionZ * distanceconstants::Parsec
);
const glm::dvec3 sunPosition = glm::dvec3(0.0, 0.0, 0.0);
const glm::dvec3 starToSunVec = glm::normalize(sunPosition - starPosition);
const glm::dvec3 galacticNorth = glm::dvec3(0.0, 0.0, 1.0);
const glm::dmat3 galaxticToCelestialMatrix =
SpiceManager::ref().positionTransformMatrix("GALACTIC", "J2000", 0.0);
const glm::dvec3 celestialNorth = glm::normalize(
galaxticToCelestialMatrix * galacticNorth
);
// Earth's north vector projected onto the skyplane, the plane perpendicular to the
// viewing vector (starToSunVec)
const float celestialAngle = static_cast<float>(glm::dot(
celestialNorth,
starToSunVec
));
glm::dvec3 northProjected = glm::normalize(
celestialNorth - (celestialAngle / glm::length(starToSunVec)) * starToSunVec
);
const glm::dvec3 beta = glm::normalize(glm::cross(starToSunVec, northProjected));
const glm::dmat3 exoplanetSystemRotation = glm::dmat3(
northProjected.x,
northProjected.y,
northProjected.z,
beta.x,
beta.y,
beta.z,
starToSunVec.x,
starToSunVec.y,
starToSunVec.z
);
// Star renderable globe, if we have a radius
std::string starGlobeRenderableString;
const float starRadius = p.rStar;
if (!std::isnan(starRadius)) {
std::ifstream colorMap(absPath(BvColormapPath), std::ios::in);
if (!colorMap.good()) {
return ghoul::lua::luaError(L, "Failed to open colormap data file");
}
const std::string color = starColor(p.bmv, colorMap);
const float radiusInMeter = starRadius * static_cast<float>(distanceconstants::SolarRadius);
starGlobeRenderableString = "Renderable = {"
"Type = 'RenderableGlobe',"
"Radii = " + std::to_string(radiusInMeter) + ","
"SegmentsPerPatch = 64,"
"PerformShading = false,"
"Layers = {"
"ColorLayers = {"
"{"
"Identifier = 'StarColor',"
"Type = 'SolidColor',"
"Color = " + color + ","
"BlendMode = 'Normal',"
"Enabled = true"
"},"
"{"
"Identifier = 'StarTexture',"
"FilePath = openspace.absPath('" + StarTextureFile +"'),"
"BlendMode = 'Color',"
"Enabled = true"
"}"
"}"
"}"
"},";
}
const std::string starParent = "{"
"Identifier = '" + starIdentifier + "',"
"Parent = 'SolarSystemBarycenter',"
"" + starGlobeRenderableString + ""
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(exoplanetSystemRotation) + ""
"},"
"Translation = {"
"Type = 'StaticTranslation',"
"Position = " + ghoul::to_string(starPosition) + ""
"}"
"},"
"GUI = {"
"Name = '" + starNameSpeck + " (Star)',"
"Path = '" + guiPath + "'"
"}"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + starParent + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
// Planets
for (size_t i = 0; i < planetSystem.size(); i++) {
Exoplanet planet = planetSystem[i];
const std::string planetName = planetNames[i];
if (std::isnan(planet.ecc)) {
planet.ecc = 0.f;
}
if (std::isnan(planet.i)) {
planet.i = 90.f;
}
if (std::isnan(planet.bigOm)) {
planet.bigOm = 180.f;
}
if (std::isnan(planet.om)) {
planet.om = 90.f;
}
Time epoch;
std::string sEpoch;
if (!std::isnan(planet.tt)) {
epoch.setTime("JD " + std::to_string(planet.tt));
sEpoch = std::string(epoch.ISO8601());
}
else {
sEpoch = "2009-05-19T07:11:34.080";
}
float planetRadius;
std::string enabled;
const float astronomicalUnit = static_cast<float>(distanceconstants::AstronomicalUnit);
const float solarRadius = static_cast<float>(distanceconstants::SolarRadius);
const float jupiterRadius = static_cast<float>(distanceconstants::JupiterRadius);
if (std::isnan(planet.r)) {
if (std::isnan(planet.rStar)) {
planetRadius = planet.a * 0.001f * astronomicalUnit;
}
else {
planetRadius = planet.rStar * 0.1f * solarRadius;
}
enabled = "false";
}
else {
planetRadius = static_cast<float>(planet.r) * jupiterRadius;
enabled = "true";
}
const float period = static_cast<float>(planet.per * SecondsPerDay);
const float semiMajorAxisInMeter = planet.a * astronomicalUnit;
const float semiMajorAxisInKm = semiMajorAxisInMeter * 0.001f;
const std::string planetIdentifier = createIdentifier(planetName);
const std::string planetKeplerTranslation = "{"
"Type = 'KeplerTranslation',"
"Eccentricity = " + std::to_string(planet.ecc) + "," //ECC
"SemiMajorAxis = " + std::to_string(semiMajorAxisInKm) + ","
"Inclination = " + std::to_string(planet.i) + "," //I
"AscendingNode = " + std::to_string(planet.bigOm) + "," //BIGOM
"ArgumentOfPeriapsis = " + std::to_string(planet.om) + "," //OM
"MeanAnomaly = 0.0,"
"Epoch = '" + sEpoch + "'," //TT. JD to YYYY MM DD hh:mm:ss
"Period = " + std::to_string(period) + ""
"}";
const std::string planetNode = "{"
"Identifier = '" + planetIdentifier + "',"
"Parent = '" + starIdentifier + "',"
"Enabled = true,"
"Renderable = {"
"Type = 'RenderableGlobe',"
"Enabled = " + enabled + ","
"Radii = " + std::to_string(planetRadius) + "," //R. in meters.
"SegmentsPerPatch = 64,"
"PerformShading = false,"
"Layers = {}"
"},"
"Transform = { "
"Translation = " + planetKeplerTranslation + ""
"},"
"GUI = {"
"Name = '" + planetName + "',"
"Path = '" + guiPath + "'"
"}"
"}";
int trailResolution = 1000;
// increase the resolution for highly eccentric orbits
const float eccentricityThreshold = 0.85f;
if (planet.ecc > eccentricityThreshold) {
trailResolution *= 2;
}
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + planetNode + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
const std::string planetTrailNode = "{"
"Identifier = '" + planetIdentifier + "_Trail',"
"Parent = '" + starIdentifier + "',"
"Enabled = true,"
"Renderable = {"
"Type = 'RenderableTrailOrbit',"
"Period = " + std::to_string(planet.per) + ","
"Resolution = " + std::to_string(trailResolution) + ","
"Translation = " + planetKeplerTranslation + ","
"Color = { 1, 1, 1 }"
"},"
"GUI = {"
"Name = '" + planetName + " Trail',"
"Path = '" + guiPath + "'"
"}"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + planetTrailNode + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
bool hasUpperAUncertainty = !std::isnan(planet.aUpper);
bool hasLowerAUncertainty = !std::isnan(planet.aLower);
if (hasUpperAUncertainty && hasLowerAUncertainty) {
// Get the orbit plane of the planet trail orbit from the KeplerTranslation
const glm::dmat4 orbitPlaneRotationMatrix = computeOrbitPlaneRotationMatrix(
planet.i,
planet.bigOm,
planet.om
);
const glm::dmat3 rotation = orbitPlaneRotationMatrix;
const std::string discNode = "{"
"Identifier = '" + planetIdentifier + "_Disc',"
"Parent = '" + starIdentifier + "',"
"Enabled = true,"
"Renderable = {"
"Type = 'RenderableOrbitDisc',"
"Texture = openspace.absPath('" + DiscTextureFile + "'),"
"Size = " + std::to_string(semiMajorAxisInMeter) + ","
"Eccentricity = " + std::to_string(planet.ecc) + ","
"Offset = { " +
std::to_string(planet.aLower) + ", " +
std::to_string(planet.aUpper) +
"}," //min / max extend
"Opacity = 0.3"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(rotation) + ""
"}"
"},"
"GUI = {"
"Name = '" + planetName + " Disc',"
"Path = '" + guiPath + "'"
"}"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + discNode + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
}
}
return 0;
}
int removeExoplanetSystem(lua_State* L) {
const int StringLocation = -1;
const std::string starName = luaL_checkstring(L, StringLocation);
const std::string starNameSpeck = std::string(speckStarName(starName));
const std::string starIdentifier = createIdentifier(starNameSpeck);
openspace::global::scriptEngine.queueScript(
"openspace.removeSceneGraphNode('" + starIdentifier + "');",
scripting::ScriptEngine::RemoteScripting::Yes
);
return 0;
}
int listAvailableExoplanetSystems(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::listAvailableExoplanetSystems");
std::ifstream file(absPath(LookUpTablePath));
if (!file.good()) {
return ghoul::lua::luaError(
L,
fmt::format("Failed to open file '{}'", LookUpTablePath)
);
}
std::vector<std::string> names;
// As of 2020 there are about 4000 confirmed exoplanets, so use this number
// as a guess for the vector size
const int nExoplanetsGuess = 4000;
names.reserve(nExoplanetsGuess);
std::string line;
while (getline(file, line)) {
std::stringstream ss(line);
std::string name;
getline(ss, name, ',');
// Remove the last two characters, that specify the planet
name = name.substr(0, name.size() - 2);
names.push_back(name);
}
// For easier read, sort by names and remove duplicates
std::sort(names.begin(), names.end());
names.erase(std::unique(names.begin(), names.end()), names.end());
std::string output;
for (auto it = names.begin(); it != names.end(); ++it) {
if (it != names.end()) {
output += *it + ", ";
}
}
LINFO(fmt::format(
"There is data available for the following {} exoplanet systems: {}",
names.size(),
output
));
return 0;
}
} //namespace openspace::exoplanets::luascriptfunctions

View File

@@ -0,0 +1 @@
set(DEFAULT_MODULE ON)

View File

@@ -0,0 +1,325 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include <modules/exoplanets/rendering/renderableorbitdisc.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scene/scene.h>
#include <openspace/util/distanceconstants.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/openglstatecache.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
namespace {
static const openspace::properties::Property::PropertyInfo TextureInfo = {
"Texture",
"Texture",
"This value is the path to a texture on disk that contains a one-dimensional "
"texture which is used for these rings."
};
static const openspace::properties::Property::PropertyInfo SizeInfo = {
"Size",
"Size",
"This value specifies the semi-major axis of the orbit in meter."
};
static const openspace::properties::Property::PropertyInfo EccentricityInfo = {
"Eccentricity",
"Eccentricity",
"This value determines the eccentricity, that is the deviation from a perfect "
"sphere, for this orbit."
};
static const openspace::properties::Property::PropertyInfo OffsetInfo = {
"Offset",
"Offset",
"This value is used to limit the width of the rings. Each of the two values is "
"the lower and the upper uncertainties of the semi-major axis. "
};
} // namespace
namespace openspace {
documentation::Documentation RenderableOrbitDisc::Documentation() {
using namespace documentation;
return {
"Renderable Orbit Disc",
"exoplanets_renderable_orbit_disc",
{
{
"Type",
new StringEqualVerifier("RenderableOrbitDisc"),
Optional::No
},
{
TextureInfo.identifier,
new StringVerifier,
Optional::No,
TextureInfo.description
},
{
SizeInfo.identifier,
new DoubleVerifier,
Optional::No,
SizeInfo.description
},
{
EccentricityInfo.identifier,
new DoubleVerifier,
Optional::No,
EccentricityInfo.description
},
{
OffsetInfo.identifier,
new DoubleVector2Verifier,
Optional::Yes,
OffsetInfo.description
}
}
};
}
RenderableOrbitDisc::RenderableOrbitDisc(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _texturePath(TextureInfo)
, _size(SizeInfo, 1.f, 0.f, 3.0e12f)
, _eccentricity(EccentricityInfo, 0.f, 0.f, 1.f)
, _offset(OffsetInfo, glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(1.f))
{
using ghoul::filesystem::File;
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableOrbitDisc"
);
if (dictionary.hasKey(OffsetInfo.identifier)) {
_offset = dictionary.value<glm::vec2>(OffsetInfo.identifier);
}
addProperty(_offset);
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
_size = _size + (_offset.value().y * distanceconstants::AstronomicalUnit);
setBoundingSphere(_size);
_size.onChange([&]() { _planeIsDirty = true; });
addProperty(_size);
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
_textureFile = std::make_unique<File>(_texturePath);
_texturePath.onChange([&]() { _textureIsDirty = true; });
addProperty(_texturePath);
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
_eccentricity = static_cast<float>(
dictionary.value<double>(EccentricityInfo.identifier)
);
_eccentricity.onChange([&]() { _planeIsDirty = true; });
addProperty(_eccentricity);
addProperty(_opacity);
}
bool RenderableOrbitDisc::isReady() const {
return _shader && _texture;
}
void RenderableOrbitDisc::initializeGL() {
_shader = global::renderEngine.buildRenderProgram(
"OrbitdiscProgram",
absPath("${BASE}/modules/exoplanets/shaders/orbitdisc_vs.glsl"),
absPath("${BASE}/modules/exoplanets/shaders/orbitdisc_fs.glsl")
);
_uniformCache.modelViewProjection = _shader->uniformLocation(
"modelViewProjectionTransform"
);
_uniformCache.textureOffset = _shader->uniformLocation("textureOffset");
_uniformCache.opacity = _shader->uniformLocation("opacity");
_uniformCache.texture = _shader->uniformLocation("discTexture");
_uniformCache.eccentricity = _shader->uniformLocation("eccentricity");
_uniformCache.semiMajorAxis = _shader->uniformLocation("semiMajorAxis");
glGenVertexArrays(1, &_quad);
glGenBuffers(1, &_vertexPositionBuffer);
createPlane();
loadTexture();
}
void RenderableOrbitDisc::deinitializeGL() {
glDeleteVertexArrays(1, &_quad);
_quad = 0;
glDeleteBuffers(1, &_vertexPositionBuffer);
_vertexPositionBuffer = 0;
_textureFile = nullptr;
_texture = nullptr;
global::renderEngine.removeRenderProgram(_shader.get());
_shader = nullptr;
}
void RenderableOrbitDisc::render(const RenderData& data, RendererTasks&) {
_shader->activate();
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
_shader->setUniform(
_uniformCache.modelViewProjection,
data.camera.projectionMatrix() * glm::mat4(modelViewTransform)
);
_shader->setUniform(_uniformCache.textureOffset, _offset);
_shader->setUniform(_uniformCache.opacity, _opacity);
_shader->setUniform(_uniformCache.eccentricity, _eccentricity);
_shader->setUniform(_uniformCache.semiMajorAxis, _size);
ghoul::opengl::TextureUnit unit;
unit.activate();
_texture->bind();
_shader->setUniform(_uniformCache.texture, unit);
glEnablei(GL_BLEND, 0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
glDisable(GL_CULL_FACE);
glBindVertexArray(_quad);
glDrawArrays(GL_TRIANGLES, 0, 6);
_shader->deactivate();
// Restores GL State
global::renderEngine.openglStateCache().resetBlendState();
global::renderEngine.openglStateCache().resetDepthState();
global::renderEngine.openglStateCache().resetPolygonAndClippingState();
}
void RenderableOrbitDisc::update(const UpdateData& data) {
if (_shader->isDirty()) {
_shader->rebuildFromFile();
_uniformCache.modelViewProjection = _shader->uniformLocation(
"modelViewProjectionTransform"
);
_uniformCache.textureOffset = _shader->uniformLocation("textureOffset");
_uniformCache.opacity = _shader->uniformLocation("opacity");
_uniformCache.texture = _shader->uniformLocation("discTexture");
_uniformCache.eccentricity = _shader->uniformLocation("eccentricity");
_uniformCache.semiMajorAxis = _shader->uniformLocation("semiMajorAxis");
}
if (_planeIsDirty) {
createPlane();
_planeIsDirty = false;
}
if (_textureIsDirty) {
loadTexture();
_textureIsDirty = false;
}
}
void RenderableOrbitDisc::loadTexture() {
if (!_texturePath.value().empty()) {
std::unique_ptr<ghoul::opengl::Texture> texture =
ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
if (texture) {
LDEBUGC(
"RenderableOrbitDisc",
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
_texture = std::move(texture);
_texture->uploadTexture();
_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);
_textureFile->setCallback(
[&](const ghoul::filesystem::File&) { _textureIsDirty = true; }
);
}
}
}
void RenderableOrbitDisc::createPlane() {
const GLfloat size = _size * (1.f + _eccentricity);
struct VertexData {
GLfloat x;
GLfloat y;
GLfloat s;
GLfloat t;
};
VertexData data[] = {
{ -size, -size, 0.f, 0.f },
{ size, size, 1.f, 1.f },
{ -size, size, 0.f, 1.f },
{ -size, -size, 0.f, 0.f },
{ size, -size, 1.f, 0.f },
{ size, size, 1.f, 1.f },
};
glBindVertexArray(_quad);
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(
0,
2,
GL_FLOAT,
GL_FALSE,
sizeof(VertexData),
nullptr
);
glEnableVertexAttribArray(1);
glVertexAttribPointer(
1,
2,
GL_FLOAT,
GL_FALSE,
sizeof(VertexData),
reinterpret_cast<void*>(offsetof(VertexData, s))
);
}
} // namespace openspace

View File

@@ -0,0 +1,82 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEORBITDISC___H__
#define __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEORBITDISC___H__
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/vector/vec2property.h>
#include <openspace/rendering/renderable.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/uniformcache.h>
namespace ghoul::filesystem { class File; }
namespace ghoul::opengl {
class ProgramObject;
} // namespace ghoul::opengl
namespace openspace {
namespace documentation { struct Documentation; }
class RenderableOrbitDisc : public Renderable {
public:
RenderableOrbitDisc(const ghoul::Dictionary& dictionary);
void initializeGL() override;
void deinitializeGL() override;
bool isReady() const override;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void update(const UpdateData& data) override;
static documentation::Documentation Documentation();
private:
void loadTexture();
void createPlane();
properties::StringProperty _texturePath;
properties::FloatProperty _size;
properties::FloatProperty _eccentricity;
properties::Vec2Property _offset;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader = nullptr;
UniformCache(modelViewProjection, textureOffset, opacity,
texture, eccentricity, semiMajorAxis) _uniformCache;
std::unique_ptr<ghoul::opengl::Texture> _texture = nullptr;
std::unique_ptr<ghoul::filesystem::File> _textureFile;
bool _textureIsDirty = false;
bool _planeIsDirty = false;
GLuint _quad = 0;
GLuint _vertexPositionBuffer = 0;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEORBITDISC___H__

View File

@@ -0,0 +1,114 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include "PowerScaling/powerScaling_fs.hglsl"
#include "fragment.glsl"
in vec2 vs_st;
in vec4 vs_position;
uniform sampler1D discTexture;
uniform vec2 textureOffset;
uniform float opacity;
uniform float eccentricity;
uniform float semiMajorAxis;
const float AstronomicalUnit = 149597870700.0; // m
const float Epsilon = 0.0000001;
// Compute semi minor axis from major axis, a, and eccentricity, e
float semiMinorAxis(float a, float e) {
return a * sqrt(1.0 - e * e);
}
// If returned value <= 1, the point is insdie or on the ellipse specified by the input:
// a and b are the semi-major and semi-minor axes, respectively.
// cx is the displacement of the center of the ellipse along the x-axis (for an orbit,
// the y-displacement is always zero)
float ellipseTest(vec2 point, float a, float b, float cx) {
float x = point.x;
float y = point.y;
return (pow(x - cx, 2.0) / (a*a)) + ((y*y) / (b*b));
}
Fragment getFragment() {
// Moving the origin to the center
vec2 st = (vs_st - vec2(0.5)) * 2.0;
float AUpper = semiMajorAxis;
float BUpper = semiMinorAxis(AUpper, eccentricity);
float CUpper = sqrt(AUpper*AUpper - BUpper*BUpper);
float outerApoapsisDistance = AUpper * (1 + eccentricity);
float ALower = AUpper - AstronomicalUnit * (textureOffset.x + textureOffset.y);
float BLower = semiMinorAxis(ALower, eccentricity);
float CLower = sqrt(ALower*ALower - BLower*BLower);
float innerApoapsisDistance = ALower * (1 + eccentricity);
// Normalize based on outer apoapsis distance (size of plane)
float AU_n = AUpper / outerApoapsisDistance;
float BU_n = BUpper / outerApoapsisDistance;
float CU_n = CUpper / outerApoapsisDistance;
float AL_n = ALower / outerApoapsisDistance;
float BL_n = BLower / outerApoapsisDistance;
float CL_n = CLower / outerApoapsisDistance;
if (eccentricity <= Epsilon) {
CU_n = 0.0;
CL_n = 0.0;
}
float outer = ellipseTest(st, AU_n, BU_n, -CU_n);
float inner = ellipseTest(st, AL_n, BL_n, -CL_n);
if (outer > 1.0 || inner < 1.0) {
// point is outside outer ellipse or inside inner eliipse
discard;
}
// Remapping the texture coordinates
vec2 dir = normalize(st);
// Find outer ellipse: where along the direction does the equation == 1?
float denominator = pow(BU_n * dir.x, 2.0) + pow(AU_n * dir.y, 2.0);
float first = -(pow(BU_n, 2.0) * dir.x * CU_n) / denominator;
float second = pow((pow(BU_n, 2.0) * dir.x * CU_n) / denominator, 2.0);
float third = (pow(BU_n * CU_n, 2.0) - pow(AU_n * BU_n, 2.0)) / denominator;
float scale = first + sqrt(second - third);
vec2 max = dir * scale;
vec2 min = max * (innerApoapsisDistance / outerApoapsisDistance);
float distance1 = distance(max, min);
float distance2 = distance(max, st);
float textureCoord = distance2 / distance1;
vec4 diffuse = texture(discTexture, textureCoord);
diffuse.a *= opacity;
Fragment frag;
frag.color = diffuse;
frag.depth = vs_position.w;
return frag;
}

View File

@@ -0,0 +1,44 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#version __CONTEXT__
#include "PowerScaling/powerScaling_vs.hglsl"
layout(location = 0) in vec2 in_position;
layout(location = 1) in vec2 in_st;
out vec2 vs_st;
out vec4 vs_position;
uniform mat4 modelViewProjectionTransform;
void main() {
vs_st = in_st;
vs_position = z_normalization(
modelViewProjectionTransform * vec4(in_position, 0.0, 1.0)
);
gl_Position = vs_position;
}

View File

@@ -0,0 +1,706 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include <modules/exoplanets/tasks/exoplanetscsvtobintask.h>
#include <modules/exoplanets/exoplanetshelper.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/fmt.h>
#include <ghoul/glm.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/dictionary.h>
#include <charconv>
#include <fstream>
namespace {
constexpr const char* KeyInputCsv = "InputCSV";
constexpr const char* KeyInputSpeck = "InputSPECK";
constexpr const char* KeyOutputBin = "OutputBIN";
constexpr const char* KeyOutputLut = "OutputLUT";
constexpr const char* KeyTeffToBv = "TeffToBvFile";
constexpr const char* _loggerCat = "CsvToBinTask";
} // namespace
namespace openspace::exoplanets {
ExoplanetsCsvToBinTask::ExoplanetsCsvToBinTask(const ghoul::Dictionary& dictionary) {
openspace::documentation::testSpecificationAndThrow(
documentation(),
dictionary,
"ExoplanetsCsvToBinTask"
);
_inputCsvPath = absPath(dictionary.value<std::string>(KeyInputCsv));
_inputSpeckPath = absPath(dictionary.value<std::string>(KeyInputSpeck));
_outputBinPath = absPath(dictionary.value<std::string>(KeyOutputBin));
_outputLutPath = absPath(dictionary.value<std::string>(KeyOutputLut));
_teffToBvFilePath = absPath(dictionary.value<std::string>(KeyTeffToBv));
}
std::string ExoplanetsCsvToBinTask::description() {
return fmt::format(
"Extract metadata from csv-file '{}' and write as bin to '{}'",
_inputCsvPath,
_outputBinPath
);
}
void ExoplanetsCsvToBinTask::perform(const Task::ProgressCallback& progressCallback) {
std::ifstream csvFile(_inputCsvPath);
if (!csvFile.good()) {
LERROR(fmt::format("Failed to open CSV file '{}'", _inputCsvPath));
return;
}
std::ofstream binFile(_outputBinPath, std::ios::out | std::ios::binary);
std::ofstream lutFile(_outputLutPath);
int version = 1;
binFile.write(reinterpret_cast<char*>(&version), sizeof(int));
std::string planetRow;
getline(csvFile, planetRow); // The first line, containing the data names
int total = 0;
while (getline(csvFile, planetRow)) {
++total;
}
csvFile.clear();
csvFile.seekg(0);
getline(csvFile, planetRow); // The first line, containing the data names
LINFOC("CSVTOBIN", fmt::format("Loading {} stars", total));
auto readFloatData = [](const std::string& str) -> float {
#ifdef WIN32
float result;
auto [p, ec] = std::from_chars(str.data(), str.data() + str.size(), result);
if (ec == std::errc()) {
return result;
}
return NAN;
#else
// clang is missing float support for std::from_chars
return !str.empty() ? std::stof(str.c_str(), nullptr) : NAN;
#endif
};
auto readDoubleData = [](const std::string& str) -> double {
#ifdef WIN32
double result;
auto [p, ec] = std::from_chars(str.data(), str.data() + str.size(), result);
if (ec == std::errc()) {
return result;
}
return NAN;
#else
// clang is missing double support for std::from_chars
return !str.empty() ? std::stod(str.c_str(), nullptr) : NAN;
#endif
};
auto readIntegerData = [](const std::string& str) -> int {
int result;
auto [p, ec] = std::from_chars(str.data(), str.data() + str.size(), result);
if (ec == std::errc()) {
return result;
}
return -1;
};
Exoplanet p;
std::string data;
int count = 0;
while (getline(csvFile, planetRow)) {
++count;
progressCallback(static_cast<float>(count) / static_cast<float>(total));
std::istringstream lineStream(planetRow);
getline(lineStream, data, ','); // A
p.a = readFloatData(data);
getline(lineStream, data, ','); // AUPPER
p.aUpper = readDoubleData(data);
getline(lineStream, data, ','); // ALOWER
p.aLower = readDoubleData(data);
getline(lineStream, data, ','); // UA
p.ua = readDoubleData(data);
getline(lineStream, data, ','); // AREF
getline(lineStream, data, ','); // AURL
getline(lineStream, data, ','); // AR
getline(lineStream, data, ','); // ARUPPER
getline(lineStream, data, ','); // ARLOWER
getline(lineStream, data, ','); // UAR
getline(lineStream, data, ','); // ARREF
getline(lineStream, data, ','); // ARURL
getline(lineStream, data, ','); // ASTROMETRY
getline(lineStream, data, ','); // B
getline(lineStream, data, ','); // BUPPER
getline(lineStream, data, ','); // BLOWER
getline(lineStream, data, ','); // UB
getline(lineStream, data, ','); // BREF
getline(lineStream, data, ','); // BURL
getline(lineStream, data, ','); // BIGOM
p.bigOm = readFloatData(data);
getline(lineStream, data, ','); // BIGOMUPPER
p.bigOmUpper = readFloatData(data);
getline(lineStream, data, ','); // BIGOMLOWER
p.bigOmLower = readFloatData(data);
getline(lineStream, data, ','); // UBIGOM
p.uBigOm = readFloatData(data);
getline(lineStream, data, ','); // BIGOMREF
getline(lineStream, data, ','); // BIGOMURL
getline(lineStream, data, ','); // BINARY
p.binary = static_cast<bool>(readIntegerData(data));
getline(lineStream, data, ','); // BINARYREF
getline(lineStream, data, ','); // BINARYURL
getline(lineStream, data, ','); // BMV
p.bmv = readFloatData(data);
getline(lineStream, data, ','); // CHI2
getline(lineStream, data, ','); // COMP
std::string component = data;
getline(lineStream, data, ','); // DATE
getline(lineStream, data, ','); // DEC
getline(lineStream, data, ','); // DEC_STRING
getline(lineStream, data, ','); // DENSITY
getline(lineStream, data, ','); // DENSITYUPPER
getline(lineStream, data, ','); // DENSITYLOWER
getline(lineStream, data, ','); // UDENSITY
getline(lineStream, data, ','); // DENSITYREF
getline(lineStream, data, ','); // DENSITYURL
getline(lineStream, data, ','); // DEPTH
getline(lineStream, data, ','); // DEPTHUPPER
getline(lineStream, data, ','); // DEPTHLOWER
getline(lineStream, data, ','); // UDEPTH
getline(lineStream, data, ','); // DEPTHREF
getline(lineStream, data, ','); // DEPTHURL
getline(lineStream, data, ','); // DIST
getline(lineStream, data, ','); // DISTUPPER
getline(lineStream, data, ','); // DISTLOWER
getline(lineStream, data, ','); // UDIST
getline(lineStream, data, ','); // DISTREF
getline(lineStream, data, ','); // DISTURL
getline(lineStream, data, ','); // DR
getline(lineStream, data, ','); // DRUPPER
getline(lineStream, data, ','); // DRLOWER
getline(lineStream, data, ','); // UDR
getline(lineStream, data, ','); // DRREF
getline(lineStream, data, ','); // DRURL
getline(lineStream, data, ','); // DVDT
getline(lineStream, data, ','); // DVDTUPPER
getline(lineStream, data, ','); // DVDTLOWER
getline(lineStream, data, ','); // UDVDT
getline(lineStream, data, ','); // DVDTREF
getline(lineStream, data, ','); // DVDTURL
getline(lineStream, data, ','); // EANAME
getline(lineStream, data, ','); // EAURL
getline(lineStream, data, ','); // ECC
p.ecc = readFloatData(data);
getline(lineStream, data, ','); // ECCUPPER
p.eccUpper = readFloatData(data);
getline(lineStream, data, ','); // ECCLOWER
p.eccLower = readFloatData(data);
getline(lineStream, data, ','); // UECC
p.uEcc = readFloatData(data);
getline(lineStream, data, ','); // ECCREF
getline(lineStream, data, ','); // ECCURL
getline(lineStream, data, ','); // EOD
getline(lineStream, data, ','); // ETDNAME
getline(lineStream, data, ','); // ETDURL
getline(lineStream, data, ','); // FE
getline(lineStream, data, ','); // FEUPPER
getline(lineStream, data, ','); // FELOWER
getline(lineStream, data, ','); // UFE
getline(lineStream, data, ','); // FEREF
getline(lineStream, data, ','); // FEURL
getline(lineStream, data, ','); // FIRSTREF
getline(lineStream, data, ','); // FIRSTURL
getline(lineStream, data, ','); // FREEZE_ECC
getline(lineStream, data, ','); // GAMMA
getline(lineStream, data, ','); // GAMMAUPPER
getline(lineStream, data, ','); // GAMMALOWER
getline(lineStream, data, ','); // UGAMMA
getline(lineStream, data, ','); // GAMMAREF
getline(lineStream, data, ','); // GAMMAURL
getline(lineStream, data, ','); // GL
getline(lineStream, data, ','); // GRAVITY
getline(lineStream, data, ','); // GRAVITYUPPER
getline(lineStream, data, ','); // GRAVITYLOWER
getline(lineStream, data, ','); // UGRAVITY
getline(lineStream, data, ','); // GRAVITYREF
getline(lineStream, data, ','); // GRAVITYURL
getline(lineStream, data, ','); // H
getline(lineStream, data, ','); // HD
getline(lineStream, data, ','); // HIPP
getline(lineStream, data, ','); // HR
getline(lineStream, data, ','); // I
p.i = readFloatData(data);
getline(lineStream, data, ','); // IUPPER
p.iUpper = readFloatData(data);
getline(lineStream, data, ','); // ILOWER
p.iLower = readFloatData(data);
getline(lineStream, data, ','); // UI
p.ui = readFloatData(data);
getline(lineStream, data, ','); // IREF
getline(lineStream, data, ','); // IURL
getline(lineStream, data, ','); // IMAGING
getline(lineStream, data, ','); // J
getline(lineStream, data, ','); // JSNAME
getline(lineStream, data, ','); // EPEURL
getline(lineStream, data, ','); // K
getline(lineStream, data, ','); // KUPPER
getline(lineStream, data, ','); // KLOWER
getline(lineStream, data, ','); // UK
getline(lineStream, data, ','); // KREF
getline(lineStream, data, ','); // KURL
getline(lineStream, data, ','); // KOI
getline(lineStream, data, ','); // KS
getline(lineStream, data, ','); // KP
getline(lineStream, data, ','); // LAMBDA
getline(lineStream, data, ','); // LAMBDAUPPER
getline(lineStream, data, ','); // LAMBDALOWER
getline(lineStream, data, ','); // ULAMBDA
getline(lineStream, data, ','); // LAMBDAREF
getline(lineStream, data, ','); // LAMBDAURL
getline(lineStream, data, ','); // LOGG
getline(lineStream, data, ','); // LOGGUPPER
getline(lineStream, data, ','); // LOGGLOWER
getline(lineStream, data, ','); // ULOGG
getline(lineStream, data, ','); // LOGGREF
getline(lineStream, data, ','); // LOGGURL;
getline(lineStream, data, ','); // MASS
getline(lineStream, data, ','); // MASSUPPER
getline(lineStream, data, ','); // MASSLOWER
getline(lineStream, data, ','); // UMASS
getline(lineStream, data, ','); // MASSREF
getline(lineStream, data, ','); // MASSURL
getline(lineStream, data, ','); // MICROLENSING
getline(lineStream, data, ','); // MSINI
getline(lineStream, data, ','); // MSINIUPPER
getline(lineStream, data, ','); // MSINILOWER
getline(lineStream, data, ','); // UMSINI
getline(lineStream, data, ','); // MSINIREF
getline(lineStream, data, ','); // MSINIURL
getline(lineStream, data, ','); // MSTAR
getline(lineStream, data, ','); // MSTARUPPER
getline(lineStream, data, ','); // MSTARLOWER
getline(lineStream, data, ','); // UMSTAR
getline(lineStream, data, ','); // MSTARREF
getline(lineStream, data, ','); // MSTARURL
getline(lineStream, data, ','); // MULT
getline(lineStream, data, ','); // NAME
getline(lineStream, data, ','); // NCOMP
p.nComp = readIntegerData(data);
getline(lineStream, data, ','); // NOBS
getline(lineStream, data, ','); // OM
p.om = readFloatData(data);
getline(lineStream, data, ','); // OMUPPER
p.omUpper = readFloatData(data);
getline(lineStream, data, ','); // OMLOWER
p.omLower = readFloatData(data);
getline(lineStream, data, ','); // UOM
p.uOm = readFloatData(data);
getline(lineStream, data, ','); // OMREF
getline(lineStream, data, ','); // OMURL
getline(lineStream, data, ','); // ORBREF
getline(lineStream, data, ','); // ORBURL
getline(lineStream, data, ','); // OTHERNAME
getline(lineStream, data, ','); // PAR
getline(lineStream, data, ','); // PARUPPER
getline(lineStream, data, ','); // PARLOWER
getline(lineStream, data, ','); // UPAR
getline(lineStream, data, ','); // PER
p.per = readDoubleData(data);
getline(lineStream, data, ','); // PERUPPER
p.perUpper = readFloatData(data);
getline(lineStream, data, ','); // PERLOWER
p.perLower = readFloatData(data);
getline(lineStream, data, ','); // UPER
p.uPer = readFloatData(data);
getline(lineStream, data, ','); // PERREF
getline(lineStream, data, ','); // PERURL
getline(lineStream, data, ','); // PLANETDISCMETH
getline(lineStream, data, ','); // R
p.r = readDoubleData(data);
getline(lineStream, data, ','); // RUPPER
p.rUpper = readDoubleData(data);
getline(lineStream, data, ','); // RLOWER
p.rLower = readDoubleData(data);
getline(lineStream, data, ','); //UR
p.ur = readDoubleData(data);
getline(lineStream, data, ','); // RREF
getline(lineStream, data, ','); // RURL
getline(lineStream, data, ','); // RA
getline(lineStream, data, ','); // RA_STRING
getline(lineStream, data, ','); // RHK
getline(lineStream, data, ','); // RHOSTAR
getline(lineStream, data, ','); // RHOSTARUPPER
getline(lineStream, data, ','); // RHOSTARLOWER
getline(lineStream, data, ','); // URHOSTAR
getline(lineStream, data, ','); // RHOSTARREF
getline(lineStream, data, ','); // RHOSTARURL
getline(lineStream, data, ','); // RMS
getline(lineStream, data, ','); // RR
getline(lineStream, data, ','); // RRUPPER
getline(lineStream, data, ','); // RRLOWER
getline(lineStream, data, ','); // URR
getline(lineStream, data, ','); // RRREF
getline(lineStream, data, ','); // RRURL
getline(lineStream, data, ','); // RSTAR
p.rStar = readFloatData(data);
getline(lineStream, data, ','); // RSTARUPPER
p.rStarUpper = readFloatData(data);
getline(lineStream, data, ','); // RSTARLOWER
p.rStarLower = readFloatData(data);
getline(lineStream, data, ','); // URSTAR
p.urStar = readFloatData(data);
getline(lineStream, data, ','); // RSTARREF
getline(lineStream, data, ','); // RSTARURL
getline(lineStream, data, ','); // SAO
getline(lineStream, data, ','); // SE
getline(lineStream, data, ','); // SEREF
getline(lineStream, data, ','); // SEURL
getline(lineStream, data, ','); // SEDEPTHJ
getline(lineStream, data, ','); // SEDEPTHJUPPER
getline(lineStream, data, ','); // SEDEPTHJLOWER
getline(lineStream, data, ','); // USEDEPTHJ
getline(lineStream, data, ','); // SEDEPTHJREF
getline(lineStream, data, ','); // SEDEPTHJURL
getline(lineStream, data, ','); // SEDEPTHH
getline(lineStream, data, ','); // SEDEPTHHUPPER
getline(lineStream, data, ','); // SEDEPTHHLOWER
getline(lineStream, data, ','); // USEDEPTHH
getline(lineStream, data, ','); // SEDEPTHHREF
getline(lineStream, data, ','); // SEDEPTHHURL
getline(lineStream, data, ','); // SEDEPTHKS
getline(lineStream, data, ','); // SEDEPTHKSUPPER
getline(lineStream, data, ','); // SEDEPTHKSLOWER
getline(lineStream, data, ','); // USEDEPTHKS
getline(lineStream, data, ','); // SEDEPTHKSREF
getline(lineStream, data, ','); // SEDEPTHKSURL
getline(lineStream, data, ','); // SEDEPTHKP
getline(lineStream, data, ','); // SEDEPTHKPUPPER
getline(lineStream, data, ','); // SEDEPTHKPLOWER
getline(lineStream, data, ','); // USEDEPTHKP
getline(lineStream, data, ','); // SEDEPTHKPREF
getline(lineStream, data, ','); // SEDEPTHKPURL
getline(lineStream, data, ','); // SEDEPTH36
getline(lineStream, data, ','); // SEDEPTH36UPPER
getline(lineStream, data, ','); // SEDEPTH36LOWER
getline(lineStream, data, ','); // USEDEPTH36
getline(lineStream, data, ','); // SEDEPTH36REFx
getline(lineStream, data, ','); // SEDEPTH36URLx
getline(lineStream, data, ','); // SEDEPTH45
getline(lineStream, data, ','); // SEDEPTH45UPPER
getline(lineStream, data, ','); // SEDEPTH45LOWER
getline(lineStream, data, ','); // USEDEPTH45
getline(lineStream, data, ','); // SEDEPTH45REF
getline(lineStream, data, ','); // SEDEPTH45URL
getline(lineStream, data, ','); // SEDEPTH58
getline(lineStream, data, ','); // SEDEPTH58UPPER
getline(lineStream, data, ','); // SEDEPTH58LOWER
getline(lineStream, data, ','); // USEDEPTH58
getline(lineStream, data, ','); // EDEPTH58REF
getline(lineStream, data, ','); // SEDEPTH58URL
getline(lineStream, data, ','); // SEDEPTH80
getline(lineStream, data, ','); // SEDEPTH80UPPER
getline(lineStream, data, ','); // SEDEPTH80LOWER
getline(lineStream, data, ','); // USEDEPTH80
getline(lineStream, data, ','); // SEDEPTH80REF
getline(lineStream, data, ','); // SEDEPTH80URL
getline(lineStream, data, ','); // SEP
getline(lineStream, data, ','); // SEPUPPER
getline(lineStream, data, ','); // SEPLOWER
getline(lineStream, data, ','); // USEP
getline(lineStream, data, ','); // SEPREF
getline(lineStream, data, ','); // SEPURL
getline(lineStream, data, ','); // SET
getline(lineStream, data, ','); // SETUPPER
getline(lineStream, data, ','); // SETLOWER
getline(lineStream, data, ','); // USET
getline(lineStream, data, ','); // SETREF
getline(lineStream, data, ','); // SETURL
getline(lineStream, data, ','); // SHK
getline(lineStream, data, ','); // SIMBADNAME
getline(lineStream, data, ','); // SIMBADURL
getline(lineStream, data, ','); // SPECREF
getline(lineStream, data, ','); // SPECURL
getline(lineStream, data, ','); // STAR
std::string speckStarname = std::string(speckStarName(data));
glm::vec3 position = starPosition(speckStarname);
p.positionX = position[0];
p.positionY = position[1];
p.positionZ = position[2];
getline(lineStream, data, ','); // STARDISCMETH
getline(lineStream, data, ','); // T0
getline(lineStream, data, ','); // T0UPPER
getline(lineStream, data, ','); // T0LOWER
getline(lineStream, data, ','); // UT0
getline(lineStream, data, ','); // T0REF
getline(lineStream, data, ','); // T0URL
getline(lineStream, data, ','); // T14
getline(lineStream, data, ','); // T14UPPER
getline(lineStream, data, ','); // T14LOWER
getline(lineStream, data, ','); // UT14
getline(lineStream, data, ','); // T14REF
getline(lineStream, data, ','); // T14URL
getline(lineStream, data, ','); // TEFF
float teff = readFloatData(data);
getline(lineStream, data, ','); // TEFFUPPER
getline(lineStream, data, ','); // TEFFLOWER
getline(lineStream, data, ','); // UTEFF
getline(lineStream, data, ','); // TEFFREF
getline(lineStream, data, ','); // TEFFURL
getline(lineStream, data, ','); // TIMING
getline(lineStream, data, ','); // TRANSIT
getline(lineStream, data, ','); // TRANSITREF
getline(lineStream, data, ','); // TRANSITURL
getline(lineStream, data, ','); // TREND
getline(lineStream, data, ','); // TT
p.tt = readDoubleData(data);
getline(lineStream, data, ','); // TTUPPER
p.ttUpper = readFloatData(data);
getline(lineStream, data, ','); // TTLOWER
p.ttLower = readFloatData(data);
getline(lineStream, data, ','); // UTT
p.uTt = readFloatData(data);
getline(lineStream, data, ','); // TTREF
getline(lineStream, data, ','); // TTURL
getline(lineStream, data, ','); // V
getline(lineStream, data, ','); // VREF
getline(lineStream, data, ','); // VURL
getline(lineStream, data, ','); // VSINI
getline(lineStream, data, ','); // VSINIUPPER
getline(lineStream, data, ','); // VSINILOWER
getline(lineStream, data, ','); // UVSINI
getline(lineStream, data, ','); // VSINIREF
getline(lineStream, data, ','); // VSINIURL
getline(lineStream, data, ','); // KEPID
bool isKeplerObject = false;
if (!data.empty()) {
isKeplerObject = true;
}
getline(lineStream, data); // KDE
if (!isKeplerObject) {
// calculate B-V from Teff if not exsisting
if (std::isnan(p.bmv)) {
p.bmv = bvFromTeff(teff);
}
// create look-up table
long pos = static_cast<long>(binFile.tellp());
std::string planetName = speckStarname + " " + component;
lutFile << planetName << "," << pos << std::endl;
binFile.write(reinterpret_cast<char*>(&p), sizeof(Exoplanet));
}
}
progressCallback(1.f);
}
glm::vec3 ExoplanetsCsvToBinTask::starPosition(const std::string& starName) {
std::ifstream exoplanetsFile(_inputSpeckPath);
if (!exoplanetsFile) {
LERROR(fmt::format("Error opening file expl.speck"));
}
glm::vec3 position{ NAN };
std::string line;
while (getline(exoplanetsFile, line)) {
bool shouldSkipLine = (
line.empty() || line[0] == '#' || line.substr(0, 7) == "datavar" ||
line.substr(0, 10) == "texturevar" || line.substr(0, 7) == "texture"
);
if (shouldSkipLine) {
continue;
}
std::string data;
std::string name;
std::istringstream linestream(line);
getline(linestream, data, '#');
getline(linestream, name);
name.erase(0, 1);
std::string coord;
if (name == starName) {
std::stringstream dataStream(data);
getline(dataStream, coord, ' ');
position[0] = std::stof(coord.c_str(), nullptr);
getline(dataStream, coord, ' ');
position[1] = std::stof(coord.c_str(), nullptr);
getline(dataStream, coord, ' ');
position[2] = std::stof(coord.c_str(), nullptr);
break;
}
}
// Apply transformation matrix to pos
glm::dmat4 _transformationMatrix = glm::dmat4(1.0);
glm::vec3 transformedPosition = glm::vec3(
_transformationMatrix * glm::dvec4(position, 1.0)
);
return transformedPosition;
}
float ExoplanetsCsvToBinTask::bvFromTeff(float teff) {
if (std::isnan(teff)) {
return NAN;
}
std::ifstream teffToBvFile(_teffToBvFilePath);
if (!teffToBvFile.good()) {
LERROR(fmt::format("Failed to open teff_bv.txt file"));
return NAN;
}
float bv = 0.f;
float bvUpper = 0.f;
float bvLower = 0.f;
float teffLower, teffUpper;
std::string row, teffString, bvString;
while (getline(teffToBvFile, row)) {
std::istringstream lineStream(row);
getline(lineStream, teffString, ',');
getline(lineStream, bvString);
float teffCurrent = std::stof(teffString.c_str(), nullptr);
float bvCurrent = std::stof(bvString.c_str(), nullptr);
if (teff > teffCurrent) {
teffLower = teffCurrent;
bvLower = bvCurrent;
}
else {
teffUpper = teffCurrent;
bvUpper = bvCurrent;
if (bvLower == 0.f) {
bv = 2.f;
}
else {
float bvDiff = (bvUpper - bvLower);
float teffDiff = (teffUpper - teffLower);
bv = ((bvDiff * (teff - teffLower)) / teffDiff) + bvLower;
}
break;
}
}
return bv;
}
documentation::Documentation ExoplanetsCsvToBinTask::documentation() {
using namespace documentation;
return {
"ExoplanetsCsvToBinTask",
"exoplanets_csv_to_bin_task",
{
{
"Type",
new StringEqualVerifier("ExoplanetsCsvToBinTask"),
Optional::No,
""
},
{
KeyInputCsv,
new StringAnnotationVerifier("A file path to a csv file"),
Optional::No,
"The csv file to extract data from"
},
{
KeyInputSpeck,
new StringAnnotationVerifier("A file path to a speck file"),
Optional::No,
"The speck file with star locations"
},
{
KeyOutputBin,
new StringAnnotationVerifier("A valid filepath"),
Optional::No,
"The bin file to export data into"
},
{
KeyOutputLut,
new StringAnnotationVerifier("A valid filepath"),
Optional::No,
"The txt file to write look-up table into"
},
{
KeyTeffToBv,
new StringAnnotationVerifier("A valid filepath"),
Optional::No,
"The path to a teff to bv conversion file"
}
}
};
}
} // namespace openspace::exoplanets

View File

@@ -0,0 +1,56 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSCSVTOBINTASK___H__
#define __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSCSVTOBINTASK___H__
#include <openspace/properties/vector/vec3property.h>
#include <openspace/util/task.h>
#include <string>
namespace openspace::exoplanets {
class ExoplanetsCsvToBinTask : public Task {
public:
ExoplanetsCsvToBinTask(const ghoul::Dictionary& dictionary);
std::string description() override;
void perform(const Task::ProgressCallback& progressCallback) override;
static documentation::Documentation documentation();
private:
std::string _inputCsvPath;
std::string _inputSpeckPath;
std::string _outputBinPath;
std::string _outputLutPath;
std::string _teffToBvFilePath;
glm::vec3 starPosition(const std::string& starName);
// Compute b-v color from teff value using a conversion file
float bvFromTeff(float teff);
};
} // namespace openspace::exoplanets
#endif // __OPENSPACE_MODULE_EXOPLANETS___EXOPLANETSCSVTOBINTASK___H__

View File

@@ -53,9 +53,11 @@ set(MODULE_NAME openspace-module-fitsfilereader)
# CCfits is dependent on cfitsio, let it handle the internal linking
add_subdirectory(${CFITSIO_ROOT_DIR})
set_folder_location(cfitsio "External")
set(cfitsio_BUILD_SHARED_LIBS OFF)
add_subdirectory(${CCFITS_ROOT_DIR})
set_folder_location(CCfits "External")
set(CCfits_BUILD_SHARED_LIBS OFF)
if (GHOUL_DISABLE_EXTERNAL_WARNINGS)
disable_external_warnings(cfitsio)

View File

@@ -51,14 +51,16 @@
#include <ghoul/systemcapabilities/openglcapabilitiescomponent.h>
#include <numeric>
#include <queue>
#ifndef __APPLE__
#include <memory_resource>
#else
#include <vector>
#if defined(__APPLE__) || (defined(__linux__) && defined(__clang__))
#include <experimental/memory_resource>
namespace std {
using namespace experimental;
} // namespace std
#endif // __APPLE__
#else
#include <memory_resource>
#endif
namespace {
// Global flags to modify the RenderableGlobe
@@ -268,22 +270,22 @@ const Chunk& findChunkNode(const Chunk& node, const Geodetic2& location) {
return *n;
}
#ifndef __APPLE__
using ChunkTileVector = std::pmr::vector<std::pair<ChunkTile, const LayerRenderSettings*>>;
#else // __APPLE__
#if defined(__APPLE__) || (defined(__linux__) && defined(__clang__))
using ChunkTileVector = std::vector<std::pair<ChunkTile, const LayerRenderSettings*>>;
#endif // __APPLE__
#else
using ChunkTileVector = std::pmr::vector<std::pair<ChunkTile, const LayerRenderSettings*>>;
#endif
ChunkTileVector tilesAndSettingsUnsorted(const LayerGroup& layerGroup,
const TileIndex& tileIndex)
{
ZoneScoped
#ifndef __APPLE__
ChunkTileVector tilesAndSettings(&global::memoryManager.TemporaryMemory);
#else // __APPLE__
#if defined(__APPLE__) || (defined(__linux__) && defined(__clang__))
ChunkTileVector tilesAndSettings;
#endif // __APPLE__
#else
ChunkTileVector tilesAndSettings(&global::memoryManager.TemporaryMemory);
#endif
for (Layer* layer : layerGroup.activeLayers()) {
if (layer->tileProvider()) {
tilesAndSettings.emplace_back(

View File

@@ -63,6 +63,7 @@ set(OPENSPACE_SOURCE
${OPENSPACE_BASE_DIR}/src/interaction/shortcutmanager_lua.inl
${OPENSPACE_BASE_DIR}/src/interaction/websocketinputstate.cpp
${OPENSPACE_BASE_DIR}/src/interaction/websocketcamerastates.cpp
${OPENSPACE_BASE_DIR}/src/interaction/tasks/convertrecformattask.cpp
${OPENSPACE_BASE_DIR}/src/mission/mission.cpp
${OPENSPACE_BASE_DIR}/src/mission/missionmanager.cpp
${OPENSPACE_BASE_DIR}/src/mission/missionmanager_lua.inl
@@ -244,6 +245,7 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/interaction/shortcutmanager.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/websocketinputstate.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/websocketcamerastates.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/tasks/convertrecformattask.h
${OPENSPACE_BASE_DIR}/include/openspace/mission/mission.h
${OPENSPACE_BASE_DIR}/include/openspace/mission/missionmanager.h
${OPENSPACE_BASE_DIR}/include/openspace/network/parallelconnection.h
@@ -435,6 +437,8 @@ target_include_directories(openspace-core PUBLIC
${OPENSPACE_BASE_DIR}
# In order to use the date library
${OPENSPACE_BASE_DIR}/ext/date/include
# In order to use the nlohmann JSON library
${OPENSPACE_BASE_DIR}/ext
# In order to be able to include the module_registration file
${CMAKE_BINARY_DIR}/_generated/include
)

View File

@@ -318,12 +318,10 @@ void OpenSpaceEngine::initialize() {
);
}
std::vector<std::string> content;
std::string line;
while (std::getline(inFile, line)) {
content.push_back(std::move(line));
}
std::string content(
(std::istreambuf_iterator<char>(inFile)),
std::istreambuf_iterator<char>()
);
global::profile = Profile(content);
// Then save the profile to a scene so that we can load it with the
@@ -1169,9 +1167,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
);
}
if (!global::windowDelegate.isMaster()) {
global::renderEngine.updateScene();
}
global::renderEngine.updateScene();
global::renderEngine.updateRenderer();
global::renderEngine.updateScreenSpaceRenderables();
global::renderEngine.updateShaderPrograms();

View File

@@ -43,6 +43,14 @@ namespace {
namespace openspace::interaction {
KeyframeNavigator::CameraPose::CameraPose(datamessagestructures::CameraKeyframe&& kf)
: position(std::move(kf._position))
, rotation(std::move(kf._rotation))
, focusNode(std::move(kf._focusNode))
, scale(std::move(kf._scale))
, followFocusNodeRotation(std::move(kf._followNodeRotation))
{}
bool KeyframeNavigator::updateCamera(Camera& camera, bool ignoreFutureKeyframes) {
double now = currentTime();
bool foundPrevKeyframe = false;

File diff suppressed because it is too large Load Diff

View File

@@ -40,7 +40,7 @@ int startRecording(lua_State* L) {
return luaL_error(L, "filepath string is empty");
}
global::sessionRecording.setRecordDataFormat(
openspace::interaction::SessionRecording::RecordedDataMode::Binary
interaction::SessionRecording::DataMode::Binary
);
global::sessionRecording.startRecording(recordFilePath);
@@ -63,7 +63,7 @@ int startRecordingAscii(lua_State* L) {
return luaL_error(L, "filepath string is empty");
}
global::sessionRecording.setRecordDataFormat(
openspace::interaction::SessionRecording::RecordedDataMode::Ascii
interaction::SessionRecording::DataMode::Ascii
);
global::sessionRecording.startRecording(recordFilePath);
@@ -80,7 +80,7 @@ int stopRecording(lua_State* L) {
return 0;
}
int startPlayback(lua_State* L, openspace::interaction::KeyframeTimeRef timeMode,
int startPlayback(lua_State* L, interaction::KeyframeTimeRef timeMode,
bool forceSimTimeAtStart)
{
using ghoul::lua::luaTypeToString;
@@ -107,30 +107,30 @@ int startPlayback(lua_State* L, openspace::interaction::KeyframeTimeRef timeMode
int startPlaybackDefault(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::startPlaybackDefault");
using openspace::interaction::KeyframeNavigator;
using interaction::KeyframeNavigator;
return startPlayback(L,
openspace::interaction::KeyframeTimeRef::Relative_recordedStart, true);
interaction::KeyframeTimeRef::Relative_recordedStart, true);
}
int startPlaybackApplicationTime(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::startPlaybackApplicationTime");
return startPlayback(L,
openspace::interaction::KeyframeTimeRef::Relative_applicationStart, false);
interaction::KeyframeTimeRef::Relative_applicationStart, false);
}
int startPlaybackRecordedTime(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::startPlaybackRecordedTime");
using openspace::interaction::KeyframeNavigator;
using interaction::KeyframeNavigator;
return startPlayback(L,
openspace::interaction::KeyframeTimeRef::Relative_recordedStart, false);
interaction::KeyframeTimeRef::Relative_recordedStart, false);
}
int startPlaybackSimulationTime(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::startPlaybackSimulationTime");
using openspace::interaction::KeyframeNavigator;
using interaction::KeyframeNavigator;
return startPlayback(L,
openspace::interaction::KeyframeTimeRef::Absolute_simTimeJ2000, false);
interaction::KeyframeTimeRef::Absolute_simTimeJ2000, false);
}
int stopPlayback(lua_State* L) {

View File

@@ -0,0 +1,339 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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. *
****************************************************************************************/
#include <openspace/interaction/tasks/convertrecformattask.h>
#include <openspace/interaction/sessionrecording.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <iomanip>
#include <ghoul/logging/logmanager.h>
namespace {
constexpr const char* _loggerCat = "ConvertRecFormatTask";
constexpr const char* KeyConvertToAscii = "ConvertToAscii";
constexpr const char* KeyConvertToBinary = "ConvertToBinary";
constexpr const char* KeyInFilePath = "InputFilePath";
constexpr const char* KeyOutFilePath = "OutputFilePath";
} // namespace
namespace openspace::interaction {
ConvertRecFormatTask::ConvertRecFormatTask(const ghoul::Dictionary& dictionary) {
openspace::documentation::testSpecificationAndThrow(
documentation(),
dictionary,
"ConvertRecFormatTask"
);
_inFilePath = absPath(dictionary.value<std::string>(KeyInFilePath));
_outFilePath = absPath(dictionary.value<std::string>(KeyOutFilePath));
ghoul_assert(FileSys.fileExists(_inFilePath), "The filename must exist");
if (!FileSys.fileExists(_inFilePath)) {
LERROR(fmt::format("Failed to load session recording file: {}", _inFilePath));
}
else {
_iFile.open(_inFilePath, std::ifstream::in);
determineFormatType();
}
}
ConvertRecFormatTask::~ConvertRecFormatTask() {
_iFile.close();
_oFile.close();
}
std::string ConvertRecFormatTask::description() {
std::string description = "Convert session recording file '" + _inFilePath + "' ";
if (_fileFormatType == SessionRecording::DataMode::Ascii) {
description += "(ascii format) ";
}
else if (_fileFormatType == SessionRecording::DataMode::Binary) {
description += "(binary format) ";
}
else {
description += "(UNKNOWN format) ";
}
description += "conversion to file '" + _outFilePath + "'.";
return description;
}
void ConvertRecFormatTask::perform(const Task::ProgressCallback& progressCallback) {
convert();
}
void ConvertRecFormatTask::convert() {
std::string expectedFileExtension_in, expectedFileExtension_out;
std::string currentFormat;
if (_fileFormatType == SessionRecording::DataMode::Binary) {
currentFormat = "binary";
expectedFileExtension_in = SessionRecording::FileExtensionBinary;
expectedFileExtension_out = SessionRecording::FileExtensionAscii;
}
else if (_fileFormatType == SessionRecording::DataMode::Ascii) {
currentFormat = "ascii";
expectedFileExtension_in = SessionRecording::FileExtensionAscii;
expectedFileExtension_out = SessionRecording::FileExtensionBinary;
}
if (!SessionRecording::hasFileExtension(_inFilePath, expectedFileExtension_in)) {
LWARNING(fmt::format(
"Input filename doesn't have expected {} "
"format file extension",
currentFormat)
);
}
if (SessionRecording::hasFileExtension(_outFilePath, expectedFileExtension_in)) {
LERROR(fmt::format(
"Output filename has {} file extension, but is conversion from {}",
currentFormat,
currentFormat)
);
return;
}
else if (!SessionRecording::hasFileExtension(_outFilePath, expectedFileExtension_out)) {
_outFilePath += expectedFileExtension_out;
}
if (_fileFormatType == SessionRecording::DataMode::Ascii) {
_oFile.open(_outFilePath);
}
else if (_fileFormatType == SessionRecording::DataMode::Binary) {
_oFile.open(_outFilePath, std::ios::binary);
}
_oFile.write(
SessionRecording::FileHeaderTitle.c_str(),
SessionRecording::FileHeaderTitle.length()
);
_oFile.write(
SessionRecording::FileHeaderVersion,
SessionRecording::FileHeaderVersionLength
);
_oFile.close();
if (_fileFormatType == SessionRecording::DataMode::Ascii) {
convertToBinary();
}
else if (_fileFormatType == SessionRecording::DataMode::Binary) {
convertToAscii();
}
else {
//Add error output for file type not recognized
LERROR("Session recording file unrecognized format type.");
}
}
void ConvertRecFormatTask::determineFormatType() {
_fileFormatType = SessionRecording::DataMode::Unknown;
std::string line;
line = SessionRecording::readHeaderElement(_iFile,
SessionRecording::FileHeaderTitle.length());
if (line.substr(0, SessionRecording::FileHeaderTitle.length())
!= SessionRecording::FileHeaderTitle)
{
LERROR(fmt::format("Session recording file {} does not have expected header.",
_inFilePath));
}
else {
//Read version string and throw it away (and also line feed character at end)
SessionRecording::readHeaderElement(_iFile,
SessionRecording::FileHeaderVersionLength);
line = SessionRecording::readHeaderElement(_iFile, 1);
SessionRecording::readHeaderElement(_iFile, 1);
if (line.at(0) == SessionRecording::DataFormatAsciiTag) {
_fileFormatType = SessionRecording::DataMode::Ascii;
}
else if (line.at(0) == SessionRecording::DataFormatBinaryTag) {
_fileFormatType = SessionRecording::DataMode::Binary;
}
}
}
void ConvertRecFormatTask::convertToAscii() {
SessionRecording::Timestamps times;
datamessagestructures::CameraKeyframe ckf;
datamessagestructures::TimeKeyframe tkf;
datamessagestructures::ScriptMessage skf;
int lineNum = 1;
unsigned char frameType;
_oFile.open(_outFilePath, std::ifstream::app);
char tmpType = SessionRecording::DataFormatAsciiTag;
_oFile.write(&tmpType, 1);
_oFile.write("\n", 1);
bool fileReadOk = true;
while (fileReadOk) {
frameType = readFromPlayback<unsigned char>(_iFile);
// Check if have reached EOF
if (!_iFile) {
LINFO(fmt::format(
"Finished converting {} entries from file {}",
lineNum - 1, _inFilePath
));
fileReadOk = false;
break;
}
std::stringstream keyframeLine = std::stringstream();
keyframeLine.str(std::string());
if (frameType == SessionRecording::HeaderCameraBinary) {
SessionRecording::readCameraKeyframeBinary(times, ckf, _iFile, lineNum);
SessionRecording::saveHeaderAscii(times, SessionRecording::HeaderCameraAscii,
keyframeLine);
ckf.write(keyframeLine);
}
else if (frameType == SessionRecording::HeaderTimeBinary) {
SessionRecording::readTimeKeyframeBinary(times, tkf, _iFile, lineNum);
SessionRecording::saveHeaderAscii(times, SessionRecording::HeaderTimeAscii,
keyframeLine);
tkf.write(keyframeLine);
}
else if (frameType == SessionRecording::HeaderScriptBinary) {
SessionRecording::readScriptKeyframeBinary(times, skf, _iFile, lineNum);
SessionRecording::saveHeaderAscii(times, SessionRecording::HeaderScriptAscii,
keyframeLine);
skf.write(keyframeLine);
}
else {
LERROR(fmt::format(
"Unknown frame type @ index {} of playback file {}",
lineNum - 1, _inFilePath
));
break;
}
SessionRecording::saveKeyframeToFile(keyframeLine.str(), _oFile);
lineNum++;
}
_oFile.close();
}
void ConvertRecFormatTask::convertToBinary() {
SessionRecording::Timestamps times;
datamessagestructures::CameraKeyframe ckf;
datamessagestructures::TimeKeyframe tkf;
datamessagestructures::ScriptMessage skf;
int lineNum = 1;
std::string lineContents;
unsigned char keyframeBuffer[SessionRecording::_saveBufferMaxSize_bytes];
_oFile.open(_outFilePath, std::ifstream::app | std::ios::binary);
char tmpType = SessionRecording::DataFormatBinaryTag;
_oFile.write(&tmpType, 1);
_oFile.write("\n", 1);
size_t idx = 0;
while (std::getline(_iFile, lineContents)) {
lineNum++;
std::istringstream iss(lineContents);
std::string entryType;
if (!(iss >> entryType)) {
LERROR(fmt::format(
"Error reading entry type @ line {} of file {}",
lineNum, _inFilePath
));
break;
}
if (entryType == SessionRecording::HeaderCameraAscii) {
SessionRecording::readCameraKeyframeAscii(times, ckf, lineContents, lineNum);
SessionRecording::saveCameraKeyframeBinary(times, ckf, keyframeBuffer,
_oFile);
}
else if (entryType == SessionRecording::HeaderTimeAscii) {
SessionRecording::readTimeKeyframeAscii(times, tkf, lineContents, lineNum);
SessionRecording::saveTimeKeyframeBinary(times, tkf, keyframeBuffer,
_oFile);
}
else if (entryType == SessionRecording::HeaderScriptAscii) {
SessionRecording::readScriptKeyframeAscii(times, skf, lineContents, lineNum);
SessionRecording::saveScriptKeyframeBinary(times, skf, keyframeBuffer,
_oFile);
}
else if (entryType.substr(0, 1) == SessionRecording::HeaderCommentAscii) {
continue;
}
else {
LERROR(fmt::format(
"Unknown frame type {} @ line {} of file {}",
entryType, lineContents, _inFilePath
));
break;
}
}
_oFile.close();
LINFO(fmt::format(
"Finished converting {} entries from file {}",
lineNum, _inFilePath
));
}
std::string ConvertRecFormatTask::addFileSuffix(const std::string& filePath,
const std::string& suffix)
{
size_t lastdot = filePath.find_last_of(".");
std::string extension = filePath.substr(0, lastdot);
if (lastdot == std::string::npos) {
return filePath + suffix;
}
else {
return filePath.substr(0, lastdot) + suffix + extension;
}
}
documentation::Documentation ConvertRecFormatTask::documentation() {
using namespace documentation;
return {
"ConvertRecFormatTask",
"convert_format_task",
{
{
"Type",
new StringEqualVerifier("ConvertRecFormatTask"),
Optional::No,
"The type of this task",
},
{
KeyInFilePath,
new StringAnnotationVerifier("A valid filename to convert"),
Optional::No,
"The filename to convert to the opposite format.",
},
{
KeyOutFilePath,
new StringAnnotationVerifier("A valid output filename"),
Optional::No,
"The filename containing the converted result.",
},
},
};
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -108,8 +108,7 @@ std::string_view Time::ISO8601() const {
std::memset(b, 0, S);
SpiceManager::ref().dateFromEphemerisTime(_time, b, S, Format);
return std::string_view(b, S);
return std::string_view(b, S - 1);
}
void Time::ISO8601(char* buffer) const {

View File

@@ -297,7 +297,6 @@ void TimeManager::progressTime(double dt) {
// and time is not paused, just advance time.
_deltaTime = _targetDeltaTime;
_currentTime.data().advanceTime(dt * _deltaTime);
_playbackModeEnabled = false;
}
if (hasPastKeyframes) {
@@ -523,6 +522,10 @@ void TimeManager::triggerPlaybackStart() {
_playbackModeEnabled = true;
}
void TimeManager::stopPlayback() {
_playbackModeEnabled = false;
}
void TimeManager::removeTimeJumpCallback(CallbackHandle handle) {
const auto it = std::find_if(
_timeJumpCallbacks.begin(),

View File

@@ -111,7 +111,6 @@ function (set_openspace_compile_settings project)
${project}
PRIVATE
"-stdlib=libc++"
"-std=gnu++17"
"-Wall"
"-Wextra"
"-Wabstract-vbase-init"
@@ -192,7 +191,7 @@ function (set_openspace_compile_settings project)
"-Wzero-length-array"
"-Wno-missing-braces"
)
elseif (LINUX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
elseif (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (OPENSPACE_WARNINGS_AS_ERRORS)
target_compile_options(${project} PRIVATE "-Werror")
endif ()
@@ -200,8 +199,8 @@ function (set_openspace_compile_settings project)
target_compile_options(
${project}
PRIVATE
"-stdlib=libstdc++"
"-std=gnu++17"
"-stdlib=libc++"
"-std=c++17"
"-Wall"
"-Wextra"
"-Wabstract-vbase-init"
@@ -282,6 +281,9 @@ function (set_openspace_compile_settings project)
"-Wzero-length-array"
"-Wno-missing-braces"
)
target_link_libraries(${project} PRIVATE "c++" "c++abi")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(
${project}

View File

@@ -0,0 +1,8 @@
{
"version": { "major": 12, "minor": 13 },
"additional_scripts": [
"script-1",
"script-2",
"script-3"
]
}

View File

@@ -0,0 +1,8 @@
{
"version": { "major": 12, "minor": 13 },
"assets": [
"folder1/folder2/asset",
"folder3/folder4/asset2",
"folder5/folder6/asset3"
]
}

View File

@@ -0,0 +1,9 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": 1.0,
"longitude": 2.0
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": 1.0,
"longitude": 2.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,13 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"aim": "aim",
"frame": "root",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"yaw": 10.0,
"pitch": -10.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"frame": "root",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"yaw": 10.0,
"pitch": -10.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"aim": "aim",
"frame": "root",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"yaw": 10.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"aim": "aim",
"frame": "root",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"yaw": 10.0,
"pitch": -10.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"aim": "aim",
"frame": "root",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"pitch": -10.0
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"delta_times": [
1.0,
30.0,
60.0,
1000.0,
36000.0
]
}

View File

@@ -0,0 +1,29 @@
{
"version": { "major": 12, "minor": 13 },
"keybindings": [
{
"key": "T",
"documentation": "T documentation",
"name": "T name",
"gui_path": "T Gui-Path",
"is_local": true,
"script": "T script"
},
{
"key": "U",
"documentation": "U documentation",
"name": "U name",
"gui_path": "U Gui-Path",
"is_local": false,
"script": "U script"
},
{
"key": "CTRL+V",
"documentation": "CTRL+V documentation",
"name": "CTRL+V name",
"gui_path": "CTRL+V Gui-Path",
"is_local": false,
"script": "CTRL+V script"
}
]
}

View File

@@ -0,0 +1,6 @@
{
"version": { "major": 12, "minor": 13 },
"mark_nodes": [
"node-1", "node-2", "node-3"
]
}

View File

@@ -0,0 +1,11 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"version": "version",
"description": "description",
"author": "author",
"url": "url",
"license": "license"
}
}

View File

@@ -0,0 +1,11 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"version": "version",
"description": "description",
"author": "author",
"url": "url",
"license": "license"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"version": "version",
"description": "description",
"url": "url",
"license": "license"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"version": "version",
"author": "author",
"url": "url",
"license": "license"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"version": "version",
"description": "description",
"author": "author",
"url": "url"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"version": "version",
"description": "description",
"author": "author",
"url": "url",
"license": "license"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"version": "version",
"description": "description",
"author": "author",
"license": "license"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"meta": {
"name": "name",
"description": "description",
"author": "author",
"url": "url",
"license": "license"
}
}

View File

@@ -0,0 +1,19 @@
{
"version": { "major": 12, "minor": 13 },
"modules": [
{ "name": "abs-module" },
{
"name": "def-module",
"loadedInstruction": "instr"
},
{
"name": "ghi-module",
"notLoadedInstruction": "not_instr"
},
{
"name": "jkl-module",
"loadedInstruction": "instr",
"notLoadedInstruction": "not_instr"
}
]
}

View File

@@ -0,0 +1,35 @@
{
"version": { "major": 12, "minor": 13 },
"properties": [
{
"type": "setPropertyValue",
"name": "property_name_1",
"value": "property_value_1"
},
{
"type": "setPropertyValue",
"name": "property_name_2",
"value": "property_value_2"
},
{
"type": "setPropertyValue",
"name": "property_name_3",
"value": "property_value_3"
},
{
"type": "setPropertyValueSingle",
"name": "property_name_4",
"value": "property_value_4"
},
{
"type": "setPropertyValueSingle",
"name": "property_name_5",
"value": "property_value_5"
},
{
"type": "setPropertyValueSingle",
"name": "property_name_6",
"value": "property_value_6"
}
]
}

View File

@@ -0,0 +1,7 @@
{
"version": { "major": 12, "minor": 13 },
"time": {
"type": "absolute",
"value": "2020-06-01T12:00:00"
}
}

View File

@@ -0,0 +1,7 @@
{
"version": { "major": 12, "minor": 13 },
"time": {
"type": "relative",
"value": "-1d"
}
}

View File

@@ -1,7 +0,0 @@
#Version
12.13
#AdditionalScripts
script-1
script-2
script-3

View File

@@ -1,7 +0,0 @@
#Version
12.13
#Asset
folder1/folder2/asset
folder3/folder4/asset2 variable
folder5/folder6/asset3

View File

@@ -1,5 +0,0 @@
#Version
12.13
#Camera
goToGeo "anchor" 1.0 2.0

View File

@@ -1,5 +0,0 @@
#Version
12.13
#Camera
goToGeo "anchor" 1.0 2.0 4.0

View File

@@ -1,5 +0,0 @@
#Version
12.13
#Camera
setNavigationState "node" "root" 1.0, 2.0, 3.0 4.0, 5.0, 6.0 10.0 -10.0

View File

@@ -1,9 +0,0 @@
#Version
12.13
#DeltaTimes
1.0
30.0
60.0
1000.0
36000.0

View File

@@ -1,7 +0,0 @@
#Version
12.13
#Keybinding
T T documentation T name T Gui-Path true T script
U U documentation U name U Gui-Path false U script
CTRL+V CTRL+V documentation CTRL+V name CTRL+V Gui-Path false CTRL+V script

View File

@@ -1,7 +0,0 @@
#Version
12.13
#MarkNodes
node-1
node-2
node-3

View File

@@ -1,10 +0,0 @@
#Version
12.13
#Meta
Name name
Version version
Description description
Author author
URL url
License license

View File

@@ -1,7 +0,0 @@
#Version
12.13
#Module
abc-module
def-module
ghi-module

View File

@@ -1,10 +0,0 @@
#Version
12.13
#Property
setPropertyValue property_name_1 property_value_1
setPropertyValue property_name_2 property_value_2
setPropertyValue property_name_3 property_value_3
setPropertyValueSingle property_name_4 property_value_5
setPropertyValueSingle property_name_4 property_value_5
setPropertyValueSingle property_name_4 property_value_5

View File

@@ -1,5 +0,0 @@
#Version
12.13
#Time
absolute 2020-06-01T12:00:00

View File

@@ -1,5 +0,0 @@
#Version
12.13
#Time
relative -1d

View File

@@ -1,2 +0,0 @@
#Version
100

View File

@@ -1,2 +0,0 @@
#Version
100.200

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": 1.0,
"longitude": 2.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,9 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"latitude": 1.0,
"longitude": 2.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,9 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"longitude": 2.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,9 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": 1.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": 1.0,
"longitude": 2.0,
"altitude": "a"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": 1.0,
"latitude": 1.0,
"longitude": 2.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": "a",
"longitude": 2.0,
"altitude": 4.0
}
}

View File

@@ -0,0 +1,10 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "goToGeo",
"anchor": "anchor",
"latitude": 1.0,
"longitude": "a",
"altitude": 4.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"aim": "aim",
"frame": "root",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"yaw": 10.0,
"pitch": -10.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"aim": "aim",
"position": { "x": 1.0, "y": 2.0, "z": 3.0},
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"yaw": 10.0,
"pitch": -10.0
}
}

View File

@@ -0,0 +1,12 @@
{
"version": { "major": 12, "minor": 13 },
"camera": {
"type": "setNavigationState",
"anchor": "none",
"aim": "aim",
"frame": "root",
"up": { "x": 4.0, "y": 5.0, "z": 6.0 },
"yaw": 10.0,
"pitch": -10.0
}
}

Some files were not shown because too many files have changed in this diff Show More