From 944d26128a93b27747f418e1e087061510755b4f Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Mon, 29 Mar 2021 15:43:09 +0200 Subject: [PATCH 01/23] Update Apollo CSM model --- .../missions/apollo/15/apollo15.asset | 29 +- .../missions/apollo/8/launch_model.asset | 29 +- .../solarsystem/missions/apollo/8/model.asset | 29 +- .../missions/apollo/apollo_csm.asset | 280 ------------------ 4 files changed, 65 insertions(+), 302 deletions(-) delete mode 100644 data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset diff --git a/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset b/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset index 7e6001679f..3c150626ba 100644 --- a/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset +++ b/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset @@ -1,9 +1,15 @@ local assetHelper = asset.require('util/asset_helper') local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon') local sun_transforms = asset.require('scene/solarsystem/sun/transforms') -local csm = asset.require('../apollo_csm') asset.require('spice/base') +local models = asset.syncedResource({ + Name = "Apollo Models", + Type = "HttpSynchronization", + Identifier = "apollo_models", + Version = 2 +}) + local kernels = asset.require('scene/solarsystem/missions/apollo/15/kernels').kernels @@ -47,6 +53,20 @@ local Apollo15 = { DestinationFrame = "GALACTIC" } }, + Renderable = { + Type = "RenderableModel", + GeometryFile = models .. "/ApolloCSM.fbx", + LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sun_transforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + } + }, + PerformShading = true, + DisableFaceCulling = true + }, TimeFrame = { Type = "TimeFrameInterval", Start = "1971-07-30T02:22:00.00", @@ -101,13 +121,6 @@ local Apollo15Trail = { } } - -local model_part = csm.createCsmModel(Apollo15.Identifier) - local list = { Apollo15, Apollo15Trail } -for k,v in pairs(model_part) do - v.GUI.Path = "/Solar System/Missions/Apollo/15/Model" - table.insert(list, v) -end assetHelper.registerSceneGraphNodesAndExport(asset, list) diff --git a/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset b/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset index 1e76c60931..d957fc8a97 100644 --- a/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset +++ b/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset @@ -1,7 +1,14 @@ local asset_helper = asset.require('util/asset_helper') local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') local kernels = asset.require('./kernels').kernels -local csm = asset.require('../apollo_csm') + +local models = asset.syncedResource({ + Name = "Apollo Models", + Type = "HttpSynchronization", + Identifier = "apollo_models", + Version = 2 +}) local apolloSpiceId = "-908" @@ -47,6 +54,20 @@ local Apollo8LaunchModel = { Rotation = {0.0, 0.0, -3.1415 / 2} } }, + Renderable = { + Type = "RenderableModel", + GeometryFile = models .. "/ApolloCSM.fbx", + LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sun_transforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + } + }, + PerformShading = true, + DisableFaceCulling = true + }, GUI = { Hidden = true, Name = "Apollo 8 Launch Model", @@ -54,12 +75,6 @@ local Apollo8LaunchModel = { } } -local launch_model_part = csm.createCsmModel(Apollo8LaunchModel.Identifier) - local list = { Apollo8Launch, Apollo8LaunchModel } -for k,v in pairs(launch_model_part) do - v.GUI.Path = "/Solar System/Missions/Apollo/8/Model" - table.insert(list, v) -end asset_helper.registerSceneGraphNodesAndExport(asset, list) diff --git a/data/assets/scene/solarsystem/missions/apollo/8/model.asset b/data/assets/scene/solarsystem/missions/apollo/8/model.asset index 4b677cc818..a2fa8e32a9 100644 --- a/data/assets/scene/solarsystem/missions/apollo/8/model.asset +++ b/data/assets/scene/solarsystem/missions/apollo/8/model.asset @@ -1,7 +1,14 @@ local asset_helper = asset.require('util/asset_helper') local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') local kernels = asset.require('./kernels').kernels -local csm = asset.require('../apollo_csm') + +local models = asset.syncedResource({ + Name = "Apollo Models", + Type = "HttpSynchronization", + Identifier = "apollo_models", + Version = 2 +}) local apolloSpiceId = "-908" @@ -59,6 +66,20 @@ local Apollo8Model = { Rotation = {0.0, 0.0, -3.1415 / 2} } }, + Renderable = { + Type = "RenderableModel", + GeometryFile = models .. "/ApolloCSM.fbx", + LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sun_transforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + } + }, + PerformShading = true, + DisableFaceCulling = true + }, GUI = { Hidden = true, Name = "Apollo 8 Model", @@ -82,12 +103,6 @@ local Apollo8Pivot = { } } -local model_part = csm.createCsmModel(Apollo8Model.Identifier) - local list = { Apollo8, Apollo8Model, Apollo8Pivot } -for k,v in pairs(model_part) do - v.GUI.Path = "/Solar System/Missions/Apollo/8/Model" - table.insert(list, v) -end asset_helper.registerSceneGraphNodesAndExport(asset, list) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset b/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset deleted file mode 100644 index 32581a1597..0000000000 --- a/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset +++ /dev/null @@ -1,280 +0,0 @@ --- This asset exports a function to create an Apollo Command and Service Module (CSM). --- Instead of hard-coding the scene graph node parent, --- client assets can decide which object that the CSM should be attached to. --- Usage example: createCsmModel(asset, Apollo8.Idenfitier) --- ...where Apollo8 is the scene graph node identifier to attach the CSM to. - -local asset_helper = asset.require('util/asset_helper') -local sun_transforms = asset.require('scene/solarsystem/sun/transforms') - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_models", - Version = 1 -}) - -local partsInfo = { - -- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading - - -- Exterior - { "AP08_cone_command_module", "Command_module_diff.png", true }, - { "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true }, - { "AP08_cone_vent_ports_black", "black.png", true }, - { "AP08_cone_vent_ports_red", "red.png", true }, - { "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false }, - - { "AP08_service_black", "black.png", true }, - { "AP08_service_brown", "brown.png", true }, - { "AP08_service_grey", "gray.png", true }, - { "AP08_service_high_gain_antenna", "Antenna_diff.png", true }, - { "AP08_service_module", "Service_module_diff.png", true }, - { "AP08_service_nozzle", "Nozzle_diff.png", true }, - { "AP08_service_pink", "pink.png", true }, - { "AP08_service_red", "red.png", true }, - { "AP08_service_scratched_metal", "scratched_metal_gloss.png", true }, - { "AP08_service_white", "white.png", true }, - - -- Interior - -- { "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false}, - -- { "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false }, - -- { "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false }, - -- { "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false }, - -- { "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false }, - -- { "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false }, - -- { "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false }, - -- { "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false }, - -- { "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false }, - -- { "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false }, - -- { "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false }, - -- { "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false }, - -- { "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false }, - -- { "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false }, - -- { "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false }, - -- { "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false }, - -- { "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false }, - -- { "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false }, - -- { "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false }, - -- { "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false }, - -- { "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false }, - -- { "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false }, - -- { "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false }, - -- { "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false }, - -- { "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false }, - -- { "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false }, - -- { "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false }, - -- { "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false }, - -- { "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false }, - -- { "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false }, - -- { "AP11_interior_grey", "gray.png", false }, - -- { "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false }, - -- { "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false }, - -- { "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false }, - -- { "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false }, - -- { "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false }, - -- { "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false }, - -- { "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false }, - -- { "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false }, - -- { "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false }, - -- { "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false }, - -- { "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false }, - -- { "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_pole_end_02", "pole_end_02.png", false }, - -- { "AP11_interior_pole_end_03", "pole_end_03.png", false }, - -- { "AP11_interior_pole_tex_03", "pole_tex_03.png", false }, - -- { "AP11_interior_pole_tex_04", "pole_tex_04.png", false }, - -- { "AP11_interior_pole_tex_05", "pole_tex_05.png", false }, - -- { "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false }, - -- { "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false }, - -- { "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false }, - -- { "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false }, - -- { "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false }, - -- { "AP11_interior_red", "red.png", false }, - -- { "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false }, - -- { "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false }, - -- { "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false }, - -- { "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false }, - -- { "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false }, - -- { "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false }, - -- { "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false }, - -- { "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false }, - -- { "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false }, - -- { "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false }, - -- { "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false }, - -- { "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false }, - -- { "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false }, - -- { "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false }, - -- { "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false } -} - - -local partsInfoFull = { - -- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading - - -- Exterior - { "AP08_cone_command_module", "Command_module_diff.png", true }, - { "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true }, - { "AP08_cone_vent_ports_black", "black.png", true }, - { "AP08_cone_vent_ports_red", "red.png", true }, - { "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false }, - - { "AP08_service_black", "black.png", true }, - { "AP08_service_brown", "brown.png", true }, - { "AP08_service_grey", "gray.png", true }, - { "AP08_service_high_gain_antenna", "Antenna_diff.png", true }, - { "AP08_service_module", "Service_module_diff.png", true }, - { "AP08_service_nozzle", "Nozzle_diff.png", true }, - { "AP08_service_pink", "pink.png", true }, - { "AP08_service_red", "red.png", true }, - { "AP08_service_scratched_metal", "scratched_metal_gloss.png", true }, - { "AP08_service_white", "white.png", true }, - - -- Interior - { "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false }, - { "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false }, - { "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false }, - { "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false }, - { "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false }, - { "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false }, - { "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false }, - { "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false }, - { "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false }, - { "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false }, - { "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false }, - { "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false }, - { "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false }, - { "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false }, - { "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false }, - { "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false }, - { "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false }, - { "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false }, - { "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false }, - { "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false }, - { "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false }, - { "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false }, - { "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false }, - { "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false }, - { "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false }, - { "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false }, - { "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false }, - { "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false }, - { "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false }, - { "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false }, - { "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false }, - { "AP11_interior_grey", "gray.png", false }, - { "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false }, - { "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false }, - { "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false }, - { "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false }, - { "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false }, - { "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false }, - { "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false }, - { "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false }, - { "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false }, - { "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false }, - { "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false }, - { "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false }, - { "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false }, - { "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false }, - { "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false }, - { "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false }, - { "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false }, - { "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false }, - { "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false }, - { "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false }, - { "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false }, - { "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false }, - { "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false }, - { "AP11_interior_pole_end_02", "pole_end_02.png", false }, - { "AP11_interior_pole_end_03", "pole_end_03.png", false }, - { "AP11_interior_pole_tex_03", "pole_tex_03.png", false }, - { "AP11_interior_pole_tex_04", "pole_tex_04.png", false }, - { "AP11_interior_pole_tex_05", "pole_tex_05.png", false }, - { "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false }, - { "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false }, - { "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false }, - { "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false }, - { "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false }, - { "AP11_interior_red", "red.png", false }, - { "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false }, - { "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false }, - { "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false }, - { "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false }, - { "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false }, - { "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false }, - { "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false }, - { "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false }, - { "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false }, - { "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false }, - { "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false }, - { "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false }, - { "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false }, - { "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false }, - { "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false }, - { "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false }, - { "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false }, - { "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false } -} - - - -asset.export("createCsmModel", function (parentNodeIdentifier) - local parts = {} - for i, info in ipairs(partsInfo) do - parts[#parts + 1] = asset_helper.createModelPart( - parentNodeIdentifier, - sun_transforms.SolarSystemBarycenter.Identifier, - models, - info[1], - info[2], - info[3] - ) - end - return parts -end) - - - -asset.export("createCsmModelFull", function (parentNodeIdentifier) - local parts = {} - for i, info in ipairs(partsInfoFull) do - parts[#parts + 1] = asset_helper.createModelPart( - parentNodeIdentifier, - sun_transforms.SolarSystemBarycenter.Identifier, - models, - info[1], - info[2], - info[3] - ) - end - return parts -end) From 256a5db926378f23062705d7729a1e4e0fbdd5e2 Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Mon, 29 Mar 2021 16:06:36 +0200 Subject: [PATCH 02/23] Fix name error --- data/assets/scene/solarsystem/missions/voyager/model.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/scene/solarsystem/missions/voyager/model.asset b/data/assets/scene/solarsystem/missions/voyager/model.asset index cb565ad315..e1d17adda6 100644 --- a/data/assets/scene/solarsystem/missions/voyager/model.asset +++ b/data/assets/scene/solarsystem/missions/voyager/model.asset @@ -1,5 +1,5 @@ local models = asset.syncedResource({ - Name = "New Horizons Model", + Name = "Voyager Model", Type = "HttpSynchronization", Identifier = "voyager_model", Version = 1 From edf42ab083207f385cbfb0ea720560d962adf48d Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Tue, 30 Mar 2021 09:01:04 +0200 Subject: [PATCH 03/23] Move model sync to seperate file --- .../scene/solarsystem/missions/apollo/15/apollo15.asset | 8 +------- .../solarsystem/missions/apollo/8/launch_model.asset | 8 +------- .../scene/solarsystem/missions/apollo/8/model.asset | 8 +------- .../scene/solarsystem/missions/apollo/csm_model.asset | 8 ++++++++ 4 files changed, 11 insertions(+), 21 deletions(-) create mode 100644 data/assets/scene/solarsystem/missions/apollo/csm_model.asset diff --git a/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset b/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset index 3c150626ba..900a9631af 100644 --- a/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset +++ b/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset @@ -2,13 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon') local sun_transforms = asset.require('scene/solarsystem/sun/transforms') asset.require('spice/base') - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_models", - Version = 2 -}) +local models = asset.require('scene/solarsystem/missions/apollo/csm_model').models local kernels = asset.require('scene/solarsystem/missions/apollo/15/kernels').kernels diff --git a/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset b/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset index d957fc8a97..9e5b749c17 100644 --- a/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset +++ b/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset @@ -2,13 +2,7 @@ local asset_helper = asset.require('util/asset_helper') local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') local sun_transforms = asset.require('scene/solarsystem/sun/transforms') local kernels = asset.require('./kernels').kernels - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_models", - Version = 2 -}) +local models = asset.require('scene/solarsystem/missions/apollo/csm_model').models local apolloSpiceId = "-908" diff --git a/data/assets/scene/solarsystem/missions/apollo/8/model.asset b/data/assets/scene/solarsystem/missions/apollo/8/model.asset index a2fa8e32a9..00036a697a 100644 --- a/data/assets/scene/solarsystem/missions/apollo/8/model.asset +++ b/data/assets/scene/solarsystem/missions/apollo/8/model.asset @@ -2,13 +2,7 @@ local asset_helper = asset.require('util/asset_helper') local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') local sun_transforms = asset.require('scene/solarsystem/sun/transforms') local kernels = asset.require('./kernels').kernels - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_models", - Version = 2 -}) +local models = asset.require('scene/solarsystem/missions/apollo/csm_model').models local apolloSpiceId = "-908" diff --git a/data/assets/scene/solarsystem/missions/apollo/csm_model.asset b/data/assets/scene/solarsystem/missions/apollo/csm_model.asset new file mode 100644 index 0000000000..84d52270f5 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/csm_model.asset @@ -0,0 +1,8 @@ +local models = asset.syncedResource({ + Name = "Apollo Models", + Type = "HttpSynchronization", + Identifier = "apollo_models", + Version = 2 +}) + +asset.export('models', models) \ No newline at end of file From ed56ea38559d4deb3b72f44d89c5de5839a12427 Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Tue, 30 Mar 2021 09:04:03 +0200 Subject: [PATCH 04/23] Add new line at end of file --- data/assets/scene/solarsystem/missions/apollo/csm_model.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/scene/solarsystem/missions/apollo/csm_model.asset b/data/assets/scene/solarsystem/missions/apollo/csm_model.asset index 84d52270f5..298640354c 100644 --- a/data/assets/scene/solarsystem/missions/apollo/csm_model.asset +++ b/data/assets/scene/solarsystem/missions/apollo/csm_model.asset @@ -5,4 +5,4 @@ local models = asset.syncedResource({ Version = 2 }) -asset.export('models', models) \ No newline at end of file +asset.export('models', models) From f7e53386fb91e0f642b4d4203fb01f689e3b9075 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 30 Mar 2021 19:44:35 +0200 Subject: [PATCH 05/23] Update Ghoul repository to get Mac working again --- ext/ghoul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ghoul b/ext/ghoul index a5d69fac8b..71bf9d8f51 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit a5d69fac8ba86dc30ebd0966b9d50af2fa7b8028 +Subproject commit 71bf9d8f51e4d11acac24846f1dd84c90e65b86b From d9a1a0233b604f78ca768df05e20ef134faf0a0c Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 30 Mar 2021 22:12:53 +0200 Subject: [PATCH 06/23] Remove apple clang warnings --- apps/OpenSpace/ext/sgct | 2 +- ext/ghoul | 2 +- modules/globebrowsing/src/shadowcomponent.h | 8 -------- modules/space/rendering/renderablesatellites.cpp | 4 ++-- modules/space/rendering/renderablesmallbody.cpp | 8 ++++---- modules/space/rendering/renderablesmallbody.h | 1 - modules/space/rendering/renderablestars.cpp | 4 ++-- .../rendering/renderableplaneprojection.cpp | 6 ------ modules/sync/syncs/urlsynchronization.cpp | 8 +------- modules/volume/tasks/generaterawvolumetask.cpp | 8 -------- support/coding/codegen | 2 +- 11 files changed, 12 insertions(+), 41 deletions(-) diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index c651841a49..669fbc16a9 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit c651841a49c468f2371713f23e90561f0c080d52 +Subproject commit 669fbc16a9910b28333427f5e07235baa43ea7a6 diff --git a/ext/ghoul b/ext/ghoul index 71bf9d8f51..1413844185 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 71bf9d8f51e4d11acac24846f1dd84c90e65b86b +Subproject commit 1413844185b244559b8b90a06e03ddcea33fb2b5 diff --git a/modules/globebrowsing/src/shadowcomponent.h b/modules/globebrowsing/src/shadowcomponent.h index 1862dfe7eb..dddea2fb66 100644 --- a/modules/globebrowsing/src/shadowcomponent.h +++ b/modules/globebrowsing/src/shadowcomponent.h @@ -123,14 +123,6 @@ private: GLboolean _depthIsEnabled; GLboolean _blendIsEnabled = false; - GLenum _faceToCull; - GLenum _depthFunction; - - GLfloat _polygonOffSetFactor; - GLfloat _polygonOffSetUnits; - GLfloat _colorClearValue[4]; - GLfloat _depthClearValue; - glm::vec3 _sunPosition = glm::vec3(0.f); glm::dmat4 _shadowMatrix = glm::dmat4(1.0); diff --git a/modules/space/rendering/renderablesatellites.cpp b/modules/space/rendering/renderablesatellites.cpp index 64d0f887d7..f808be2147 100644 --- a/modules/space/rendering/renderablesatellites.cpp +++ b/modules/space/rendering/renderablesatellites.cpp @@ -90,13 +90,13 @@ RenderableSatellites::RenderableSatellites(const ghoul::Dictionary& dictionary) _updateStartRenderIdxSelect = [this]() { if ((_numObjects - _startRenderIdx) < _sizeRender) { - _sizeRender = _numObjects - _startRenderIdx; + _sizeRender = static_cast(_numObjects - _startRenderIdx); } updateBuffers(); }; _updateRenderSizeSelect = [this]() { if (_sizeRender > (_numObjects - _startRenderIdx)) { - _startRenderIdx = _numObjects - _sizeRender; + _startRenderIdx = static_cast(_numObjects - _sizeRender); } updateBuffers(); }; diff --git a/modules/space/rendering/renderablesmallbody.cpp b/modules/space/rendering/renderablesmallbody.cpp index 0a0259eb98..72414c3453 100644 --- a/modules/space/rendering/renderablesmallbody.cpp +++ b/modules/space/rendering/renderablesmallbody.cpp @@ -113,8 +113,8 @@ documentation::Documentation RenderableSmallBody::Documentation() { RenderableSmallBody::RenderableSmallBody(const ghoul::Dictionary& dictionary) : RenderableOrbitalKepler(dictionary) - , _upperLimit(UpperLimitInfo, 1000, 1, 1000000) , _contiguousMode(ContiguousModeInfo, false) + , _upperLimit(UpperLimitInfo, 1000, 1, 1000000) { codegen::bake(dictionary); @@ -142,7 +142,7 @@ RenderableSmallBody::RenderableSmallBody(const ghoul::Dictionary& dictionary) _updateStartRenderIdxSelect = std::function([this] { if (_contiguousMode) { if ((_numObjects - _startRenderIdx) < _sizeRender) { - _sizeRender = _numObjects - _startRenderIdx; + _sizeRender = static_cast(_numObjects - _startRenderIdx); } _updateDataBuffersAtNextRender = true; } @@ -150,7 +150,7 @@ RenderableSmallBody::RenderableSmallBody(const ghoul::Dictionary& dictionary) _updateRenderSizeSelect = std::function([this] { if (_contiguousMode) { if (_sizeRender > (_numObjects - _startRenderIdx)) { - _startRenderIdx = _numObjects - _sizeRender; + _startRenderIdx = static_cast(_numObjects - _sizeRender); } _updateDataBuffersAtNextRender = true; } @@ -221,7 +221,7 @@ void RenderableSmallBody::readDataFile(const std::string& filename) { else { lineSkipFraction = static_cast(_upperLimit) / static_cast(_numObjects); - endElement = _numObjects - 1; + endElement = static_cast(_numObjects - 1); } if (line.compare(expectedHeaderLine) != 0) { diff --git a/modules/space/rendering/renderablesmallbody.h b/modules/space/rendering/renderablesmallbody.h index 1be028b539..b55c114d65 100644 --- a/modules/space/rendering/renderablesmallbody.h +++ b/modules/space/rendering/renderablesmallbody.h @@ -59,7 +59,6 @@ private: /// The index array that is potentially used in the draw call. If this is empty, no /// element draw call is used. std::vector _indexBufferData; - bool contiguousMode = true; properties::BoolProperty _contiguousMode; properties::UIntProperty _upperLimit; properties::Property::OnChangeHandle _contiguousModeCallbackhandle; diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index 17d576693e..1ce1c04748 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -771,8 +771,8 @@ void RenderableStars::loadPSFTexture() { void RenderableStars::renderPSFToTexture() { // Saves current FBO first - GLint defaultFBO; - defaultFBO = global::renderEngine->openglStateCache().defaultFramebuffer(); + // GLint defaultFBO; + // defaultFBO = global::renderEngine->openglStateCache().defaultFramebuffer(); // GLint m_viewport[4]; // global::renderEngine.openglStateCache().viewPort(m_viewport); diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp index 5f2d224c3b..be21ff31a0 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp @@ -45,12 +45,6 @@ namespace { constexpr const char* _loggerCat = "RenderablePlaneProjection"; - constexpr const char* KeySpacecraft = "Spacecraft"; - constexpr const char* KeyInstrument = "Instrument"; - constexpr const char* KeyMoving = "Moving"; - constexpr const char* KeyTexture = "Texture"; - constexpr const char* KeyName = "Name"; - constexpr const char* KeyTarget = "DefaultTarget"; constexpr const char* GalacticFrame = "GALACTIC"; struct [[codegen::Dictionary(RenderablePlaneProjection)]] Parameters { diff --git a/modules/sync/syncs/urlsynchronization.cpp b/modules/sync/syncs/urlsynchronization.cpp index 0f6bc61aa9..b1c75a80a6 100644 --- a/modules/sync/syncs/urlsynchronization.cpp +++ b/modules/sync/syncs/urlsynchronization.cpp @@ -41,12 +41,6 @@ #include namespace { - constexpr const char* KeyUrl = "Url"; - constexpr const char* KeyIdentifier = "Identifier"; - constexpr const char* KeyOverride = "Override"; - constexpr const char* KeyUseHash = "UseHash"; - constexpr const char* KeyFilename = "Filename"; - constexpr const char* TempSuffix = ".tmp"; struct [[codegen::Dictionary(UrlSynchronization)]] Parameters { @@ -130,7 +124,7 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dict, documentation::TestResult res; res.success = false; documentation::TestResult::Offense o; - o.offender = std::string(KeyIdentifier) + "|" + KeyUseHash; + o.offender = "Identifier|UseHash"; o.reason = documentation::TestResult::Offense::Reason::MissingKey; res.offenses.push_back(o); throw documentation::SpecificationError(std::move(res), "UrlSynchronization"); diff --git a/modules/volume/tasks/generaterawvolumetask.cpp b/modules/volume/tasks/generaterawvolumetask.cpp index e0774bec63..53372f91f8 100644 --- a/modules/volume/tasks/generaterawvolumetask.cpp +++ b/modules/volume/tasks/generaterawvolumetask.cpp @@ -41,14 +41,6 @@ #include namespace { - constexpr const char* KeyRawVolumeOutput = "RawVolumeOutput"; - constexpr const char* KeyDictionaryOutput = "DictionaryOutput"; - constexpr const char* KeyDimensions = "Dimensions"; - constexpr const char* KeyTime = "Time"; - constexpr const char* KeyValueFunction = "ValueFunction"; - constexpr const char* KeyLowerDomainBound = "LowerDomainBound"; - constexpr const char* KeyUpperDomainBound = "UpperDomainBound"; - struct [[codegen::Dictionary(GenerateRawVolumeTask)]] Parameters { // The Lua function used to compute the cell values std::string valueFunction [[codegen::annotation("A Lua expression that returns a " diff --git a/support/coding/codegen b/support/coding/codegen index 1aac589ded..d1e354f072 160000 --- a/support/coding/codegen +++ b/support/coding/codegen @@ -1 +1 @@ -Subproject commit 1aac589ded45ff416cc7f8673fcfd37095819bc2 +Subproject commit d1e354f07257d37b241d7c8d3a85eef3d0cb62bd From 7fefbf9ea0303975311f2c96c5ebb5110f865d39 Mon Sep 17 00:00:00 2001 From: Gene Payne Date: Wed, 31 Mar 2021 19:33:50 -0600 Subject: [PATCH 07/23] Added CMake variable to avoid minizip error with assimp update on linux --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c98d8f77f..c29f718631 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,7 +107,8 @@ linux_gcc_make: { } stage('linux-gcc-make/build') { def cmakeCompileOptions = moduleCMakeFlags(); - cmakeCompileOptions += ' -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS:STRING="-DGLM_ENABLE_EXPERIMENTAL" -DOpenGL_GL_PREFERENCE:STRING=GLVND'; + cmakeCompileOptions += ' -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS:STRING="-DGLM_ENABLE_EXPERIMENTAL"'; + cmakeCompileOptions += ' -DOpenGL_GL_PREFERENCE:STRING=GLVND -DASSIMP_BUILD_MINIZIP=1'; // Not sure why the linking of OpenSpaceTest takes so long compileHelper.build(compileHelper.Make(), compileHelper.Gcc(), cmakeCompileOptions, 'OpenSpace', 'build-make'); compileHelper.recordCompileIssues(compileHelper.Gcc()); From 52b020d836952e5662dca6374f6c31b39fc4aead Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 1 Apr 2021 23:37:35 +0200 Subject: [PATCH 08/23] Include strict lua file, throw error in configuration loading when overriding with unused variable - Preventing True/true bug - Fix issue with unused variable in configuration_helper --- scripts/configuration_helper.lua | 2 +- scripts/strict.lua | 40 ++++++++++++++++++++++++++++++++ src/engine/configuration.cpp | 4 ++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 scripts/strict.lua diff --git a/scripts/configuration_helper.lua b/scripts/configuration_helper.lua index 970314a89a..84dd547e75 100644 --- a/scripts/configuration_helper.lua +++ b/scripts/configuration_helper.lua @@ -702,7 +702,7 @@ function sgct.config.single(arg) ) sgctconfiginitializeString = "sgct.config.single" - trackedSpecifier = "tracked=\"true\"" + local trackedSpecifier = "tracked=\"true\"" if (arg["tracked"] ~= nil and arg["tracked"] == false) then trackedSpecifier = "tracked=\"false\"" diff --git a/scripts/strict.lua b/scripts/strict.lua new file mode 100644 index 0000000000..088ef4c62d --- /dev/null +++ b/scripts/strict.lua @@ -0,0 +1,40 @@ +-- strict.lua +-- checks uses of undeclared global variables +-- All global variables must be 'declared' through a regular assignment +-- (even assigning nil will do) in a main chunk before being used +-- anywhere or assigned to inside a function. +-- distributed under the Lua license: http://www.lua.org/license.html + +local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget + +local mt = getmetatable(_G) +if mt == nil then + mt = {} + setmetatable(_G, mt) +end + +mt.__declared = {} + +local function what () + local d = getinfo(3, "S") + return d and d.what or "C" +end + +mt.__newindex = function (t, n, v) + if not mt.__declared[n] then + local w = what() + if w ~= "main" and w ~= "C" then + error("assign to undeclared variable '"..n.."'", 2) + end + mt.__declared[n] = true + end + rawset(t, n, v) +end + +mt.__index = function (t, n) + if not mt.__declared[n] and what() ~= "C" then + error("variable '"..n.."' is not declared", 2) + end + return rawget(t, n) +end + diff --git a/src/engine/configuration.cpp b/src/engine/configuration.cpp index f063bded20..e168e90877 100644 --- a/src/engine/configuration.cpp +++ b/src/engine/configuration.cpp @@ -37,6 +37,7 @@ namespace { // We can't use ${SCRIPTS} here as that hasn't been defined by this point constexpr const char* InitialConfigHelper = "${BASE}/scripts/configuration_helper.lua"; + constexpr const char* StrictLuaScript = "${BASE}/scripts/strict.lua"; struct [[codegen::Dictionary(Configuration)]] Parameters { // The SGCT configuration file that determines the window and view frustum @@ -649,6 +650,9 @@ Configuration loadConfigurationFromFile(const std::string& filename, if (FileSys.fileExists(absPath(InitialConfigHelper))) { ghoul::lua::runScriptFile(result.state, absPath(InitialConfigHelper)); } + if (FileSys.fileExists(absPath(StrictLuaScript))) { + ghoul::lua::runScriptFile(result.state, absPath(StrictLuaScript)); + } // Load the configuration file into the state ghoul::lua::runScriptFile(result.state, filename); From 9ef11c4c0d4c65b9dea351d9380169ef263632d3 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Tue, 6 Apr 2021 10:44:18 -0400 Subject: [PATCH 09/23] Update spherical_mirror.xml fixing path for mesh --- config/spherical_mirror.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/spherical_mirror.xml b/config/spherical_mirror.xml index fc98729758..f15de39d45 100644 --- a/config/spherical_mirror.xml +++ b/config/spherical_mirror.xml @@ -19,7 +19,7 @@ --> - + From 923ad3f8ce5bd6bb2d8466f176cc18801237da2b Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 9 Apr 2021 13:58:43 +0200 Subject: [PATCH 10/23] Fix misspelled 'codegen' --- .../rendering/renderablebillboardscloud.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index 6bc06860c8..01a28f5214 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -273,32 +273,32 @@ namespace { // The number of sides for the polygon used to represent the astronomical object std::optional polygonSides; - // [[codgen::verbatim(DrawLabelInfo.description)]] + // [[codegen::verbatim(DrawLabelInfo.description)]] std::optional drawLabels; - // [[codgen::verbatim(TextColorInfo.description)]] + // [[codegen::verbatim(TextColorInfo.description)]] std::optional textColor [[codegen::color()]]; - // [[codgen::verbatim(TextOpacityInfo.description)]] + // [[codegen::verbatim(TextOpacityInfo.description)]] std::optional textOpacity; - // [[codgen::verbatim(TextSizeInfo.description)]] + // [[codegen::verbatim(TextSizeInfo.description)]] std::optional textSize; // The path to the label file that contains information about the astronomical // objects being rendered std::optional labelFile; - // [[codgen::verbatim(LabelMinSizeInfo.description)]] + // [[codegen::verbatim(LabelMinSizeInfo.description)]] std::optional textMinSize; - // [[codgen::verbatim(LabelMaxSizeInfo.description)]] + // [[codegen::verbatim(LabelMaxSizeInfo.description)]] std::optional textMaxSize; - // [[codgen::verbatim(ColorOptionInfo.description)]] + // [[codegen::verbatim(ColorOptionInfo.description)]] std::optional> colorOption; - // [[codgen::verbatim(SizeOptionInfo.description)]] + // [[codegen::verbatim(SizeOptionInfo.description)]] std::optional> sizeOption; // This value determines the colormap ranges for the color parameters of the @@ -308,28 +308,28 @@ namespace { // Transformation matrix to be applied to each astronomical object std::optional transformationMatrix; - // [[codgen::verbatim(FadeInDistancesInfo.description)]] + // [[codegen::verbatim(FadeInDistancesInfo.description)]] std::optional fadeInDistances; - // [[codgen::verbatim(DisableFadeInInfo.description)]] + // [[codegen::verbatim(DisableFadeInInfo.description)]] std::optional disableFadeIn; - // [[codgen::verbatim(BillboardMaxSizeInfo.description)]] + // [[codegen::verbatim(BillboardMaxSizeInfo.description)]] std::optional billboardMaxSize; - // [[codgen::verbatim(BillboardMinSizeInfo.description)]] + // [[codegen::verbatim(BillboardMinSizeInfo.description)]] std::optional billboardMinSize; - // [[codgen::verbatim(CorrectionSizeEndDistanceInfo.description)]] + // [[codegen::verbatim(CorrectionSizeEndDistanceInfo.description)]] std::optional correctionSizeEndDistance; - // [[codgen::verbatim(CorrectionSizeFactorInfo.description)]] + // [[codegen::verbatim(CorrectionSizeFactorInfo.description)]] std::optional correctionSizeFactor; - // [[codgen::verbatim(PixelSizeControlInfo.description)]] + // [[codegen::verbatim(PixelSizeControlInfo.description)]] std::optional enablePixelSizeControl; - // [[codgen::verbatim(UseLinearFiltering.description)]] + // [[codegen::verbatim(UseLinearFiltering.description)]] std::optional useLinearFiltering; }; #include "renderablebillboardscloud_codegen.cpp" From ab6f5c037b3ef2b4eeecfbc5682b37a38b8243ac Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 9 Apr 2021 15:36:19 +0200 Subject: [PATCH 11/23] Update DU Kepler planetary candidates data version Removes an outlier from a faulty datapoint --- data/assets/scene/digitaluniverse/kepler.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/scene/digitaluniverse/kepler.asset b/data/assets/scene/digitaluniverse/kepler.asset index 04fc503c77..1d5834487a 100644 --- a/data/assets/scene/digitaluniverse/kepler.asset +++ b/data/assets/scene/digitaluniverse/kepler.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Kepler Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_kepler_speck", - Version = 2 + Version = 3 }) local object = { From 73c0bc1d9c8b217c8e58cbca4442b4e8d62d20e6 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Mon, 12 Apr 2021 10:44:11 -0400 Subject: [PATCH 12/23] Update gui_projector.xml update capitalization on fullscreen in config --- config/gui_projector.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/gui_projector.xml b/config/gui_projector.xml index 21e9d09a9f..9ac213193b 100644 --- a/config/gui_projector.xml +++ b/config/gui_projector.xml @@ -4,7 +4,7 @@ - + @@ -17,7 +17,7 @@ - + From a62b71ac81f349e9ca2cca9ccf5c4178898a2f20 Mon Sep 17 00:00:00 2001 From: Gene Payne Date: Tue, 13 Apr 2021 12:59:45 -0600 Subject: [PATCH 13/23] Update CMake options for gcc linux build --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ab1ca6c9..c3e35daafc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,9 +134,19 @@ endif () option(OPENSPACE_WITH_ABUFFER_RENDERER "Compile ABuffer Renderer" OFF) -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") +if (UNIX) + if (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") + else () + if(NOT CMAKE_BUILD_TYPE) + #Can set to "RelWithDebInfo" or "Debug" also, but problems occur if this is blank by default + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Default build type" FORCE) + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLM_ENABLE_EXPERIMENTAL" CACHE STRING "" FORCE) + set(OpenGL_GL_PREFERENCE "GLVND" CACHE STRING "OpenGL Preference setting necessary for linux" FORCE) + set(ASSIMP_BUILD_MINIZIP ON CACHE BOOL "Set to have assimp build minizip" FORCE) + endif () endif () add_subdirectory(ext) From 54e5050b53c4e0287080e290d09989c1eb923faa Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Wed, 14 Apr 2021 16:09:50 +0200 Subject: [PATCH 14/23] Ignore joystick input in deadzone, fixes #678 --- src/interaction/joystickcamerastates.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/interaction/joystickcamerastates.cpp b/src/interaction/joystickcamerastates.cpp index 75c0e40306..78a9f97506 100644 --- a/src/interaction/joystickcamerastates.cpp +++ b/src/interaction/joystickcamerastates.cpp @@ -56,8 +56,7 @@ void JoystickCameraStates::updateStateFromInput(const InputState& inputState, float value = inputState.joystickAxis(i); if (std::fabs(value) <= t.deadzone) { - value = 0.f; - hasValue = false; + continue; } if (t.normalize) { From d32a09ba809bbd845cf22a098851eacf7e8ed4da Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 15 Apr 2021 13:01:00 +0200 Subject: [PATCH 15/23] Feature/strict lua (#1556) Make all LuaState strict to check whether uninitialized variables are used Adapt the existing assets to work with the strict state --- .../dwarf_planets/pluto/charon/charon.asset | 3 +- .../dwarf_planets/pluto/minor/kerberos.asset | 3 +- .../dwarf_planets/pluto/minor/nix.asset | 3 +- .../dwarf_planets/pluto/minor/styx.asset | 4 +- .../dwarf_planets/pluto/pluto.asset | 3 +- .../missions/apollo/11/lem_flipbook.asset | 9 +---- .../missions/messenger/messengerSC.asset | 2 +- .../missions/newhorizons/pluto.asset | 1 + .../neptune/irregular_prograde_moons.asset | 2 +- data/assets/util/asset_helper.asset | 6 +-- data/assets/util/procedural_globe.asset | 2 +- data/assets/util/static_server.asset | 2 +- data/assets/util/tle_helper.asset | 2 +- ext/ghoul | 2 +- .../globebrowsing/scripts/layer_support.lua | 40 +++++++++++++------ scripts/strict.lua | 40 ------------------- src/engine/configuration.cpp | 4 -- support/coding/codegen | 2 +- 18 files changed, 46 insertions(+), 84 deletions(-) delete mode 100644 scripts/strict.lua diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset index 4b6aa574c2..0d45b5abd9 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset @@ -13,8 +13,7 @@ local Charon = { Translation = { Type = "SpiceTranslation", Target = "CHARON", - Observer = "PLUTO BARYCENTER", - Kernels = NewHorizonsKernels + Observer = "PLUTO BARYCENTER" }, Rotation = { Type = "SpiceRotation", diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset index 0434de709b..fb2ddb43a6 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset @@ -11,8 +11,7 @@ local Kerberos = { Translation = { Type = "SpiceTranslation", Target = "KERBEROS", - Observer = "PLUTO BARYCENTER", - Kernels = PlutoKernels + Observer = "PLUTO BARYCENTER" } }, Renderable = { diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset index bea389470d..c5f7e03923 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset @@ -11,8 +11,7 @@ local Nix = { Translation = { Type = "SpiceTranslation", Target = "NIX", - Observer = "PLUTO BARYCENTER", - Kernels = PlutoKernels + Observer = "PLUTO BARYCENTER" } }, Renderable = { diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset index 25c369e4e7..bc54df433a 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset @@ -3,7 +3,6 @@ local transforms = asset.require('../transforms') local kernels = asset.require('../kernels').PlutoKernels - local Styx = { Identifier = "Styx", Parent = transforms.PlutoBarycenter.Identifier, @@ -11,8 +10,7 @@ local Styx = { Translation = { Type = "SpiceTranslation", Target = "STYX", - Observer = "PLUTO BARYCENTER", - Kernels = PlutoKernels + Observer = "PLUTO BARYCENTER" } }, Renderable = { diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset index 5299ebc5dd..968a7edd86 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset @@ -13,8 +13,7 @@ local Pluto = { Translation = { Type = "SpiceTranslation", Target = "PLUTO", - Observer = "PLUTO BARYCENTER", - Kernels = NewHorizonsKernels + Observer = "PLUTO BARYCENTER" }, Rotation = { Type = "SpiceRotation", diff --git a/data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset b/data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset index a716eb4626..06e4259d50 100644 --- a/data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset +++ b/data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset @@ -18,13 +18,8 @@ asset.onInitialize(function () openspace.globebrowsing.addBlendingLayersFromDirectory(vrts, assetGlobe); flipbook = helper.createFlipbook(assetPrefix, assetGlobe, 19); - function nextFlip() - helper.nextFlipbookPage(flipbook); - end - - function previousFlip() - helper.previousFlipbookPage(flipbook); - end + rawset(_G, "nextFlip", function() helper.nextFlipbookPage(flipbook) end) + rawset(_G, "previousFlip", function() helper.previousFlipbookPage(flipbook) end) openspace.bindKey("p", "nextFlip()", "Show the next Apollo 11 flipbook image.", "Next A11 flip", "/Missions/Apollo/11") openspace.bindKey("o", "previousFlip()","Show the previous Apollo 11 flipbook image.", "Prev A11 flip", "/Missions/Apollo/11") diff --git a/data/assets/scene/solarsystem/missions/messenger/messengerSC.asset b/data/assets/scene/solarsystem/missions/messenger/messengerSC.asset index ce2f3b32bc..68e23b4742 100644 --- a/data/assets/scene/solarsystem/missions/messenger/messengerSC.asset +++ b/data/assets/scene/solarsystem/missions/messenger/messengerSC.asset @@ -172,7 +172,7 @@ local MessengerTrail = { Type = "SpiceTranslation", Target = "MESSENGER", Observer = "MERCURY BARYCENTER", - Kernels = Kernels + Kernels = LocalKernels }, Color = { 0.288, 0.375, 0.934 }, EnableFade = false, diff --git a/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset b/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset index 3a963722e2..35210c0e09 100644 --- a/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset +++ b/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset @@ -1,6 +1,7 @@ local assetHelper = asset.require('util/asset_helper') local transforms = asset.require('./transforms') local sunTransforms = asset.require('scene/solarsystem/sun/transforms') +local NewHorizonsKernels = asset.require('./kernels').NewHorizonsKernels local assets = asset.syncedResource({ Name = "Pluto Assets", diff --git a/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset b/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset index 632ebd6859..826e6366c4 100644 --- a/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset +++ b/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset @@ -3,7 +3,7 @@ local proceduralGlobes = asset.require('util/procedural_globe') local transforms = asset.require('./transforms') local kernels = asset.require('./kernels') local kernel081 = kernels.nep081 -local kernel087 = kernels.nep087 +local kernel086 = kernels.nep086 local kernel088 = kernels.nep088 diff --git a/data/assets/util/asset_helper.asset b/data/assets/util/asset_helper.asset index 77a28382f1..e5cf1582e6 100644 --- a/data/assets/util/asset_helper.asset +++ b/data/assets/util/asset_helper.asset @@ -13,7 +13,7 @@ local registerSpiceKernels = function (spiceAsset, kernels) end) spiceAsset.onDeinitialize(function () for i = #kernels, 1, -1 do - kernel = kernels[i] + local kernel = kernels[i] openspace.spice.unloadKernel(kernel) end end) @@ -75,7 +75,7 @@ local registerDashboardItems = function (dashboardAsset, items) ) dashboardAsset.onDeinitialize(function () for i = #items, 1, -1 do - item = items[i] + local item = items[i] openspace.dashboard.removeDashboardItem(item.Identifier) end end) @@ -103,7 +103,7 @@ local registerSceneGraphNodesAndExport = function (sceneAsset, nodes, override) end) sceneAsset.onDeinitialize(function () for i = #nodes, 1, -1 do - node = nodes[i] + local node = nodes[i] openspace.removeSceneGraphNode(node.Identifier) end end) diff --git a/data/assets/util/procedural_globe.asset b/data/assets/util/procedural_globe.asset index 23198f2e65..4c34de326a 100644 --- a/data/assets/util/procedural_globe.asset +++ b/data/assets/util/procedural_globe.asset @@ -68,7 +68,7 @@ local createGlobes = function(t) end end - result = {} + local result = {} for i, v in ipairs(t) do local globe = nil diff --git a/data/assets/util/static_server.asset b/data/assets/util/static_server.asset index 3e98da9fdd..936f18277f 100644 --- a/data/assets/util/static_server.asset +++ b/data/assets/util/static_server.asset @@ -10,7 +10,7 @@ local backend = asset.syncedResource({ asset.onInitialize(function () -- Unzip the server bundle - dest = backend .. "/backend" + local dest = backend .. "/backend" if not openspace.directoryExists(dest) then openspace.unzipFile(backend .. "/backend.zip", dest, true) end diff --git a/data/assets/util/tle_helper.asset b/data/assets/util/tle_helper.asset index fdcccdbb43..6a80121695 100644 --- a/data/assets/util/tle_helper.asset +++ b/data/assets/util/tle_helper.asset @@ -24,7 +24,7 @@ end -- Check format of a set of 3 TLE file lines and return nonzero if there is a format error function isValidTLEFileFormat(lineArr) - function isEmpty(s) return s == nil or s == '' end + local function isEmpty(s) return s == nil or s == '' end if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then return false diff --git a/ext/ghoul b/ext/ghoul index 1413844185..bddc5370d7 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 1413844185b244559b8b90a06e03ddcea33fb2b5 +Subproject commit bddc5370d7dd8bc8ab05f2a234a12f2d0e266ca4 diff --git a/modules/globebrowsing/scripts/layer_support.lua b/modules/globebrowsing/scripts/layer_support.lua index 9771fd8b3f..e6153e0d84 100644 --- a/modules/globebrowsing/scripts/layer_support.lua +++ b/modules/globebrowsing/scripts/layer_support.lua @@ -118,7 +118,7 @@ end openspace.globebrowsing.createTemporalGibsGdalXml = function (layerName, startDate, endDate, timeResolution, resolution, format, temporalFormat) temporalFormat = temporalFormat or 'YYYY-MM-DD' - temporalTemplate = + local temporalTemplate = "" .. "" .. startDate .. "" .. "" .. endDate .. "" .. @@ -130,7 +130,7 @@ openspace.globebrowsing.createTemporalGibsGdalXml = function (layerName, startDa end openspace.globebrowsing.createGibsGdalXml = function (layerName, date, resolution, format) - tileLevel = 5 + local tileLevel = 5 -- These resolutions are defined by GIBS: https://wiki.earthdata.nasa.gov/display/GIBS/GIBS+API+for+Developers#GIBSAPIforDevelopers-Script-levelAccessviaGDAL if resolution == "2km" then tileLevel = 5 @@ -153,7 +153,7 @@ openspace.globebrowsing.createGibsGdalXml = function (layerName, date, resolutio return "" end - rasterCount = 3 + local rasterCount = 3 if format == "jpg" then if layerName == "ASTER_GDEM_Greyscale_Shaded_Relief" then rasterCount = 1 @@ -167,7 +167,7 @@ openspace.globebrowsing.createGibsGdalXml = function (layerName, date, resolutio return "" end - gdalWmsTemplate = + local gdalWmsTemplate = "" .. "" .. "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/" .. @@ -198,14 +198,21 @@ openspace.globebrowsing.createGibsGdalXml = function (layerName, date, resolutio end openspace.globebrowsing.parseInfoFile = function (file) - Name = nil - Identifier = nil - Description = nil - ColorFile = nil - HeightFile = nil + -- We are loading these values from an external info file and since we are switching + -- to a strict Lua, we need to predefine these global variables + local function declare(name) + rawset(_G, name, "") + end + + declare("Name") + declare("Identifier") + declare("Description") + declare("ColorFile") + declare("HeightFile") + declare("Location") local dir = openspace.directoryForPath(file) - file_func, error = loadfile(file) + local file_func, error = loadfile(file) if file_func then file_func() else @@ -213,6 +220,15 @@ openspace.globebrowsing.parseInfoFile = function (file) return nil, nil, nil, nil end + -- Hoist the global variables into local space + local Name = rawget(_G, "Name") + local Identifier = rawget(_G, "Identifier") + local Description = rawget(_G, "Description") + local ColorFile = rawget(_G, "ColorFile") + local HeightFile = rawget(_G, "HeightFile") + local Location = rawget(_G, "Location") + + -- Now we can start local name = Name or Identifier local identifier = Identifier or Name @@ -222,7 +238,7 @@ openspace.globebrowsing.parseInfoFile = function (file) end local color = nil - if ColorFile then + if ColorFile and ColorFile ~= "" then color = { Identifier = identifier, Name = name, @@ -233,7 +249,7 @@ openspace.globebrowsing.parseInfoFile = function (file) end local height = nil - if HeightFile then + if HeightFile and HeightFile ~= "" then height = { Identifier = identifier, Name = name, diff --git a/scripts/strict.lua b/scripts/strict.lua deleted file mode 100644 index 088ef4c62d..0000000000 --- a/scripts/strict.lua +++ /dev/null @@ -1,40 +0,0 @@ --- strict.lua --- checks uses of undeclared global variables --- All global variables must be 'declared' through a regular assignment --- (even assigning nil will do) in a main chunk before being used --- anywhere or assigned to inside a function. --- distributed under the Lua license: http://www.lua.org/license.html - -local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget - -local mt = getmetatable(_G) -if mt == nil then - mt = {} - setmetatable(_G, mt) -end - -mt.__declared = {} - -local function what () - local d = getinfo(3, "S") - return d and d.what or "C" -end - -mt.__newindex = function (t, n, v) - if not mt.__declared[n] then - local w = what() - if w ~= "main" and w ~= "C" then - error("assign to undeclared variable '"..n.."'", 2) - end - mt.__declared[n] = true - end - rawset(t, n, v) -end - -mt.__index = function (t, n) - if not mt.__declared[n] and what() ~= "C" then - error("variable '"..n.."' is not declared", 2) - end - return rawget(t, n) -end - diff --git a/src/engine/configuration.cpp b/src/engine/configuration.cpp index e168e90877..f063bded20 100644 --- a/src/engine/configuration.cpp +++ b/src/engine/configuration.cpp @@ -37,7 +37,6 @@ namespace { // We can't use ${SCRIPTS} here as that hasn't been defined by this point constexpr const char* InitialConfigHelper = "${BASE}/scripts/configuration_helper.lua"; - constexpr const char* StrictLuaScript = "${BASE}/scripts/strict.lua"; struct [[codegen::Dictionary(Configuration)]] Parameters { // The SGCT configuration file that determines the window and view frustum @@ -650,9 +649,6 @@ Configuration loadConfigurationFromFile(const std::string& filename, if (FileSys.fileExists(absPath(InitialConfigHelper))) { ghoul::lua::runScriptFile(result.state, absPath(InitialConfigHelper)); } - if (FileSys.fileExists(absPath(StrictLuaScript))) { - ghoul::lua::runScriptFile(result.state, absPath(StrictLuaScript)); - } // Load the configuration file into the state ghoul::lua::runScriptFile(result.state, filename); diff --git a/support/coding/codegen b/support/coding/codegen index d1e354f072..2efd176817 160000 --- a/support/coding/codegen +++ b/support/coding/codegen @@ -1 +1 @@ -Subproject commit d1e354f07257d37b241d7c8d3a85eef3d0cb62bd +Subproject commit 2efd1768176c1559b8eda3cbdcaeea2ded46e145 From e75fe4294314fe47118fe11e4c1a7e41e9cc3d56 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 16 Apr 2021 12:49:44 +0200 Subject: [PATCH 16/23] Enable support for single double radius in SizeReferenceTileProvider (closes #1562) --- .../moon/layers/overlays/size_reference.asset | 15 +++++++++++++++ modules/globebrowsing/src/tileprovider.cpp | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 data/assets/scene/solarsystem/planets/earth/moon/layers/overlays/size_reference.asset diff --git a/data/assets/scene/solarsystem/planets/earth/moon/layers/overlays/size_reference.asset b/data/assets/scene/solarsystem/planets/earth/moon/layers/overlays/size_reference.asset new file mode 100644 index 0000000000..030be3572d --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/moon/layers/overlays/size_reference.asset @@ -0,0 +1,15 @@ +local moonAsset = asset.require("./../../moon").Moon +local globeIdentifier = moonAsset.Identifier + +local layer ={ + Identifier = "Size_Reference", + Name = "Size Reference", + Type = "SizeReferenceTileLayer", + Radii = moonAsset.Renderable.Radii +} + +asset.onInitialize(function () + openspace.globebrowsing.addLayer(globeIdentifier, "Overlays", layer) +end) + +asset.export("layer", layer) diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index 379857325d..ddf1200ed9 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -657,6 +657,10 @@ SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& di if (dictionary.hasValue(sizereferenceprovider::KeyRadii)) { ellipsoid = dictionary.value(sizereferenceprovider::KeyRadii); } + else if (dictionary.hasValue(sizereferenceprovider::KeyRadii)) { + const double r = dictionary.value(sizereferenceprovider::KeyRadii); + ellipsoid = glm::dvec3(r, r, r); + } } From fd17f51959b0a43467ae51303390abeacd3f907e Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 16 Apr 2021 13:11:33 +0200 Subject: [PATCH 17/23] Fix Taskrunner compile error (closes #1554) --- apps/TaskRunner/main.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/TaskRunner/main.cpp b/apps/TaskRunner/main.cpp index 76b37e0f5e..7e038fe34d 100644 --- a/apps/TaskRunner/main.cpp +++ b/apps/TaskRunner/main.cpp @@ -122,7 +122,13 @@ int main(int argc, char** argv) { ); std::string configFile = configuration::findConfiguration(); - *global::configuration = configuration::loadConfigurationFromFile(configFile); + + // Register the base path as the directory where the configuration file lives + std::string base = ghoul::filesystem::File(configFile).directoryName(); + constexpr const char* BasePathToken = "${BASE}"; + FileSys.registerPathToken(BasePathToken, base); + + *global::configuration = configuration::loadConfigurationFromFile(configFile, ""); openspace::global::openSpaceEngine->registerPathTokens(); global::openSpaceEngine->initialize(); @@ -131,7 +137,7 @@ int main(int argc, char** argv) { ghoul::cmdparser::CommandlineParser::AllowUnknownCommands::Yes ); - std::string tasksPath = ""; + std::string tasksPath; commandlineParser.addCommand( std::make_unique>( tasksPath, @@ -146,7 +152,7 @@ int main(int argc, char** argv) { //FileSys.setCurrentDirectory(launchDirectory); - if (tasksPath != "") { + if (!tasksPath.empty()) { performTasks(tasksPath); return 0; } From cd29e29b00bac76d9eb1b5d4c2fe7cf9185932f3 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 16 Apr 2021 14:49:12 +0200 Subject: [PATCH 18/23] Update the constellation art (closes #1553) --- .../constellations/constellation_art.asset | 2 +- .../constellation_extrakeybinds.asset | 40 +++++++++++++++++++ .../constellation_keybinds.asset | 14 +++---- 3 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 data/assets/scene/milkyway/constellations/constellation_extrakeybinds.asset diff --git a/data/assets/scene/milkyway/constellations/constellation_art.asset b/data/assets/scene/milkyway/constellations/constellation_art.asset index c77fa2e29f..cc0db4c8d9 100644 --- a/data/assets/scene/milkyway/constellations/constellation_art.asset +++ b/data/assets/scene/milkyway/constellations/constellation_art.asset @@ -5,7 +5,7 @@ local images = asset.syncedResource({ Name = "Constellation Images", Type = "HttpSynchronization", Identifier = "constellation_images", - Version = 2 + Version = 3 }) --function that reads the file diff --git a/data/assets/scene/milkyway/constellations/constellation_extrakeybinds.asset b/data/assets/scene/milkyway/constellations/constellation_extrakeybinds.asset new file mode 100644 index 0000000000..35ea29873f --- /dev/null +++ b/data/assets/scene/milkyway/constellations/constellation_extrakeybinds.asset @@ -0,0 +1,40 @@ +local scene_helper = asset.require('util/scene_helper') + +local Keybindings = { + + { + Key = "v", + Name = "Show Constellation Art", + Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0);" .. + "openspace.setPropertyValue('{zodiac}.Renderable.Enabled',true);" .. + "openspace.setPropertyValue('{zodiac}.Renderable.Opacity', 1, 2);", + Documentation = "Enables and fades up zodiac art work", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "Shift+v", + Name = "Show Constellation Art", + Command = "openspace.setPropertyValue('{zodiac}.Renderable.Opacity', 0, 2);", + Documentation = "fades down zodiac art work", + GuiPath = "/Rendering", + Local = false + }, +} + +asset.onInitialize(function () + scene_helper.bindKeys(Keybindings) +end) + +asset.onDeinitialize(function () + scene_helper.unbindKeys(Keybindings) +end) + +asset.meta = { + Name = "Constellation Image Extra Keybinds", + Version = "1.0", + Description = "Artistic images depicting the constellations", + Author = "James Hedberg", + URL = "http://jameshedberg.com", + License = "CC-BY" +} diff --git a/data/assets/scene/milkyway/constellations/constellation_keybinds.asset b/data/assets/scene/milkyway/constellations/constellation_keybinds.asset index ac310f24a2..08765add84 100644 --- a/data/assets/scene/milkyway/constellations/constellation_keybinds.asset +++ b/data/assets/scene/milkyway/constellations/constellation_keybinds.asset @@ -6,7 +6,7 @@ local Keybindings = { Name = "Show Constellation Art", Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0);" .. "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Enabled', true);" .. - "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0.1, 2);", + "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0.2, 2);", Documentation = "Enables and fades up constellation art work", GuiPath = "/Rendering", Local = false @@ -39,10 +39,10 @@ end) asset.meta = { - Name = "Constellation Image Keybinds", - Version = "1.0", - Description = "Keybinds for fading in and out the constellations", - Author = "OpenSpace Team", - URL = "http://openspaceproject.com", - License = "MIT License" + Name = "Constellation Image Keybinds", + Version = "1.0", + Description = "Artistic images depicting the constellations", + Author = "James Hedberg", + URL = "http://jameshedberg.com", + License = "CC-BY" } From fdee3d4faf2d7a0aeec12ca80d0e30aee7e51716 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 16 Apr 2021 16:14:02 +0200 Subject: [PATCH 19/23] Prevent setting zero line width from UI --- modules/base/rendering/grids/renderableboxgrid.cpp | 2 +- modules/base/rendering/grids/renderablegrid.cpp | 2 +- modules/base/rendering/grids/renderableradialgrid.cpp | 2 +- modules/base/rendering/grids/renderablesphericalgrid.cpp | 2 +- modules/digitaluniverse/rendering/renderabledumeshes.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/base/rendering/grids/renderableboxgrid.cpp b/modules/base/rendering/grids/renderableboxgrid.cpp index c9a474306b..9f35f6541b 100644 --- a/modules/base/rendering/grids/renderableboxgrid.cpp +++ b/modules/base/rendering/grids/renderableboxgrid.cpp @@ -80,7 +80,7 @@ documentation::Documentation RenderableBoxGrid::Documentation() { RenderableBoxGrid::RenderableBoxGrid(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f)) - , _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f) + , _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f) , _size(SizeInfo, glm::vec3(1.f), glm::vec3(1.f), glm::vec3(100.f)) { const Parameters p = codegen::bake(dictionary); diff --git a/modules/base/rendering/grids/renderablegrid.cpp b/modules/base/rendering/grids/renderablegrid.cpp index 4c7b1e598c..1f364157f1 100644 --- a/modules/base/rendering/grids/renderablegrid.cpp +++ b/modules/base/rendering/grids/renderablegrid.cpp @@ -91,7 +91,7 @@ RenderableGrid::RenderableGrid(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f)) , _segments(SegmentsInfo, glm::uvec2(10), glm::uvec2(1), glm::uvec2(200)) - , _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f) + , _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f) , _size(SizeInfo, glm::vec2(1e20f), glm::vec2(1.f), glm::vec2(1e35f)) { const Parameters p = codegen::bake(dictionary); diff --git a/modules/base/rendering/grids/renderableradialgrid.cpp b/modules/base/rendering/grids/renderableradialgrid.cpp index 73993cd951..fd2150e178 100644 --- a/modules/base/rendering/grids/renderableradialgrid.cpp +++ b/modules/base/rendering/grids/renderableradialgrid.cpp @@ -113,7 +113,7 @@ RenderableRadialGrid::RenderableRadialGrid(const ghoul::Dictionary& dictionary) , _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f)) , _gridSegments(GridSegmentsInfo, glm::ivec2(1), glm::ivec2(1), glm::ivec2(200)) , _circleSegments(CircleSegmentsInfo, 36, 4, 200) - , _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f) + , _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f) , _maxRadius(OuterRadiusInfo, 1.f, 0.f, 20.f) , _minRadius(InnerRadiusInfo, 0.f, 0.f, 20.f) { diff --git a/modules/base/rendering/grids/renderablesphericalgrid.cpp b/modules/base/rendering/grids/renderablesphericalgrid.cpp index 878e05972d..75a2b27fbf 100644 --- a/modules/base/rendering/grids/renderablesphericalgrid.cpp +++ b/modules/base/rendering/grids/renderablesphericalgrid.cpp @@ -83,7 +83,7 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio , _gridProgram(nullptr) , _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f)) , _segments(SegmentsInfo, 36, 4, 200) - , _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f) + , _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f) { const Parameters p = codegen::bake(dictionary); diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index 661de9600d..d73465cc19 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -194,7 +194,7 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary) , _drawLabels(DrawLabelInfo, false) , _textMinSize(LabelMinSizeInfo, 8.f, 0.5f, 24.f) , _textMaxSize(LabelMaxSizeInfo, 500.f, 0.f, 1000.f) - , _lineWidth(LineWidthInfo, 2.f, 0.f, 16.f) + , _lineWidth(LineWidthInfo, 2.f, 1.f, 16.f) , _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown) { const Parameters p = codegen::bake(dictionary); From 94d2db7376bfea6febb6e1bcd0c5b2c9385643ef Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 16 Apr 2021 17:24:41 +0200 Subject: [PATCH 20/23] Fix an issue that prevented the spheres from being rendered --- data/assets/examples/spheres.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/examples/spheres.asset b/data/assets/examples/spheres.asset index 2510084d70..f19458eacd 100644 --- a/data/assets/examples/spheres.asset +++ b/data/assets/examples/spheres.asset @@ -18,7 +18,7 @@ for z=1,3 do Size = 0.20 + i * 0.01, Segments = 80, Opacity = 1, - Texture = "${DATA}/test2.jpg", + Texture = openspace.absPath("${DATA}/test2.jpg"), Orientation = "Both", }, GUI = { From b00fcb78df7cae7c0bd4aac676f2e8ef504c5386 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 16 Apr 2021 17:31:55 +0200 Subject: [PATCH 21/23] Enable setting of opacity for RenderableGlobe (closes #1449) --- modules/globebrowsing/shaders/renderer_fs.glsl | 3 +++ modules/globebrowsing/src/renderableglobe.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/modules/globebrowsing/shaders/renderer_fs.glsl b/modules/globebrowsing/shaders/renderer_fs.glsl index 09d291cc93..07ba765e6c 100644 --- a/modules/globebrowsing/shaders/renderer_fs.glsl +++ b/modules/globebrowsing/shaders/renderer_fs.glsl @@ -156,6 +156,7 @@ in vec3 positionCameraSpace; in vec3 positionWorldSpace; #endif // USE_ECLIPSE_SHADOWS +uniform float opacity; Fragment getFragment() { @@ -296,5 +297,7 @@ Fragment getFragment() { frag.color.xyz *= shadow < 0.99 ? clamp(shadow + 0.3, 0.0, 1.0) : shadow; #endif + frag.color.a *= opacity; + return frag; } diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 5306c49d32..c0813352a8 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -567,6 +567,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) ghoul::Dictionary layersDictionary = dictionary.value("Layers"); _layerManager.initialize(layersDictionary); + addProperty(_opacity); addProperty(_generalProperties.performShading); addProperty(_generalProperties.useAccurateNormals); @@ -971,6 +972,9 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, _globalRenderer.program->setUniform("orenNayarRoughness", onr); } + _localRenderer.program->setUniform("opacity", _opacity); + _globalRenderer.program->setUniform("opacity", _opacity); + if (_globalRenderer.updatedSinceLastCall) { const std::array& layerGroups = From 91387d840172eb50c4a99ec23d968cf77c860bcb Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Mon, 19 Apr 2021 16:10:36 +0200 Subject: [PATCH 22/23] ListProperties and SelectionProperty (#1558) * Reimplement stringlistproperty with a listproperty parent class * Add string list property tests and structure test files * Reimplement SelectionProperty and add tests * Some TemplateProperty documentation updates * Read full constellation name and not just first word for ConstallationSelection * Remove support for setting property value from string (unused) * Add IntListProperty, DoubleListProperty * Bug fix: SetProperty topic now support empty json objects * Imgui renderings for list properties and pass SelectionProperty info to WebGui --- .../properties/list/doublelistproperty.h | 65 ++++ .../properties/list/intlistproperty.h | 64 ++++ .../properties/list/stringlistproperty.h | 66 ++++ include/openspace/properties/listproperty.h | 46 +++ ...{stringlistproperty.h => listproperty.inl} | 22 +- .../openspace/properties/numericalproperty.h | 3 - .../properties/numericalproperty.inl | 55 --- include/openspace/properties/property.h | 25 +- .../openspace/properties/propertydelegate.h | 3 - .../openspace/properties/propertydelegate.inl | 7 - .../openspace/properties/selectionproperty.h | 114 ++++-- .../openspace/properties/templateproperty.h | 22 +- .../openspace/properties/templateproperty.inl | 33 +- modules/gaia/rendering/renderablegaiastars.h | 2 +- modules/imgui/include/guipropertycomponent.h | 2 +- modules/imgui/include/renderproperties.h | 8 + modules/imgui/src/guipropertycomponent.cpp | 4 +- modules/imgui/src/renderproperties.cpp | 160 +++++--- modules/server/include/serverinterface.h | 2 +- .../server/src/topics/setpropertytopic.cpp | 3 + .../renderableconstellationbounds.cpp | 46 +-- .../rendering/renderableconstellationbounds.h | 1 + modules/volume/transferfunctionproperty.cpp | 7 - modules/webgui/webguimodule.h | 2 +- src/CMakeLists.txt | 10 +- src/properties/list/doublelistproperty.cpp | 104 +++++ src/properties/list/intlistproperty.cpp | 104 +++++ .../{ => list}/stringlistproperty.cpp | 65 ++-- src/properties/matrix/dmat2property.cpp | 28 -- src/properties/matrix/dmat2x3property.cpp | 28 -- src/properties/matrix/dmat2x4property.cpp | 28 -- src/properties/matrix/dmat3property.cpp | 28 -- src/properties/matrix/dmat3x2property.cpp | 28 -- src/properties/matrix/dmat3x4property.cpp | 29 -- src/properties/matrix/dmat4property.cpp | 28 -- src/properties/matrix/dmat4x2property.cpp | 28 -- src/properties/matrix/dmat4x3property.cpp | 28 -- src/properties/matrix/mat2property.cpp | 28 -- src/properties/matrix/mat2x3property.cpp | 28 -- src/properties/matrix/mat2x4property.cpp | 28 -- src/properties/matrix/mat3property.cpp | 28 -- src/properties/matrix/mat3x2property.cpp | 28 -- src/properties/matrix/mat3x4property.cpp | 28 -- src/properties/matrix/mat4property.cpp | 28 -- src/properties/matrix/mat4x2property.cpp | 28 -- src/properties/matrix/mat4x3property.cpp | 28 -- src/properties/property.cpp | 5 - src/properties/scalar/boolproperty.cpp | 14 - src/properties/scalar/charproperty.cpp | 14 - src/properties/scalar/doubleproperty.cpp | 14 - src/properties/scalar/floatproperty.cpp | 14 - src/properties/scalar/intproperty.cpp | 14 - src/properties/scalar/longdoubleproperty.cpp | 14 - src/properties/scalar/longlongproperty.cpp | 14 - src/properties/scalar/longproperty.cpp | 14 - src/properties/scalar/shortproperty.cpp | 14 - src/properties/scalar/signedcharproperty.cpp | 14 - src/properties/scalar/ucharproperty.cpp | 14 - src/properties/scalar/uintproperty.cpp | 14 - src/properties/scalar/ulonglongproperty.cpp | 14 - src/properties/scalar/ulongproperty.cpp | 14 - src/properties/scalar/ushortproperty.cpp | 14 - src/properties/selectionproperty.cpp | 211 ++++++----- src/properties/stringproperty.cpp | 14 - src/properties/vector/bvec2property.cpp | 24 -- src/properties/vector/bvec3property.cpp | 24 -- src/properties/vector/bvec4property.cpp | 24 -- src/properties/vector/dvec2property.cpp | 24 -- src/properties/vector/dvec3property.cpp | 24 -- src/properties/vector/dvec4property.cpp | 24 -- src/properties/vector/ivec2property.cpp | 24 -- src/properties/vector/ivec3property.cpp | 24 -- src/properties/vector/ivec4property.cpp | 24 -- src/properties/vector/uvec2property.cpp | 24 -- src/properties/vector/uvec3property.cpp | 24 -- src/properties/vector/uvec4property.cpp | 24 -- src/properties/vector/vec2property.cpp | 24 -- src/properties/vector/vec3property.cpp | 24 -- src/properties/vector/vec4property.cpp | 24 -- tests/CMakeLists.txt | 5 +- .../property/test_property_listproperties.cpp | 355 ++++++++++++++++++ .../test_property_optionproperty.cpp} | 0 .../test_property_selectionproperty.cpp | 225 +++++++++++ 83 files changed, 1451 insertions(+), 1484 deletions(-) create mode 100644 include/openspace/properties/list/doublelistproperty.h create mode 100644 include/openspace/properties/list/intlistproperty.h create mode 100644 include/openspace/properties/list/stringlistproperty.h create mode 100644 include/openspace/properties/listproperty.h rename include/openspace/properties/{stringlistproperty.h => listproperty.inl} (85%) create mode 100644 src/properties/list/doublelistproperty.cpp create mode 100644 src/properties/list/intlistproperty.cpp rename src/properties/{ => list}/stringlistproperty.cpp (73%) create mode 100644 tests/property/test_property_listproperties.cpp rename tests/{test_optionproperty.cpp => property/test_property_optionproperty.cpp} (100%) create mode 100644 tests/property/test_property_selectionproperty.cpp diff --git a/include/openspace/properties/list/doublelistproperty.h b/include/openspace/properties/list/doublelistproperty.h new file mode 100644 index 0000000000..b857dbc144 --- /dev/null +++ b/include/openspace/properties/list/doublelistproperty.h @@ -0,0 +1,65 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2021 * + * * + * 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___DOUBLELISTPROPERTY___H__ +#define __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__ + +#include + +namespace openspace::properties { + +class DoubleListProperty : public ListProperty { +public: + DoubleListProperty(Property::PropertyInfo info); + DoubleListProperty(Property::PropertyInfo info, std::vector values); + + using TemplateProperty>::operator std::vector; + using TemplateProperty>::operator=; +}; + +template <> +std::string PropertyDelegate>>::className(); + +template <> +template <> +std::vector +PropertyDelegate>>::fromLuaValue( + lua_State* state, bool& success); + +template <> +template <> +bool PropertyDelegate>>::toLuaValue( + lua_State* state, const std::vector& value); + +template <> +int PropertyDelegate>>::typeLua(); + +template <> +template <> +bool PropertyDelegate>>::toString( + std::string& outValue, const std::vector& inValue); + +} // namespace openspace::properties + +#endif // __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__ diff --git a/include/openspace/properties/list/intlistproperty.h b/include/openspace/properties/list/intlistproperty.h new file mode 100644 index 0000000000..2213968d0d --- /dev/null +++ b/include/openspace/properties/list/intlistproperty.h @@ -0,0 +1,64 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2021 * + * * + * 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___INTLISTPROPERTY___H__ +#define __OPENSPACE_CORE___INTLISTPROPERTY___H__ + +#include + +namespace openspace::properties { + +class IntListProperty : public ListProperty { +public: + IntListProperty(Property::PropertyInfo info); + IntListProperty(Property::PropertyInfo info, std::vector values); + + using TemplateProperty>::operator std::vector; + using TemplateProperty>::operator=; +}; + +template <> +std::string PropertyDelegate>>::className(); + +template <> +template <> +std::vector PropertyDelegate>>::fromLuaValue( + lua_State* state, bool& success); + +template <> +template <> +bool PropertyDelegate>>::toLuaValue( + lua_State* state, const std::vector& value); + +template <> +int PropertyDelegate>>::typeLua(); + +template <> +template <> +bool PropertyDelegate>>::toString( + std::string& outValue, const std::vector& inValue); + +} // namespace openspace::properties + +#endif // __OPENSPACE_CORE___INTLISTPROPERTY___H__ diff --git a/include/openspace/properties/list/stringlistproperty.h b/include/openspace/properties/list/stringlistproperty.h new file mode 100644 index 0000000000..8ed0259332 --- /dev/null +++ b/include/openspace/properties/list/stringlistproperty.h @@ -0,0 +1,66 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2021 * + * * + * 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___STRINGLISTPROPERTY___H__ +#define __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ + +#include +#include + +namespace openspace::properties { + +class StringListProperty : public ListProperty { +public: + StringListProperty(Property::PropertyInfo info); + StringListProperty(Property::PropertyInfo info, std::vector values); + + using TemplateProperty>::operator std::vector; + using TemplateProperty>::operator=; +}; + +template <> +std::string PropertyDelegate>>::className(); + +template <> +template <> +std::vector +PropertyDelegate>>::fromLuaValue( + lua_State* state, bool& success); + +template <> +template <> +bool PropertyDelegate>>::toLuaValue( + lua_State* state, const std::vector& value); + +template <> +int PropertyDelegate>>::typeLua(); + +template <> +template <> +bool PropertyDelegate>>::toString( + std::string& outValue, const std::vector& inValue); + +} // namespace openspace::properties + +#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ diff --git a/include/openspace/properties/listproperty.h b/include/openspace/properties/listproperty.h new file mode 100644 index 0000000000..9d7ef0f820 --- /dev/null +++ b/include/openspace/properties/listproperty.h @@ -0,0 +1,46 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2021 * + * * + * 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___LISTPROPERTY___H__ +#define __OPENSPACE_CORE___LISTPROPERTY___H__ + +#include +#include + +namespace openspace::properties { + +template +class ListProperty : public TemplateProperty> { +public: + ListProperty(Property::PropertyInfo info); + ListProperty(Property::PropertyInfo info, std::vector values); + + virtual ~ListProperty() = 0; +}; + +} // namespace openspace::properties + +#include "openspace/properties/listproperty.inl" + +#endif // __OPENSPACE_CORE___LISTPROPERTY___H__ diff --git a/include/openspace/properties/stringlistproperty.h b/include/openspace/properties/listproperty.inl similarity index 85% rename from include/openspace/properties/stringlistproperty.h rename to include/openspace/properties/listproperty.inl index b929273cf3..6bad6b2c09 100644 --- a/include/openspace/properties/stringlistproperty.h +++ b/include/openspace/properties/listproperty.inl @@ -22,18 +22,20 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ -#define __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ - -#include - -#include -#include - namespace openspace::properties { -REGISTER_TEMPLATEPROPERTY_HEADER(StringListProperty, std::vector) +template +ListProperty::ListProperty(Property::PropertyInfo info) + : TemplateProperty>(std::move(info)) +{} + +template +ListProperty::ListProperty(Property::PropertyInfo info, std::vector values) + : TemplateProperty>(std::move(info), std::move(values)) +{} + +template +ListProperty::~ListProperty() {} } // namespace openspace::properties -#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ diff --git a/include/openspace/properties/numericalproperty.h b/include/openspace/properties/numericalproperty.h index 53f2122125..05a88a48fb 100644 --- a/include/openspace/properties/numericalproperty.h +++ b/include/openspace/properties/numericalproperty.h @@ -46,7 +46,6 @@ public: int typeLua() const override; bool getStringValue(std::string& value) const override; - bool setStringValue(std::string value) override; T minValue() const; void setMinValue(T value); @@ -66,10 +65,8 @@ public: using TemplateProperty::operator=; - void setInterpolationTarget(std::any value) override; void setLuaInterpolationTarget(lua_State* state) override; - void setStringInterpolationTarget(std::string value) override; void interpolateValue(float t, ghoul::EasingFunc easingFunc = nullptr) override; diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index 7417c2a212..57913c30de 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -75,16 +75,6 @@ namespace openspace::properties { \ template <> \ template <> \ - TYPE PropertyDelegate>::fromString(const std::string& value, \ - bool& success); \ - \ - template <> \ - template <> \ - TYPE PropertyDelegate>::fromString(const std::string& value, \ - bool& success); \ - \ - template <> \ - template <> \ bool PropertyDelegate>::toString(std::string& outValue, \ const TYPE& inValue); \ \ @@ -98,7 +88,6 @@ namespace openspace::properties { DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, \ DEFAULT_STEPPING, FROM_LUA_LAMBDA_EXPRESSION, \ TO_LUA_LAMBDA_EXPRESSION, \ - FROM_STRING_LAMBDA_EXPRESSION, \ TO_STRING_LAMBDA_EXPRESSION, LUA_TYPE) \ template <> \ std::string PropertyDelegate>::className() \ @@ -187,25 +176,6 @@ namespace openspace::properties { \ template <> \ template <> \ - TYPE PropertyDelegate>::fromString(const std::string& value, \ - bool& success) \ - { \ - return FROM_STRING_LAMBDA_EXPRESSION(value, success); \ - } \ - \ - template <> \ - template <> \ - TYPE PropertyDelegate>::fromString(const std::string& value, \ - bool& success) \ - { \ - return PropertyDelegate>::fromString( \ - value, \ - success \ - ); \ - } \ - \ - template <> \ - template <> \ bool PropertyDelegate>::toString(std::string& outValue, \ const TYPE& inValue) \ { \ @@ -336,18 +306,6 @@ bool NumericalProperty::getStringValue(std::string& value) const { return success; } -template -bool NumericalProperty::setStringValue(std::string value) { - bool success = false; - T thisValue = PropertyDelegate>::template fromString( - value, success - ); - if (success) { - TemplateProperty::set(std::any(std::move(thisValue))); - } - return success; -} - template T NumericalProperty::minValue() const { return _minimumValue; @@ -442,19 +400,6 @@ void NumericalProperty::setLuaInterpolationTarget(lua_State* state) { } } -template -void NumericalProperty::setStringInterpolationTarget(std::string value) { - bool success = false; - T thisValue = PropertyDelegate>::template fromString( - value, - success - ); - if (success) { - _interpolationStart = TemplateProperty::_value; - _interpolationEnd = std::move(thisValue); - } -} - template void NumericalProperty::interpolateValue(float t, ghoul::EasingFunc easingFunction) diff --git a/include/openspace/properties/property.h b/include/openspace/properties/property.h index eda38ae4c6..b0257ef484 100644 --- a/include/openspace/properties/property.h +++ b/include/openspace/properties/property.h @@ -44,8 +44,7 @@ class PropertyOwner; * used as a URI. This class is an abstract base class and each subclass (most notable * TemplateProperty) needs to implement the methods Property::className, Property::get, * Property::set, Property::type(), Property::getLuaValue, Property::setLuaValue, - * Property::getStringValue, Property::setStringValue and Property::typeLua to make full - * use of the infrastructure. + * Property::getStringValue, and Property::typeLua to make full use of the infrastructure. * The most common types can be implemented by creating a specialized instantiation of * TemplateProperty, which provides default implementations for these methods. * @@ -217,8 +216,7 @@ public: /** * This method encodes the encapsulated \p value of this Property as a * std::string. The specific details of this serialization is up to the - * property developer. The implementation has to be synchronized with the - * Property::setStringValue method. The default implementation is a no-op. + * property developer. The default implementation is a no-op. * * \param value The value to which the Property will be encoded * \return \p true if the encoding succeeded, \p false otherwise @@ -235,18 +233,6 @@ public: */ std::string getStringValue() const; - /** - * This method sets the value encapsulated by this Property by deserializing the - * passed std::string. The specific details of the deserialization are up - * to the Property developer. The implementation has to be synchronized with the - * Property::getLuaValue method. The default implementation is a no-op. - * - * \param value The value from which the Property will be decoded - * \return \c true if the decoding and setting of the value succeeded, \c false - * otherwise - */ - virtual bool setStringValue(std::string value); - /** * This method registers a \p callback function that will be called every time if * either Property:set or Property::setLuaValue was called with a value that is @@ -385,9 +371,9 @@ public: /** * This method determines if this Property should be read-only in external * applications. This setting is only a hint and does not need to be followed by GUI - * applications and does not have any effect on the Property::set, - * Property::setLuaValue, or Property::setStringValue methods. The value is stored in - * the metaData Dictionary with the key: \c isReadOnly. The default value is \c false. + * applications and does not have any effect on the Property::set or + * Property::setLuaValue methods. The value is stored in the metaData Dictionary + * with the key: \c isReadOnly. The default value is \c false. * * \param state \c true if the Property should be read only, \c false otherwise */ @@ -456,7 +442,6 @@ public: /// Interpolation methods virtual void setInterpolationTarget(std::any value); virtual void setLuaInterpolationTarget(lua_State* state); - virtual void setStringInterpolationTarget(std::string value); virtual void interpolateValue(float t, ghoul::EasingFunc easingFunction = nullptr); diff --git a/include/openspace/properties/propertydelegate.h b/include/openspace/properties/propertydelegate.h index f107a00878..1a871d7b96 100644 --- a/include/openspace/properties/propertydelegate.h +++ b/include/openspace/properties/propertydelegate.h @@ -150,9 +150,6 @@ public: */ static int typeLua(); - template - static U fromString(const std::string& value, bool& success); - template static bool toString(std::string& outValue, const U& inValue); }; diff --git a/include/openspace/properties/propertydelegate.inl b/include/openspace/properties/propertydelegate.inl index 6486381916..be419421cf 100644 --- a/include/openspace/properties/propertydelegate.inl +++ b/include/openspace/properties/propertydelegate.inl @@ -91,11 +91,4 @@ bool PropertyDelegate::toString(std::string&, const U&) { return false; } -template -template -U PropertyDelegate::fromString(const std::string&, bool&) { - static_assert(sizeof(T) == 0, - "Unimplemented PropertyDelegate::fromString specialization"); -} - } // namespace openspace::properties diff --git a/include/openspace/properties/selectionproperty.h b/include/openspace/properties/selectionproperty.h index 30749ca9b3..9006ecc630 100644 --- a/include/openspace/properties/selectionproperty.h +++ b/include/openspace/properties/selectionproperty.h @@ -27,62 +27,120 @@ #include +#include #include namespace openspace::properties { -class SelectionProperty : public TemplateProperty> { -public: - struct Option { - int value; - std::string description; - }; +class SelectionProperty : public TemplateProperty> { +public: SelectionProperty(Property::PropertyInfo info); - void addOption(Option option); - void removeOptions(); - const std::vector