mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-23 05:19:18 -06:00
Merge branch 'master' into feature/model-animation
* Resolve conflicts * Master has error with changing focus
This commit is contained in:
@@ -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)
|
||||
|
||||
3
Jenkinsfile
vendored
3
Jenkinsfile
vendored
@@ -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());
|
||||
|
||||
Submodule apps/OpenSpace/ext/sgct updated: c651841a49...669fbc16a9
@@ -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<ghoul::cmdparser::SingleCommand<std::string>>(
|
||||
tasksPath,
|
||||
@@ -146,7 +152,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
//FileSys.setCurrentDirectory(launchDirectory);
|
||||
|
||||
if (tasksPath != "") {
|
||||
if (!tasksPath.empty()) {
|
||||
performTasks(tasksPath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Display swapInterval="0" />
|
||||
</Settings>
|
||||
<Node address="localhost" port="20401">
|
||||
<Window fullScreen="true" monitor="1" name="OpenSpace" draw2d="false">
|
||||
<Window fullscreen="true" monitor="1" name="OpenSpace" draw2d="false">
|
||||
<Stereo type="none" />
|
||||
<Size x="1920" y="1080" />
|
||||
<Pos x="0" y="0" />
|
||||
@@ -17,7 +17,7 @@
|
||||
</PlanarProjection>
|
||||
</Viewport>
|
||||
</Window>
|
||||
<Window fullScreen="false" border="false" name="GUI" tags="GUI" draw3D="false">
|
||||
<Window fullscreen="false" border="false" name="GUI" tags="GUI" draw3D="false">
|
||||
<Stereo type="none" />
|
||||
<Size x="1920" y="1080" />
|
||||
<Pos x="0" y="0" />
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
-->
|
||||
<!-- mesh path is relative to working directory-->
|
||||
<!-- NOTE, if no working directory is set, mesh must be absolute path -->
|
||||
<Viewport name="warped fisheye" mesh="config/mesh/standard_16x9.data">
|
||||
<Viewport name="warped fisheye" mesh="mesh/standard_16x9.data">
|
||||
<Pos x="0.0" y="0.0" />
|
||||
<Size x="1.0" y="1.0" />
|
||||
<FisheyeProjection fov="180" quality="2k" tilt="30.0">
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -13,7 +13,7 @@ local speck = asset.syncedResource({
|
||||
Name = "Kepler Speck Files",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "digitaluniverse_kepler_speck",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
local object = {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@ local Charon = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "CHARON",
|
||||
Observer = "PLUTO BARYCENTER",
|
||||
Kernels = NewHorizonsKernels
|
||||
Observer = "PLUTO BARYCENTER"
|
||||
},
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
|
||||
@@ -11,8 +11,7 @@ local Kerberos = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "KERBEROS",
|
||||
Observer = "PLUTO BARYCENTER",
|
||||
Kernels = PlutoKernels
|
||||
Observer = "PLUTO BARYCENTER"
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
|
||||
@@ -11,8 +11,7 @@ local Nix = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "NIX",
|
||||
Observer = "PLUTO BARYCENTER",
|
||||
Kernels = PlutoKernels
|
||||
Observer = "PLUTO BARYCENTER"
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -13,8 +13,7 @@ local Pluto = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "PLUTO",
|
||||
Observer = "PLUTO BARYCENTER",
|
||||
Kernels = NewHorizonsKernels
|
||||
Observer = "PLUTO BARYCENTER"
|
||||
},
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.require('scene/solarsystem/missions/apollo/csm_model').models
|
||||
|
||||
local kernels = asset.require('scene/solarsystem/missions/apollo/15/kernels').kernels
|
||||
|
||||
@@ -47,6 +47,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 +115,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)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
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.require('scene/solarsystem/missions/apollo/csm_model').models
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
@@ -47,6 +48,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 +69,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)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
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.require('scene/solarsystem/missions/apollo/csm_model').models
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
@@ -59,6 +60,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 +97,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)
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,8 @@
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_models",
|
||||
Version = 2
|
||||
})
|
||||
|
||||
asset.export('models', models)
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local models = asset.syncedResource({
|
||||
Name = "New Horizons Model",
|
||||
Name = "Voyager Model",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "voyager_model",
|
||||
Version = 1
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -68,7 +68,7 @@ local createGlobes = function(t)
|
||||
end
|
||||
end
|
||||
|
||||
result = {}
|
||||
local result = {}
|
||||
|
||||
for i, v in ipairs(t) do
|
||||
local globe = nil
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Submodule ext/ghoul updated: 6ef01a676c...4db5e42c95
65
include/openspace/properties/list/doublelistproperty.h
Normal file
65
include/openspace/properties/list/doublelistproperty.h
Normal file
@@ -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 <openspace/properties/listproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
class DoubleListProperty : public ListProperty<double> {
|
||||
public:
|
||||
DoubleListProperty(Property::PropertyInfo info);
|
||||
DoubleListProperty(Property::PropertyInfo info, std::vector<double> values);
|
||||
|
||||
using TemplateProperty<std::vector<double>>::operator std::vector<double>;
|
||||
using TemplateProperty<std::vector<double>>::operator=;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<double>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<double>
|
||||
PropertyDelegate<TemplateProperty<std::vector<double>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<double>>>::toLuaValue(
|
||||
lua_State* state, const std::vector<double>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<double>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<double>>>::toString(
|
||||
std::string& outValue, const std::vector<double>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__
|
||||
64
include/openspace/properties/list/intlistproperty.h
Normal file
64
include/openspace/properties/list/intlistproperty.h
Normal file
@@ -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 <openspace/properties/listproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
class IntListProperty : public ListProperty<int> {
|
||||
public:
|
||||
IntListProperty(Property::PropertyInfo info);
|
||||
IntListProperty(Property::PropertyInfo info, std::vector<int> values);
|
||||
|
||||
using TemplateProperty<std::vector<int>>::operator std::vector<int>;
|
||||
using TemplateProperty<std::vector<int>>::operator=;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(
|
||||
lua_State* state, const std::vector<int>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(
|
||||
std::string& outValue, const std::vector<int>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___INTLISTPROPERTY___H__
|
||||
66
include/openspace/properties/list/stringlistproperty.h
Normal file
66
include/openspace/properties/list/stringlistproperty.h
Normal file
@@ -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 <openspace/properties/listproperty.h>
|
||||
#include <string>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
class StringListProperty : public ListProperty<std::string> {
|
||||
public:
|
||||
StringListProperty(Property::PropertyInfo info);
|
||||
StringListProperty(Property::PropertyInfo info, std::vector<std::string> values);
|
||||
|
||||
using TemplateProperty<std::vector<std::string>>::operator std::vector<std::string>;
|
||||
using TemplateProperty<std::vector<std::string>>::operator=;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<std::string>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<std::string>
|
||||
PropertyDelegate<TemplateProperty<std::vector<std::string>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<std::string>>>::toLuaValue(
|
||||
lua_State* state, const std::vector<std::string>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<std::string>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<std::string>>>::toString(
|
||||
std::string& outValue, const std::vector<std::string>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
|
||||
46
include/openspace/properties/listproperty.h
Normal file
46
include/openspace/properties/listproperty.h
Normal file
@@ -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 <openspace/properties/templateproperty.h>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
template <typename T>
|
||||
class ListProperty : public TemplateProperty<std::vector<T>> {
|
||||
public:
|
||||
ListProperty(Property::PropertyInfo info);
|
||||
ListProperty(Property::PropertyInfo info, std::vector<T> values);
|
||||
|
||||
virtual ~ListProperty() = 0;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#include "openspace/properties/listproperty.inl"
|
||||
|
||||
#endif // __OPENSPACE_CORE___LISTPROPERTY___H__
|
||||
@@ -22,18 +22,20 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
|
||||
|
||||
#include <openspace/properties/templateproperty.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(StringListProperty, std::vector<std::string>)
|
||||
template <typename T>
|
||||
ListProperty<T>::ListProperty(Property::PropertyInfo info)
|
||||
: TemplateProperty<std::vector<T>>(std::move(info))
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
ListProperty<T>::ListProperty(Property::PropertyInfo info, std::vector<T> values)
|
||||
: TemplateProperty<std::vector<T>>(std::move(info), std::move(values))
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
ListProperty<T>::~ListProperty() {}
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___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<T>::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<float> easingFunc = nullptr) override;
|
||||
|
||||
@@ -75,16 +75,6 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
|
||||
bool& success); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromString(const std::string& value, \
|
||||
bool& success); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::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<TemplateProperty<TYPE>>::className() \
|
||||
@@ -187,25 +176,6 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
|
||||
bool& success) \
|
||||
{ \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, success); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromString(const std::string& value, \
|
||||
bool& success) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::fromString<TYPE>( \
|
||||
value, \
|
||||
success \
|
||||
); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue) \
|
||||
{ \
|
||||
@@ -336,18 +306,6 @@ bool NumericalProperty<T>::getStringValue(std::string& value) const {
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::setStringValue(std::string value) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(
|
||||
value, success
|
||||
);
|
||||
if (success) {
|
||||
TemplateProperty<T>::set(std::any(std::move(thisValue)));
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::minValue() const {
|
||||
return _minimumValue;
|
||||
@@ -442,19 +400,6 @@ void NumericalProperty<T>::setLuaInterpolationTarget(lua_State* state) {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void NumericalProperty<T>::setStringInterpolationTarget(std::string value) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(
|
||||
value,
|
||||
success
|
||||
);
|
||||
if (success) {
|
||||
_interpolationStart = TemplateProperty<T>::_value;
|
||||
_interpolationEnd = std::move(thisValue);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void NumericalProperty<T>::interpolateValue(float t,
|
||||
ghoul::EasingFunc<float> easingFunction)
|
||||
|
||||
@@ -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
|
||||
* <code>std::string</code>. 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 <code>std::string</code>. 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<float> easingFunction = nullptr);
|
||||
|
||||
@@ -150,9 +150,6 @@ public:
|
||||
*/
|
||||
static int typeLua();
|
||||
|
||||
template <typename U>
|
||||
static U fromString(const std::string& value, bool& success);
|
||||
|
||||
template <typename U>
|
||||
static bool toString(std::string& outValue, const U& inValue);
|
||||
};
|
||||
|
||||
@@ -91,11 +91,4 @@ bool PropertyDelegate<T>::toString(std::string&, const U&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::fromString(const std::string&, bool&) {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::fromString specialization");
|
||||
}
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
@@ -27,62 +27,120 @@
|
||||
|
||||
#include <openspace/properties/templateproperty.h>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
class SelectionProperty : public TemplateProperty<std::vector<int>> {
|
||||
public:
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
class SelectionProperty : public TemplateProperty<std::set<std::string>> {
|
||||
|
||||
public:
|
||||
SelectionProperty(Property::PropertyInfo info);
|
||||
|
||||
void addOption(Option option);
|
||||
void removeOptions();
|
||||
const std::vector<Option>& options() const;
|
||||
/**
|
||||
* This method sets the stored value to the provided value <code>val</code>.
|
||||
* If the value is different, the listeners are notified. It also removes any
|
||||
* invalid keys in the input set. A key is invalid if it does not correspond to
|
||||
* an existing option in the SelectionProperty
|
||||
*
|
||||
* \param val The new value for this SelectionProperty
|
||||
*/
|
||||
void setValue(std::set<std::string> val) override;
|
||||
|
||||
using TemplateProperty<std::vector<int>>::operator std::vector<int>;
|
||||
/**
|
||||
* Checks if an option given by the provided <code>key</code> exists.
|
||||
*
|
||||
* \param key The key that should be checked for existence
|
||||
* \return \c if the option exists; \c false otherwise
|
||||
*/
|
||||
bool hasOption(const std::string& key) const;
|
||||
|
||||
using TemplateProperty<std::vector<int>>::operator=;
|
||||
/**
|
||||
* Checks if an option given by the provided <code>key</code> is selected.
|
||||
*
|
||||
* \param key The key that should be checked
|
||||
* \return \c true if the option is selected; \c false otherwise
|
||||
*/
|
||||
bool isSelected(const std::string& key) const;
|
||||
|
||||
/**
|
||||
* Checks if the SelectionProperty has any selected values, that is, if its
|
||||
* value is empty.
|
||||
*
|
||||
* \return \c true if there are selected options; \c false otherwise
|
||||
*/
|
||||
bool hasSelected() const;
|
||||
|
||||
/**
|
||||
* Returns all available options for this SelectionProperty. Should be
|
||||
* sorted alphabetically.
|
||||
*
|
||||
* \return A list of all available options
|
||||
*/
|
||||
const std::vector<std::string>& options() const;
|
||||
|
||||
/**
|
||||
* This method sets all available options at once, removing any potential duplicates.
|
||||
* If a selection exists, it is updated to that any selected option that does not
|
||||
* match the new set of options is removed.
|
||||
*
|
||||
* \param keys The keys for the options to be set
|
||||
*/
|
||||
void setOptions(const std::vector<std::string>& keys);
|
||||
|
||||
/**
|
||||
* Adds an individual option, if it did not already exist.
|
||||
*
|
||||
* \param key The key for the option to be added
|
||||
*/
|
||||
void addOption(const std::string& key);
|
||||
|
||||
/**
|
||||
* This method clears the selection list, that is the value of this SelectionProperty
|
||||
*/
|
||||
void clearSelection();
|
||||
|
||||
/**
|
||||
* This method clears the options list. As the selection must match the available
|
||||
* options, the selection list is cleared as well.
|
||||
*/
|
||||
void clearOptions();
|
||||
|
||||
using TemplateProperty<std::set<std::string>>::operator std::set<std::string>;
|
||||
|
||||
using TemplateProperty<std::set<std::string>>::operator=;
|
||||
|
||||
private:
|
||||
static const std::string OptionsKey;
|
||||
void sortOptions();
|
||||
bool removeInvalidKeys(std::set<std::string>& keys);
|
||||
|
||||
std::string generateAdditionalJsonDescription() const override;
|
||||
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
std::vector<int> _values;
|
||||
// A list of all available options that can be selected
|
||||
std::vector<std::string> _options;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
|
||||
std::string PropertyDelegate<TemplateProperty<std::set<std::string>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
std::set<std::string>
|
||||
PropertyDelegate<TemplateProperty<std::set<std::string>>>::fromLuaValue(lua_State* state,
|
||||
bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(lua_State* state,
|
||||
const std::vector<int>& value);
|
||||
bool PropertyDelegate<TemplateProperty<std::set<std::string>>>::toLuaValue(
|
||||
lua_State* state, const std::set<std::string>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
|
||||
int PropertyDelegate<TemplateProperty<std::set<std::string>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromString(
|
||||
const std::string& value, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(
|
||||
std::string& outValue, const std::vector<int>& inValue);
|
||||
bool PropertyDelegate<TemplateProperty<std::set<std::string>>>::toString(
|
||||
std::string& outValue, const std::set<std::string>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
|
||||
/**
|
||||
* Sets the value of this TemplateProprty by decoding the object at the top of the Lua
|
||||
* Sets the value of this TemplateProperty by decoding the object at the top of the Lua
|
||||
* stack and, if successful, assigning it using the Property::set method. The decoding
|
||||
* is performed by calling the PropertyDelegate::fromLuaValue with the template
|
||||
* parameter <code>T</code> as argument. If the decoding is successful, the new value
|
||||
@@ -132,10 +132,18 @@ public:
|
||||
/// \see Property::typeLua
|
||||
int typeLua() const override;
|
||||
|
||||
/**
|
||||
* This method encodes the stored value into a std::string object. The encoding is
|
||||
* performed by calling PropertyDelegate::toStringValue with the template parameter
|
||||
* <code>T</code> as an argument. This method has to be specialized for each new
|
||||
* type, or a compile-time error will occur. The resulting encoding must also be a
|
||||
* valid JSON representation fo the property.
|
||||
*
|
||||
* \param value The string object in which to store the resulting encoding
|
||||
* \return \c true if the encoding succeeded; \c false otherwise
|
||||
*/
|
||||
bool getStringValue(std::string& value) const override;
|
||||
|
||||
bool setStringValue(std::string value) override;
|
||||
|
||||
/**
|
||||
* Returns the description for this TemplateProperty as a Lua script that returns a
|
||||
* table on execution.
|
||||
@@ -169,15 +177,15 @@ public:
|
||||
* the TemplateProperty::set method. It will be done internally by this method and it
|
||||
* allows assignments such as <code>prop = T(1)</code>.
|
||||
*
|
||||
* \param val The value that should be set.
|
||||
* \param val The value that should be set
|
||||
*/
|
||||
TemplateProperty<T>& operator=(T val);
|
||||
|
||||
/**
|
||||
* These method sets the stored value to the provided value <code>val</code>,
|
||||
* moving it into place. This move only happens if the provided value <code>val</code>
|
||||
* This method sets the stored value to the provided value <code>val</code>,
|
||||
* moving it into place. The move only happens if the provided value <code>val</code>
|
||||
* is different from the stored value, which needs an operator== to exist for the type
|
||||
* <code>T</code>. If the value are different, the listeners are notified.
|
||||
* <code>T</code>. If the value is different, the listeners are notified.
|
||||
*
|
||||
* \param val The new value for this TemplateProperty
|
||||
*/
|
||||
|
||||
@@ -59,11 +59,6 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
|
||||
bool& success); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue);
|
||||
|
||||
@@ -86,7 +81,6 @@ namespace openspace::properties {
|
||||
#define REGISTER_TEMPLATEPROPERTY_SOURCE(CLASS_NAME, TYPE, DEFAULT_VALUE, \
|
||||
FROM_LUA_LAMBDA_EXPRESSION, \
|
||||
TO_LUA_LAMBDA_EXPRESSION, \
|
||||
FROM_STRING_LAMBDA_EXPRESSION, \
|
||||
TO_STRING_LAMBDA_EXPRESSION, LUA_TYPE) \
|
||||
template <> \
|
||||
std::string PropertyDelegate<TemplateProperty<TYPE>>::className() \
|
||||
@@ -124,14 +118,6 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
|
||||
bool& success) \
|
||||
{ \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, success); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue) \
|
||||
{ \
|
||||
@@ -194,11 +180,7 @@ std::any TemplateProperty<T>::get() const {
|
||||
template <typename T>
|
||||
void TemplateProperty<T>::set(std::any value) {
|
||||
T v = std::any_cast<T>(std::move(value));
|
||||
if (v != _value) {
|
||||
_value = std::move(v);
|
||||
notifyChangeListeners();
|
||||
_isValueDirty = true;
|
||||
}
|
||||
setValue(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -242,17 +224,4 @@ bool TemplateProperty<T>::getStringValue(std::string& value) const {
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool TemplateProperty<T>::setStringValue(std::string value) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromString<T>(
|
||||
value,
|
||||
success
|
||||
);
|
||||
if (success) {
|
||||
set(std::any(thisValue));
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
@@ -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<Parameters>(dictionary);
|
||||
|
||||
@@ -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<Parameters>(dictionary);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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<Parameters>(dictionary);
|
||||
|
||||
|
||||
@@ -273,32 +273,32 @@ namespace {
|
||||
// The number of sides for the polygon used to represent the astronomical object
|
||||
std::optional<int> polygonSides;
|
||||
|
||||
// [[codgen::verbatim(DrawLabelInfo.description)]]
|
||||
// [[codegen::verbatim(DrawLabelInfo.description)]]
|
||||
std::optional<bool> drawLabels;
|
||||
|
||||
// [[codgen::verbatim(TextColorInfo.description)]]
|
||||
// [[codegen::verbatim(TextColorInfo.description)]]
|
||||
std::optional<glm::vec3> textColor [[codegen::color()]];
|
||||
|
||||
// [[codgen::verbatim(TextOpacityInfo.description)]]
|
||||
// [[codegen::verbatim(TextOpacityInfo.description)]]
|
||||
std::optional<float> textOpacity;
|
||||
|
||||
// [[codgen::verbatim(TextSizeInfo.description)]]
|
||||
// [[codegen::verbatim(TextSizeInfo.description)]]
|
||||
std::optional<float> textSize;
|
||||
|
||||
// The path to the label file that contains information about the astronomical
|
||||
// objects being rendered
|
||||
std::optional<std::string> labelFile;
|
||||
|
||||
// [[codgen::verbatim(LabelMinSizeInfo.description)]]
|
||||
// [[codegen::verbatim(LabelMinSizeInfo.description)]]
|
||||
std::optional<float> textMinSize;
|
||||
|
||||
// [[codgen::verbatim(LabelMaxSizeInfo.description)]]
|
||||
// [[codegen::verbatim(LabelMaxSizeInfo.description)]]
|
||||
std::optional<float> textMaxSize;
|
||||
|
||||
// [[codgen::verbatim(ColorOptionInfo.description)]]
|
||||
// [[codegen::verbatim(ColorOptionInfo.description)]]
|
||||
std::optional<std::vector<std::string>> colorOption;
|
||||
|
||||
// [[codgen::verbatim(SizeOptionInfo.description)]]
|
||||
// [[codegen::verbatim(SizeOptionInfo.description)]]
|
||||
std::optional<std::vector<std::string>> 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<glm::dmat4x4> transformationMatrix;
|
||||
|
||||
// [[codgen::verbatim(FadeInDistancesInfo.description)]]
|
||||
// [[codegen::verbatim(FadeInDistancesInfo.description)]]
|
||||
std::optional<glm::dvec2> fadeInDistances;
|
||||
|
||||
// [[codgen::verbatim(DisableFadeInInfo.description)]]
|
||||
// [[codegen::verbatim(DisableFadeInInfo.description)]]
|
||||
std::optional<bool> disableFadeIn;
|
||||
|
||||
// [[codgen::verbatim(BillboardMaxSizeInfo.description)]]
|
||||
// [[codegen::verbatim(BillboardMaxSizeInfo.description)]]
|
||||
std::optional<float> billboardMaxSize;
|
||||
|
||||
// [[codgen::verbatim(BillboardMinSizeInfo.description)]]
|
||||
// [[codegen::verbatim(BillboardMinSizeInfo.description)]]
|
||||
std::optional<float> billboardMinSize;
|
||||
|
||||
// [[codgen::verbatim(CorrectionSizeEndDistanceInfo.description)]]
|
||||
// [[codegen::verbatim(CorrectionSizeEndDistanceInfo.description)]]
|
||||
std::optional<float> correctionSizeEndDistance;
|
||||
|
||||
// [[codgen::verbatim(CorrectionSizeFactorInfo.description)]]
|
||||
// [[codegen::verbatim(CorrectionSizeFactorInfo.description)]]
|
||||
std::optional<float> correctionSizeFactor;
|
||||
|
||||
// [[codgen::verbatim(PixelSizeControlInfo.description)]]
|
||||
// [[codegen::verbatim(PixelSizeControlInfo.description)]]
|
||||
std::optional<bool> enablePixelSizeControl;
|
||||
|
||||
// [[codgen::verbatim(UseLinearFiltering.description)]]
|
||||
// [[codegen::verbatim(UseLinearFiltering.description)]]
|
||||
std::optional<bool> useLinearFiltering;
|
||||
};
|
||||
#include "renderablebillboardscloud_codegen.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<Parameters>(dictionary);
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#include <modules/gaia/rendering/octreemanager.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/stringlistproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
|
||||
@@ -453,6 +453,7 @@ std::vector<documentation::Documentation> GlobeBrowsingModule::documentations()
|
||||
globebrowsing::Layer::Documentation(),
|
||||
globebrowsing::LayerAdjustment::Documentation(),
|
||||
globebrowsing::LayerManager::Documentation(),
|
||||
globebrowsing::GlobeTranslation::Documentation(),
|
||||
GlobeLabelsComponent::Documentation(),
|
||||
RingsComponent::Documentation(),
|
||||
ShadowComponent::Documentation()
|
||||
|
||||
@@ -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 =
|
||||
"<OpenSpaceTemporalGDALDataset>" ..
|
||||
"<OpenSpaceTimeStart>" .. startDate .. "</OpenSpaceTimeStart>" ..
|
||||
"<OpenSpaceTimeEnd>" .. endDate .. "</OpenSpaceTimeEnd>" ..
|
||||
@@ -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 =
|
||||
"<GDAL_WMS>" ..
|
||||
"<Service name=\"TMS\">" ..
|
||||
"<ServerUrl>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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -567,6 +567,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
ghoul::Dictionary layersDictionary = dictionary.value<ghoul::Dictionary>("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<LayerGroup*, LayerManager::NumLayerGroups>& layerGroups =
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -657,6 +657,10 @@ SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& di
|
||||
if (dictionary.hasValue<glm::dvec3>(sizereferenceprovider::KeyRadii)) {
|
||||
ellipsoid = dictionary.value<glm::dvec3>(sizereferenceprovider::KeyRadii);
|
||||
}
|
||||
else if (dictionary.hasValue<double>(sizereferenceprovider::KeyRadii)) {
|
||||
const double r = dictionary.value<double>(sizereferenceprovider::KeyRadii);
|
||||
ellipsoid = glm::dvec3(r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <modules/imgui/include/guicomponent.h>
|
||||
|
||||
#include <openspace/properties/stringlistproperty.h>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <ghoul/misc/boolean.h>
|
||||
#include <functional>
|
||||
|
||||
@@ -55,6 +55,14 @@ void renderStringProperty(properties::Property* prop, const std::string& ownerNa
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderIntListProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDoubleListProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderStringListProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
@@ -477,7 +477,7 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
>;
|
||||
static const std::map<std::string, Func> FunctionMapping = {
|
||||
{ "BoolProperty", &renderBoolProperty },
|
||||
{ "DoubleProperty", &renderDoubleProperty},
|
||||
{ "DoubleProperty", &renderDoubleProperty },
|
||||
{ "IntProperty", &renderIntProperty },
|
||||
{ "IVec2Property", &renderIVec2Property },
|
||||
{ "IVec3Property", &renderIVec3Property },
|
||||
@@ -493,6 +493,8 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
{ "DMat3Property", &renderDMat3Property },
|
||||
{ "DMat4Property", &renderDMat4Property },
|
||||
{ "StringProperty", &renderStringProperty },
|
||||
{ "DoubleListProperty", &renderDoubleListProperty },
|
||||
{ "IntListProperty", &renderIntListProperty },
|
||||
{ "StringListProperty", &renderStringListProperty },
|
||||
{ "OptionProperty", &renderOptionProperty },
|
||||
{ "TriggerProperty", &renderTriggerProperty },
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/stringlistproperty.h>
|
||||
#include <openspace/properties/list/doublelistproperty.h>
|
||||
#include <openspace/properties/list/intlistproperty.h>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
#include <openspace/properties/matrix/dmat2property.h>
|
||||
#include <openspace/properties/matrix/dmat3property.h>
|
||||
#include <openspace/properties/matrix/dmat4property.h>
|
||||
@@ -47,6 +49,7 @@
|
||||
#include <openspace/properties/vector/vec4property.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/misc/dictionaryluaformatter.h>
|
||||
#include <ghoul/misc/misc.h>
|
||||
|
||||
namespace openspace {
|
||||
@@ -101,7 +104,7 @@ void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
|
||||
BoolProperty* p = static_cast<BoolProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
BoolProperty::ValueType value = *p;
|
||||
ImGui::Checkbox(name.c_str(), &value);
|
||||
@@ -123,7 +126,7 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
|
||||
OptionProperty* p = static_cast<OptionProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
bool isReadOnly = false;
|
||||
if (p->metaData().hasValue<bool>("isReadOnly")) {
|
||||
isReadOnly = p->metaData().value<bool>("isReadOnly");
|
||||
@@ -186,34 +189,36 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
SelectionProperty* p = static_cast<SelectionProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
bool selectionChanged = false;
|
||||
std::set<std::string> newSelected;
|
||||
|
||||
if (ImGui::TreeNode(name.c_str())) {
|
||||
const std::vector<SelectionProperty::Option>& options = p->options();
|
||||
std::vector<int> newSelectedIndices;
|
||||
|
||||
std::vector<int> selectedIndices = p->value();
|
||||
std::set<std::string> selected = p->value();
|
||||
const std::vector<std::string>& options = p->options();
|
||||
|
||||
for (int i = 0; i < static_cast<int>(options.size()); ++i) {
|
||||
std::string description = options[i].description;
|
||||
bool selected = std::find(
|
||||
selectedIndices.begin(), selectedIndices.end(), i
|
||||
) != selectedIndices.end();
|
||||
const std::string key = options[i];
|
||||
bool isSelected = p->isSelected(key);
|
||||
|
||||
ImGui::Checkbox(description.c_str(), &selected);
|
||||
selectionChanged |= ImGui::Checkbox(key.c_str(), &isSelected);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
newSelectedIndices.push_back(i);
|
||||
if (isSelected) {
|
||||
newSelected.insert(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (newSelectedIndices != p->value()) {
|
||||
if (selectionChanged) {
|
||||
std::string parameters = "{";
|
||||
for (int i : newSelectedIndices) {
|
||||
parameters += std::to_string(i) + ",";
|
||||
for (const std::string& s : newSelected) {
|
||||
parameters += fmt::format("'{}',", s);
|
||||
}
|
||||
if (!newSelected.empty()) {
|
||||
parameters.pop_back();
|
||||
}
|
||||
parameters += "}";
|
||||
executeScript(p->fullyQualifiedIdentifier(), parameters, isRegular);
|
||||
@@ -230,7 +235,7 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
StringProperty* p = static_cast<StringProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
const std::string value = p->value();
|
||||
|
||||
@@ -262,18 +267,13 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
void renderListProperty(const std::string& name, const std::string& fullIdentifier,
|
||||
const std::string& stringValue, IsRegularProperty isRegular)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
StringListProperty* p = static_cast<StringListProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ghoul_assert(stringValue.size() > 2, "an empty list should have the string value '[]'");
|
||||
|
||||
std::string value;
|
||||
p->getStringValue(value);
|
||||
// const std::string value = p->value();
|
||||
// Remove brackets from the string value
|
||||
std::string value = stringValue.substr(1, stringValue.size() - 2);
|
||||
|
||||
static const int bufferSize = 512;
|
||||
static char buffer[bufferSize];
|
||||
@@ -288,9 +288,6 @@ void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
bufferSize,
|
||||
ImGuiInputTextFlags_EnterReturnsTrue
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (hasNewValue) {
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(std::string(buffer), ',');
|
||||
@@ -298,17 +295,78 @@ void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
for (std::string& token : tokens) {
|
||||
if (!token.empty()) {
|
||||
ghoul::trimWhitespace(token);
|
||||
script += "[[" + token + "]],";
|
||||
script += token + ',';
|
||||
}
|
||||
}
|
||||
script += "}";
|
||||
script += '}';
|
||||
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
fullIdentifier,
|
||||
std::move(script),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void renderDoubleListProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DoubleListProperty* p = static_cast<DoubleListProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
std::string value;
|
||||
p->getStringValue(value);
|
||||
|
||||
renderListProperty(name, p->fullyQualifiedIdentifier(), value, isRegular);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderIntListProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IntListProperty* p = static_cast<IntListProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
std::string value;
|
||||
p->getStringValue(value);
|
||||
|
||||
renderListProperty(name, p->fullyQualifiedIdentifier(), value, isRegular);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
StringListProperty* p = static_cast<StringListProperty*>(prop);
|
||||
const std::string& name = p->guiName();
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
std::string value;
|
||||
p->getStringValue(value);
|
||||
|
||||
renderListProperty(name, p->fullyQualifiedIdentifier(), value, isRegular);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
@@ -320,7 +378,7 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DoubleProperty* p = static_cast<DoubleProperty*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
float value = static_cast<float>(*p);
|
||||
float min = static_cast<float>(p->minValue());
|
||||
@@ -352,7 +410,7 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IntProperty* p = static_cast<IntProperty*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
IntProperty::ValueType value = *p;
|
||||
int min = p->minValue();
|
||||
@@ -377,7 +435,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec2Property* p = static_cast<IVec2Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
IVec2Property::ValueType value = *p;
|
||||
int min = glm::compMin(p->minValue());
|
||||
@@ -410,7 +468,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec3Property* p = static_cast<IVec3Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
IVec3Property::ValueType value = *p;
|
||||
int min = glm::compMin(p->minValue());
|
||||
@@ -443,7 +501,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec4Property* p = static_cast<IVec4Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
IVec4Property::ValueType value = *p;
|
||||
int min = glm::compMin(p->minValue());
|
||||
@@ -476,7 +534,7 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
FloatProperty* p = static_cast<FloatProperty*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
FloatProperty::ValueType value = *p;
|
||||
float min = p->minValue();
|
||||
@@ -507,7 +565,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec2Property* p = static_cast<Vec2Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
Vec2Property::ValueType value = *p;
|
||||
float min = glm::compMin(p->minValue());
|
||||
@@ -543,7 +601,7 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec3Property* p = static_cast<Vec3Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
Vec3Property::ValueType value = *p;
|
||||
float min = glm::compMin(p->minValue());
|
||||
@@ -588,7 +646,7 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec4Property* p = static_cast<Vec4Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
Vec4Property::ValueType value = *p;
|
||||
float min = glm::compMin(p->minValue());
|
||||
@@ -633,7 +691,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec2Property* p = static_cast<DVec2Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
glm::vec2 value = glm::dvec2(*p);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
@@ -668,7 +726,7 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec3Property* p = static_cast<DVec3Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
glm::vec3 value = glm::dvec3(*p);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
@@ -704,7 +762,7 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec4Property* p = static_cast<DVec4Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
glm::vec4 value = glm::dvec4(*p);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
@@ -741,7 +799,7 @@ void renderDMat2Property(Property* prop, const std::string& ownerName,
|
||||
DMat2Property* p = static_cast<DMat2Property*>(prop);
|
||||
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
ImGui::Text("%s", name.c_str());
|
||||
|
||||
glm::mat2 value = glm::dmat2(*p);
|
||||
@@ -798,7 +856,7 @@ void renderDMat3Property(Property* prop, const std::string& ownerName,
|
||||
DMat3Property* p = static_cast<DMat3Property*>(prop);
|
||||
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
ImGui::Text("%s", name.c_str());
|
||||
|
||||
glm::mat3 value = glm::dmat3(*p);
|
||||
@@ -865,7 +923,7 @@ void renderDMat4Property(Property* prop, const std::string& ownerName,
|
||||
DMat4Property* p = static_cast<DMat4Property*>(prop);
|
||||
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
ImGui::Text("%s", name.c_str());
|
||||
|
||||
glm::mat4 value = glm::dmat4(*p);
|
||||
@@ -940,7 +998,7 @@ void renderTriggerProperty(Property* prop, const std::string& ownerName,
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
std::string name = prop->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::PushID((ownerName + '.' + name).c_str());
|
||||
|
||||
bool pressed = ImGui::Button(name.c_str());
|
||||
if (pressed) {
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/stringlistproperty.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace {
|
||||
else if (value.is_number()) {
|
||||
return std::to_string(value.get<double>());
|
||||
}
|
||||
else if (value.empty()) {
|
||||
return "{}";
|
||||
}
|
||||
else if (value.is_array()) {
|
||||
std::string literal = "{";
|
||||
for (nlohmann::json::iterator it = value.begin(); it != value.end(); ++it) {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/misc.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
@@ -135,18 +136,11 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
addProperty(_constellationSelection);
|
||||
|
||||
if (p.constellationSelection.has_value()) {
|
||||
std::vector<properties::SelectionProperty::Option> options =
|
||||
_constellationSelection.options();
|
||||
const std::vector<std::string> options = _constellationSelection.options();
|
||||
|
||||
std::vector<int> selectedIndices;
|
||||
std::set<std::string> selectedNames;
|
||||
for (const std::string& s : *p.constellationSelection) {
|
||||
const auto it = std::find_if(
|
||||
options.begin(),
|
||||
options.end(),
|
||||
[&s](const properties::SelectionProperty::Option& o) {
|
||||
return o.description == s;
|
||||
}
|
||||
);
|
||||
const auto it = std::find(options.begin(), options.end(), s);
|
||||
if (it == options.end()) {
|
||||
// The user has specified a constellation name that doesn't exist
|
||||
LWARNINGC(
|
||||
@@ -155,15 +149,10 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
);
|
||||
}
|
||||
else {
|
||||
// If the found the option, we push the index of the found value into the
|
||||
// array
|
||||
selectedIndices.push_back(static_cast<int>(
|
||||
std::distance(options.begin(), it)
|
||||
));
|
||||
selectedNames.insert(s);
|
||||
}
|
||||
}
|
||||
|
||||
_constellationSelection = selectedIndices;
|
||||
_constellationSelection = selectedNames;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +366,11 @@ bool RenderableConstellationBounds::loadConstellationFile() {
|
||||
}
|
||||
|
||||
// Update the constellations full name
|
||||
s >> it->constellationFullName;
|
||||
std::string fullName;
|
||||
std::getline(s, fullName);
|
||||
ghoul::trimWhitespace(fullName);
|
||||
it->constellationFullName = std::move(fullName);
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
@@ -385,32 +378,23 @@ bool RenderableConstellationBounds::loadConstellationFile() {
|
||||
}
|
||||
|
||||
void RenderableConstellationBounds::fillSelectionProperty() {
|
||||
// Each constellation is associated with its position in the array as this is unique
|
||||
// and will be constant during the runtime
|
||||
for (int i = 0 ; i < static_cast<int>(_constellationBounds.size()); ++i) {
|
||||
const ConstellationBound& bound = _constellationBounds[i];
|
||||
_constellationSelection.addOption( { i, bound.constellationFullName } );
|
||||
_constellationSelection.addOption(bound.constellationFullName);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableConstellationBounds::selectionPropertyHasChanged() {
|
||||
const std::vector<int>& values = _constellationSelection;
|
||||
// If no values are selected (the default), we want to show all constellations
|
||||
if (values.empty()) {
|
||||
if (!_constellationSelection.hasSelected()) {
|
||||
for (ConstellationBound& b : _constellationBounds) {
|
||||
b.isEnabled = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// In the worst case, this algorithm runs with 2 * nConstellations, which is
|
||||
// acceptable as the number of constellations is < 100
|
||||
// First disable all constellations
|
||||
// Enable all constellations that are selected
|
||||
for (ConstellationBound& b : _constellationBounds) {
|
||||
b.isEnabled = false;
|
||||
}
|
||||
// then re-enable the ones for which we have indices
|
||||
for (int value : values) {
|
||||
_constellationBounds[value].isEnabled = true;
|
||||
b.isEnabled = _constellationSelection.isSelected(b.constellationFullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul::opengl { class ProgramObject; }
|
||||
|
||||
|
||||
@@ -90,13 +90,13 @@ RenderableSatellites::RenderableSatellites(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_updateStartRenderIdxSelect = [this]() {
|
||||
if ((_numObjects - _startRenderIdx) < _sizeRender) {
|
||||
_sizeRender = _numObjects - _startRenderIdx;
|
||||
_sizeRender = static_cast<unsigned int>(_numObjects - _startRenderIdx);
|
||||
}
|
||||
updateBuffers();
|
||||
};
|
||||
_updateRenderSizeSelect = [this]() {
|
||||
if (_sizeRender > (_numObjects - _startRenderIdx)) {
|
||||
_startRenderIdx = _numObjects - _sizeRender;
|
||||
_startRenderIdx = static_cast<unsigned int>(_numObjects - _sizeRender);
|
||||
}
|
||||
updateBuffers();
|
||||
};
|
||||
|
||||
@@ -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<Parameters>(dictionary);
|
||||
|
||||
@@ -142,7 +142,7 @@ RenderableSmallBody::RenderableSmallBody(const ghoul::Dictionary& dictionary)
|
||||
_updateStartRenderIdxSelect = std::function<void()>([this] {
|
||||
if (_contiguousMode) {
|
||||
if ((_numObjects - _startRenderIdx) < _sizeRender) {
|
||||
_sizeRender = _numObjects - _startRenderIdx;
|
||||
_sizeRender = static_cast<unsigned int>(_numObjects - _startRenderIdx);
|
||||
}
|
||||
_updateDataBuffersAtNextRender = true;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ RenderableSmallBody::RenderableSmallBody(const ghoul::Dictionary& dictionary)
|
||||
_updateRenderSizeSelect = std::function<void()>([this] {
|
||||
if (_contiguousMode) {
|
||||
if (_sizeRender > (_numObjects - _startRenderIdx)) {
|
||||
_startRenderIdx = _numObjects - _sizeRender;
|
||||
_startRenderIdx = static_cast<unsigned int>(_numObjects - _sizeRender);
|
||||
}
|
||||
_updateDataBuffersAtNextRender = true;
|
||||
}
|
||||
@@ -221,7 +221,7 @@ void RenderableSmallBody::readDataFile(const std::string& filename) {
|
||||
else {
|
||||
lineSkipFraction = static_cast<float>(_upperLimit)
|
||||
/ static_cast<float>(_numObjects);
|
||||
endElement = _numObjects - 1;
|
||||
endElement = static_cast<unsigned int>(_numObjects - 1);
|
||||
}
|
||||
|
||||
if (line.compare(expectedHeaderLine) != 0) {
|
||||
|
||||
@@ -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<unsigned int> _indexBufferData;
|
||||
bool contiguousMode = true;
|
||||
properties::BoolProperty _contiguousMode;
|
||||
properties::UIntProperty _upperLimit;
|
||||
properties::Property::OnChangeHandle _contiguousModeCallbackhandle;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -41,12 +41,6 @@
|
||||
#include <variant>
|
||||
|
||||
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");
|
||||
|
||||
@@ -41,14 +41,6 @@
|
||||
#include <fstream>
|
||||
|
||||
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 "
|
||||
|
||||
@@ -38,12 +38,6 @@ bool toLuaConversion(lua_State* state, openspace::volume::TransferFunction value
|
||||
return value.envelopesToLua(state);
|
||||
}
|
||||
|
||||
openspace::volume::TransferFunction fromStringConversion(std::string val, bool& success) {
|
||||
openspace::volume::TransferFunction tf;
|
||||
success = tf.setEnvelopesFromString(val);
|
||||
return tf;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue,
|
||||
openspace::volume::TransferFunction inValue)
|
||||
{
|
||||
@@ -59,7 +53,6 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(TransferFunctionProperty, volume::TransferFunct
|
||||
volume::TransferFunction(),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
|
||||
#include <openspace/properties/stringlistproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <ghoul/misc/process.h>
|
||||
|
||||
@@ -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\""
|
||||
|
||||
@@ -76,8 +76,10 @@ set(OPENSPACE_SOURCE
|
||||
${OPENSPACE_BASE_DIR}/src/properties/propertyowner.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/selectionproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/stringproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/stringlistproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/triggerproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/list/doublelistproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/list/intlistproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/list/stringlistproperty.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat2property.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat2x3property.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat2x4property.cpp
|
||||
@@ -260,6 +262,8 @@ set(OPENSPACE_HEADER
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/network/parallelpeer.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/network/parallelserver.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/network/messagestructures.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/listproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/listproperty.inl
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/numericalproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/numericalproperty.inl
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/optionproperty.h
|
||||
@@ -269,10 +273,12 @@ set(OPENSPACE_HEADER
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/propertyowner.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/selectionproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/stringproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/stringlistproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/templateproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/templateproperty.inl
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/triggerproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/list/doublelistproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/list/intlistproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/list/stringlistproperty.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat2property.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat2x3property.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat2x4property.h
|
||||
|
||||
@@ -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) {
|
||||
|
||||
104
src/properties/list/doublelistproperty.cpp
Normal file
104
src/properties/list/doublelistproperty.cpp
Normal file
@@ -0,0 +1,104 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/properties/list/doublelistproperty.h>
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/misc/misc.h>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr const char* _loggerCat = "DoubleListProperty";
|
||||
|
||||
std::vector<double> fromLuaConversion(lua_State* state, bool& success) {
|
||||
if (!lua_istable(state, -1)) {
|
||||
success = false;
|
||||
LERROR("Conversion from Lua failed. The input was not a table");
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<double> result;
|
||||
lua_pushnil(state);
|
||||
while (lua_next(state, -2) != 0) {
|
||||
if (lua_isnumber(state, -1)) {
|
||||
result.emplace_back(lua_tonumber(state, -1));
|
||||
}
|
||||
else {
|
||||
success = false;
|
||||
LERROR(
|
||||
"Conversion from Lua failed. The input table contains non-number values"
|
||||
);
|
||||
return {};
|
||||
}
|
||||
lua_pop(state, 1);
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toLuaConversion(lua_State* state, std::vector<double> val) {
|
||||
lua_createtable(state, static_cast<int>(val.size()), 0);
|
||||
|
||||
int i = 1;
|
||||
for (int v : val) {
|
||||
lua_pushinteger(state, i);
|
||||
lua_pushinteger(state, v);
|
||||
lua_settable(state, -3);
|
||||
++i;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, const std::vector<double>& inValue) {
|
||||
nlohmann::json json(inValue);
|
||||
outValue = json.dump();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
DoubleListProperty::DoubleListProperty(Property::PropertyInfo info)
|
||||
: ListProperty(std::move(info))
|
||||
{}
|
||||
|
||||
DoubleListProperty::DoubleListProperty(Property::PropertyInfo info, std::vector<double> values)
|
||||
: ListProperty(std::move(info), std::move(values))
|
||||
{}
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_SOURCE(
|
||||
DoubleListProperty,
|
||||
std::vector<double>,
|
||||
std::vector<double>(),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
} // namespace openspace::properties
|
||||
104
src/properties/list/intlistproperty.cpp
Normal file
104
src/properties/list/intlistproperty.cpp
Normal file
@@ -0,0 +1,104 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/properties/list/intlistproperty.h>
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/misc/misc.h>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr const char* _loggerCat = "IntListProperty";
|
||||
|
||||
std::vector<int> fromLuaConversion(lua_State* state, bool& success) {
|
||||
if (!lua_istable(state, -1)) {
|
||||
success = false;
|
||||
LERROR("Conversion from Lua failed. The input was not a table");
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<int> result;
|
||||
lua_pushnil(state);
|
||||
while (lua_next(state, -2) != 0) {
|
||||
if (lua_isnumber(state, -1)) {
|
||||
result.emplace_back(lua_tonumber(state, -1));
|
||||
}
|
||||
else {
|
||||
success = false;
|
||||
LERROR(
|
||||
"Conversion from Lua failed. The input table contains non-number values"
|
||||
);
|
||||
return {};
|
||||
}
|
||||
lua_pop(state, 1);
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toLuaConversion(lua_State* state, std::vector<int> val) {
|
||||
lua_createtable(state, static_cast<int>(val.size()), 0);
|
||||
|
||||
int i = 1;
|
||||
for (const int& v : val) {
|
||||
lua_pushinteger(state, i);
|
||||
lua_pushinteger(state, v);
|
||||
lua_settable(state, -3);
|
||||
++i;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, const std::vector<int>& inValue) {
|
||||
nlohmann::json json(inValue);
|
||||
outValue = json.dump();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
IntListProperty::IntListProperty(Property::PropertyInfo info)
|
||||
: ListProperty(std::move(info))
|
||||
{}
|
||||
|
||||
IntListProperty::IntListProperty(Property::PropertyInfo info, std::vector<int> values)
|
||||
: ListProperty(std::move(info), std::move(values))
|
||||
{}
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_SOURCE(
|
||||
IntListProperty,
|
||||
std::vector<int>,
|
||||
std::vector<int>(),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
} // namespace openspace::properties
|
||||
@@ -22,19 +22,23 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/properties/stringlistproperty.h>
|
||||
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/misc/misc.h>
|
||||
#include <numeric>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/misc/misc.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "IntListProperty";
|
||||
} // namespace
|
||||
|
||||
namespace {
|
||||
|
||||
std::vector<std::string> fromLuaConversion(lua_State* state, bool& success) {
|
||||
if (!lua_istable(state, -1)) {
|
||||
success = false;
|
||||
LERROR("Conversion from Lua failed. The input was not a table");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -58,8 +62,8 @@ bool toLuaConversion(lua_State* state, std::vector<std::string> val) {
|
||||
lua_createtable(state, static_cast<int>(val.size()), 0);
|
||||
|
||||
int i = 1;
|
||||
for (std::string& v : val) {
|
||||
lua_pushnumber(state, i);
|
||||
for (const std::string& v : val) {
|
||||
lua_pushinteger(state, i);
|
||||
lua_pushstring(state, v.c_str());
|
||||
lua_settable(state, -3);
|
||||
++i;
|
||||
@@ -68,42 +72,9 @@ bool toLuaConversion(lua_State* state, std::vector<std::string> val) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> fromStringConversion(const std::string& val, bool& success) {
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
for (std::string& token : tokens) {
|
||||
// Each incoming string is of the form "value"
|
||||
// so we want to remove the leading and trailing " characters
|
||||
if (token.size() > 2 && (token[0] == '"' && token[token.size() - 1] == '"')) {
|
||||
token = token.substr(1, token.size() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
success = true;
|
||||
return tokens;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, const std::vector<std::string>& inValue) {
|
||||
outValue = "[";
|
||||
for (const std::string& v : inValue) {
|
||||
std::string str;
|
||||
nlohmann::json json;
|
||||
nlohmann::to_json(json, v);
|
||||
str = json.dump();
|
||||
if (&v != &*inValue.cbegin()) {
|
||||
outValue += ", ";
|
||||
}
|
||||
outValue += str;
|
||||
}
|
||||
outValue += "]";
|
||||
|
||||
// outValue = std::accumulate(
|
||||
// inValue.begin(),
|
||||
// inValue.end(),
|
||||
// std::string(""),
|
||||
// [](std::string lhs, std::string rhs) {
|
||||
// return lhs + "," + "\"" + rhs + "\"";
|
||||
// }
|
||||
// );
|
||||
nlohmann::json json(inValue);
|
||||
outValue = json.dump();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -111,13 +82,21 @@ bool toStringConversion(std::string& outValue, const std::vector<std::string>& i
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
StringListProperty::StringListProperty(Property::PropertyInfo info)
|
||||
: ListProperty(std::move(info))
|
||||
{}
|
||||
|
||||
StringListProperty::StringListProperty(Property::PropertyInfo info,
|
||||
std::vector<std::string> values)
|
||||
: ListProperty(std::move(info), std::move(values))
|
||||
{}
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_SOURCE(
|
||||
StringListProperty,
|
||||
std::vector<std::string>,
|
||||
std::vector<std::string>(),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat2x2 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat2x2 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat2x2 result = glm::dmat2x2(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat2x2>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat2x2::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat2x2::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat2x2::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat2x2 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat2x2::row_type::length(); ++i) {
|
||||
@@ -127,7 +100,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
glm::dmat2x2(0.01, 0.01, 0.01, 0.01),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat2x3 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat2x3 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat2x3 result = glm::dmat2x3(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat2x3>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat2x3::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat2x3::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat2x3::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat2x3 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat2x3::row_type::length(); ++i) {
|
||||
@@ -135,7 +108,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
glm::dmat2x3(0.01, 0.01, 0.01, 0.01, 0.01, 0.01),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat2x4 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat2x4 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat2x4 result = glm::dmat2x4(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat2x4>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat2x4::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat2x4::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat2x4::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat2x4 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat2x4::row_type::length(); ++i) {
|
||||
@@ -137,7 +110,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
glm::dmat2x4(0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat3x3 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat3x3 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat3x3 result = glm::dmat3x3(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat3x3>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat3x3::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat2x3::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat3x3::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat3x3 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat3x3::row_type::length(); ++i) {
|
||||
@@ -140,7 +113,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat3x2 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat3x2 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat3x2 result = glm::dmat3x2(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat3x2>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat3x2::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat3x2::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat3x2::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat3x2 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat3x2::row_type::length(); ++i) {
|
||||
@@ -136,7 +109,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,34 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat3x4 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
glm::dmat3x4 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat3x4 result = glm::dmat3x4(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat3x4>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat3x4::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat3x4::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat3x4::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat3x4 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat3x4::row_type::length(); ++i) {
|
||||
@@ -143,7 +115,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat4x4 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat4x4 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat4x4 result = glm::dmat4x4(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat4x4>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat4x4::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat4x4::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat4x4::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat4x4 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat4x4::row_type::length(); ++i) {
|
||||
@@ -142,7 +115,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat4x2 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat4x2 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat4x2 result = glm::dmat4x2(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat4x2>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat4x2::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat4x2::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat4x2::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat4x2 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat4x2::row_type::length(); ++i) {
|
||||
@@ -136,7 +109,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -73,33 +73,6 @@ bool toLuaConversion(lua_State* state, glm::dmat4x3 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::dmat4x3 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::dmat4x3 result = glm::dmat4x3(1.0);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::dmat4x3>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::dmat4x3::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::dmat4x3::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::dmat4x3::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::dmat4x3 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::dmat4x3::row_type::length(); ++i) {
|
||||
@@ -139,7 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -75,33 +75,6 @@ bool toLuaConversion(lua_State* state, glm::mat2x2 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat2x2 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat2x2 result = glm::mat2x2(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat2x2>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat2x2::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat2x2::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat2x2::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat2x2 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat2x2::row_type::length(); ++i) {
|
||||
@@ -138,7 +111,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -76,33 +76,6 @@ bool toLuaConversion(lua_State* state, glm::mat2x3 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat2x3 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat2x3 result = glm::mat2x3(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat2x3>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat2x3::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat2x3::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat2x3::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat2x3 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat2x3::row_type::length(); ++i) {
|
||||
@@ -141,7 +114,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -74,33 +74,6 @@ bool toLuaConversion(lua_State* state, glm::mat2x4 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat2x4 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat2x4 result = glm::mat2x4(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat2x4>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat2x4::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat2x4::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat2x4::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat2x4 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat2x4::row_type::length(); ++i) {
|
||||
@@ -143,7 +116,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -74,33 +74,6 @@ bool toLuaConversion(lua_State* state, glm::mat3x3 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat3x3 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat3x3 result = glm::mat3x3(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat3x3>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat3x3::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat3x3::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat3x3::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat3x3 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat3x3::row_type::length(); ++i) {
|
||||
@@ -140,7 +113,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -74,33 +74,6 @@ bool toLuaConversion(lua_State* state, glm::mat3x2 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat3x2 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat3x2 result = glm::mat3x2(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat3x2>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat3x2::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat3x2::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat3x2::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat3x2 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat3x2::row_type::length(); ++i) {
|
||||
@@ -137,7 +110,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -74,33 +74,6 @@ bool toLuaConversion(lua_State* state, glm::mat3x4 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat3x4 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat3x4 result = glm::mat3x4(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat3x4>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat3x4::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat3x4::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat3x4::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat3x4 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat3x4::row_type::length(); ++i) {
|
||||
@@ -143,7 +116,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -76,33 +76,6 @@ bool toLuaConversion(lua_State* state, glm::mat4x4 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat4x4 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat4x4 result = glm::mat4x4(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat4x4>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat4x4::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat4x4::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat4x4::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat4x4 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat4x4::row_type::length(); ++i) {
|
||||
@@ -145,7 +118,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -74,33 +74,6 @@ bool toLuaConversion(lua_State* state, glm::mat4x2 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat4x2 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat4x2 result = glm::mat4x2(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat4x2>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat4x2::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat4x2::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat4x2::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat4x2 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat4x2::row_type::length(); ++i) {
|
||||
@@ -137,7 +110,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -74,33 +74,6 @@ bool toLuaConversion(lua_State* state, glm::mat4x3 value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::mat4x3 fromStringConversion(const std::string& val, bool& success) {
|
||||
glm::mat4x3 result = glm::mat4x3(1.f);
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(val, ',');
|
||||
if (tokens.size() != ghoul::glm_components<glm::mat4x3>::value) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
int number = 0;
|
||||
for (glm::length_t i = 0; i < glm::mat4x3::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < glm::mat4x3::col_type::length(); ++j) {
|
||||
std::stringstream s(tokens[number]);
|
||||
glm::mat4x3::value_type v;
|
||||
s >> v;
|
||||
if (s.fail()) {
|
||||
success = false;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
result[i][j] = v;
|
||||
++number;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool toStringConversion(std::string& outValue, glm::mat4x3 inValue) {
|
||||
outValue = "[";
|
||||
for (glm::length_t i = 0; i < glm::mat4x3::row_type::length(); ++i) {
|
||||
@@ -140,7 +113,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(
|
||||
),
|
||||
fromLuaConversion,
|
||||
toLuaConversion,
|
||||
fromStringConversion,
|
||||
toStringConversion,
|
||||
LUA_TTABLE
|
||||
)
|
||||
|
||||
@@ -168,10 +168,6 @@ std::string Property::getStringValue() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
bool Property::setStringValue(std::string) { // NOLINT
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& Property::guiName() const {
|
||||
return _guiName;
|
||||
}
|
||||
@@ -383,7 +379,6 @@ std::string Property::generateAdditionalJsonDescription() const {
|
||||
|
||||
void Property::setInterpolationTarget(std::any) {} // NOLINT
|
||||
void Property::setLuaInterpolationTarget(lua_State*) {}
|
||||
void Property::setStringInterpolationTarget(std::string) {} // NOLINT
|
||||
void Property::interpolateValue(float, ghoul::EasingFunc<float>) {}
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user