Merge branch 'master' of github.com:OpenSpace/OpenSpace into feature/data-management

Conflicts:
	include/openspace/scene/scenegraphnode.h
	src/engine/openspaceengine.cpp
	src/interaction/interactionhandler.cpp
	src/interaction/interactionmode.cpp
This commit is contained in:
Emil Axelsson
2017-07-18 10:54:41 +02:00
253 changed files with 9999 additions and 5219 deletions

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
# overwrite default settings here, for instance like this:
# [*.cpp]
# indent_style = tabs

125
.gitattributes vendored Normal file
View File

@@ -0,0 +1,125 @@
* text=auto
# GitHub files
ATTRIBUTION text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
copyright text
*COPYRIGHT* text
INSTALL text
LICENSE text
NEWS text
readme text
*README* text
TODO text
# Other helpers
.clang-format text
.gitattributes text
.gitconfig text
.gitignore text
Doxyfile text
Jenkinsfile text
langDef text
# Documents
*.bib text
*.cfg text
*.csv text
*.ini text
*.markdown text
*.md text
*.xml text
# Graphics
*.eps binary
*.gif binary
*.ico binary
*.jpeg binary
*.jpg binary
*.png binary
*.svg text
*.tif binary
*.tiff binary
# C++ sources
*.c text
*.cc text
*.cxx text
*.cpp text
*.c++ text
*.h text
*.hh text
*.hpp text
*.h++ text
*.in text
*.inl text
# CMake
*.cmake text
*.template text
# HTML
*.css text
*.htm text
*.html text
*.hbs text
*.js text
# GLSL
*.glsl text
*.hglsl text
*.fs text
*.frag text
*.vert text
*.vs text
# Other
*.am text
*.json text
*.lua text
*.py text
# Web Server Gateway Interface
*.wsgi text
# Compiled Dynamic libraries
*.dll binary
*.dylib binary
*.so binary
# Compiled Static libraries
*.a binary
*.la binary
*.lai binary
*.lib binary
# Fonts
*.otf binary
*.ttf binary
# Resource files
*.rc text
*.qrc text
# OpenSpace specific
*.scene text
*.mod text
*.data text
# SPICE specific
*.tf text
*.ti text
*.tls text
*.tpc text
# GDAL specific
*.wkt text
*.dxf text
*.gfs text
*.xsd text
*.rsc binary
*.dgn binary

2
.gitignore vendored
View File

@@ -118,4 +118,4 @@ data/spice/nh_kernels
data/spice/OsirisRexKernels
data/spice/plu055.bsp
data/spice/Rosetta
data/spice/sat375.bsp
data/spice/sat375.bsp

3
.gitmodules vendored
View File

@@ -10,3 +10,6 @@
[submodule "ext/sgct"]
path = ext/sgct
url = https://github.com/opensgct/sgct.git
[submodule "modules/touch/ext/libTUIO11"]
path = modules/touch/ext/libTUIO11
url = https://github.com/mkalten/TUIO11_CPP

View File

@@ -21,7 +21,7 @@ Rickard Lindtstedt
Michael Sjöström
Michael Novén
Oskar Carlbaum
Jonathas Bosson
Jonathan Bosson
Klas Eskilson
Anteige

4
Jenkinsfile vendored
View File

@@ -34,7 +34,7 @@ stage('Build') {
cd build
cmake .. ''' +
flags + ''' ..
make
make -j2
'''
}
}
@@ -70,7 +70,7 @@ stage('Build') {
mkdir ${srcDir}/build
fi
cd ${srcDir}/build
/Applications/CMake.app/Contents/bin/cmake -G Xcode -D NASM=/usr/local/bin/nasm ${srcDir} .. ''' +
/Applications/CMake.app/Contents/bin/cmake -G Xcode ${srcDir} .. ''' +
flags + '''
xcodebuild -quiet
'''

View File

@@ -1,9 +1,11 @@
OpenSpace is an open source, non-commercial, and freely available interactive data visualization software designed to visualize the entire known universe and portray our ongoing efforts to investigate the cosmos. Bringing the latest techniques from data visualization research to the general public, OpenSpace supports interactive presentation of dynamic data from observations, simulations, and space mission planning and operations. The software works on multiple operating systems (Windows, Linux, MacOS) with an extensible architecture powering high resolution tiled displays and planetarium domes, making use of the latest graphic card technologies for rapid data throughput. In addition, OpenSpace enables simultaneous connections across the globe creating opportunity for shared experiences among audiences worldwide.
[OpenSpace](http://openspaceproject.com) is an open source, non-commercial, and freely available interactive data visualization software designed to visualize the entire known universe and portray our ongoing efforts to investigate the cosmos. Bringing the latest techniques from data visualization research to the general public, OpenSpace supports interactive presentation of dynamic data from observations, simulations, and space mission planning and operations. The software works on multiple operating systems (Windows, Linux, MacOS) with an extensible architecture powering high resolution tiled displays and planetarium domes, making use of the latest graphic card technologies for rapid data throughput. In addition, OpenSpace enables simultaneous connections across the globe creating opportunity for shared experiences among audiences worldwide.
The project stems from the same academic collaboration between Swedens Linköping University (LiU) and the American Museum of Natural History (AMNH) that led to the creation of Uniview and its parent company SCISS. Development of the software began several years ago through a close collaboration with NASA Goddards Community Coordinated Modeling Center (CCMC) to model space weather forecasting and continued last year with visualization of NASAs New Horizons mission to Pluto and ESAs Rosetta mission. This promising set of preliminary work provided a foundation for recent NASA funding, which has extended the collaboration to include the University of Utahs Scientific Computing and Imaging (SCI) Institute, New York Universitys Tandon School of Engineering, multiple informal science institutions across the United States, and multiple, international vendors. Current areas of focus within OpenSpace include:
The project stems from the same academic collaboration between Swedens [Linköping University](https://www.liu.se) (LiU) and the [American Museum of Natural History](https://www.amnh.org) (AMNH) that led to the creation of Uniview and its parent company [SCISS](http://sciss.se). Development of the software began several years ago through a close collaboration with NASA Goddards [Community Coordinated Modeling Center](https://ccmc.gsfc.nasa.gov) (CCMC) to model space weather forecasting and continued with visualizations of NASAs New Horizons mission to Pluto and ESAs Rosetta mission. This promising set of preliminary work provided a foundation for recent NASA funding, which has extended the collaboration to include the University of Utahs [Scientific Computing and Imaging](https://www.sci.utah.edu) (SCI) Institute, [New York University](https://www.nyu.edu)s Tandon School of Engineering, multiple informal science institutions across the United States, and multiple, international vendors. Current areas of focus within OpenSpace include:
- Visualization of dynamic simulations via interactive volumetric rendering, as a priority for communicating research in astrophysics.
- Utilization of NASAs SPICE observational geometry system with its Planetary Data Service (PDS) to enable space mission visualization that reveal how missions are designed to gather science.
- Globe browsing techniques across spatial and temporal scales to examine scientific campaigns on multiple planets, including close up surface exploration.
This repository contains the source code and example scenes for OpenSpace, but does not contain any data. To build and install the client, we refer to the [Wiki](https://github.com/OpenSpace/OpenSpace/wiki) pages here on GitHub, specifically [building](https://github.com/OpenSpace/OpenSpace/wiki/General-Getting-Started-Guide%3A-Compiling-OpenSpace) for [Windows](https://github.com/OpenSpace/OpenSpace/wiki/Guides-Compile-OpenSpace-on-Windows), [Linux](https://github.com/OpenSpace/OpenSpace/wiki/Guides-Compile-OpenSpace-on-Linux), and [MacOS](https://github.com/OpenSpace/OpenSpace/wiki/Guides-Compile-OpenSpace-on-OSX). Required preexisting dependencies are: [NASM](http://www.nasm.us/), [Boost](http://www.boost.org/), and [Qt](http://www.qt.io/download). Feel free to create issues for missing features, bug reports, or compile problems or contact us via [email](mailto:alexander.bock@me.com?subject=OpenSpace:).
This repository contains the source code and example scenes for OpenSpace, but does not contain any data. To build and install the client, we refer to the [Wiki](https://github.com/OpenSpace/OpenSpace/wiki) pages here on GitHub, specifically [building](https://github.com/OpenSpace/OpenSpace/wiki/General-Getting-Started-Guide%3A-Compiling-OpenSpace) for [Windows](https://github.com/OpenSpace/OpenSpace/wiki/Guides-Compile-OpenSpace-on-Windows), [Linux](https://github.com/OpenSpace/OpenSpace/wiki/Guides-Compile-OpenSpace-on-Linux), and [MacOS](https://github.com/OpenSpace/OpenSpace/wiki/Guides-Compile-OpenSpace-on-OSX). Required preexisting dependencies are: [Boost](http://www.boost.org/) and [Qt](http://www.qt.io/download). Feel free to create issues for missing features, bug reports, or compile problems or contact us via [email](mailto:alexander.bock@me.com?subject=OpenSpace:).
Regarding any issues, you are very welcome on our [Slack support channel](https://openspacesupport.slack.com) to which you can freely [sign-up](https://join.slack.com/openspacesupport/shared_invite/MjA4ODY1MDQzNTUzLTE0OTk0MzUyODEtOGZkYTMwNmI5ZA).

View File

@@ -285,7 +285,7 @@ void MainWindow::initialize() {
_syncWidget->setSceneFiles(_sceneFiles);
// Load all available configuration files
QString configurationDirectory = QString::fromStdString(absPath("${SGCT}"));
QString configurationDirectory = QString::fromStdString(absPath("${CONFIG}"));
d = QDir(configurationDirectory);
d.setFilter(QDir::Files);
list = d.entryInfoList();

View File

@@ -84,10 +84,13 @@ if (OPENSPACE_SPOUT_SUPPORT)
set(SPOUT_INCLUDE_DIRS ${OPENSPACE_APPS_DIR}/OpenSpace/ext/spout)
set(SPOUT_LIBRARY ${OPENSPACE_APPS_DIR}/OpenSpace/ext/spout/SpoutLibrary.lib)
set(SPOUT_DEFINITIONS "OPENSPACE_HAS_SPOUT")
set(SGCT_SPOUT_SUPPORT ON CACHE BOOL "" FORCE)
endif ()
########################
# Spout section end #
# Spout section end #
########################
add_executable(${APPLICATION_NAME}

View File

@@ -442,10 +442,10 @@ void mainMousePosCallback(double x, double y) {
}
}
void mainMouseScrollCallback(double, double posY) {
void mainMouseScrollCallback(double posX, double posY) {
LTRACE("main::mainMouseScrollCallback(begin");
if (SgctEngine->isMaster()) {
OsEng.mouseScrollWheelCallback(posY);
OsEng.mouseScrollWheelCallback(posX, posY);
}
LTRACE("main::mainMouseScrollCallback(end)");
}

View File

@@ -1,8 +0,0 @@
width 1024
lower 0.0
upper 0.7
mappingkey 0.001 0 0 1 1
mappingkey 0.01 2 2 0 2
mappingkey 0.2 50 50 25 50
mappingkey 0.35 100 100 100 100
mappingkey 0.51 200 200 100 200

View File

@@ -1,15 +0,0 @@
width 1024
lower 0.0
upper 0.99
mappingkey 0.0035 1 1 1 1
mappingkey 0.0045 3 0 0 1
mappingkey 0.0060 3 0 0 2
mappingkey 0.0100 4 1 0 3
mappingkey 0.0200 6 2 0 3
mappingkey 0.0300 8 3 0 3
mappingkey 0.0350 10 4 0 4
mappingkey 0.0400 12 6 0 5
mappingkey 0.0800 14 10 0 5
mappingkey 0.1000 16 12 0 5
mappingkey 0.2000 50 50 10 10
mappingkey 0.2500 200 200 200 200

View File

@@ -1,8 +0,0 @@
width 1024
lower 0.0
upper 1.0
mappingkey 0.0 0 0 0 0
mappingkey 0.45 5 0 0 5
mappingkey 0.5 0 100 0 100
mappingkey 0.55 0 0 5 5
mappingkey 0.99 0 0 0 0

View File

@@ -1,5 +0,0 @@
width 1024
lower 0.0
upper 1.0
mappingkey 0.1 20 20 20 10
mappingkey 0.9 20 20 20 10

View File

@@ -1,14 +0,0 @@
width 1024
lower 0.0
upper 0.5
mappingkey 0.0035 1 1 1 1
mappingkey 0.0045 3 0 0 1
mappingkey 0.0060 3 0 0 2
mappingkey 0.0100 4 1 0 3
mappingkey 0.0200 6 2 0 3
mappingkey 0.0300 8 3 0 3
mappingkey 0.0400 12 6 0 5
mappingkey 0.0800 14 10 0 5
mappingkey 0.1000 16 12 0 5
mappingkey 0.2000 50 50 10 10
mappingkey 0.2500 200 200 200 200

View File

@@ -41,7 +41,8 @@ return {
CommonFolder = "common",
Camera = {
Focus = "Earth",
Position = {1, 0, 0, 2},
Position = {1, 0, 0},
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
},
Modules = {
"sun",

View File

@@ -29,7 +29,7 @@ function postInitialization()
openspace.addVirtualProperty("BoolProperty", "Show Trails", "*Trail.renderable.enabled", true, nil, nil)
openspace.resetCameraDirection()
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")
end

View File

@@ -6,10 +6,13 @@ function preInitialization()
critical objects.
]]--
--openspace.time.setTime(openspace.time.currentWallTime())
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
-- For unit test
--openspace.time.setTime("2016 SEP 8 23:00:00.500")
--openspace.time.togglePause()
openspace.time.setTime(openspace.time.currentWallTime())
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
@@ -75,7 +78,7 @@ function postInitialization()
openspace.setPropertyValue("Earth.RenderableGlobe.Debug.levelByProjectedAreaElseDistance", false)
openspace.setPropertyValue("Earth.RenderableGlobe.Layers.ColorLayers.blendTileLevels", true)
openspace.resetCameraDirection()
openspace.globebrowsing.goToGeo(0, 0, 20000000)
openspace.printInfo("Done setting default values")
end
@@ -86,7 +89,7 @@ return {
CommonFolder = "common",
Camera = {
Focus = "Earth",
Position = {30000000, 0, 0},
Position = {0, 0, 0},
Rotation = {0.758797, 0.221490, -0.605693, -0.091135},
},

View File

@@ -1,63 +1,63 @@
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("2016-07-05T10:05:00.00")
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
1, 5, 10, 20, 40, 90, 360, 720, 2880, 14400,
28800, 57600, 115200, 230400, 460800, 921600, 1843200, 3686400, 7372800, 14745600
})
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.printInfo("Setting default values")
openspace.setPropertyValue("Sun.renderable.enabled", false)
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
openspace.setPropertyValue('Jupiter.renderable.performShading', false);
openspace.printInfo("Done setting default values")
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Juno",
Position = {1, 0, 0, 5},
},
Modules = {
"sun",
"mercury",
"venus",
"earth",
"mars",
"jupiter",
"saturn/saturn",
"uranus",
"neptune",
"stars",
"milkyway",
"missions/juno"
}
}
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("2016-07-05T10:05:00.00")
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.setDeltaTimeKeys({
1, 5, 10, 20, 40, 90, 360, 720, 2880, 14400,
28800, 57600, 115200, 230400, 460800, 921600, 1843200, 3686400, 7372800, 14745600
})
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.printInfo("Setting default values")
openspace.setPropertyValue("Sun.renderable.enabled", false)
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
openspace.setPropertyValue('Jupiter.renderable.performShading', false);
openspace.printInfo("Done setting default values")
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Juno",
Position = {1, 0, 0, 5},
},
Modules = {
"sun",
"mercury",
"venus",
"earth",
"mars",
"jupiter",
"saturn/saturn",
"uranus",
"neptune",
"stars",
"milkyway",
"missions/juno"
}
}

View File

@@ -63,19 +63,17 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = earthEllipsoid,
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
{
Name = "ESRI VIIRS Combo",
Type = "ByLevel",
Type = "ByLevelTileLayer",
LevelTileProviders = {
{
MaxLevel = 3,
TileProvider = {
Type = "Temporal",
Type = "TemporalTileLayer",
Name = "Temporal VIIRS SNPP",
FilePath = "map_service_configs/GIBS/Temporal_VIIRS_SNPP_CorrectedReflectance_TrueColor.xml", },
},
@@ -89,23 +87,42 @@ return {
},
Enabled = true,
},
{
FilePath = "map_service_configs/ESRI/ESRI_Imagery_World_2D.wms",
Name = "ESRI",
},
{
Type = "Temporal",
Name = "Temporal_GHRSST_L4_MUR_Sea_Surface_Temperature",
FilePath = "map_service_configs/GIBS/Temporal_GHRSST_L4_MUR_Sea_Surface_Temperature.xml",
Name = "BMNG",
FilePath = "map_service_configs/Utah/Bmng.wms"
},
{
Type = "Temporal",
Type = "TemporalTileLayer",
Name = "Temporal_AMSR2_GCOM_W1_Sea_Ice_Concentration",
FilePath = "map_service_configs/GIBS/Temporal_AMSR2_GCOM_W1_Sea_Ice_Concentration.xml",
},
{
Name = "BMNG",
FilePath = "map_service_configs/Utah/Bmng.wms"
}
Type = "TemporalTileLayer",
Name = "MODIS_Terra_Chlorophyll_A",
FilePath = openspace.globebrowsing.createTemporalGibsGdalXml(
"MODIS_Terra_Chlorophyll_A",
"2013-07-02",
"Yesterday",
"1d",
"1km",
"png")
},
{
Type = "TemporalTileLayer",
Name = "GHRSST_L4_G1SST_Sea_Surface_Temperature",
FilePath = openspace.globebrowsing.createTemporalGibsGdalXml(
"GHRSST_L4_G1SST_Sea_Surface_Temperature",
"2010-06-21",
"Yesterday",
"1d",
"1km",
"png")
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = {
{
Name = "Earth at Night 2012",
@@ -118,7 +135,7 @@ return {
},
},
{
Type = "Temporal",
Type = "TemporalTileLayer",
Name = "Temporal Earth at Night",
FilePath = "map_service_configs/GIBS/Temporal_VIIRS_SNPP_DayNightBand_ENCC.xml"
}
@@ -134,7 +151,7 @@ return {
FilePath = "map_service_configs/Utah/Gebco.wms",
}
},
ColorOverlays = {
Overlays = {
{
Name = "Coastlines",
FilePath = "map_service_configs/GIBS/Coastlines.xml",
@@ -148,14 +165,13 @@ return {
FilePath = "map_service_configs/GIBS/Reference_Labels.xml",
},
{
Type = "TileIndex",
Type = "TileIndexTileLayer",
Name = "Tile Indices",
},
{
Type = "SizeReference",
Type = "SizeReferenceTileLayer",
Name = "Size Reference",
Radii = earthEllipsoid,
BackgroundImagePath = "../arrows.png",
},
},
HeightLayers = {

View File

@@ -13,10 +13,5 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/ESRI_Imagery_World_2d</Path>
<Depth>4</Depth>
<Extension>.jpg</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
</GDAL_WMS>

View File

@@ -3,19 +3,7 @@
<ServerUrl>http://198.102.45.23/arcgis/rest/services/worldelevation3d/terrain3d?</ServerUrl>
<TiledGroupName>GCS_Elevation</TiledGroupName>
</Service>
<DataWindow>
<UpperLeftX>-180.0</UpperLeftX>
<UpperLeftY>90.0</UpperLeftY>
<LowerRightX>180.0</LowerRightX>
<LowerRightY>-90.0</LowerRightY>
<YOrigin>bottom</YOrigin>
</DataWindow>
<Timeout>2</Timeout>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/TERRAIN</Path>
<Depth>4</Depth>
<Extension>.jpg</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
</GDAL_WMS>

View File

@@ -20,10 +20,4 @@
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/Coastlines</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
</GDAL_WMS>

View File

@@ -17,11 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/GIBS_Aqua_MODIS_true</Path>
<Depth>4</Depth>
<Extension>.jpg</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>

View File

@@ -17,11 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>4</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/MODIS_Terra_Brightness_Temp_Band31_Day</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>

View File

@@ -17,11 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/MODIS_Terra_CorrectedReflectance_TrueColor</Path>
<Depth>4</Depth>
<Extension>.jpg</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>

View File

@@ -17,13 +17,7 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>4</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/MODIS_Water_Mask</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockHttpCodes>400,204,404</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
</GDAL_WMS>

View File

@@ -17,12 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>4</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/Reference_Features</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>

View File

@@ -17,12 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>4</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/Reference_Labels</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>

View File

@@ -17,12 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>4</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/VIIRS_CityLights_2012</Path>
<Depth>4</Depth>
<Extension>.jpg</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>

View File

@@ -17,12 +17,6 @@
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>
<MaxConnections>5</MaxConnections>
<Cache>
<Path>./GDAL_Cache/VIIRS_SNPP_CorrectedReflectance_TrueColor</Path>
<Depth>4</Depth>
<Extension>.jpg</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>

View File

@@ -3,5 +3,4 @@
<ServerUrl>http://a${server_num}.ortho.tiles.virtualearth.net/tiles/a${quadkey}.jpeg?g=90</ServerUrl>
</Service>
<MaxConnections>4</MaxConnections>
<Cache/>
</GDAL_WMS>

View File

@@ -23,8 +23,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {2631000, 2631000, 2631000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -32,15 +30,8 @@ return {
Name = "Callisto Texture",
FilePath = "textures/callisto.jpg",
Enabled = true,
TilePixelSize = 112,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
}
},

View File

@@ -23,8 +23,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {1561000, 1561000, 1561000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -32,15 +30,8 @@ return {
Name = "Europa Texture",
FilePath = "textures/europa.jpg",
Enabled = true,
TilePixelSize = 256,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
}
},

View File

@@ -23,8 +23,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {2631000, 2631000, 2631000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -32,15 +30,8 @@ return {
Name = "Ganymede Texture",
FilePath = "textures/ganymede.jpg",
Enabled = true,
TilePixelSize = 112,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
}
},

View File

@@ -23,8 +23,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {1821300, 1821300, 1821300},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -34,12 +32,6 @@ return {
Enabled = true,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
}
},

View File

@@ -34,8 +34,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {71492000, 71492000, 66854000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -45,12 +43,6 @@ return {
Enabled = true,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
}
},

View File

@@ -12,10 +12,6 @@
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
</DataWindow>
<Cache>
<Path>./GDAL_CTX_cache</Path>
<Depth>3</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<ZeroBlockHttpCodes>400,204,404</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
</GDAL_WMS>

View File

@@ -10,10 +10,5 @@
<LowerRightY>-90.0</LowerRightY>
<YOrigin>bottom</YOrigin>
</DataWindow>
<Cache>
<Path>./GDAL_MOLA_cache</Path>
<Depth>3</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
</GDAL_WMS>

View File

@@ -17,4 +17,6 @@
<BlockSizeY>256</BlockSizeY>
<BandsCount>2</BandsCount>
<MaxConnections>10</MaxConnections>
<ZeroBlockHttpCodes>400,204,404</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
</GDAL_WMS>

View File

@@ -10,10 +10,5 @@
<LowerRightY>-90.0</LowerRightY>
<YOrigin>bottom</YOrigin>
</DataWindow>
<Cache>
<Path>./GDAL_MOLA_cache</Path>
<Depth>3</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
</GDAL_WMS>

View File

@@ -1,4 +1,5 @@
local marsEllipsoid = {3396190.0, 3396190.0, 3376200.0}
return {
-- Barycenter module
{
@@ -31,10 +32,7 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = marsEllipsoid,
CameraMinHeight = 10,
SegmentsPerPatch = 90,
-- Allows camera to go down 10000 meters below the reference ellipsoid
InteractionDepthBelowEllipsoid = 10000, -- Useful when having negative height map values
Layers = {
ColorLayers = {
{
@@ -42,87 +40,30 @@ return {
FilePath = "map_service_configs/MARS_Viking_MDIM21.xml",
Enabled = true,
},
-- {
-- Type = "SingleImage",
-- Name = "Debug Tiles",
-- FilePath = "../../debugglobe/textures/test_tile.png",
-- },
--{
-- Name = "MARS_Viking",
-- FilePath = "map_service_configs/MARS_Viking_MDIM21.xml",
-- Enabled = true,
--},
{
Name = "MOLA Pseudo Color",
FilePath = "map_service_configs/Utah/MolaPseudoColor.xml",
-- Enabled = true,
},
--[[
{
Name = "Mars Viking Clr",
FilePath = "map_datasets/Viking/Mars_Viking_ClrMosaic_global_925m_longlat_full.vrt",
Enabled = true,
},
]]
},
GrayScaleLayers = {
},
GrayScaleColorOverlays = {
{
Name = "CTX Mosaic [AWS]",
FilePath = "map_service_configs/CTX.wms",
Enabled = true,
},
{
Name = "CTX Mosaic [Europe]",
FilePath = "map_service_configs/CTX_Mosaic.xml",
--Enabled = true,
BlendMode = "Color"
},
{
Name = "CTX Mosaic [Utah]",
FilePath = "map_service_configs/Utah/CTX_Mosaic.xml",
BlendMode = "Color"
},
{
Name = "West Candor Chasma",
FilePath = "map_datasets/CTX/West_Candor_Chasma_longlat_global.vrt",
--Enabled = true,
},
{
Name = "Layered Rock Outcrops in Southwest Candor Chasma",
FilePath = "map_datasets/HiRISE/Layered_Rock_Outcrops_in_Southwest_Candor_Chasma_Texture.vrt",
},
--[[{
Name = "Themis IR Day",
FilePath = "map_service_configs/Utah/ThemisIRDay.xml",
},
{
Name = "Themis IR Night",
FilePath = "map_service_configs/Utah/ThemisIRNight.xml",
},
{
Name = "MER_Meridianni_Endeavor_Basemap_25cm",
FilePath = "map_datasets/Basemap/MER_Meridianni_Endeavor_Basemap_25cm.vrt",
},
{
Name = "Part of Area Traversed by the Mars Exploration Rover",
FilePath = "map_datasets/HiRISE/Part_of_Area_Traversed_by_the_Mars_Exploration_Rover_Texture.vrt",
},
]]
},
NightLayers = { },
WaterMasks = { },
ColorOverlays = {
Overlays = {
{
Type = "TileIndex",
Type = "TileIndexTileLayer",
Name = "Indices",
},
{
Type = "SizeReference",
Type = "SizeReferenceTileLayer",
Name = "Size Reference",
Radii = marsEllipsoid,
BackgroundImagePath = "../arrows.png",
},
},
HeightLayers = {
@@ -131,50 +72,7 @@ return {
FilePath = "map_service_configs/Mola_Elevation.xml",
Enabled = true,
TilePixelSize = 90,
DoPreProcessing = true,
},
--[[
{
Name = "Mola Elevation [Utah]",
FilePath = "map_service_configs/Utah/Mola_Elevation.xml",
Enabled = false,
TilePixelSize = 90,
DoPreProcessing = true,
},
{
Name = "Mola Elevation CTX",
FilePath = "map_service_configs/Utah/MolaCTX_Elevation.xml",
-- Enabled = true,
TilePixelSize = 90,
DoPreProcessing = true,
},]]
{
Name = "West Candor Chasma",
FilePath = "map_datasets/CTX/West_Candor_Chasma_DEM_longlat_global.vrt",
--Enabled = true,
TilePixelSize = 90,
DoPreProcessing = true,
},
{
Name = "Layered Rock Outcrops in Southwest Candor Chasma",
FilePath = "map_datasets/HiRISE/Layered_Rock_Outcrops_in_Southwest_Candor_Chasma_Heightmap.vrt",
TilePixelSize = 90,
DoPreProcessing = true,
},
--[[
{
Name = "West Candor Chasma",
FilePath = "map_datasets/CTX/West_Candor_Chasma_DEM_longlat_global.vrt",
--Enabled = true,
TilePixelSize = 90,
DoPreProcessing = true,
},]]
--[[
{
Name = "Part of Area Traversed by the Mars Exploration Rover",
FilePath = "map_datasets/HiRISE/Part_of_Area_Traversed_by_the_Mars_Exploration_Rover_Heightmap.vrt",
},
]]
},
},
}

View File

@@ -25,6 +25,7 @@
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<Timeout>5</Timeout>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
</GDAL_WMS>

View File

@@ -0,0 +1,74 @@
return {
-- Barycenter module
{
Name = "MercuryBarycenter",
Parent = "SolarSystemBarycenter",
Transform = {
Translation = {
Type = "SpiceTranslation",
Body = "MERCURY",
Observer = "SUN",
Kernels = "${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
},
},
},
-- RenderableGlobe module
{
Name = "Mercury",
Parent = "MercuryBarycenter",
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "IAU_MERCURY",
DestinationFrame = "GALACTIC",
},
Scale = {
Type = "StaticScale",
Scale = 1,
},
},
Renderable = {
Type = "RenderableGlobe",
Radii = {2439700, 2439700.0, 2439700.0},
Frame = "IAU_MERCURY",
Body = "MERCURY",
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
{
Name = "Simple Texture",
FilePath = "textures/mercury.jpg",
Enabled = true,
},
{
Name = "Messenger_Mosaic",
FilePath = "map_service_configs/Utah/MessengerMosaic.wms"
},
{
Name = "Messenger_MDIS",
FilePath = "map_service_configs/Utah/MessengerMDIS.wms"
}
},
},
},
},
-- Trail module
{
Name = "MercuryTrail",
Parent = "SolarSystemBarycenter",
Renderable = {
Type = "RenderableTrailOrbit",
Translation = {
Type = "SpiceTranslation",
Body = "MERCURY",
Observer = "SUN",
},
Color = {0.6, 0.5, 0.5 },
Period = 87.968,
Resolution = 100
}
}
}

View File

@@ -61,13 +61,8 @@
<YOrigin>top</YOrigin>
</DataWindow>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
<BlockSizeY>512</BlockSizeY>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<Cache>
<Path>./GDAL_Cache/OnMoonColor</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
</GDAL_WMS>

View File

@@ -19,9 +19,4 @@
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<Cache>
<Path>./GDAL_Cache/OnMoonHeight</Path>
<Depth>4</Depth>
<Extension>.png</Extension>
</Cache>
</GDAL_WMS>

View File

@@ -19,18 +19,9 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {1738140, 1738140, 1735970}, -- Moons's radius
CameraMinHeight = 300,
SegmentsPerPatch = 64,
-- Allows camera to go down 10000 meters below the reference ellipsoid
InteractionDepthBelowEllipsoid = 10000, -- Useful when having negative height map values
Layers = {
ColorLayers = {
},
GrayScaleColorOverlays = {
},
GrayScaleLayers = {
{
Name = "OnMoonColorGrayscale",
FilePath = "map_service_configs/OnMoonColor.xml",
@@ -48,29 +39,14 @@ return {
Name = "WAC",
FilePath = "map_service_configs/Utah/Wac.wms"
}
},
NightLayers = {
},
WaterMasks = {
},
ColorOverlays = {
},
HeightLayers = {
{
Name = "OnMoonHeight",
FilePath = "map_service_configs/OnMoonHeight.xml",
Enabled = true,
DoPreProcessing = true,
TileSize = 64,
},
{
Name = "LolaDem",
FilePath = "map_service_configs/Utah/LolaDem.wms",
DoPreProcessing = true,
TileSize = 64,
Enabled = true,
TilePixelSize = 64,
Settings = { Multiplier = 0.5 },
}
},
},

View File

@@ -31,8 +31,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {24764000, 24764000, 24314000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -40,15 +38,8 @@ return {
Name = "Texture",
FilePath = "textures/neptune.jpg",
Enabled = true,
TilePixelSize = 256,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
},
},

View File

@@ -31,8 +31,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {60268000, 60268000, 54364000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -40,15 +38,8 @@ return {
Name = "Saturn Texture",
FilePath = "textures/saturn.jpg",
Enabled = true,
TilePixelSize = 256,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
},
},

View File

@@ -31,8 +31,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {25559000, 25559000, 24973000},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -40,15 +38,8 @@ return {
Name = "Texture",
FilePath = "textures/uranus.jpg",
Enabled = true,
TilePixelSize = 256,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
},
},

View File

@@ -36,8 +36,6 @@ return {
Renderable = {
Type = "RenderableGlobe",
Radii = {6051900, 6051900, 6051800},
CameraMinHeight = 300,
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
@@ -45,15 +43,8 @@ return {
Name = "Venus Texture",
FilePath = "textures/venus.jpg",
Enabled = true,
TilePixelSize = 256,
},
},
GrayScaleLayers = { },
GrayScaleColorOverlays = { },
NightLayers = { },
WaterMasks = { },
ColorOverlays = { },
HeightLayers = { },
},
},
},

View File

@@ -127,7 +127,7 @@ return {
Parent = "JupiterBarycenter",
Renderable = {
Type = "RenderableTrailTrajectory",
Translation = {
Translation = {
Type = "SpiceTranslation",
Body = "JUNO",
Observer = "JUPITER BARYCENTER"
@@ -135,7 +135,7 @@ return {
Color = { 0.70, 0.50, 0.20 },
StartTime = "2016 JUN 28",
EndTime = "2016 APR 01",
SampleInterval = 3600
SampleInterval = 3600
},
},
}

View File

@@ -1,4 +1,4 @@
UseAccurateNewHorizonsKernels = true
UseAccurateNewHorizonsKernels = false
-- TextureResolution = "low"
TextureResolution = "med"
-- TextureResolution = "high"

View File

@@ -46,7 +46,7 @@ function postInitialization()
openspace.printInfo("Done setting default values")
openspace.loadMission("${OPENSPACE_DATA}/scene/missions/osirisrex/osirisrex/osirisrex.mission")
openspace.resetCameraDirection()
openspace.navigation.resetCameraDirection()
end
return {

View File

@@ -32,7 +32,7 @@ function postInitialization()
openspace.setPropertyValue("EarthTrail.renderable.enabled", false)
openspace.setPropertyValue("Earth.renderable.performShading", false)
openspace.resetCameraDirection()
openspace.navigation.resetCameraDirection()
openspace.printInfo("Done setting default values")

View File

@@ -1,303 +1,303 @@
/* -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; -*-
Copyright (c) 2010-2012 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <exception>
#include "tinythread.h"
#if defined(_TTHREAD_POSIX_)
#include <unistd.h>
#include <map>
#elif defined(_TTHREAD_WIN32_)
#include <process.h>
#endif
namespace tthread {
//------------------------------------------------------------------------------
// condition_variable
//------------------------------------------------------------------------------
// NOTE 1: The Win32 implementation of the condition_variable class is based on
// the corresponding implementation in GLFW, which in turn is based on a
// description by Douglas C. Schmidt and Irfan Pyarali:
// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
//
// NOTE 2: Windows Vista actually has native support for condition variables
// (InitializeConditionVariable, WakeConditionVariable, etc), but we want to
// be portable with pre-Vista Windows versions, so TinyThread++ does not use
// Vista condition variables.
//------------------------------------------------------------------------------
#if defined(_TTHREAD_WIN32_)
#define _CONDITION_EVENT_ONE 0
#define _CONDITION_EVENT_ALL 1
#endif
#if defined(_TTHREAD_WIN32_)
condition_variable::condition_variable() : mWaitersCount(0)
{
mEvents[_CONDITION_EVENT_ONE] = CreateEvent(NULL, FALSE, FALSE, NULL);
mEvents[_CONDITION_EVENT_ALL] = CreateEvent(NULL, TRUE, FALSE, NULL);
InitializeCriticalSection(&mWaitersCountLock);
}
#endif
#if defined(_TTHREAD_WIN32_)
condition_variable::~condition_variable()
{
CloseHandle(mEvents[_CONDITION_EVENT_ONE]);
CloseHandle(mEvents[_CONDITION_EVENT_ALL]);
DeleteCriticalSection(&mWaitersCountLock);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::_wait()
{
// Wait for either event to become signaled due to notify_one() or
// notify_all() being called
int result = WaitForMultipleObjects(2, mEvents, FALSE, INFINITE);
// Check if we are the last waiter
EnterCriticalSection(&mWaitersCountLock);
-- mWaitersCount;
bool lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) &&
(mWaitersCount == 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we are the last waiter to be notified to stop waiting, reset the event
if(lastWaiter)
ResetEvent(mEvents[_CONDITION_EVENT_ALL]);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::notify_one()
{
// Are there any waiters?
EnterCriticalSection(&mWaitersCountLock);
bool haveWaiters = (mWaitersCount > 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we have any waiting threads, send them a signal
if(haveWaiters)
SetEvent(mEvents[_CONDITION_EVENT_ONE]);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::notify_all()
{
// Are there any waiters?
EnterCriticalSection(&mWaitersCountLock);
bool haveWaiters = (mWaitersCount > 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we have any waiting threads, send them a signal
if(haveWaiters)
SetEvent(mEvents[_CONDITION_EVENT_ALL]);
}
#endif
//------------------------------------------------------------------------------
// POSIX pthread_t to unique thread::id mapping logic.
// Note: Here we use a global thread safe std::map to convert instances of
// pthread_t to small thread identifier numbers (unique within one process).
// This method should be portable across different POSIX implementations.
//------------------------------------------------------------------------------
#if defined(_TTHREAD_POSIX_)
static thread::id _pthread_t_to_ID(const pthread_t &aHandle)
{
static mutex idMapLock;
static std::map<pthread_t, unsigned long int> idMap;
static unsigned long int idCount(1);
lock_guard<mutex> guard(idMapLock);
if(idMap.find(aHandle) == idMap.end())
idMap[aHandle] = idCount ++;
return thread::id(idMap[aHandle]);
}
#endif // _TTHREAD_POSIX_
//------------------------------------------------------------------------------
// thread
//------------------------------------------------------------------------------
/// Information to pass to the new thread (what to run).
struct _thread_start_info {
void (*mFunction)(void *); ///< Pointer to the function to be executed.
void * mArg; ///< Function argument for the thread function.
thread * mThread; ///< Pointer to the thread object.
};
// Thread wrapper function.
#if defined(_TTHREAD_WIN32_)
unsigned WINAPI thread::wrapper_function(void * aArg)
#elif defined(_TTHREAD_POSIX_)
void * thread::wrapper_function(void * aArg)
#endif
{
// Get thread startup information
_thread_start_info * ti = (_thread_start_info *) aArg;
try
{
// Call the actual client thread function
ti->mFunction(ti->mArg);
}
catch(...)
{
// Uncaught exceptions will terminate the application (default behavior
// according to C++11)
std::terminate();
}
// The thread is no longer executing
lock_guard<mutex> guard(ti->mThread->mDataMutex);
ti->mThread->mNotAThread = true;
// The thread is responsible for freeing the startup information
delete ti;
return 0;
}
thread::thread(void (*aFunction)(void *), void * aArg)
{
// Serialize access to this thread structure
lock_guard<mutex> guard(mDataMutex);
// Fill out the thread startup information (passed to the thread wrapper,
// which will eventually free it)
_thread_start_info * ti = new _thread_start_info;
ti->mFunction = aFunction;
ti->mArg = aArg;
ti->mThread = this;
// The thread is now alive
mNotAThread = false;
// Create the thread
#if defined(_TTHREAD_WIN32_)
mHandle = (HANDLE) _beginthreadex(0, 0, wrapper_function, (void *) ti, 0, &mWin32ThreadID);
#elif defined(_TTHREAD_POSIX_)
if(pthread_create(&mHandle, NULL, wrapper_function, (void *) ti) != 0)
mHandle = 0;
#endif
// Did we fail to create the thread?
if(!mHandle)
{
mNotAThread = true;
delete ti;
}
}
thread::~thread()
{
if(joinable())
std::terminate();
}
void thread::join()
{
if(joinable())
{
#if defined(_TTHREAD_WIN32_)
WaitForSingleObject(mHandle, INFINITE);
CloseHandle(mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_join(mHandle, NULL);
#endif
}
}
bool thread::joinable() const
{
mDataMutex.lock();
bool result = !mNotAThread;
mDataMutex.unlock();
return result;
}
void thread::detach()
{
mDataMutex.lock();
if(!mNotAThread)
{
#if defined(_TTHREAD_WIN32_)
CloseHandle(mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_detach(mHandle);
#endif
mNotAThread = true;
}
mDataMutex.unlock();
}
thread::id thread::get_id() const
{
if(!joinable())
return id();
#if defined(_TTHREAD_WIN32_)
return id((unsigned long int) mWin32ThreadID);
#elif defined(_TTHREAD_POSIX_)
return _pthread_t_to_ID(mHandle);
#endif
}
unsigned thread::hardware_concurrency()
{
#if defined(_TTHREAD_WIN32_)
SYSTEM_INFO si;
GetSystemInfo(&si);
return (int) si.dwNumberOfProcessors;
#elif defined(_SC_NPROCESSORS_ONLN)
return (int) sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(_SC_NPROC_ONLN)
return (int) sysconf(_SC_NPROC_ONLN);
#else
// The standard requires this function to return zero if the number of
// hardware cores could not be determined.
return 0;
#endif
}
//------------------------------------------------------------------------------
// this_thread
//------------------------------------------------------------------------------
thread::id this_thread::get_id()
{
#if defined(_TTHREAD_WIN32_)
return thread::id((unsigned long int) GetCurrentThreadId());
#elif defined(_TTHREAD_POSIX_)
return _pthread_t_to_ID(pthread_self());
#endif
}
}
/* -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; -*-
Copyright (c) 2010-2012 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <exception>
#include "tinythread.h"
#if defined(_TTHREAD_POSIX_)
#include <unistd.h>
#include <map>
#elif defined(_TTHREAD_WIN32_)
#include <process.h>
#endif
namespace tthread {
//------------------------------------------------------------------------------
// condition_variable
//------------------------------------------------------------------------------
// NOTE 1: The Win32 implementation of the condition_variable class is based on
// the corresponding implementation in GLFW, which in turn is based on a
// description by Douglas C. Schmidt and Irfan Pyarali:
// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
//
// NOTE 2: Windows Vista actually has native support for condition variables
// (InitializeConditionVariable, WakeConditionVariable, etc), but we want to
// be portable with pre-Vista Windows versions, so TinyThread++ does not use
// Vista condition variables.
//------------------------------------------------------------------------------
#if defined(_TTHREAD_WIN32_)
#define _CONDITION_EVENT_ONE 0
#define _CONDITION_EVENT_ALL 1
#endif
#if defined(_TTHREAD_WIN32_)
condition_variable::condition_variable() : mWaitersCount(0)
{
mEvents[_CONDITION_EVENT_ONE] = CreateEvent(NULL, FALSE, FALSE, NULL);
mEvents[_CONDITION_EVENT_ALL] = CreateEvent(NULL, TRUE, FALSE, NULL);
InitializeCriticalSection(&mWaitersCountLock);
}
#endif
#if defined(_TTHREAD_WIN32_)
condition_variable::~condition_variable()
{
CloseHandle(mEvents[_CONDITION_EVENT_ONE]);
CloseHandle(mEvents[_CONDITION_EVENT_ALL]);
DeleteCriticalSection(&mWaitersCountLock);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::_wait()
{
// Wait for either event to become signaled due to notify_one() or
// notify_all() being called
int result = WaitForMultipleObjects(2, mEvents, FALSE, INFINITE);
// Check if we are the last waiter
EnterCriticalSection(&mWaitersCountLock);
-- mWaitersCount;
bool lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) &&
(mWaitersCount == 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we are the last waiter to be notified to stop waiting, reset the event
if(lastWaiter)
ResetEvent(mEvents[_CONDITION_EVENT_ALL]);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::notify_one()
{
// Are there any waiters?
EnterCriticalSection(&mWaitersCountLock);
bool haveWaiters = (mWaitersCount > 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we have any waiting threads, send them a signal
if(haveWaiters)
SetEvent(mEvents[_CONDITION_EVENT_ONE]);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::notify_all()
{
// Are there any waiters?
EnterCriticalSection(&mWaitersCountLock);
bool haveWaiters = (mWaitersCount > 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we have any waiting threads, send them a signal
if(haveWaiters)
SetEvent(mEvents[_CONDITION_EVENT_ALL]);
}
#endif
//------------------------------------------------------------------------------
// POSIX pthread_t to unique thread::id mapping logic.
// Note: Here we use a global thread safe std::map to convert instances of
// pthread_t to small thread identifier numbers (unique within one process).
// This method should be portable across different POSIX implementations.
//------------------------------------------------------------------------------
#if defined(_TTHREAD_POSIX_)
static thread::id _pthread_t_to_ID(const pthread_t &aHandle)
{
static mutex idMapLock;
static std::map<pthread_t, unsigned long int> idMap;
static unsigned long int idCount(1);
lock_guard<mutex> guard(idMapLock);
if(idMap.find(aHandle) == idMap.end())
idMap[aHandle] = idCount ++;
return thread::id(idMap[aHandle]);
}
#endif // _TTHREAD_POSIX_
//------------------------------------------------------------------------------
// thread
//------------------------------------------------------------------------------
/// Information to pass to the new thread (what to run).
struct _thread_start_info {
void (*mFunction)(void *); ///< Pointer to the function to be executed.
void * mArg; ///< Function argument for the thread function.
thread * mThread; ///< Pointer to the thread object.
};
// Thread wrapper function.
#if defined(_TTHREAD_WIN32_)
unsigned WINAPI thread::wrapper_function(void * aArg)
#elif defined(_TTHREAD_POSIX_)
void * thread::wrapper_function(void * aArg)
#endif
{
// Get thread startup information
_thread_start_info * ti = (_thread_start_info *) aArg;
try
{
// Call the actual client thread function
ti->mFunction(ti->mArg);
}
catch(...)
{
// Uncaught exceptions will terminate the application (default behavior
// according to C++11)
std::terminate();
}
// The thread is no longer executing
lock_guard<mutex> guard(ti->mThread->mDataMutex);
ti->mThread->mNotAThread = true;
// The thread is responsible for freeing the startup information
delete ti;
return 0;
}
thread::thread(void (*aFunction)(void *), void * aArg)
{
// Serialize access to this thread structure
lock_guard<mutex> guard(mDataMutex);
// Fill out the thread startup information (passed to the thread wrapper,
// which will eventually free it)
_thread_start_info * ti = new _thread_start_info;
ti->mFunction = aFunction;
ti->mArg = aArg;
ti->mThread = this;
// The thread is now alive
mNotAThread = false;
// Create the thread
#if defined(_TTHREAD_WIN32_)
mHandle = (HANDLE) _beginthreadex(0, 0, wrapper_function, (void *) ti, 0, &mWin32ThreadID);
#elif defined(_TTHREAD_POSIX_)
if(pthread_create(&mHandle, NULL, wrapper_function, (void *) ti) != 0)
mHandle = 0;
#endif
// Did we fail to create the thread?
if(!mHandle)
{
mNotAThread = true;
delete ti;
}
}
thread::~thread()
{
if(joinable())
std::terminate();
}
void thread::join()
{
if(joinable())
{
#if defined(_TTHREAD_WIN32_)
WaitForSingleObject(mHandle, INFINITE);
CloseHandle(mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_join(mHandle, NULL);
#endif
}
}
bool thread::joinable() const
{
mDataMutex.lock();
bool result = !mNotAThread;
mDataMutex.unlock();
return result;
}
void thread::detach()
{
mDataMutex.lock();
if(!mNotAThread)
{
#if defined(_TTHREAD_WIN32_)
CloseHandle(mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_detach(mHandle);
#endif
mNotAThread = true;
}
mDataMutex.unlock();
}
thread::id thread::get_id() const
{
if(!joinable())
return id();
#if defined(_TTHREAD_WIN32_)
return id((unsigned long int) mWin32ThreadID);
#elif defined(_TTHREAD_POSIX_)
return _pthread_t_to_ID(mHandle);
#endif
}
unsigned thread::hardware_concurrency()
{
#if defined(_TTHREAD_WIN32_)
SYSTEM_INFO si;
GetSystemInfo(&si);
return (int) si.dwNumberOfProcessors;
#elif defined(_SC_NPROCESSORS_ONLN)
return (int) sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(_SC_NPROC_ONLN)
return (int) sysconf(_SC_NPROC_ONLN);
#else
// The standard requires this function to return zero if the number of
// hardware cores could not be determined.
return 0;
#endif
}
//------------------------------------------------------------------------------
// this_thread
//------------------------------------------------------------------------------
thread::id this_thread::get_id()
{
#if defined(_TTHREAD_WIN32_)
return thread::id((unsigned long int) GetCurrentThreadId());
#elif defined(_TTHREAD_POSIX_)
return _pthread_t_to_ID(pthread_self());
#endif
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/*****************************************************************************************
/*****************************************************************************************
* *
* OpenSpace *
* *
@@ -78,12 +78,16 @@ public:
static const std::string KeySettingsScript;
/// The key that stores the settings for determining log-related settings
static const std::string KeyLogging;
/// The key that stores the directory for Logging
static const std::string PartLogDir;
/// The key that stores the desired LogLevel for the whole application
/// \sa ghoul::logging::LogManager
static const std::string PartLogLevel;
/// The key that stores whether the log should be immediately flushed after a n
/// \sa ghoul::logging::LogManager
static const std::string PartImmediateFlush;
/// The key for prefixing PerformanceMeasurement logfiles
static const std::string PartLogPerformancePrefix;
/// The key that stores a subdirectory with a description for additional
/// ghoul::logging::Log%s to be created
/// \sa LogFactory
@@ -144,6 +148,11 @@ public:
static const std::string PartFilterIdentifierIdentifier;
/// The part of the key storing a list of severities that should be filtered out
static const std::string PartFilterSeverity;
/// The part of the key storing whether the OpenGL state should be checked each call
static const std::string KeyCheckOpenGLState;
/// The part of the key storing whether each OpenGL call should be logged
static const std::string KeyLogEachOpenGLCall;
/**
* Iteratively walks the directory structure starting with \p filename to find the

View File

@@ -97,7 +97,7 @@ public:
ModuleSubClass* module() const {
auto it = std::find_if(_modules.begin(), _modules.end(),
[](const std::unique_ptr<OpenSpaceModule>& module) {
return module->name() == ModuleSubClass::name;
return module->name() == ModuleSubClass::Name;
});
if (it != _modules.end()) {
return dynamic_cast<ModuleSubClass*>(it->get());

View File

@@ -64,7 +64,10 @@ class SyncEngine;
class TimeManager;
class WindowWrapper;
namespace interaction { class InteractionHandler; }
namespace interaction {
class NavigationHandler;
class KeyBindingManager;
}
namespace gui { class GUI; }
namespace properties { class PropertyOwner; }
namespace scripting {
@@ -98,7 +101,7 @@ public:
void charCallback(unsigned int codepoint, KeyModifier mod);
void mouseButtonCallback(MouseButton button, MouseAction action);
void mousePositionCallback(double x, double y);
void mouseScrollWheelCallback(double pos);
void mouseScrollWheelCallback(double posX, double posY);
void externalControlCallback(const char* receivedChars, int size, int clientId);
void encode();
void decode();
@@ -124,7 +127,8 @@ public:
WindowWrapper& windowWrapper();
AssetLoader& assetLoader();
ghoul::fontrendering::FontManager& fontManager();
interaction::InteractionHandler& interactionHandler();
interaction::NavigationHandler& navigationHandler();
interaction::KeyBindingManager& keyBindingManager();
properties::PropertyOwner& globalPropertyOwner();
scripting::ScriptEngine& scriptEngine();
scripting::ScriptScheduler& scriptScheduler();
@@ -163,7 +167,9 @@ public:
std::function<void (double, double)> function);
// Registers a callback that is called when a scroll wheel change is received
void registerModuleMouseScrollWheelCallback(std::function<bool (double)> function);
void registerModuleMouseScrollWheelCallback(
std::function<bool (double, double)> function
);
/**
* Returns the Lua library that contains all Lua functions available to affect the
@@ -197,7 +203,8 @@ private:
std::unique_ptr<WindowWrapper> _windowWrapper;
std::unique_ptr<ghoul::cmdparser::CommandlineParser> _commandlineParser;
std::unique_ptr<ghoul::fontrendering::FontManager> _fontManager;
std::unique_ptr<interaction::InteractionHandler> _interactionHandler;
std::unique_ptr<interaction::NavigationHandler> _navigationHandler;
std::unique_ptr<interaction::KeyBindingManager> _keyBindingManager;
std::unique_ptr<scripting::ScriptEngine> _scriptEngine;
std::unique_ptr<scripting::ScriptScheduler> _scriptScheduler;
std::unique_ptr<VirtualPropertyManager> _virtualPropertyManager;
@@ -225,7 +232,7 @@ private:
std::vector<std::function<bool (MouseButton, MouseAction)>> mouseButton;
std::vector<std::function<void (double, double)>> mousePosition;
std::vector<std::function<bool (double)>> mouseScrollWheel;
std::vector<std::function<bool (double, double)>> mouseScrollWheel;
} _moduleCallbacks;
double _runTime;

View File

@@ -33,7 +33,7 @@
namespace openspace {
namespace interaction {
class InteractionHandler;
class NavigationHandler;
class Controller {
public:
@@ -41,10 +41,10 @@ public:
_handler(nullptr)
{}
void setHandler(InteractionHandler* handler);
void setHandler(NavigationHandler* handler);
protected:
InteractionHandler* _handler;
NavigationHandler* _handler;
};
} // namespace interaction

View File

@@ -0,0 +1,59 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___DELAYEDVARIABLE___H__
#define __OPENSPACE_CORE___DELAYEDVARIABLE___H__
namespace openspace {
namespace interaction {
/**
* Class that acts as a smoothing filter to a variable. The filter has a step
* response on a form that resembles the function y = 1-e^(-t/scale). The variable
* will be updated as soon as it is set to a value (calling the set() function).
*/
template <typename T, typename ScaleType>
class DelayedVariable {
public:
DelayedVariable(ScaleType scaleFactor, ScaleType friction);
void set(T value, double dt);
void decelerate(double dt);
void setHard(T value);
void setFriction(ScaleType friction);
void setScaleFactor(ScaleType scaleFactor);
T get() const;
private:
ScaleType _scaleFactor;
ScaleType _friction;
T _targetValue;
T _currentValue;
};
} // namespace interaction
} // namespace openspace
#include "delayedvariable.inl"
#endif // __OPENSPACE_CORE___DELAYEDVARIABLE___H__

View File

@@ -0,0 +1,76 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <ghoul/misc/assert.h>
#include <ghoul/glm.h>
namespace openspace {
namespace interaction {
template <typename T, typename ScaleType>
DelayedVariable<T, ScaleType>::DelayedVariable(ScaleType scaleFactor, ScaleType friction)
: _scaleFactor(std::move(scaleFactor))
, _friction(friction)
{
ghoul_assert(_friction >= ScaleType(0.0), "Friction must be positive");
}
template <typename T, typename ScaleType>
void DelayedVariable<T, ScaleType>::set(T value, double dt) {
_targetValue = value;
_currentValue = _currentValue + (_targetValue - _currentValue) *
glm::min(_scaleFactor * dt, 1.0); // less or equal to 1.0 keeps it stable
}
template <typename T, typename ScaleType>
void DelayedVariable<T, ScaleType>::decelerate(double dt) {
_currentValue = _currentValue + (- _currentValue) *
glm::min(_scaleFactor * _friction * dt, 1.0);
// less or equal to 1.0 keeps it stable
}
template <typename T, typename ScaleType>
void DelayedVariable<T, ScaleType>::setHard(T value) {
_targetValue = value;
_currentValue = value;
}
template <typename T, typename ScaleType>
void DelayedVariable<T, ScaleType>::setFriction(ScaleType friction) {
_friction = friction;
ghoul_assert(_friction >= ScaleType(0.0), "Friction must be positive");
}
template <typename T, typename ScaleType>
void DelayedVariable<T, ScaleType>::setScaleFactor(ScaleType scaleFactor) {
_scaleFactor = scaleFactor;
}
template <typename T, typename ScaleType>
T DelayedVariable<T, ScaleType>::get() const {
return _currentValue;
}
} // namespace interaction
} // namespace openspace

View File

@@ -0,0 +1,70 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___INPUTSTATE___H__
#define __OPENSPACE_CORE___INPUTSTATE___H__
#include <openspace/util/keys.h>
#include <openspace/util/mouse.h>
#include <glm/glm.hpp>
#include <list>
namespace openspace {
namespace interaction {
class InputState {
public:
InputState() = default;
~InputState() = default;
// Callback functions
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
void mouseButtonCallback(MouseButton button, MouseAction action);
void mousePositionCallback(double mouseX, double mouseY);
void mouseScrollWheelCallback(double mouseScrollDelta);
// Accessors
const std::list<std::pair<Key, KeyModifier>>& getPressedKeys() const;
const std::list<MouseButton>& getPressedMouseButtons() const;
glm::dvec2 getMousePosition() const;
double getMouseScrollDelta() const;
bool isKeyPressed(std::pair<Key, KeyModifier> keyModPair) const;
bool isKeyPressed(Key key) const;
bool isMouseButtonPressed(MouseButton mouseButton) const;
private:
// Input from keyboard and mouse
std::list<std::pair<Key, KeyModifier>> _keysDown;
std::list<MouseButton> _mouseButtonsDown;
glm::dvec2 _mousePosition;
double _mouseScrollDelta;
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___INPUTSTATE___H__

View File

@@ -1,286 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___INTERACTIONMODE___H__
#define __OPENSPACE_CORE___INTERACTIONMODE___H__
#include <openspace/network/parallelconnection.h>
#include <openspace/util/mouse.h>
#include <openspace/util/keys.h>
#include <openspace/util/timeline.h>
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
#include <modules/globebrowsing/tile/tileindex.h>
#include <modules/globebrowsing/geometry/geodetic2.h>
#include <modules/globebrowsing/geometry/geodetic3.h>
#endif
#include <list>
namespace openspace {
class Camera;
class SceneGraphNode;
namespace globebrowsing {
class RenderableGlobe;
}
namespace interaction {
template <typename T>
class Interpolator
{
public:
Interpolator(std::function<T(double)> transferFunction)
: _t(0.0)
, _transferFunction(transferFunction) {};
~Interpolator() {};
void start() { _t = 0.0; };
void end() { _t = 1.0; };
void step(double delta) { _t += delta; };
T value() { return _transferFunction(_t); };
bool isInterpolating() { return _t < 1.0; };
private:
std::function<T(double)> _transferFunction;
double _t;
};
class InputState
{
public:
InputState();
~InputState();
// Callback functions
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
void mouseButtonCallback(MouseButton button, MouseAction action);
void mousePositionCallback(double mouseX, double mouseY);
void mouseScrollWheelCallback(double mouseScrollDelta);
// Accessors
const std::list<std::pair<Key, KeyModifier> >& getPressedKeys() const;
const std::list<MouseButton>& getPressedMouseButtons() const;
glm::dvec2 getMousePosition() const;
double getMouseScrollDelta() const;
const std::vector<datamessagestructures::CameraKeyframe>& keyframes() const;
bool isKeyPressed(std::pair<Key, KeyModifier> keyModPair) const;
bool isKeyPressed(Key key) const;
bool isMouseButtonPressed(MouseButton mouseButton) const;
private:
// Input from keyboard and mouse
std::list<std::pair<Key, KeyModifier> > _keysDown;
std::list<MouseButton> _mouseButtonsDown;
glm::dvec2 _mousePosition;
double _mouseScrollDelta;
};
class InteractionMode {
public:
InteractionMode();
virtual ~InteractionMode();
// Mutators
virtual void setFocusNode(SceneGraphNode* focusNode);
// Accessors
SceneGraphNode* focusNode();
Interpolator<double>& rotateToFocusNodeInterpolator();
virtual bool followingNodeRotation() const = 0;
virtual void updateMouseStatesFromInput(const InputState& inputState, double deltaTime) = 0;
virtual void updateCameraStateFromMouseStates(Camera& camera, double deltaTime) = 0;
protected:
/**
Inner class that acts as a smoothing filter to a variable. The filter has a step
response on a form that resembles the function y = 1-e^(-t/scale). The variable
will be updates as soon as it is set to a value (calling the set() function).
*/
template <typename T, typename ScaleType>
class DelayedVariable {
public:
DelayedVariable(ScaleType scaleFactor, ScaleType friction) {
_scaleFactor = scaleFactor;
_friction = glm::max(friction, ScaleType(0.0));
}
void set(T value, double dt) {
_targetValue = value;
_currentValue = _currentValue + (_targetValue - _currentValue) *
std::min(_scaleFactor * dt, 1.0); // less or equal to 1.0 keeps it stable
}
void decelerate(double dt) {
_currentValue = _currentValue + (- _currentValue) *
std::min(_scaleFactor * _friction * dt, 1.0); // less or equal to 1.0 keeps it stable
}
void setHard(T value) {
_targetValue = value;
_currentValue = value;
}
void setFriction(ScaleType friction) {
_friction = glm::max(friction, ScaleType(0.0));
}
void setScaleFactor(ScaleType scaleFactor) {
_scaleFactor = scaleFactor;
}
T get() {
return _currentValue;
}
private:
ScaleType _scaleFactor;
ScaleType _friction;
T _targetValue;
T _currentValue;
};
struct MouseState {
MouseState(double scaleFactor)
: velocity(scaleFactor, 1)
, previousPosition(0.0, 0.0) {}
void setFriction(double friction) {
velocity.setFriction(friction);
}
void setVelocityScaleFactor(double scaleFactor) {
velocity.setScaleFactor(scaleFactor);
}
glm::dvec2 previousPosition;
DelayedVariable<glm::dvec2, double> velocity;
};
SceneGraphNode* _focusNode = nullptr;
glm::dvec3 _previousFocusNodePosition;
glm::dquat _previousFocusNodeRotation;
Interpolator<double> _rotateToFocusNodeInterpolator;
};
class KeyframeInteractionMode : public InteractionMode
{
public:
struct CameraPose {
glm::dvec3 position;
glm::quat rotation;
std::string focusNode;
bool followFocusNodeRotation;
};
KeyframeInteractionMode();
~KeyframeInteractionMode();
virtual void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
virtual void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
bool followingNodeRotation() const override;
Timeline<CameraPose>& timeline();
private:
Timeline<CameraPose> _cameraPoseTimeline;
};
class GlobeBrowsingInteractionMode;
class OrbitalInteractionMode : public InteractionMode
{
public:
class MouseStates
{
public:
/**
\param sensitivity
\param velocityScaleFactor can be set to 60 to remove the inertia of the
interaction. Lower value will make it harder to move the camera.
*/
MouseStates(double sensitivity, double velocityScaleFactor);
void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
void setRotationalFriction(double friction);
void setHorizontalFriction(double friction);
void setVerticalFriction(double friction);
void setSensitivity(double sensitivity);
void setVelocityScaleFactor(double scaleFactor);
glm::dvec2 synchedGlobalRotationMouseVelocity();
glm::dvec2 synchedLocalRotationMouseVelocity();
glm::dvec2 synchedTruckMovementMouseVelocity();
glm::dvec2 synchedLocalRollMouseVelocity();
glm::dvec2 synchedGlobalRollMouseVelocity();
private:
double _sensitivity;
MouseState _globalRotationMouseState;
MouseState _localRotationMouseState;
MouseState _truckMovementMouseState;
MouseState _localRollMouseState;
MouseState _globalRollMouseState;
};
OrbitalInteractionMode(std::shared_ptr<MouseStates> mouseStates);
~OrbitalInteractionMode();
//virtual void update(Camera& camera, const InputState& inputState, double deltaTime);
virtual void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
virtual void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
bool followingNodeRotation() const override;
protected:
//void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
std::shared_ptr<MouseStates> _mouseStates;
};
class GlobeBrowsingInteractionMode : public OrbitalInteractionMode
{
public:
GlobeBrowsingInteractionMode(std::shared_ptr<MouseStates> mouseStates);
~GlobeBrowsingInteractionMode();
virtual void setFocusNode(SceneGraphNode* focusNode);
//virtual void update(Camera& camera, const InputState& inputState, double deltaTime);
virtual void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
bool followingNodeRotation() const override;
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
void goToChunk(Camera& camera, globebrowsing::TileIndex ti, glm::vec2 uv,
bool resetCameraDirection);
void goToGeodetic2(Camera& camera, globebrowsing::Geodetic2 geo2,
bool resetCameraDirection);
void goToGeodetic3(Camera& camera, globebrowsing::Geodetic3 geo3);
void resetCameraDirection(Camera& camera, globebrowsing::Geodetic2 geo2);
#endif
private:
//void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
globebrowsing::RenderableGlobe* _globe;
#endif
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___INTERACTIONMODE___H__

View File

@@ -0,0 +1,65 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___INTERPOLATOR___H__
#define __OPENSPACE_CORE___INTERPOLATOR___H__
#include <functional>
namespace openspace {
namespace interaction {
/*
* Interpolates a typename T using a transfer function.
*/
template <typename T>
class Interpolator {
public:
Interpolator();
~Interpolator() = default;
void start();
void end();
void setDeltaTime(float deltaTime);
void setTransferFunction(std::function<T(float)> transferFunction);
void setInterpolationTime(float interpolationTime);
void step();
float deltaTimeScaled() const;
T value() const;
bool isInterpolating() const;
private:
std::function<T(float)> _transferFunction;
float _t;
float _interpolationTime;
float _scaledDeltaTime;
};
} // namespace interaction
} // namespace openspace
#include "interpolator.inl"
#endif // __OPENSPACE_CORE___INTERPOLATOR___H__

View File

@@ -0,0 +1,85 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <ghoul/misc/assert.h>
#include <functional>
namespace openspace {
namespace interaction {
template <typename T>
Interpolator<T>::Interpolator()
: _transferFunction([](float t){ return t; })
, _t(0.0)
, _interpolationTime(1.0) {};
template <typename T>
void Interpolator<T>::start() {
_t = 0.0;
};
template <typename T>
void Interpolator<T>::end() {
_t = 1.0;
}
template <typename T>
void Interpolator<T>::setDeltaTime(float deltaTime) {
_scaledDeltaTime = deltaTime / _interpolationTime;
}
template <typename T>
void Interpolator<T>::setTransferFunction(std::function<T(float)> transferFunction) {
_transferFunction = transferFunction;
}
template <typename T>
void Interpolator<T>::setInterpolationTime(float interpolationTime) {
_interpolationTime = interpolationTime;
}
template <typename T>
void Interpolator<T>::step() {
_t += _scaledDeltaTime;
_t = glm::clamp(_t, 0.0f, 1.0f);
}
template <typename T>
float Interpolator<T>::deltaTimeScaled() const {
return _scaledDeltaTime;
}
template <typename T>
T Interpolator<T>::value() const {
return _transferFunction(_t);
}
template <typename T>
bool Interpolator<T>::isInterpolating() const {
return _t < 1.0 && _t >= 0.0;
}
} // namespace interaction
} // namespace openspace

View File

@@ -0,0 +1,87 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___KEYBINDINGMANAGER___H__
#define __OPENSPACE_CORE___KEYBINDINGMANAGER___H__
#include <openspace/documentation/documentationgenerator.h>
#include <openspace/scripting/lualibrary.h>
#include <openspace/util/keys.h>
#include <ghoul/misc/boolean.h>
namespace openspace {
class Camera;
class SceneGraphNode;
namespace interaction {
class KeyBindingManager : public DocumentationGenerator
{
public:
KeyBindingManager();
~KeyBindingManager() = default;
void resetKeyBindings();
void bindKeyLocal(
Key key,
KeyModifier modifier,
std::string luaCommand,
std::string documentation = ""
);
void bindKey(
Key key,
KeyModifier modifier,
std::string luaCommand,
std::string documentation = ""
);
static scripting::LuaLibrary luaLibrary();
// Callback functions
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
private:
using Synchronized = ghoul::Boolean;
struct KeyInformation {
std::string command;
Synchronized synchronization;
std::string documentation;
};
std::string generateJson() const override;
bool _cameraUpdatedFromScript = false;
std::multimap<KeyWithModifier, KeyInformation> _keyLua;
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___KEYBINDINGMANAGER___H__

View File

@@ -0,0 +1,69 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___KEYFRAMENAVIGATOR___H__
#define __OPENSPACE_CORE___KEYFRAMENAVIGATOR___H__
#include <openspace/util/timeline.h>
#include <openspace/network/parallelconnection.h>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
namespace openspace {
class Camera;
namespace interaction {
class KeyframeNavigator
{
public:
struct CameraPose {
glm::dvec3 position;
glm::quat rotation;
std::string focusNode;
bool followFocusNodeRotation;
};
KeyframeNavigator() = default;
~KeyframeNavigator() = default;
void updateCamera(Camera& camera);
Timeline<CameraPose>& timeline();
void addKeyframe(double timestamp, KeyframeNavigator::CameraPose pose);
void removeKeyframesAfter(double timestamp);
void clearKeyframes();
size_t nKeyframes() const;
const std::vector<datamessagestructures::CameraKeyframe>& keyframes() const;
private:
Timeline<CameraPose> _cameraPoseTimeline;
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___KEYFRAMENAVIGATOR___H__

View File

@@ -0,0 +1,80 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___MOUSESTATE___H__
#define __OPENSPACE_CORE___MOUSESTATE___H__
#include <openspace/interaction/delayedvariable.h>
#include <openspace/interaction/inputstate.h>
#include <glm/glm.hpp>
namespace openspace {
namespace interaction {
struct MouseState {
MouseState(double scaleFactor);
void setFriction(double friction);
void setVelocityScaleFactor(double scaleFactor);
glm::dvec2 previousPosition;
DelayedVariable<glm::dvec2, double> velocity;
};
class MouseStates
{
public:
/**
\param sensitivity
\param velocityScaleFactor can be set to 60 to remove the inertia of the
interaction. Lower value will make it harder to move the camera.
*/
MouseStates(double sensitivity, double velocityScaleFactor);
void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
void setRotationalFriction(double friction);
void setHorizontalFriction(double friction);
void setVerticalFriction(double friction);
void setSensitivity(double sensitivity);
void setVelocityScaleFactor(double scaleFactor);
glm::dvec2 globalRotationMouseVelocity() const;
glm::dvec2 localRotationMouseVelocity() const;
glm::dvec2 truckMovementMouseVelocity() const;
glm::dvec2 localRollMouseVelocity() const;
glm::dvec2 globalRollMouseVelocity() const;
private:
double _sensitivity;
MouseState _globalRotationMouseState;
MouseState _localRotationMouseState;
MouseState _truckMovementMouseState;
MouseState _localRollMouseState;
MouseState _globalRollMouseState;
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___MOUSESTATE___H__

View File

@@ -22,14 +22,13 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___INTERACTIONHANDLER___H__
#define __OPENSPACE_CORE___INTERACTIONHANDLER___H__
#ifndef __OPENSPACE_CORE___NAVIGATIONHANDLER___H__
#define __OPENSPACE_CORE___NAVIGATIONHANDLER___H__
#include <openspace/documentation/documentationgenerator.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/interaction/interactionmode.h>
#include <openspace/network/parallelconnection.h>
#include <openspace/interaction/orbitalnavigator.h>
#include <openspace/interaction/keyframenavigator.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
@@ -38,10 +37,6 @@
#include <ghoul/misc/boolean.h>
#include <list>
#include <mutex>
namespace openspace {
class Camera;
@@ -49,11 +44,10 @@ class SceneGraphNode;
namespace interaction {
class InteractionHandler : public properties::PropertyOwner, public DocumentationGenerator
{
class NavigationHandler : public properties::PropertyOwner {
public:
InteractionHandler();
~InteractionHandler();
NavigationHandler();
~NavigationHandler();
void initialize();
void deinitialize();
@@ -63,39 +57,9 @@ public:
void setCamera(Camera* camera);
void resetCameraDirection();
// Interaction mode setters
void setCameraStateFromDictionary(const ghoul::Dictionary& cameraDict);
InteractionMode* interactionMode();
void setCameraStateFromDictionary(const ghoul::Dictionary& cameraDict);
void goToChunk(int x, int y, int level);
void goToGeo(double latitude, double longitude);
void resetKeyBindings();
void addKeyframe(double timestamp, KeyframeInteractionMode::CameraPose pose);
void removeKeyframesAfter(double timestamp);
void clearKeyframes();
size_t nKeyframes() const;
const std::vector<datamessagestructures::CameraKeyframe>& keyframes() const;
void bindKeyLocal(
Key key,
KeyModifier modifier,
std::string luaCommand,
std::string documentation = ""
);
void bindKey(
Key key,
KeyModifier modifier,
std::string luaCommand,
std::string documentation = ""
);
void lockControls();
void unlockControls();
//void update(double deltaTime);
void updateCamera(double deltaTime);
void updateInputStates(double timeSinceLastUpdate);
// Accessors
ghoul::Dictionary getCameraStateDictionary();
@@ -104,15 +68,8 @@ public:
glm::quat focusNodeToCameraRotation() const;
Camera* camera() const;
const InputState& inputState() const;
/**
* Returns the Lua library that contains all Lua functions available to affect the
* interaction. The functions contained are
* - openspace::luascriptfunctions::setOrigin
* \return The Lua library that contains all Lua functions available to affect the
* interaction
*/
static scripting::LuaLibrary luaLibrary();
const OrbitalNavigator& orbitalNavigator() const;
KeyframeNavigator& keyframeNavigator() const;
// Callback functions
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
@@ -123,47 +80,26 @@ public:
void saveCameraStateToFile(const std::string& filepath);
void restoreCameraStateFromFile(const std::string& filepath);
/**
* \return The Lua library that contains all Lua functions available to affect the
* interaction
*/
static scripting::LuaLibrary luaLibrary();
private:
using Synchronized = ghoul::Boolean;
struct KeyInformation {
std::string command;
Synchronized synchronization;
std::string documentation;
};
std::string generateJson() const override;
void setInteractionMode(InteractionMode* interactionMode);
bool _cameraUpdatedFromScript = false;
std::multimap<KeyWithModifier, KeyInformation> _keyLua;
std::unique_ptr<InputState> _inputState;
Camera* _camera;
InteractionMode* _currentInteractionMode;
std::shared_ptr<OrbitalInteractionMode::MouseStates> _mouseStates;
std::unique_ptr<OrbitalInteractionMode> _orbitalInteractionMode;
std::unique_ptr<GlobeBrowsingInteractionMode> _globeBrowsingInteractionMode;
std::unique_ptr<KeyframeInteractionMode> _keyframeInteractionMode;
std::unique_ptr<OrbitalNavigator> _orbitalNavigator;
std::unique_ptr<KeyframeNavigator> _keyframeNavigator;
// Properties
properties::StringProperty _origin;
properties::OptionProperty _interactionModeOption;
properties::BoolProperty _rotationalFriction;
properties::BoolProperty _horizontalFriction;
properties::BoolProperty _verticalFriction;
properties::FloatProperty _sensitivity;
properties::FloatProperty _rapidness;
properties::BoolProperty _useKeyFrameInteraction;
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___INTERACTIONHANDLER___H__
#endif // __OPENSPACE_CORE___NAVIGATIONHANDLER___H__

View File

@@ -0,0 +1,197 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___ORBITALNAVIGATOR___H__
#define __OPENSPACE_CORE___ORBITALNAVIGATOR___H__
#include <openspace/interaction/delayedvariable.h>
#include <openspace/interaction/inputstate.h>
#include <openspace/interaction/interpolator.h>
#include <openspace/interaction/mousestate.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
namespace openspace {
class SceneGraphNode;
class Camera;
class SurfacePositionHandle;
namespace interaction {
class OrbitalNavigator : public properties::PropertyOwner {
public:
OrbitalNavigator();
~OrbitalNavigator();
void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
void setFocusNode(SceneGraphNode* focusNode);
void startInterpolateCameraDirection(const Camera& camera);
bool followingNodeRotation() const;
SceneGraphNode* focusNode() const;
private:
struct CameraRotationDecomposition {
glm::dquat localRotation;
glm::dquat globalRotation;
};
// Properties
properties::BoolProperty _rotationalFriction;
properties::BoolProperty _horizontalFriction;
properties::BoolProperty _verticalFriction;
properties::FloatProperty _followFocusNodeRotationDistance;
properties::FloatProperty _minimumAllowedDistance;
properties::FloatProperty _sensitivity;
properties::FloatProperty _motionLag;
MouseStates _mouseStates;
SceneGraphNode* _focusNode = nullptr;
glm::dvec3 _previousFocusNodePosition;
glm::dquat _previousFocusNodeRotation;
Interpolator<double> _rotateToFocusNodeInterpolator;
Interpolator<double> _followRotationInterpolator;
/**
* Decomposes the cameras rotation in to a global and a local rotation defined by
* CameraRotationDecomposition. The global rotation defines the rotation so that the
* camera points towards the focus node in the direction opposite to the direction
* out from the surface of the object. The local rotation defines the differential
* from the global to the current total rotation so that
* <code>cameraRotation = globalRotation * localRotation</code>.
*/
CameraRotationDecomposition decomposeCameraRotation(
const glm::dvec3& cameraPosition,
const glm::dquat& cameraRotation,
const glm::dvec3& cameraLookUp,
const glm::dvec3& cameraViewDirection);
/*
* Perform a camera roll on the local camera rotation
* \returns a local camera rotation modified with a roll.
*/
glm::dquat roll(double deltaTime, const glm::dquat& localCameraRotation) const;
/**
* Performs rotation around the cameras x and y axes.
* \returns a local camera rotation modified with two degrees of freedom.
*/
glm::dquat rotateLocally(double deltaTime,
const glm::dquat& localCameraRotation) const;
/**
* Interpolates the local rotation towards a 0 rotation.
* \returns a modified local rotation interpolated towards 0.
*/
glm::dquat interpolateLocalRotation(double deltaTime,
const glm::dquat& localCameraRotation);
/**
* Translates the horizontal direction. If far from the focus object, this will
* result in an orbital rotation around the object. This function does not affect the
* rotation but only the position.
* \returns a position vector adjusted in the horizontal direction.
*/
glm::dvec3 translateHorizontally(double deltaTime, const glm::dvec3& cameraPosition,
const glm::dvec3& objectPosition,
const glm::dquat& focusNodeRotationDiff,
const glm::dquat& globalCameraRotation,
const SurfacePositionHandle& positionHandle) const;
/*
* Adds rotation to the camera position so that it follows the rotation of the focus
* node defined by the differential focusNodeRotationDiff.
* \returns a position updated with the rotation defined by focusNodeRotationDiff
*/
glm::dvec3 followFocusNodeRotation(const glm::dvec3& cameraPosition,
const glm::dvec3& objectPosition,
const glm::dquat& focusNodeRotationDiff) const;
/**
* Updates the global rotation so that it points towards the focus node.
* \returns a global rotation quaternion defining a rotation towards the focus node.
*/
glm::dquat rotateGlobally(const glm::dquat& globalCameraRotation,
const glm::dvec3& objectPosition,
const glm::dquat& focusNodeRotationDiff,
const glm::dvec3& cameraPosition,
const SurfacePositionHandle& positionHandle) const;
/**
* Translates the camera position towards or away from the focus node.
* \returns a position vector adjusted in the vertical direction.
*/
glm::dvec3 translateVertically(double deltaTime, const glm::dvec3& cameraPosition,
const glm::dvec3& objectPosition,
const SurfacePositionHandle& positionHandle) const;
/**
* Rotates the camera around the out vector of the surface.
* \returns a quaternion adjusted to rotate around the out vector of the surface.
*/
glm::dquat rotateHorizontally(double deltaTime,
const glm::dquat& globalCameraRotation,
const glm::dvec3& cameraPosition,
const SurfacePositionHandle& positionHandle) const;
/**
* Push the camera out to the surface of the object.
* \returns a position vector adjusted to be at least minHeightAboveGround meters
* above the actual surface of the object
*/
glm::dvec3 pushToSurface(double minHeightAboveGround,
const glm::dvec3& cameraPosition,
const glm::dvec3& objectPosition,
const SurfacePositionHandle& positionHandle) const;
/**
* Interpolates between rotationDiff and a 0 rotation.
*/
glm::dquat interpolateRotationDifferential(
double deltaTime, double interpolationTime,
const glm::dquat& rotationDiff,
const glm::dvec3& objectPosition,
const glm::dvec3& cameraPosition,
const SurfacePositionHandle& positionHandle);
/**
* Calculates a SurfacePositionHandle given a camera position in world space.
*/
SurfacePositionHandle calculateSurfacePositionHandle(
const glm::dvec3 cameraPositionWorldSpace);
};
} // namespace interaction
} // namespace openspace
#endif // __OPENSPACE_CORE___ORBITALNAVIGATOR___H__

View File

@@ -58,14 +58,41 @@ public:
void storeIndividualPerformanceMeasurement(std::string identifier, long long nanoseconds);
void storeScenePerformanceMeasurements(const std::vector<SceneGraphNode*>& sceneNodes);
PerformanceLayout* performanceData();
void outputLogs();
void writeData(std::ofstream& out, const std::vector<float>& data);
std::string formatLogName(std::string nodeName);
void logDir(std::string dir);
std::string logDir() const;
void prefix(std::string prefix);
std::string prefix() const;
void enableLogging();
void disableLogging();
void toggleLogging();
void setLogging(bool enabled);
bool loggingEnabled() const;
PerformanceLayout* performanceData();
private:
bool _doPerformanceMeasurements;
bool _loggingEnabled;
std::string _logDir;
std::string _prefix;
std::string _suffix;
std::string _ext;
std::map<std::string, size_t> individualPerformanceLocations;
std::unique_ptr<ghoul::SharedMemory> _performanceMemory;
size_t _tick;
void tick();
bool createLogDir();
};
} // namespace performance

View File

@@ -73,6 +73,14 @@ public:
User = 0 ///< Visible in User mode
};
/// An OnChangeHandle is returned by the onChange method to uniquely identify an
/// onChange callback
using OnChangeHandle = uint32_t;
/// This OnChangeHandle can be used to remove all onChange callbacks from this
/// Property
static OnChangeHandle OnChangeHandleAll;
/**
* The constructor for the property. The <code>identifier</code> needs to be unique
* for each PropertyOwner. The <code>guiName</code> will be stored in the metaData
@@ -92,7 +100,7 @@ public:
* The destructor taking care of deallocating all unused memory. This method will not
* remove the Property from the PropertyOwner.
*/
virtual ~Property();
virtual ~Property() = default;
/**
* This method returns the class name of the Property. The method is used by the
@@ -191,12 +199,25 @@ public:
* This method registers a <code>callback</code> function that will be called every
* time if either Property:set or Property::setLuaValue was called with a value that
* is different from the previously stored value. The callback can be removed by
* passing an empty <code>std::function<void()></code> object.
* calling the removeOnChange method with the OnChangeHandle that was returned here.
* \param callback The callback function that is called when the encapsulated type has
* been successfully changed by either the Property::set or Property::setLuaValue
* methods.
* \pre The callback must not be empty
* \return An OnChangeHandle that can be used in subsequent calls to remove a callback
*/
virtual void onChange(std::function<void()> callback);
OnChangeHandle onChange(std::function<void()> callback);
/**
* This method deregisters a callback that was previously registered with the onChange
* method. If OnChangeHandleAll is passed to this function, all registered callbacks
* are removed.
* \param handle An OnChangeHandle that was returned from a previous call to onChange
* by this property or OnChangeHandleAll if all callbacks should be removed.
* \pre handle must refer to a callback that has been previously registred
* \pre handle must refer to a callback that has not been removed previously
*/
void removeOnChange(OnChangeHandle handle);
/**
* This method returns the unique identifier of this Property.
@@ -389,8 +410,11 @@ protected:
/// The Dictionary containing all meta data necessary for external applications
ghoul::Dictionary _metaData;
/// The callback function that will be invoked whenever the encapsulated value changes
std::function<void()> _onChangeCallback;
/// The callback function sthat will be invoked whenever the value changes
std::vector<std::pair<OnChangeHandle, std::function<void()>>> _onChangeCallbacks;
private:
OnChangeHandle _currentHandleValue;
};
} // namespace properties

View File

@@ -42,6 +42,7 @@ namespace openspace {
struct RenderData;
struct UpdateData;
struct RendererTasks;
struct SurfacePositionHandle;
namespace documentation { struct Documentation; }
@@ -78,6 +79,8 @@ public:
virtual void render(const RenderData& data);
virtual void render(const RenderData& data, RendererTasks& rendererTask);
virtual void update(const UpdateData& data);
virtual SurfacePositionHandle calculateSurfacePositionHandle(
const glm::dvec3& targetModelSpace);
RenderBin renderBin() const;
void setRenderBin(RenderBin bin);

View File

@@ -48,6 +48,7 @@ class Translation;
class Scale;
class Scene;
struct UpdateData;
struct SurfacePositionHandle;
namespace documentation { struct Documentation; }
@@ -93,6 +94,9 @@ public:
void clearDependencies();
void setDependencies(const std::vector<SceneGraphNode*>& dependencies);
SurfacePositionHandle calculateSurfacePositionHandle(
const glm::dvec3& targetModelSpace);
const std::vector<SceneGraphNode*>& dependencies() const;
const std::vector<SceneGraphNode*>& dependentNodes() const;

View File

@@ -75,6 +75,21 @@ struct RaycastData {
std::string namespaceName;
};
/**
* Defines the position of an object relative to a surface. The surface is defined as
* a reference surface together with a height offset from that reference surface.
*/
struct SurfacePositionHandle {
/// Vector from the center of the object to the reference surface of the object
glm::dvec3 centerToReferenceSurface;
/// Direction out from the reference. Can conincide with the surface normal but does
/// not have to.
glm::dvec3 referenceSurfaceOutDirection;
/// Height from the reference surface out to the actual surface in the direction of
/// the surface normal. Can be positive or negative.
double heightToSurface;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___UPDATESTRUCTURES___H__

2
logs/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -52,9 +52,7 @@
namespace openspace {
BaseModule::BaseModule()
: OpenSpaceModule("Base")
{}
BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {}
void BaseModule::internalInitialize() {
FactoryManager::ref().addFactory(

View File

@@ -31,6 +31,8 @@ namespace openspace {
class BaseModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "Base";
BaseModule();
virtual ~BaseModule() = default;
std::vector<documentation::Documentation> documentations() const override;

View File

@@ -34,7 +34,7 @@
namespace openspace {
DebuggingModule::DebuggingModule()
: OpenSpaceModule("Debugging")
: OpenSpaceModule(Name)
{}
void DebuggingModule::internalInitialize() {
@@ -42,7 +42,6 @@ void DebuggingModule::internalInitialize() {
ghoul_assert(fRenderable, "No renderable factory existed");
fRenderable->registerClass<RenderableDebugPlane>("RenderableDebugPlane");
}
} // namespace openspace

View File

@@ -31,6 +31,8 @@ namespace openspace {
class DebuggingModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "Debugging";
DebuggingModule();
protected:

View File

@@ -34,7 +34,7 @@
namespace openspace {
FieldlinesModule::FieldlinesModule()
: OpenSpaceModule("Fieldlines")
: OpenSpaceModule(Name)
{}
void FieldlinesModule::internalInitialize() {

View File

@@ -31,6 +31,8 @@ namespace openspace {
class FieldlinesModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "Fieldlines";
FieldlinesModule();
protected:

View File

@@ -32,7 +32,7 @@
namespace openspace {
GalaxyModule::GalaxyModule() : OpenSpaceModule("Galaxy") {}
GalaxyModule::GalaxyModule() : OpenSpaceModule(Name) {}
void GalaxyModule::internalInitialize() {
auto fRenderable = FactoryManager::ref().factory<Renderable>();

View File

@@ -31,6 +31,8 @@ namespace openspace {
class GalaxyModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "Galaxy";
GalaxyModule();
void internalInitialize() override;
};

View File

@@ -25,6 +25,8 @@
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule.h
${CMAKE_CURRENT_SOURCE_DIR}/cache/lrucache.h
${CMAKE_CURRENT_SOURCE_DIR}/cache/lrucache.inl
${CMAKE_CURRENT_SOURCE_DIR}/cache/memoryawaretilecache.h
@@ -79,12 +81,14 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpuchunktilepile.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpuheightlayer.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayer.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayeradjustment.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayergroup.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayermanager.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayerrendersettings.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gputiledepthtransform.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gputileuvtransform.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layer.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layeradjustment.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroup.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroupid.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layermanager.h
@@ -102,8 +106,7 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileselector.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileuvtransform.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileloadjob.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/cachingtileprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/presentationslideprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/defaulttileprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/singleimageprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/sizereferencetileprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/temporaltileprovider.h
@@ -123,6 +126,9 @@ set(HEADER_FILES
)
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/cache/memoryawaretilecache.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cache/texturecontainer.cpp
@@ -159,12 +165,14 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpuchunktilepile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpuheightlayer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayeradjustment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayergroup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayermanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gpulayerrendersettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gputiledepthtransform.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gpu/gputileuvtransform.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layeradjustment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layermanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layerrendersettings.cpp
@@ -178,8 +186,7 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/tile/tilemetadata.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileselector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileloadjob.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/cachingtileprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/presentationslideprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/defaulttileprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/singleimageprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/sizereferencetileprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileprovider/temporaltileprovider.cpp
@@ -211,7 +218,9 @@ set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/texturetilemapping.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tile.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tilefragcolor.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tilevertexheight.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tileheight.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tilevertexskirt.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/globeshading.hglsl
)
source_group("Shader Files" FILES ${SHADER_FILES})

View File

@@ -70,6 +70,7 @@ public:
*/
Item popLRU();
size_t size() const;
size_t maximumCacheSize() const;
private:
void putWithoutCleaning(const KeyType& key, const ValueType& value);

View File

@@ -120,6 +120,11 @@ size_t LRUCache<KeyType, ValueType, HasherType>::size() const {
return _itemMap.size();
}
template<typename KeyType, typename ValueType, typename HasherType>
size_t LRUCache<KeyType, ValueType, HasherType>::maximumCacheSize() const {
return _maximumCacheSize;
}
template<typename KeyType, typename ValueType, typename HasherType>
void LRUCache<KeyType, ValueType, HasherType>::putWithoutCleaning(const KeyType& key,
const ValueType& value)

View File

@@ -117,7 +117,7 @@ void MemoryAwareTileCache::clear() {
void MemoryAwareTileCache::createDefaultTextureContainers() {
for (int id = 0; id < layergroupid::NUM_LAYER_GROUPS; id++) {
TileTextureInitData initData =
LayerManager::getTileTextureInitData(layergroupid::ID(id));
LayerManager::getTileTextureInitData(layergroupid::GroupID(id));
assureTextureContainerExists(initData);
}
}

View File

@@ -68,8 +68,9 @@ public:
private:
std::vector<std::unique_ptr<ghoul::opengl::Texture>> _textures;
size_t _freeTexture;
const TileTextureInitData _initData;
size_t _freeTexture;
size_t _numTextures;
};

View File

@@ -102,7 +102,7 @@ Chunk::BoundingHeights Chunk::getBoundingHeights() const {
// a single raster image. If it is not we will just use the first raster
// (that is channel 0).
const size_t HeightChannel = 0;
const LayerGroup& heightmaps = layerManager->layerGroup(layergroupid::HeightLayers);
const LayerGroup& heightmaps = layerManager->layerGroup(layergroupid::GroupID::HeightLayers);
std::vector<ChunkTileSettingsPair> chunkTileSettingPairs =
tileselector::getTilesAndSettingsUnsorted(
heightmaps, _tileIndex);

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