Reorganize configuration files. Use script dir to make changes instead of having different modules

This commit is contained in:
Matthew Territo
2017-07-21 14:06:36 -06:00
parent be0ce22270
commit da5f264748
141 changed files with 15010 additions and 531 deletions

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-12.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"child",
}
}

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-front.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"child",
}
}

View File

@@ -24,7 +24,7 @@ function postInitialization()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/mrv-settings.lua'))
end

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-12.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"leaf",
}
}

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-front.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"leaf",
}
}

View File

@@ -24,7 +24,7 @@ function postInitialization()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/mrv-settings.lua'))
end

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-12.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"opacity",
}
}

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-front.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"opacity",
}
}

View File

@@ -24,7 +24,7 @@ function postInitialization()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/mrv-settings.lua'))
end

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-12.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"sand",
}
}

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-front.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"sand",
}
}

View File

@@ -24,7 +24,7 @@ function postInitialization()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/mrv-settings.lua'))
end

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-12.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"shen",
}
}

View File

@@ -1,43 +0,0 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv-front.lua'))
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Enlil New Horizons",
Position = {505370268486.696167, 1089706179272.719116, -890259148524.319458},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"shen",
}
}

View File

@@ -24,7 +24,7 @@ function postInitialization()
openspace.printInfo("Done setting default values")
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
dofile(openspace.absPath('${SCRIPTS}/mrv-settings.lua'))
end

View File

@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/child",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,7 +5,7 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/child-front.scene",
Scene = "${SCENE}/multires/child.scene",
Logging = {
LogDir = "${LOGS}/mrv",
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/child-front",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,11 +5,11 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/child-12.scene",
Scene = "${SCENE}/multires/child.scene",
Logging = {
LogDir = "${LOGS}/mrv",
PerformancePrefix = "child-12-",
PerformancePrefix = "child-reduced-",
LogLevel = "Error",
ImmediateFlush = true,
CapabilitiesVerbosity = "Full"
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/child-reduced",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/leaf",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,7 +5,7 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/leaf-front.scene",
Scene = "${SCENE}/multires/leaf.scene",
Logging = {
LogDir = "${LOGS}/mrv",
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/leaf-front",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,11 +5,11 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/leaf-12.scene",
Scene = "${SCENE}/multires/leaf.scene",
Logging = {
LogDir = "${LOGS}/mrv",
PerformancePrefix = "leaf-12-",
PerformancePrefix = "leaf-reduced-",
LogLevel = "Error",
ImmediateFlush = true,
CapabilitiesVerbosity = "Full"
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/leaf-reduced",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/opacity",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,7 +5,7 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/opacity-front.scene",
Scene = "${SCENE}/multires/opacity.scene",
Logging = {
LogDir = "${LOGS}/mrv",
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/opacity-front",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

69
mrv-opacity-reduced.cfg Normal file
View File

@@ -0,0 +1,69 @@
-- The configuration has an implict
-- require('scripts/configuration_helper.lua')
-- which defines helper functions useful to customize the configuration
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/opacity.scene",
Logging = {
LogDir = "${LOGS}/mrv",
PerformancePrefix = "opacity-reduced-",
LogLevel = "Error",
ImmediateFlush = true,
CapabilitiesVerbosity = "Full"
},
-- Determines which SGCT configuration file is loaded, that is, if there rendering
-- occurs in a single window, a fisheye projection, or a dome cluster system
-- A windowed 1920x1080 fullscreen
SGCTConfig = sgct.config.single{1920, 1080, border=false, windowPos={0,0}, shared=true, name="Multiresolution Volumes"},
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/opacity-reduced",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",
TASKS = "${OPENSPACE_DATA}/tasks",
SPICE = "${OPENSPACE_DATA}/spice",
MODULES = "${BASE_PATH}/modules",
TESTDIR = "${BASE_PATH}/tests",
CONFIG = "${BASE_PATH}/config",
CACHE = "${BASE_PATH}/cache",
FONTS = "${OPENSPACE_DATA}/fonts",
DOCUMENTATION = "${BASE_PATH}/documentation",
LOGS = "${BASE_PATH}/logs"
},
Fonts = {
Mono = "${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf",
Light = "${FONTS}/Roboto/Roboto-Regular.ttf",
Console = "${FONTS}/Inconsolata/Inconsolata-Regular.ttf"
},
Launcher = {
LogLevel = "None"
},
LuaDocumentation = "${DOCUMENTATION}/LuaScripting.html",
PropertyDocumentation = "${DOCUMENTATION}/Properties.html",
ScriptLog = "${LOGS}/ScriptLog.txt",
KeyboardShortcuts = "${DOCUMENTATION}/KeyboardMapping.html",
Documentation = "${DOCUMENTATION}/Documentation.html",
FactoryDocumentation = "${DOCUMENTATION}/FactoryDocumentation.html",
ShutdownCountdown = 0,
DownloadRequestURL = "http://data.openspaceproject.com/request.cgi",
RenderingMethod = "ABuffer",
OpenGLDebugContext = {
Activate = true,
FilterIdentifier = {
{ Type = "Other", Source = "API", Identifier = 131185 },
{ Type = "Performance", Source = "API", Identifier = 131186 }, --Buffer performance warning: "copied/moved from VIDEO memory to HOST memory"
{ Type = "Deprecated", Source = "API", Identifier = 7} -- API_ID_LINE_WIDTH deprecated behavior warning has been generated
},
},
}

View File

@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/sand",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,7 +5,7 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/sand-front.scene",
Scene = "${SCENE}/multires/sand.scene",
Logging = {
LogDir = "${LOGS}/mrv",
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/sand-front",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,11 +5,11 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/opacity-12.scene",
Scene = "${SCENE}/multires/sand.scene",
Logging = {
LogDir = "${LOGS}/mrv",
PerformancePrefix = "opacity-12-",
PerformancePrefix = "sand-reduced-",
LogLevel = "Error",
ImmediateFlush = true,
CapabilitiesVerbosity = "Full"
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/sand-reduced",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -1,69 +0,0 @@
-- The configuration has an implict
-- require('scripts/configuration_helper.lua')
-- which defines helper functions useful to customize the configuration
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/shen-12.scene",
Logging = {
LogDir = "${LOGS}/mrv",
PerformancePrefix = "shen-12-",
LogLevel = "Error",
ImmediateFlush = true,
CapabilitiesVerbosity = "Full"
},
-- Determines which SGCT configuration file is loaded, that is, if there rendering
-- occurs in a single window, a fisheye projection, or a dome cluster system
-- A windowed 1920x1080 fullscreen
SGCTConfig = sgct.config.single{1920, 1080, border=false, windowPos={0,0}, shared=true, name="Multiresolution Volumes"},
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",
TASKS = "${OPENSPACE_DATA}/tasks",
SPICE = "${OPENSPACE_DATA}/spice",
MODULES = "${BASE_PATH}/modules",
TESTDIR = "${BASE_PATH}/tests",
CONFIG = "${BASE_PATH}/config",
CACHE = "${BASE_PATH}/cache",
FONTS = "${OPENSPACE_DATA}/fonts",
DOCUMENTATION = "${BASE_PATH}/documentation",
LOGS = "${BASE_PATH}/logs"
},
Fonts = {
Mono = "${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf",
Light = "${FONTS}/Roboto/Roboto-Regular.ttf",
Console = "${FONTS}/Inconsolata/Inconsolata-Regular.ttf"
},
Launcher = {
LogLevel = "None"
},
LuaDocumentation = "${DOCUMENTATION}/LuaScripting.html",
PropertyDocumentation = "${DOCUMENTATION}/Properties.html",
ScriptLog = "${LOGS}/ScriptLog.txt",
KeyboardShortcuts = "${DOCUMENTATION}/KeyboardMapping.html",
Documentation = "${DOCUMENTATION}/Documentation.html",
FactoryDocumentation = "${DOCUMENTATION}/FactoryDocumentation.html",
ShutdownCountdown = 0,
DownloadRequestURL = "http://data.openspaceproject.com/request.cgi",
RenderingMethod = "ABuffer",
OpenGLDebugContext = {
Activate = true,
FilterIdentifier = {
{ Type = "Other", Source = "API", Identifier = 131185 },
{ Type = "Performance", Source = "API", Identifier = 131186 }, --Buffer performance warning: "copied/moved from VIDEO memory to HOST memory"
{ Type = "Deprecated", Source = "API", Identifier = 7} -- API_ID_LINE_WIDTH deprecated behavior warning has been generated
},
},
}

View File

@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/shen",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,7 +5,7 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/shen-front.scene",
Scene = "${SCENE}/multires/shen.scene",
Logging = {
LogDir = "${LOGS}/mrv",
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/shen-front",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -5,11 +5,11 @@
return {
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
-- of all entities that will be visible during an instance of OpenSpace
Scene = "${SCENE}/multires/sand-12.scene",
Scene = "${SCENE}/multires/shen.scene",
Logging = {
LogDir = "${LOGS}/mrv",
PerformancePrefix = "sand-12-",
PerformancePrefix = "shen-reduced-",
LogLevel = "Error",
ImmediateFlush = true,
CapabilitiesVerbosity = "Full"
@@ -24,7 +24,7 @@ return {
Task = "${TASKS}/default.task",
Paths = {
SCRIPTS = "${BASE_PATH}/scripts",
SCRIPTS = "${BASE_PATH}/scripts/mrv-20170721-00/shen-reduced",
SHADERS = "${BASE_PATH}/shaders",
OPENSPACE_DATA = "${BASE_PATH}/data",
SCENE = "${OPENSPACE_DATA}/scene",

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1,6 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scalingExponent", 12)
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scaling", {0.7, 0.7, 0.7})
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".rotation", {0.85153, 2.76746, 0.0})

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1,5 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scalingExponent", 12)
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scaling", {0.7, 0.7, 0.7})

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))

View File

@@ -0,0 +1 @@
openspace.setPropertyValue("Enlil New Horizons.renderable.scalingExponent", 12)

View File

@@ -0,0 +1,4 @@
openspace.setPropertyValue("Enlil New Horizons.renderable.scalingExponent", 12)
openspace.setPropertyValue("Enlil New Horizons.renderable.scaling", {0.7, 0.7, 0.7})
openspace.setPropertyValue("Enlil New Horizons.renderable.rotation", {0.85153, 2.76746, 0.0})

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('./config_mrv_logging.lua'))
dofile(openspace.absPath('./config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1,6 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scalingExponent", 12)
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scaling", {0.7, 0.7, 0.7})
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".rotation", {0.85153, 2.76746, 0.0})

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1,5 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scalingExponent", 12)
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scaling", {0.7, 0.7, 0.7})

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1,6 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scalingExponent", 12)
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scaling", {0.7, 0.7, 0.7})
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".rotation", {0.85153, 2.76746, 0.0})

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1,5 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scalingExponent", 12)
openspace.setPropertyValue(MRV_CONFIG_ENLIL_RENDERABLE .. ".scaling", {0.7, 0.7, 0.7})

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

View File

@@ -0,0 +1,144 @@
--[[ Commonly used OpenSpace configuration functions ]]--
helper = {}
helper.renderable = {}
helper.property = {}
-- These helpers are for scheduling lua scripts
-- See class ScriptScheduler and ScheduledScript for reference
helper.scheduledScript = {}
helper.scheduledScript.reversible = {}
-- Function that sets the most common key bindings that are common to most (all?)
-- scenes
helper.setCommonKeys = function()
openspace.bindKeyLocal(
"F1",
helper.property.invert('Global Properties.OnScreenGUI.Main.enabled'),
"Toggles the visibility of the on-screen GUI."
)
openspace.bindKeyLocal(
"F2",
helper.property.invert("RenderEngine.performanceMeasurements"),
"Toogles performance measurements that shows rendering time informations."
)
openspace.bindKeyLocal(
"ESC",
"openspace.toggleShutdown()",
"Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period."
)
openspace.bindKeyLocal(
"PRINT_SCREEN",
"openspace.setPropertyValueSingle('RenderEngine.takeScreenshot', nil)",
"Saves the contents of the screen to a file in the working directory."
)
openspace.bindKey(
"SPACE",
"openspace.time.togglePause()",
"Starts and stops the simulation time."
)
openspace.bindKey(
"COMMA",
"openspace.setRenderer('Framebuffer');",
"Changes the currently used renderer to use the 'Framebuffer' implementation."
)
openspace.bindKey(
"PERIOD",
"openspace.setRenderer('ABuffer');",
"Changes the currently used renderer to use the 'ABuffer' implementation."
)
openspace.bindKey(
"f",
helper.property.invert('NavigationHandler.OrbitalNavigator.horizontalFriction'),
"Toggles the horizontal friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely."
)
openspace.bindKey(
"Shift+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.verticalFriction'),
"Toggles the vertical friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely."
)
openspace.bindKey(
"Ctrl+f",
helper.property.invert('NavigationHandler.OrbitalNavigator.rotationalFriction'),
"Toggles the rotational friction of the camera. If it is disabled, the camera rotates around its own axis indefinitely."
)
openspace.bindKey(
"w",
"openspace.toggleFade(3)",
"Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds."
)
end
helper.setDeltaTimeKeys = function(t)
local Keys = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'Shift+1', 'Shift+2', 'Shift+3', 'Shift+4', 'Shift+5', 'Shift+6', 'Shift+7', 'Shift+8', 'Shift+9', 'Shift+0',
'Ctrl+1', 'Ctrl+2', 'Ctrl+3', 'Ctrl+4', 'Ctrl+5', 'Ctrl+6', 'Ctrl+7', 'Ctrl+8', 'Ctrl+9', 'Ctrl+0',
'Alt+1', 'Alt+2', 'Alt+3', 'Alt+4', 'Alt+5', 'Alt+6', 'Alt+7', 'Alt+8', 'Alt+9', 'Alt+0'
}
if #t > #Keys then
openspace.printError("Error settings delta time keys: Too many delta times (" .. #t .. ")")
return
end
for i, v in ipairs(t) do
openspace.bindKey(
Keys[i],
'openspace.time.setDeltaTime(' .. v .. ")",
'Setting the simulation speed to ' .. v .. ' seconds per realtime second'
)
end
end
-- Function that returns the string that inverts the fully qualified boolean property 'property'
helper.property.invert = function(property)
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
helper.property.increment = function(property, value)
local v = value or 1
local escaped_property = "'" .. property .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
helper.property.decrement = function(property, value)
return helper.property.increment(property, -value)
end
-- Function that returns the string that enables/disables the renderable 'renderable'
helper.renderable.toggle = function(renderable)
return helper.property.invert(renderable .. ".renderable.enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
helper.renderable.setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.enabled', " .. (enabled and "true" or "false") .. ");";
end
-- Function that returns a lua table specifying a reversible ScheduledScript for
-- setting the enabled property of <renderable> to <enabled> at time <time>.
helper.scheduledScript.reversible.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled),
BackwardScript = helper.renderable.setEnabled(renderable, not enabled)
}
end
helper.scheduledScript.setEnabled = function(time, renderable, enabled)
return
{
Time = time,
ForwardScript = helper.renderable.setEnabled(renderable, enabled)
}
end

View File

@@ -0,0 +1,4 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv_logging.lua'))
dofile(openspace.absPath('${SCRIPTS}/config_mrv_research_kit.lua'))
MRV_CONFIG_ENLIL = "Enlil New Horizons"
MRV_CONFIG_ENLIL_RENDERABLE = MRV_CONFIG_ENLIL .. ".renderable"

View File

@@ -0,0 +1,3 @@
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.enabled", true)
openspace.setPropertyValue("Global Properties.OnScreenGUI.Main.PerformanceComponent.outputLogs", true)
openspace.setPropertyValue("RenderEngine.performanceMeasurements", true)

View File

@@ -0,0 +1,5 @@
--[[ Configuration scripts for the Research Kit ]]--
-- Set a timeout for the application
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeout", 2000)
openspace.setPropertyValue("Global Properties.ResearchKit.Timer._timeoutCycles", 0)

View File

@@ -0,0 +1,812 @@
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}-- Helper functions that are useful to customize the openspace.cfg loading
--[[
##########################################################################################
Public functions
##########################################################################################
]]--
-- SGCT related functions
sgct = {}
sgct.config = {}
-- This function takes a text definition for an SGCT configuration file and returns the path
-- to a temporary file containing the string which SGCT can use
function sgct.makeConfig(config) end
-- Creates a configuration file similar to the default 'single.xml':
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view settings [example: fov={ left=20, right=30, up=10, down=50}] {default: { left=30.0, right=30.0, up=16.875, down=16.875}}
-- Thus this function can be called the following ways:
-- sgct.config.single() -> Leading to a 1280x720 resolution window
-- sgct.config.single(1920, 1080) -> Leading to a 1920x1080 resolution window
-- sgct.config.single(640, 360, res={3840, 2160}) -> 640x360 window with 4K rendering resolution
-- sgct.config.single(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.single(arg) end
-- Creates a configuration file similar to the default 'single_fisheye.xml'
-- The parameter is a table and can contain the follow attributes:
-- first argument: horizontal window size {default: 1280}
-- second argument: vertical window size {default: 720}
-- res: A table containing the horizontal and vertical resolution [example: res={3840, 2160}]
-- windowPos: The position of the window on the screen [example: windowPos={50, 100}] {default: {50, 50}}
-- fullScreen: Whether the application should run in exclusive full screen [example: fullScreen=true] {default: false}
-- border: Whether the application should have window decorations (aka. border) [example: border=false] {default: true}
-- monitor: Determines the monitor on which the application is started [example: monitor=2] {default: 0}
-- shared: Determines whether the contents of the window should be shared using the SPOUT library [example: shared=true] {default: false}
-- Expert settings:
-- name: The name of the window [example: window="Foobar"] {default: "OpenSpace"}
-- tags: A list of string tags that are passed to the window [example: tags ={"GUI"}] {default: {}}
-- vsync: Whether the rendering speed is locked to the refreshrate [example: vsync=true] {default: false}
-- refreshRate: If vsync is enabled, this is the target framerate [example: refreshRate=30] {default: infinity}
-- stereo: Select the stereo rendering mode as supported by SGCT [example: stereo='anaglyph_red_cyan'] {default: 'none'}
-- msaa: The multisampling anti-aliasing factor [example: msaa=4] {default: 8}
-- eyeSep: The base eye separation in m [example: eyeSep=0.1] {default: 0.065}
-- eyePos: The location of the user [example: eyePos={0.0, 1.0, 0.0}] {default: {0.0, 0.0, 0.0}}
-- scene: Global settings to all scene objects (offset, orientation, scaling; each optional)
-- [example: scene = {offset = {x = 1.0, y = 1.0, z = 2.0}, orientation = { yaw = 120, pitch = 15, roll = 0.0 }, scale = 10.0}]
-- capture: Settings to configure the image capture [example: capture = { path = "./images"]
-- sgctDebug: Determines whether a higher debug level in SGCT is enabled [example: sgctDebug=true] {default: false}
-- fov: The field of view for the fisheye [example: fov=360] {default: 180}
-- quality: The quality setting for the cubemap textures [example: quality="4k"] {default: "1k"}
-- tilt: The forwards tilt of the fisheye, relative to the center [example: tilt=90] {default: 0.0}
-- background: The background color used outside of the fisheye rendering [example: backgruound={r=1.0, g=0.25, b=0.25, a=1.0}] {default: {r=0.1, g=0.1, b=0.1, a=1.0}}
-- Thus this function can be called the following ways:
-- sgct.config.fisheye() -> Leading to a 1280x720 resolution window
-- sgct.config.fisheye(640, 640) -> Leading to a 640x650 resolution window
-- sgct.config.fisheye(640, 360, res={3840, 3840}) -> 640x360 window with 4K rendering resolution
-- sgct.config.fisheye(msaa=1) -> 1280x720 resolution without multisampling
function sgct.config.fisheye(arg) end
function sgct.config.cube(arg) end
--[[
##########################################################################################
Internal helper functions
##########################################################################################
]]--
function generateSingleViewportFOV(down, up, left, right)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<PlanarProjection>
<FOV down="]]..down..[[" left="]]..left..[[" right="]]..right..[[" up="]]..up..[[" />
<Orientation heading="0.0" pitch="0.0" roll="0.0" />
</PlanarProjection>
</Viewport>
]]
end
function generateSingleViewport(lowerLeft, upperLeft, upperRight)
return
[[
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Projectionplane>
<Pos x="]] .. lowerLeft[1] .. [[" y="]] .. lowerLeft[2] .. [[" z="]] .. lowerLeft[3] .. [[" />
<Pos x="]] .. upperLeft[1] .. [[" y="]] .. upperLeft[2] .. [[" z="]] .. upperLeft[3] .. [[" />
<Pos x="]] .. upperRight[1] .. [[" y="]] .. upperRight[2] .. [[" z="]] .. upperRight[3] .. [[" />
</Projectionplane>
</Viewport>
]]
end
function generateFisheyeViewport(fov, quality, tilt, background, crop, offset)
local b = [[
<Background
r="]]..background["r"]..[["
g="]]..background["g"]..[["
b="]]..background["b"]..[["
a="]]..background["a"]..[["
/>
]]
local c = ""
if crop then
c = [[
<Crop
left="]] .. crop["left"] .. [["
right="]] .. crop["right"] .. [["
top="]] .. crop["top"] .. [["
bottom="]] .. crop["bottom"] .. [["
/>
]]
end
local o = ""
if offset then
o = [[
<Offset
x="]] .. offset["x"] .. [["
y="]] .. offset["y"] .. [["
z="]] .. offset["z"] .. [["
/>
]]
end
return [[
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="]]..fov..[[" quality="]]..quality..[[" tilt="]]..tilt..[[">
]]..b..[[
]]..c..[[
]]..o..[[
</FisheyeProjection>
</Viewport>
]]
end
function generateWindow(arg)
local resolution = ""
if arg["res"] then
arg["res"][1] = arg["res"][1] or arg["windowSize"][1]
arg["res"][2] = arg["res"][2] or arg["windowSize"][2]
resolution =
[[
<Res x="]] .. arg["res"][1] .. [[" y="]] .. arg["res"][2] .. [[" />
]]
end
local tags = ""
if arg["tags"] then
tags = table.concat(arg["tags"], ",")
end
return
[[
<Window
fullScreen="]] .. tostring(arg["fullScreen"]) .. [["
numberOfSamples="]] .. arg["msaa"] .. [["
border="]] .. tostring(arg["border"]) .. [["
name="]] .. arg["name"] .. [["
monitor="]] .. arg["monitor"] .. [["
tags="]] .. tags .. [["
>
<Stereo type="]] .. arg["stereo"] .. [[" />
<Size x="]] .. arg["windowSize"][1] .. [[" y="]] .. arg["windowSize"][2] .. [[" />
<Pos x="]].. arg["windowPos"][1] ..[[" y="]] .. arg["windowPos"][2] .. [[" />
]]..resolution..
[[
]]..
arg["viewport"]..
[[
</Window>
]]
end
function generateUser(arg)
return [[
<User eyeSeparation="]] .. arg["eyeSep"] .. [[">
<Pos
x="]] .. arg["eyePos"][1] .. [["
y="]] .. arg["eyePos"][2] .. [["
z="]] .. arg["eyePos"][3] .. [["
/>
</User>
]]
end
function generateScene(arg)
local scene = arg["scene"]
if scene == nil then
return ""
else
local offset = nil
if scene["offset"] then
local o = scene["offset"]
offset = [[<Offset x="]]..o["x"]..[[" y="]]..o["y"]..[[" z="]]..o["z"]..[[" />]]
end
local orientation = nil
if scene["orientation"] then
local o = scene["orientation"]
orientation = [[<Orientation yaw="]]..o["yaw"]..[[" pitch="]]..o["pitch"]..[[" roll="]]..o["roll"]..[[" />]]
end
local scale = nil
if scene["scale"] then
scale = [[<Scale value="]] .. scene["scale"] .. [[" />]]
end
local sceneString = " <Scene>"
if offset then
sceneString = sceneString .. "\n " .. offset .. "\n"
end
if orientation then
sceneString = sceneString .. "\n " .. orientation .. "\n"
end
if scale then
sceneString = sceneString .. "\n " .. scale .. "\n"
end
sceneString = sceneString .. " </Scene>\n"
return sceneString
-- return [[
-- <Scene>
-- ]]..offset..[[
-- ]]..orientation..[[
-- ]]..scale..[[
-- </Scene>]]
end
end
function generateSettings(arg)
local v
if arg["vsync"] then
v = 1
else
v = 0
end
local refresh = ""
if arg["refreshRate"] then
refresh = "refreshRate=" .. arg["refreshRate"] .. " "
end
return [[
<Settings>
<Display swapInterval="]].. v ..[[" ]] .. refresh .. [[/>
</Settings>
]]
end
function generateCapture(arg)
if arg["capture"] == nil then
return ""
else
local path = ""
if arg["capture"]["path"] then
path = 'path="' .. arg["capture"]["path"] .. '" '
end
local monoPath = ""
if arg["capture"]["monoPath"] then
path = 'monoPath="' .. arg["capture"]["monoPath"] .. '" '
end
local leftPath = ""
if arg["capture"]["leftPath"] then
path = 'leftPath="' .. arg["capture"]["leftPath"] .. '" '
end
local rightPath = ""
if arg["capture"]["rightPath"] then
path = 'rightPath="' .. arg["capture"]["rightPath"] .. '" '
end
local format = ""
if arg["capture"]["format"] then
path = 'format="' .. arg["capture"]["format"] .. '" '
end
end
end
function generateCluster(arg)
return [[
<?xml version="1.0" ?>
<Cluster
masterAddress="localhost"
externalControlPort="20500"
debug="]] .. tostring(arg["sgctDebug"]) .. [["
>
]] .. (arg["settings"] or "") .. [[
]] .. (arg["scene"] or "") .. [[
<Node address="localhost" port="20401">
]] .. arg["window"] ..[[
</Node>
]] .. arg["user"] .. [[
]] .. (arg["capture"] or "") .. [[
</Cluster>
]]
end
function generateSingleWindowConfig(arg)
-- First some type checking
assert(
type(arg[1]) == "number" or type(arg[1]) == "nil",
"First argument must be a number or nil"
)
assert(
type(arg[2]) == "number" or type(arg[2]) == "nil",
"Second argument must be a number or nil"
)
assert(
type(arg["res"]) == "table" or type(arg["res"]) == "nil",
"res must be a table or nil"
)
if (type(arg["res"]) == "table") then
assert(type(arg["res"][1]) == "number", "res[1] must be a number")
assert(type(arg["res"][2]) == "number", "res[2] must be a number")
end
assert(
type(arg["shared"]) == "boolean" or type(arg["shared"]) == "nil",
"shared must be a boolean or nil"
)
assert(
type(arg["tags"]) == "table" or type(arg["tags"]) == "nil",
"tags must be a table or nil"
)
if (type(arg["tags"]) == "table") and (next(arg["tags"]) ~= nil) then
for index, value in ipairs(arg["tags"]) do
assert(type(value) == "string", "Each tag must be a string")
end
end
assert(
type(arg["windowSize"]) == "table" or type(arg["windowSize"]) == "nil",
"windowSize must be a table or nil"
)
if (type(arg["windowSize"]) == "table") then
assert(type(arg["windowSize"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowSize"][2]) == "number", "windowPos[2] must be a number")
assert(
type(arg[1]) == "nil" and type(arg[2]) == "nil",
"Only windowSize or the first and second arguments can be set. Not both"
)
end
assert(
type(arg["windowPos"]) == "table" or type(arg["windowPos"]) == "nil",
"windowPos must be a table or nil"
)
if (type(arg["windowPos"]) == "table") then
assert(type(arg["windowPos"][1]) == "number", "windowPos[1] must be a number")
assert(type(arg["windowPos"][2]) == "number", "windowPos[2] must be a number")
end
assert(
type(arg["name"]) == "string" or type(arg["name"]) == "nil",
"name must be a string or nil"
)
assert(
type(arg["fullScreen"]) == "boolean" or type(arg["fullScreen"]) == "nil",
"fullScreen must be a boolean or nil"
)
assert(
type(arg["monitor"]) == "number" or type(arg["monitor"]) == "nil",
"monitor must be a number or nil"
)
assert(
type(arg["border"]) == "boolean" or type(arg["border"]) == "nil",
"border must be a boolean or nil"
)
assert(
type(arg["msaa"]) == "number" or type(arg["msaa"]) == "nil",
"msaa must be a number or nil"
)
assert(
type(arg["vsync"]) == "boolean" or type(arg["vsync"]) == "nil",
"vsync must be a boolean or nil"
)
assert(
type(arg["refreshRate"]) == "number" or type(arg["refreshRate"]) == "nil",
"refreshRate must be a number or nil"
)
assert(
type(arg["stereo"]) == "string" or type(arg["stereo"]) == "nil",
"stereo must be a boolean or nil"
)
assert(
type(arg["eyeSep"]) == "number" or type(arg["eyeSep"]) == "nil",
"eyeSep must be a number or nil"
)
assert(
type(arg["eyePos"]) == "table" or type(arg["eyePos"]) == "nil",
"eyePos must be a table or nil"
)
if (type(arg["eyePos"]) == "table") then
assert(type(arg["eyePos"][1]) == "number", "eyePos[1] must be a number")
assert(type(arg["eyePos"][2]) == "number", "eyePos[2] must be a number")
assert(type(arg["eyePos"][3]) == "number", "eyePos[3] must be a number")
end
assert(
type(arg["sgctDebug"]) == "boolean" or type(arg["sgctDebug"]) == "nil",
"sgctDebug must be a boolean or nil"
)
assert(
type(arg["scene"]) == "table" or type(arg["scene"]) == "nil",
"scene must be a table or nil"
)
if type(arg["scene"]) == "table" then
local offset = arg["scene"]["offset"]
assert(
type(offset) == "table" or type(offset) == "nil",
"scene['offset'] must be a table or nil"
)
if type(offset) == "table" then
assert(type(offset["x"]) == "number", "scene['offset']['x'] must be a number")
assert(type(offset["y"]) == "number", "scene['offset']['y'] must be a number")
assert(type(offset["z"]) == "number", "scene['offset']['z'] must be a number")
end
local orientation = arg["scene"]["orientation"]
assert(
type(orientation) == "table" or type(orientation) == "nil",
"scene['orientation] must be a table or nil"
)
if type(orientation) == "table" then
assert(type(orientation["yaw"]) == "number", "orientation['yaw'] must be a number")
assert(type(orientation["pitch"]) == "number", "orientation['pitch'] must be a number")
assert(type(orientation["roll"]) == "number", "orientation['roll'] must be a number")
end
local scale = arg["scene"]["scale"]
assert(
type(scale) == "number" or type(scale) == "nil",
"scene['scale'] must be a number or nil"
)
end
assert(
type(arg["capture"]) == "table" or type(arg["capture"]) == "nil",
"capture must be a table or nil"
)
if type(arg["capture"]) == "table" then
local c = arg["capture"]
assert(
type(c["path"]) == "string" or type(c["path"]) == "nil",
"capture['path'] must be a string or nil"
)
assert(
type(c["monoPath"]) == "string" or type(c["monoPath"]) == "nil",
"capture['monoPath'] must be a string or nil"
)
assert(
type(c["leftPath"]) == "string" or type(c["leftPath"]) == "nil",
"capture['leftPath'] must be a string or nil"
)
assert(
type(c["rightPath"]) == "string" or type(c["rightPath"]) == "nil",
"capture['rightPath'] must be a string or nil"
)
assert(
type(c["format"]) == "string" or type(c["format"]) == "nil",
"capture['format'] must be a string or nil"
)
end
assert(type(arg["viewport"]) == "string", "viewport must be a string")
-- Then setting reasonable default values
if arg["vsync"] == nil then
arg["vsync"] = false
end
if arg["fullScreen"] == nil then
arg["fullScreen"] = false
end
if arg["monitor"] == nil then
arg["monitor"] = 0
end
if arg["tags"] == nil then
arg["tags"] = {}
end
if arg["msaa"] == nil then
arg["msaa"] = 8
end
if arg["border"] == nil then
arg["border"] = true
end
if arg["shared"] then
local t = arg["tags"]
t[#t + 1] = "Spout"
end
if arg["name"] == nil then
arg["name"] = "OpenSpace"
end
if arg["stereo"] == nil then
arg["stereo"] = "none"
end
if arg["windowPos"] == nil then
arg["windowPos"] = { 50, 50 }
end
if arg["eyeSep"] == nil then
arg["eyeSep"] = 0.065
end
if arg["eyePos"] == nil then
arg["eyePos"] = { 0.0, 0.0, 0.0 }
end
if arg["sgctDebug"] == nil then
arg["sgctDebug"] = false
end
if not arg["windowSize"] then
arg["windowSize"] = {}
arg["windowSize"][1] = arg[1] or 1280
arg["windowSize"][2] = arg[2] or 720
end
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = generateWindow(arg)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return generateCluster(arg)
end
function sgct.makeConfig(config)
local configFile = os.tmpname()
local file = io.open(configFile, "w+")
file:write(config)
io.close(file)
return configFile
end
function sgct.config.single(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "table" or type(arg["fov"]) == "nil",
"fov must be a table or nil"
)
if (type(arg["fov"]) == "table") then
assert(type(arg["fov"]["left"]) == "number", "fov['left'] must be a number")
assert(type(arg["fov"]["right"]) == "number", "fov['right'] must be a number")
assert(type(arg["fov"]["up"]) == "number", "fov['up'] must be a number")
assert(type(arg["fov"]["down"]) == "number", "fov['down'] must be a number")
end
arg["fov"] = arg["fov"] or { down = 16.875, up = 16.875, left = 30.0, right = 30.0 }
arg["viewport"] = generateSingleViewportFOV(
arg["fov"]["down"],
arg["fov"]["up"],
arg["fov"]["left"],
arg["fov"]["right"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.fisheye(arg)
arg = arg or {}
assert(
type(arg["fov"]) == "number" or type(arg["fov"]) == "nil",
"fov must be a number or nil"
)
assert(
type(arg["quality"]) == "string" or type(arg["quality"]) == "nil",
"quality must be a string or nil"
)
assert(
type(arg["tilt"]) == "number" or type(arg["tilt"]) == "nil",
"tilt must be a number or nil"
)
assert(
type(arg["background"]) == "table" or type(arg["background"]) == "nil",
"background must be a table or nil"
)
if type(arg["background"]) == "table" then
assert(type(background["r"]) == "number", "backgroud['r'] must be a number")
assert(type(background["g"]) == "number", "backgroud['g'] must be a number")
assert(type(background["b"]) == "number", "backgroud['b'] must be a number")
assert(type(background["a"]) == "number", "backgroud['a'] must be a number")
end
assert(
type(arg["crop"]) == "table" or type(arg["crop"]) == "nil",
"crop must be a table or nil"
)
if type(arg["crop"]) == "table" then
assert(
type(arg["crop"]["left"]) == "number", "crop['left'] must be a number"
)
assert(
type(arg["crop"]["right"]) == "number", "crop['right'] must be a number"
)
assert(
type(arg["crop"]["top"]) == "number", "crop['top'] must be a number"
)
assert(
type(arg["crop"]["bottom"]) == "number", "crop['bottom'] must be a number"
)
end
assert(
type(arg["offset"]) == "table" or type(arg["offset"]) == "nil",
"offset must be a table or nil"
)
if type(arg["offset"]) == "table" then
assert(type(arg["offset"]["x"]) == "number", "offset['x'] must be a number")
assert(type(arg["offset"]["y"]) == "number", "offset['y'] must be a number")
assert(type(arg["offset"]["z"]) == "number", "offset['z'] must be a number")
end
if arg["fov"] == nil then
arg["fov"] = 180
end
if arg["quality"] == nil then
arg["quality"] = "1k"
end
if arg["tilt"] == nil then
arg["tilt"] = 0
end
if arg["background"] == nil then
arg["background"] = { r = 0.1, g = 0.1, b = 0.1, a = 1.0 }
end
arg["viewport"] = generateFisheyeViewport(
arg["fov"],
arg["quality"],
arg["tilt"],
arg["background"],
arg["crop"],
arg["offset"]
)
return sgct.makeConfig(generateSingleWindowConfig(arg))
end
function sgct.config.cube(arg)
function getCubeWindow(location, res, size)
local pos
local lowerLeft
local upperLeft
local upperRight
if location == 'left' then
pos = { 0, size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, 1, 1 }
upperRight = { -1, 1, -1 }
elseif location == 'right' then
pos = { 2 * size[1], size[2] }
lowerLeft = { 1, -1, -1 }
upperLeft = { 1, 1, -1 }
upperRight = { 1, 1, 1 }
elseif location == 'up' then
pos = { size[1], 0 }
lowerLeft = { 1, 1, -1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'down' then
pos = { size[1], 2 * size[2] }
lowerLeft = { -1, -1, 1 }
upperLeft = { -1, -1, -1 }
upperRight = { 1, -1, -1 }
elseif location == 'back' then
pos = { 2 * size[1], 2 * size[2] }
lowerLeft = { 1, -1, 1 }
upperLeft = { 1, 1, 1 }
upperRight = { -1, 1, 1 }
elseif location == 'front' then
pos = { size[1], size[2] }
lowerLeft = { -1, -1, -1 }
upperLeft = { -1, 1, -1 }
upperRight = { 1, 1, -1 }
end
arg = {}
arg["msaa"] = 8
arg["border"] = false
arg["name"] = "OpenSpace_" .. location
arg["tags"] = { "Spout" }
arg["windowSize"] = size
arg["windowPos"] = pos
arg["res"] = { res, res }
arg["viewport"] = generateSingleViewport(lowerLeft, upperLeft, upperRight)
return generateWindow(arg)
end
function getControlWindow(down, up, left, right)
arg = {}
arg["viewport"] = generateSingleViewportFOV(down, up, left, right)
return generateWindow(arg)
end
res = 1024
size = {640, 360}
arg["scene"] = generateScene(arg)
arg["settings"] = generateSettings(arg)
arg["window"] = getControlWindow(16.875, 16.875, 30.0, 30.0) .. getCubeWindow('front', res, size) .. getCubeWindow('back', res, size) ..
getCubeWindow('left', res, size) .. getCubeWindow('right', res, size) ..
getCubeWindow('up', res, size) .. getCubeWindow('down', res, size)
arg["user"] = generateUser(arg)
arg["capture"] = generateCapture(arg)
return sgct.makeConfig(generateCluster(arg))
end

View File

@@ -0,0 +1 @@
dofile(openspace.absPath('${SCRIPTS}/config_mrv.lua'))

View File

@@ -0,0 +1,20 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
})
-- OBS: One month (1mo) is approximated by 30 days.

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