Merge branch 'master' of github.com:OpenSpace/OpenSpace into feature/hdrOS

This commit is contained in:
Emil Axelsson
2019-08-13 08:52:07 +02:00
4 changed files with 30 additions and 4 deletions

View File

@@ -20,12 +20,22 @@ asset.onInitialize(function ()
openspace.unzipFile(frontend .. "/frontend.zip", dest, true)
end
-- Serve the production GUI:
-- Disable the server, add production gui endpoint, and restart server.
-- The temporary disabling avoids restarting the server on each property change.
-- TODO: Add a trigger property to the module to restart the server "manually"
-- and remove automatic restart on each property change,
-- since frequent restarting seems to be unstable on mac.
local enabled = openspace.getPropertyValue("Modules.WebGui.ServerProcessEnabled")
openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", false)
local directories = openspace.getPropertyValue("Modules.WebGui.Directories")
directories[#directories + 1] = "frontend"
directories[#directories + 1] = frontend .. '/frontend'
openspace.setPropertyValueSingle("Modules.WebGui.Directories", directories)
openspace.setPropertyValueSingle("Modules.WebGui.DefaultEndpoint", "frontend")
openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", enabled)
if guiCustomization.webguiDevelopmentMode then
-- Route CEF to the deveopment version of the GUI.

View File

@@ -30,7 +30,11 @@ namespace openspace {
template <typename T>
void SyncBuffer::encode(const T& v) {
const size_t size = sizeof(T);
ghoul_assert(_encodeOffset + size < _n, "");
size_t anticpatedBufferSize = _encodeOffset + size;
if (anticpatedBufferSize >= _n) {
_dataStream.resize(anticpatedBufferSize);
}
memcpy(_dataStream.data() + _encodeOffset, &v, size);
_encodeOffset += size;

View File

@@ -366,6 +366,7 @@ glm::quat OrbitalNavigator::anchorNodeToCameraRotation() const {
void OrbitalNavigator::resetVelocities() {
_mouseStates.resetVelocities();
_joystickStates.resetVelocities();
_websocketStates.resetVelocities();
_scriptStates.resetVelocities();
}
@@ -587,10 +588,17 @@ void OrbitalNavigator::setAnchorNode(const SceneGraphNode* anchorNode) {
if (!_anchorNode) {
_directlySetStereoDistance = true;
}
if (_anchorNode != anchorNode) {
resetVelocities();
}
_anchorNode = anchorNode;
if (_anchorNode) {
_previousAnchorNodePosition = _anchorNode->worldPosition();
_previousAnchorNodeRotation = glm::quat_cast(_anchorNode->worldRotationMatrix());
}
else {
_previousAnchorNodePosition.reset();
_previousAnchorNodeRotation.reset();
}

View File

@@ -35,9 +35,13 @@ SyncBuffer::SyncBuffer(size_t n)
SyncBuffer::~SyncBuffer() {} // NOLINT
void SyncBuffer::encode(const std::string& s) {
ghoul_assert(_encodeOffset + sizeof(char) * s.size() + sizeof(int32_t) < _n, "");
int32_t anticpatedBufferSize = _encodeOffset + (sizeof(char) * s.size())
+ sizeof(int32_t);
if (anticpatedBufferSize >= _n) {
_dataStream.resize(anticpatedBufferSize);
}
int32_t length = static_cast<int32_t>(s.length());
int32_t length = static_cast<int32_t>(s.size() * sizeof(char));
memcpy(
_dataStream.data() + _encodeOffset,
reinterpret_cast<const char*>(&length),