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

This commit is contained in:
Emil Axelsson
2017-11-05 20:04:47 +01:00
16 changed files with 6260 additions and 12 deletions

1
.gitignore vendored
View File

@@ -124,6 +124,7 @@ data/scene/mars/map_datasets/mars_COL_v006_mars2000_rgb.tif
data/scene/mars/map_datasets/mars_COL_v006_mars2000_rgb.vrt
data/spice/Juno/
data/scene/digitaluniverse/*/data/*.dat
data/scene/digitaluniverse/*/data/*.data
data/scene/digitaluniverse/*/speck/*.speck
data/scene/digitaluniverse/*/speck/*.cmap
data/scene/digitaluniverse/*/speck/*.label

View File

@@ -107,6 +107,7 @@ add_subdirectory(${OPENSPACE_EXT_DIR}/ghoul)
target_link_libraries(libOpenSpace Ghoul)
set_property(TARGET Lua PROPERTY FOLDER "External")
set_property(TARGET lz4 PROPERTY FOLDER "External")
link_directories("${GHOUL_LIBRARY_DIRS}")
# SGCT
set(SGCT_TEXT OFF CACHE BOOL "" FORCE)
@@ -124,7 +125,9 @@ target_link_libraries(
${GLFW_LIBRARIES}
)
set_property(TARGET sgct_light PROPERTY FOLDER "External")
if (TARGET sgct_light)
set_property(TARGET sgct_light PROPERTY FOLDER "External")
endif ()
if (TARGET glew)
set_property(TARGET glew PROPERTY FOLDER "External/SGCT")
endif ()

View File

@@ -67,8 +67,8 @@ target_link_libraries(
#####
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
SET(LIBTORRENT_encryption OFF)
SET(LIBTORRENT_shared OFF)
SET(LIBTORRENT_encryption OFF CACHE BOOL "Use OpenSSL Encryption" FORCE)
SET(LIBTORRENT_shared OFF CACHE BOOL "Use Libtorrent as shared library" FORCE)
include_external_library(
Launcher

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" ?>
<Cluster masterAddress="127.0.0.1">
<Node ip="127.0.0.1" port="20401">
<Window fullscreen="false" fxaa="false" msaa="1" name="Spherical Projection">
<Stereo type="none" />
<Pos x="0" y="100" />
<!-- 16:9 aspect ratio -->
<Size x="1280" y="720" />
<Res x="2048" y="2048" />
<!--
quality options (cubemap size):
- low (256)
- medium (512)
- high/1k (1024)
- 2k (2048)
- 4k (4096)
- 8k (8192)
tilt specifies the dome tilt angle in degrees from the horizontal
-->
<Viewport name="warped fisheye" mesh="mesh/standard_16x9.data">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="180" quality="2k" tilt="30.0">
<Background r="0.1" g="0.1" b="0.1" a="1.0" />
</FisheyeProjection>
</Viewport>
</Window>
</Node>
<User eyeSeparation="0.06">
<Pos x="0.0" y="0.0" z="0.0" />
</User>
</Cluster>

37
config/spout_output.xml Normal file
View File

@@ -0,0 +1,37 @@
<?xml version="1.0" ?>
<Cluster masterAddress="localhost">
<!-- <Scene>
<Orientation yaw="0.0" pitch="-27.0" roll="0.0" />
<Offset x="0.0" y="0.0" z="0.0" />
<Scale value="1.0" />
</Scene> -->
<Node address="localhost" port="20401">
<Window fullScreen="false" numberOfSamples="8" name="OpenSpace">
<Stereo type="none" />
<!-- 16:9 aspect ratio -->
<Size x="1024" y="1024" />
<!-- Frame buffer resolution
<Res x="4096" y="4096" /> -->
<!--
quality options (cubemap size):
- low (256)
- medium (512)
- high/1k (1024)
- 2k (2048)
- 4k (4096)
- 8k (8192)
tilt specifies the dome tilt angle in degrees from the horizontal
-->
<Viewport name="Spout">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<SpoutOutputProjection quality="2k">
<Background r="0.1" g="0.1" b="0.1" a="1.0" />
</SpoutOutputProjection>
</Viewport>
</Window>
</Node>
<User eyeSeparation="0.06">
<Pos x="0.0" y="0.0" z="0.0" />
</User>
</Cluster>

View File

@@ -1,5 +1,5 @@
return {
FileRequest = {
{ Identifier = "digitaluniverse_starlabels_speck", Destination = "speck", Version = 1 }
{ Identifier = "digitaluniverse_starlabels_speck", Destination = "speck", Version = 2 }
}
}

View File

@@ -1,7 +1,7 @@
return {
FileRequest = {
{ Identifier = "stars_textures", Destination = "textures", Version = 1 },
{ Identifier = "stars_du", Destination = "speck", Version = 1 },
{ Identifier = "stars_du", Destination = "speck", Version = 2 },
{ Identifier = "stars_colormap", Destination = ".", Version = 1 },
},
}

View File

@@ -58,6 +58,10 @@ public:
bool followingNodeRotation() const;
SceneGraphNode* focusNode() const;
bool hasRotationalFriction() const;
bool hasZoomFriction() const;
bool hasRollFriction() const;
private:
struct CameraRotationDecomposition {
glm::dquat localRotation;

View File

@@ -97,6 +97,7 @@ public:
void renderScreenLog();
void renderVersionInformation();
void renderCameraInformation();
void renderShutdownInformation(float timer, float fullTime);
void postDraw();
@@ -201,6 +202,7 @@ private:
properties::BoolProperty _showInfo;
properties::BoolProperty _showLog;
properties::BoolProperty _showVersionInfo;
properties::BoolProperty _showCameraInfo;
properties::TriggerProperty _takeScreenshot;
bool _shouldTakeScreenshot;

View File

@@ -176,6 +176,7 @@ private:
properties::FloatProperty _slerpTime;
properties::IVec2Property _guiButton;
properties::Vec4Property _friction;
properties::FloatProperty _pickingRadiusMinimum;
// Class variables
VelocityStates _vel;
@@ -194,6 +195,7 @@ private:
bool _lmSuccess;
bool _guiON;
std::vector<SelectedBody> _selected;
SceneGraphNode* _pickingSelected;
LMstat _lmstat;
glm::dquat _toSlerp;
glm::dvec3 _centroid;

View File

@@ -172,6 +172,12 @@ TouchInteraction::TouchInteraction()
glm::vec4(0.f),
glm::vec4(0.2f)
)
, _pickingRadiusMinimum(
{ "Picking Radius", "Minimum radius for picking in NDC coordinates", "" },
0.1f,
0.f,
1.f
)
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
, _sensitivity{ glm::dvec2(0.08, 0.045), 4.0, 2.75, glm::dvec2(0.08, 0.045) }
, _centroid(glm::dvec3(0.0))
@@ -203,6 +209,7 @@ TouchInteraction::TouchInteraction()
addProperty(_slerpTime);
addProperty(_guiButton);
addProperty(_friction);
addProperty(_pickingRadiusMinimum);
_origin.onChange([this]() {
SceneGraphNode* node = sceneGraphNode(_origin.value());
@@ -476,6 +483,15 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
glm::dquat camToWorldSpace = _camera->rotationQuaternion();
glm::dvec3 camPos = _camera->positionVec3();
std::vector<SelectedBody> newSelected;
struct PickingInfo {
SceneGraphNode* node;
double pickingDistanceNDC;
double pickingDistanceWorld;
};
std::vector<PickingInfo> pickingInfo;
for (const TuioCursor& c : list) {
double xCo = 2 * (c.getX() - 0.5);
double yCo = -2 * (c.getY() - 0.5); // normalized -1 to 1 coordinates on screen
@@ -484,7 +500,8 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
glm::dvec3 raytrace = glm::normalize(cursorInWorldSpace);
int id = c.getSessionID();
for (SceneGraphNode* node : selectableNodes) {
for (SceneGraphNode* node : selectableNodes) {
double boundingSphere = node->boundingSphere();
glm::dvec3 camToSelectable = node->worldPosition() - camPos;
double dist = length(glm::cross(cursorInWorldSpace, camToSelectable)) / glm::length(cursorInWorldSpace) - boundingSphere;
@@ -492,8 +509,9 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
// finds intersection closest point between boundingsphere and line in world coordinates, assumes line direction is normalized
double d = glm::dot(raytrace, camToSelectable);
double root = boundingSphere * boundingSphere - glm::dot(camToSelectable, camToSelectable) + d * d;
if (root > 0) // two intersection points (take the closest one)
if (root > 0) { // two intersection points (take the closest one)
d -= sqrt(root);
}
glm::dvec3 intersectionPoint = camPos + d * raytrace;
glm::dvec3 pointInModelView = glm::inverse(node->rotationMatrix()) * (intersectionPoint - node->worldPosition());
@@ -510,9 +528,65 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
newSelected.push_back({ id, node, pointInModelView });
}
}
// Compute locations in view space to perform the picking
glm::dvec4 clip = glm::dmat4(_camera->projectionMatrix()) * _camera->combinedViewMatrix() * glm::vec4(node->worldPosition(), 1.0);
glm::dvec2 ndc = clip / clip.w;
// If the object is not in the screen, we dont want to consider it at all
if (ndc.x >= -1.0 && ndc.x <= 1.0 && ndc.y >= -1.0 && ndc.y <= 1.0) {
glm::dvec2 cursor = { xCo, yCo };
double ndcDist = glm::length(ndc - cursor);
// We either want to select the object if it's bounding sphere as been touched
// (checked by the first part of this loop above) or if the touch point is
// within a minimum distance of the center
if (dist <= 0.0 || (ndcDist <= _pickingRadiusMinimum)) {
// If the user touched the planet directly, this is definitely the one they are
// interested in => minimum distance
if (dist <= 0.0) {
LINFOC(node->name(), "Picking candidate based on direct touch");
pickingInfo.push_back({
node,
-std::numeric_limits<double>::max(),
-std::numeric_limits<double>::max()
});
}
else {
// The node was considered due to minimum picking distance radius
LINFOC(node->name(), "Picking candidate based on proximity");
pickingInfo.push_back({
node,
ndcDist,
dist
});
}
}
}
}
}
_selected = newSelected;
// After we are done with all of the nodes, we can sort the picking list and pick the
// one that fits best (= is closest or was touched directly)
std::sort(
pickingInfo.begin(),
pickingInfo.end(),
[](const PickingInfo& lhs, const PickingInfo& rhs) {
return lhs.pickingDistanceWorld < rhs.pickingDistanceWorld;
}
);
// If an item has been picked, it's in the first position of the vector now
if (!pickingInfo.empty()) {
_pickingSelected = pickingInfo.begin()->node;
LINFOC("Picking", "Picked node: " + _pickingSelected->name());
}
LINFOC("Picking", "============");
_selected = std::move(newSelected);
}
// Interprets the input gesture to a specific interaction
@@ -634,8 +708,8 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list, co
break;
}
case PICK: { // pick something in the scene as focus node
if (_selected.size() == 1 && _selected.at(0).node) {
setFocusNode(_selected.at(0).node);
if (_pickingSelected) {
setFocusNode(_pickingSelected);
OsEng.navigationHandler().setFocusNode(_focusNode); // cant do setFocusNode() since TouchInteraction is not subclass of InteractionMode
// rotate camera to look at new focus, using slerp quat
@@ -771,6 +845,7 @@ void TouchInteraction::unitTest() {
// clear everything
_selected.clear();
_pickingSelected = nullptr;
_vel.orbit = glm::dvec2(0.0, 0.0);
_vel.zoom = 0.0;
_vel.roll = 0.0;
@@ -838,6 +913,7 @@ void TouchInteraction::resetAfterInput() {
_lastVel.roll = 0.0;
_lastVel.pan = glm::dvec2(0.0, 0.0);
_selected.clear();
_pickingSelected = nullptr;
}
// Reset all property values to default

View File

@@ -1170,6 +1170,12 @@ void OpenSpaceEngine::postDraw() {
if (isGuiWindow) {
_renderEngine->renderScreenLog();
_renderEngine->renderVersionInformation();
if (!_shutdown.inShutdown) {
// We render the camera information in the same location as the shutdown info
// and we won't need this if we are shutting down
_renderEngine->renderCameraInformation();
}
_console->render();
}

View File

@@ -300,6 +300,18 @@ SceneGraphNode* OrbitalNavigator::focusNode() const {
return _focusNode;
}
bool OrbitalNavigator::hasRotationalFriction() const {
return _friction.rotational;
}
bool OrbitalNavigator::hasZoomFriction() const {
return _friction.zoom;
}
bool OrbitalNavigator::hasRollFriction() const {
return _friction.roll;
}
OrbitalNavigator::CameraRotationDecomposition
OrbitalNavigator::decomposeCameraRotation(
const glm::dvec3& cameraPosition,

View File

@@ -131,10 +131,17 @@ namespace {
static const openspace::properties::Property::PropertyInfo ShowVersionInfo = {
"ShowVersion",
"Shows the version on-screen information",
"This value determines whether the GIT version information (branch and commit ) "
"This value determines whether the Git version information (branch and commit) "
"hash are shown on the screen."
};
static const openspace::properties::Property::PropertyInfo ShowCameraInfo = {
"ShowCamera",
"Shows information about the current camera state, such as friction",
"This value determines whether the information about the current camrea state is "
"shown on the screen"
};
static const openspace::properties::Property::PropertyInfo TakeScreenshotInfo = {
"TakeScreenshot",
"Take Screenshot",
@@ -206,6 +213,7 @@ RenderEngine::RenderEngine()
, _showInfo(ShowInfoInfo, true)
, _showLog(ShowLogInfo, true)
, _showVersionInfo(ShowVersionInfo, true)
, _showCameraInfo(ShowCameraInfo, true)
, _takeScreenshot(TakeScreenshotInfo)
, _shouldTakeScreenshot(false)
, _applyWarping(ApplyWarpingInfo, false)
@@ -260,6 +268,7 @@ RenderEngine::RenderEngine()
addProperty(_showInfo);
addProperty(_showLog);
addProperty(_showVersionInfo);
addProperty(_showCameraInfo);
_nAaSamples.onChange([this](){
if (_renderer) {
@@ -1301,6 +1310,68 @@ void RenderEngine::renderInformation() {
}
}
void RenderEngine::renderCameraInformation() {
if (!_showCameraInfo) {
return;
}
const glm::vec4 enabled = glm::vec4(0.2f, 0.75f, 0.2f, 1.f);
const glm::vec4 disabled = glm::vec4(0.55f, 0.2f, 0.2f, 1.f);
using FR = ghoul::fontrendering::FontRenderer;
FR::BoundingBoxInformation rotationBox = FR::defaultRenderer().boundingBox(
*_fontInfo,
"%s",
"Rotation"
);
float penPosY = fontResolution().y - rotationBox.boundingBox.y;
const float ySeparation = 5.f;
const float xSeparation = 5.f;
interaction::OrbitalNavigator nav = OsEng.navigationHandler().orbitalNavigator();
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(fontResolution().x - rotationBox.boundingBox.x - xSeparation, penPosY),
nav.hasRotationalFriction() ? enabled : disabled,
"%s",
"Rotation"
);
penPosY -= rotationBox.boundingBox.y + ySeparation;
FR::BoundingBoxInformation zoomBox = FR::defaultRenderer().boundingBox(
*_fontInfo,
"%s",
"Zoom"
);
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(fontResolution().x - zoomBox.boundingBox.x - xSeparation, penPosY),
nav.hasZoomFriction() ? enabled : disabled,
"%s",
"Zoom"
);
penPosY -= zoomBox.boundingBox.y + ySeparation;
FR::BoundingBoxInformation rollBox = FR::defaultRenderer().boundingBox(
*_fontInfo,
"%s",
"Roll"
);
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(fontResolution().x - rollBox.boundingBox.x - xSeparation, penPosY),
nav.hasRollFriction() ? enabled : disabled,
"%s",
"Roll"
);
}
void RenderEngine::renderVersionInformation() {
if (!_showVersionInfo) {
return;