mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-01 09:10:18 -06:00
* Solve bug related to corrupted texture tiles for certain sizes. * Regard layer settings when sampling height map. * Make Tile in to a class instead of a struct. * Memory aware lru cache. Needs cleanup. * Clean up and comment. * Clean up and comment. * Clean up * Clean up and comment. * Fix compilation error on Windows. * Specify data type explicitly in GDAL xml config files for Utah height maps. Closes #242 * Update the key type for the memory aware lru cache and use a unordered map instead of a map. * Solve pixel row size bug. * Solve initialization bug. * Add cache size as property of the globe browsing module. * Use memory aware tile cache for text tile provider. * Log GDAL errors as GHOUL messages * Add the ability to toggle tile level limiting by available data * Add ability to toggle GDAL logging * Add lock guard to memory aware tile cache * create base class rawtiledatareader that can be extended with different implementations than GDAL. * Let GdalWrapper take care of global GDAL settings. * Move iodescription to separate file * Move some functionality from gdalrawtiledatareader to rawtiledatareader * Move functionality from gdalrawtiledatareader to rawtiledatareader. * GDAL is no longer a necessary dependency for the globebrowsing module. However to read tiles, the SimpleRawTileDataReader needs to be implemented. Otherwise GDAL is needed. * Add ifdef check for GLOBEBROWSING_USE_GDAL * Implement SimpleRawTileDataReader. Currently can only read pow 2 textures. * Change ints to unsigned long longs * Limit number of texture creations per tile provider per frame * Solve linker error on windows * Fix Windows build errors * Fix crash in reading local patches * Update lodglobe descriptions * Abstract away overviews in gdal raw tile data reader * Update Mars and Moon configs. * Update screenshot script * Update ghoul version * Remove use of interaction depth below ellipsoid * Normalize direction vector * Use scale for distance swotch * Go back to use of interaction depth below ellipsoid * Fix comments on pull request. * TileProviderByLevel error does not propagate up. * Comment on mars and moon mod file * Add model space cut off level as a property * Update ChunkTile struct * Minor clean up * Go back tu constructor for ChunkTile
145 lines
5.4 KiB
Lua
145 lines
5.4 KiB
Lua
--[[ 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('Interaction.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('Interaction.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('Interaction.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
|