mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 12:39:24 -05:00
Merged master into NewAtmopshere branch.
This commit is contained in:
@@ -216,6 +216,19 @@ struct StringListVerifier : public TableVerifier {
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* A Verifier that checks whether all values contained in a Table are of type \c int.
|
||||
*/
|
||||
struct IntListVerifier : public TableVerifier {
|
||||
/**
|
||||
* Constructor for a IntListVerifier.
|
||||
* \param elementDocumentation The documentation for each string in the list
|
||||
*/
|
||||
IntListVerifier(std::string elementDocumentation = "");
|
||||
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Vector verifiers
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
@@ -104,6 +104,8 @@ public:
|
||||
/// The key that stores whether the master node should perform rendering just function
|
||||
/// as a pure manager
|
||||
static const std::string KeyDisableMasterRendering;
|
||||
/// The key that stores whether the master node should apply the scene transformation
|
||||
static const std::string KeyDisableSceneOnMaster;
|
||||
/// The key that sets the request URL that is used to request additional data to be
|
||||
/// downloaded
|
||||
static const std::string KeyDownloadRequestURL;
|
||||
@@ -124,7 +126,22 @@ public:
|
||||
static const std::string PartHttpProxyUser;
|
||||
/// The key that stores the password to use for authentication to access the http proxy
|
||||
static const std::string PartHttpProxyPassword;
|
||||
|
||||
/// The key that stores the dictionary containing information about debug contexts
|
||||
static const std::string KeyOpenGLDebugContext;
|
||||
/// The part of the key storing whether an OpenGL Debug context should be created
|
||||
static const std::string PartActivate;
|
||||
/// The part of the key storing whether the debug callbacks are performed synchronous
|
||||
static const std::string PartSynchronous;
|
||||
/// The part of the key storing a list of identifiers that should be filtered out
|
||||
static const std::string PartFilterIdentifier;
|
||||
/// The part of the key that stores the source of the ignored identifier
|
||||
static const std::string PartFilterIdentifierSource;
|
||||
/// The part of the key that stores the type of the ignored identifier
|
||||
static const std::string PartFilterIdentifierType;
|
||||
/// The part of the key that stores the identifier of the ignored identifier
|
||||
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;
|
||||
|
||||
/**
|
||||
* Iteratively walks the directory structure starting with \p filename to find the
|
||||
|
||||
@@ -55,6 +55,9 @@ class NetworkEngine;
|
||||
class ParallelConnection;
|
||||
class RenderEngine;
|
||||
class SettingsEngine;
|
||||
class SceneManager;
|
||||
class VirtualPropertyManager;
|
||||
|
||||
class SyncEngine;
|
||||
class TimeManager;
|
||||
class WindowWrapper;
|
||||
@@ -85,7 +88,8 @@ public:
|
||||
void deinitialize();
|
||||
void preSynchronization();
|
||||
void postSynchronizationPreDraw();
|
||||
void render(const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix);
|
||||
void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
|
||||
const glm::mat4& projectionMatrix);
|
||||
void postDraw();
|
||||
void keyboardCallback(Key key, KeyModifier mod, KeyAction action);
|
||||
void charCallback(unsigned int codepoint, KeyModifier mod);
|
||||
@@ -95,7 +99,9 @@ public:
|
||||
void externalControlCallback(const char* receivedChars, int size, int clientId);
|
||||
void encode();
|
||||
void decode();
|
||||
|
||||
|
||||
void scheduleLoadScene(std::string scenePath);
|
||||
|
||||
void enableBarrier();
|
||||
void disableBarrier();
|
||||
|
||||
@@ -120,6 +126,7 @@ public:
|
||||
properties::PropertyOwner& globalPropertyOwner();
|
||||
scripting::ScriptEngine& scriptEngine();
|
||||
scripting::ScriptScheduler& scriptScheduler();
|
||||
VirtualPropertyManager& virtualPropertyManager();
|
||||
|
||||
|
||||
// This method is only to be called from Modules
|
||||
@@ -165,8 +172,8 @@ public:
|
||||
private:
|
||||
OpenSpaceEngine(std::string programName,
|
||||
std::unique_ptr<WindowWrapper> windowWrapper);
|
||||
~OpenSpaceEngine() = default;
|
||||
|
||||
void loadScene(const std::string& scenePath);
|
||||
void gatherCommandlineArguments();
|
||||
void loadFonts();
|
||||
void runPreInitializationScripts(const std::string& sceneDescription);
|
||||
@@ -174,6 +181,7 @@ private:
|
||||
|
||||
// Components
|
||||
std::unique_ptr<ConfigurationManager> _configurationManager;
|
||||
std::unique_ptr<SceneManager> _sceneManager;
|
||||
std::unique_ptr<DownloadManager> _downloadManager;
|
||||
std::unique_ptr<LuaConsole> _console;
|
||||
std::unique_ptr<ModuleEngine> _moduleEngine;
|
||||
@@ -189,10 +197,14 @@ private:
|
||||
std::unique_ptr<interaction::InteractionHandler> _interactionHandler;
|
||||
std::unique_ptr<scripting::ScriptEngine> _scriptEngine;
|
||||
std::unique_ptr<scripting::ScriptScheduler> _scriptScheduler;
|
||||
std::unique_ptr<VirtualPropertyManager> _virtualPropertyManager;
|
||||
|
||||
// Others
|
||||
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
|
||||
|
||||
bool _scheduledSceneSwitch;
|
||||
std::string _scenePath;
|
||||
|
||||
struct {
|
||||
std::vector<std::function<void()>> initialize;
|
||||
std::vector<std::function<void()>> deinitialize;
|
||||
|
||||
@@ -89,6 +89,11 @@ public:
|
||||
*/
|
||||
void removeSyncable(Syncable* syncable);
|
||||
|
||||
/**
|
||||
* Remove multiple Syncables from being synchronized over the SGCT cluster
|
||||
*/
|
||||
void removeSyncables(const std::vector<Syncable*>& syncables);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Vector of Syncables. The vectors ensures consistent encode/decode order
|
||||
|
||||
+14
-39
@@ -21,55 +21,30 @@
|
||||
* 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___SCENEGRAPH___H__
|
||||
#define __OPENSPACE_CORE___SCENEGRAPH___H__
|
||||
|
||||
#ifndef __OPENSPACE_CORE___VIRTUALPROPERTYMANAGER___H__
|
||||
#define __OPENSPACE_CORE___VIRTUALPROPERTYMANAGER___H__
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/properties/property.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class SceneGraphNode;
|
||||
|
||||
class SceneGraph {
|
||||
class VirtualPropertyManager : public properties::PropertyOwner {
|
||||
public:
|
||||
SceneGraph();
|
||||
~SceneGraph();
|
||||
VirtualPropertyManager();
|
||||
|
||||
void clear();
|
||||
bool loadFromFile(const std::string& sceneDescription);
|
||||
|
||||
// Returns if addition was successful
|
||||
bool addSceneGraphNode(SceneGraphNode* node);
|
||||
bool removeSceneGraphNode(SceneGraphNode* node);
|
||||
|
||||
const std::vector<SceneGraphNode*>& nodes() const;
|
||||
|
||||
SceneGraphNode* rootNode() const;
|
||||
SceneGraphNode* sceneGraphNode(const std::string& name) const;
|
||||
void addProperty(std::unique_ptr<properties::Property> prop);
|
||||
void removeProperty(properties::Property* prop);
|
||||
|
||||
private:
|
||||
struct SceneGraphNodeInternal {
|
||||
~SceneGraphNodeInternal();
|
||||
|
||||
SceneGraphNode* node = nullptr;
|
||||
// From nodes that are dependent on this one
|
||||
std::vector<SceneGraphNodeInternal*> incomingEdges;
|
||||
// To nodes that this node depends on
|
||||
std::vector<SceneGraphNodeInternal*> outgoingEdges;
|
||||
};
|
||||
|
||||
bool nodeIsDependentOnRoot(SceneGraphNodeInternal* node);
|
||||
bool sortTopologically();
|
||||
|
||||
SceneGraphNodeInternal* nodeByName(const std::string& name);
|
||||
|
||||
SceneGraphNode* _rootNode;
|
||||
std::vector<SceneGraphNodeInternal*> _nodes;
|
||||
std::vector<SceneGraphNode*> _topologicalSortedNodes;
|
||||
std::vector<std::unique_ptr<properties::Property>> _properties;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___SCENEGRAPH___H__
|
||||
#endif // __OPENSPACE_CORE___VIRTUALPROPERTYMANAGER___H__
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
// Interaction mode setters
|
||||
void setCameraStateFromDictionary(const ghoul::Dictionary& cameraDict);
|
||||
void setInteractionMode(const std::string& interactionModeKey);
|
||||
InteractionMode* interactionMode();
|
||||
|
||||
void goToChunk(int x, int y, int level);
|
||||
void goToGeo(double latitude, double longitude);
|
||||
@@ -72,7 +73,9 @@ public:
|
||||
void resetKeyBindings();
|
||||
|
||||
void addKeyframe(const datamessagestructures::CameraKeyframe &kf);
|
||||
void removeKeyframesAfter(double timestamp);
|
||||
void clearKeyframes();
|
||||
const std::vector<datamessagestructures::CameraKeyframe>& keyframes() const;
|
||||
|
||||
void bindKeyLocal(
|
||||
Key key,
|
||||
@@ -95,8 +98,10 @@ public:
|
||||
|
||||
// Accessors
|
||||
ghoul::Dictionary getCameraStateDictionary();
|
||||
SceneGraphNode* const focusNode() const;
|
||||
Camera* const camera() const;
|
||||
SceneGraphNode* focusNode() const;
|
||||
glm::dvec3 focusNodeToCameraVector() const;
|
||||
glm::quat focusNodeToCameraRotation() const;
|
||||
Camera* camera() const;
|
||||
const InputState& inputState() const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,9 +82,12 @@ namespace interaction {
|
||||
|
||||
// Mutators
|
||||
void addKeyframe(const datamessagestructures::CameraKeyframe &kf);
|
||||
void removeKeyframesAfter(double timestamp);
|
||||
void clearKeyframes();
|
||||
void clearOldKeyframes();
|
||||
|
||||
static bool compareKeyframeTimes(const datamessagestructures::CameraKeyframe& a, const datamessagestructures::CameraKeyframe& b);
|
||||
|
||||
// Accessors
|
||||
const std::list<std::pair<Key, KeyModifier> >& getPressedKeys() const;
|
||||
const std::list<MouseButton>& getPressedMouseButtons() const;
|
||||
@@ -119,6 +122,7 @@ public:
|
||||
// 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;
|
||||
@@ -195,6 +199,7 @@ public:
|
||||
|
||||
virtual void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
|
||||
virtual void updateCameraStateFromMouseStates(Camera& camera, double deltaTime);
|
||||
bool followingNodeRotation() const override;
|
||||
|
||||
private:
|
||||
std::vector<datamessagestructures::CameraKeyframe> _keyframes;
|
||||
@@ -245,6 +250,7 @@ public:
|
||||
|
||||
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);
|
||||
@@ -260,6 +266,7 @@ public:
|
||||
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);
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
void addToCommand(std::string c);
|
||||
|
||||
properties::BoolProperty _isVisible;
|
||||
bool _remoteScripting;
|
||||
properties::BoolProperty _remoteScripting;
|
||||
|
||||
size_t _inputPosition;
|
||||
std::vector<std::string> _commandsHistory;
|
||||
|
||||
@@ -51,16 +51,28 @@ struct CameraKeyframe {
|
||||
|
||||
glm::dvec3 _position;
|
||||
glm::dquat _rotation;
|
||||
bool _followNodeRotation;
|
||||
std::string _focusNode;
|
||||
|
||||
double _timestamp;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add position
|
||||
// Add position
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_position), reinterpret_cast<char*>(&_position) + sizeof(_position));
|
||||
|
||||
//add orientation
|
||||
// Add orientation
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_rotation), reinterpret_cast<char*>(&_rotation) + sizeof(_rotation));
|
||||
|
||||
//add timestamp
|
||||
|
||||
// Follow focus node rotation?
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_followNodeRotation), reinterpret_cast<char*>(&_followNodeRotation) + sizeof(_followNodeRotation));
|
||||
|
||||
int nodeNameLength = _focusNode.size();
|
||||
|
||||
// Add focus node
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&nodeNameLength), reinterpret_cast<char*>(&nodeNameLength) + sizeof(nodeNameLength));
|
||||
buffer.insert(buffer.end(), _focusNode.data(), _focusNode.data() + nodeNameLength);
|
||||
|
||||
// Add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timestamp), reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp));
|
||||
};
|
||||
|
||||
@@ -68,17 +80,31 @@ struct CameraKeyframe {
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//position
|
||||
// Position
|
||||
size = sizeof(_position);
|
||||
memcpy(&_position, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//orientation
|
||||
|
||||
// Orientation
|
||||
size = sizeof(_rotation);
|
||||
memcpy(&_rotation, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
// Follow focus node rotation?
|
||||
size = sizeof(_followNodeRotation);
|
||||
memcpy(&_followNodeRotation, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
// Focus node
|
||||
int nodeNameLength;
|
||||
size = sizeof(int);
|
||||
memcpy(&nodeNameLength, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
size = nodeNameLength;
|
||||
_focusNode = std::string(buffer.data() + offset, buffer.data() + offset + size);
|
||||
offset += size;
|
||||
|
||||
//timestamp
|
||||
// Timestamp
|
||||
size = sizeof(_timestamp);
|
||||
memcpy(&_timestamp, buffer.data() + offset, size);
|
||||
};
|
||||
@@ -97,19 +123,19 @@ struct TimeKeyframe {
|
||||
double _timestamp;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add current time
|
||||
// Add current time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_time), reinterpret_cast<char*>(&_time) + sizeof(_time));
|
||||
|
||||
//add delta time
|
||||
// Add delta time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_dt), reinterpret_cast<char*>(&_dt) + sizeof(_dt));
|
||||
|
||||
//add wether time is paused or not
|
||||
// Add whether time is paused or not
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_paused), reinterpret_cast<char*>(&_paused) + sizeof(_paused));
|
||||
|
||||
//add wether a time jump is necessary (recompute paths etc)
|
||||
// Add whether a time jump is necessary (recompute paths etc)
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_requiresTimeJump), reinterpret_cast<char*>(&_requiresTimeJump) + sizeof(_requiresTimeJump));
|
||||
|
||||
//add timestamp
|
||||
// Add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timestamp), reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp));
|
||||
};
|
||||
|
||||
@@ -117,27 +143,27 @@ struct TimeKeyframe {
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//current time
|
||||
// Current time
|
||||
size = sizeof(_time);
|
||||
memcpy(&_time, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//delta time
|
||||
// Delta time
|
||||
size = sizeof(_dt);
|
||||
memcpy(&_dt, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//is time paused?
|
||||
// Is time paused?
|
||||
size = sizeof(_paused);
|
||||
memcpy(&_paused, buffer.data() + offset, size);
|
||||
offset += sizeof(_paused);
|
||||
|
||||
//is a time jump required?
|
||||
// Is a time jump required?
|
||||
size = sizeof(_requiresTimeJump);
|
||||
memcpy(&_requiresTimeJump, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
// timestamp
|
||||
// Timestamp
|
||||
size = sizeof(_timestamp);
|
||||
memcpy(&_timestamp, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
|
||||
//openspace includes
|
||||
#include <openspace/network/messagestructures.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
//glm includes
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
@@ -57,7 +60,7 @@ struct addrinfo;
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ParallelConnection {
|
||||
class ParallelConnection : public properties::PropertyOwner {
|
||||
public:
|
||||
enum class Status : uint32_t {
|
||||
Disconnected = 0,
|
||||
@@ -99,17 +102,21 @@ class ParallelConnection {
|
||||
ParallelConnection();
|
||||
~ParallelConnection();
|
||||
void clientConnect();
|
||||
void setPort(const std::string &port);
|
||||
void setAddress(const std::string &address);
|
||||
void setName(const std::string& name);
|
||||
void setPort(std::string port);
|
||||
void setAddress(std::string address);
|
||||
void setName(std::string name);
|
||||
bool isHost();
|
||||
const std::string& hostName();
|
||||
void requestHostship(const std::string &password);
|
||||
void requestHostship();
|
||||
void resignHostship();
|
||||
void setPassword(const std::string &password);
|
||||
void setPassword(std::string password);
|
||||
void setHostPassword(std::string hostPassword);
|
||||
void signalDisconnect();
|
||||
void preSynchronization();
|
||||
void sendScript(const std::string& script);
|
||||
void sendScript(std::string script);
|
||||
void resetTimeOffset();
|
||||
double latencyStandardDeviation() const;
|
||||
double timeTolerance() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
@@ -145,7 +152,6 @@ private:
|
||||
void connectionStatusMessageReceived(const std::vector<char>& messageContent);
|
||||
void nConnectionsMessageReceived(const std::vector<char>& messageContent);
|
||||
|
||||
void broadcast();
|
||||
void sendCameraKeyframe();
|
||||
void sendTimeKeyframe();
|
||||
|
||||
@@ -158,10 +164,18 @@ private:
|
||||
|
||||
double calculateBufferedKeyframeTime(double originalTime);
|
||||
|
||||
uint32_t _passCode;
|
||||
std::string _port;
|
||||
std::string _address;
|
||||
std::string _name;
|
||||
properties::StringProperty _password;
|
||||
properties::StringProperty _hostPassword;
|
||||
properties::StringProperty _port;
|
||||
properties::StringProperty _address;
|
||||
properties::StringProperty _name;
|
||||
properties::FloatProperty _bufferTime;
|
||||
properties::FloatProperty _timeKeyframeInterval;
|
||||
properties::FloatProperty _cameraKeyframeInterval;
|
||||
properties::FloatProperty _timeTolerance;
|
||||
|
||||
double _lastTimeKeyframeTimestamp;
|
||||
double _lastCameraKeyframeTimestamp;
|
||||
|
||||
_SOCKET _clientSocket;
|
||||
|
||||
@@ -191,7 +205,6 @@ private:
|
||||
double _initialTimeDiff;
|
||||
|
||||
std::unique_ptr<std::thread> _connectionThread;
|
||||
std::unique_ptr<std::thread> _broadcastThread;
|
||||
std::unique_ptr<std::thread> _sendThread;
|
||||
std::unique_ptr<std::thread> _listenThread;
|
||||
std::unique_ptr<std::thread> _handlerThread;
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace openspace {
|
||||
std::string licenseText();
|
||||
|
||||
const int OPENSPACE_VERSION_MAJOR = 0;
|
||||
const int OPENSPACE_VERSION_MINOR = 7;
|
||||
const int OPENSPACE_VERSION_MINOR = 8;
|
||||
const int OPENSPACE_VERSION_PATCH = 0;
|
||||
|
||||
const std::string OPENSPACE_VERSION_STRING = "prerelease-12 (NAOJ)";
|
||||
const std::string OPENSPACE_VERSION_STRING = "prerelease-13 (Earth Day)";
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -207,6 +207,20 @@ public:
|
||||
/// \see PropertyOwner::removePropertySubOwner(PropertyOwner*)
|
||||
void removePropertySubOwner(PropertyOwner& owner);
|
||||
|
||||
/**
|
||||
* Returns a list of all tags that have been assigned to the Property. Useful for
|
||||
* trying to find a match for a desired batch operation on Properties.
|
||||
* \return Pointer to vector of string tags that were assigned to the Property
|
||||
*/
|
||||
std::vector<std::string> tags() const;
|
||||
|
||||
/**
|
||||
* Adds a tag to the Property's list of assigned tags. Tags are useful for creating
|
||||
* groups of Properties that can be used in batch operations.
|
||||
* \param tag The string that is to be assigned to the Property
|
||||
*/
|
||||
void addTag(std::string tag);
|
||||
|
||||
private:
|
||||
/// The name of this PropertyOwner
|
||||
std::string _name;
|
||||
@@ -218,6 +232,8 @@ private:
|
||||
std::vector<PropertyOwner*> _subOwners;
|
||||
/// The associations between group identifiers of Property's and human-readable names
|
||||
std::map<std::string, std::string> _groupNames;
|
||||
/// Collection of string tag(s) assigned to this property
|
||||
std::vector<std::string> _tags;
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/util/powerscaledscalar.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
@@ -72,8 +71,8 @@ public:
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
|
||||
void setBoundingSphere(PowerScaledScalar boundingSphere);
|
||||
PowerScaledScalar getBoundingSphere();
|
||||
void setBoundingSphere(float boundingSphere);
|
||||
float boundingSphere() const;
|
||||
|
||||
virtual void render(const RenderData& data);
|
||||
virtual void render(const RenderData& data, RendererTasks& rendererTask);
|
||||
@@ -99,7 +98,7 @@ protected:
|
||||
|
||||
private:
|
||||
RenderBin _renderBin;
|
||||
PowerScaledScalar boundingSphere_;
|
||||
float _boundingSphere;
|
||||
std::string _startTime;
|
||||
std::string _endTime;
|
||||
bool _hasTimeInterval;
|
||||
|
||||
@@ -25,13 +25,19 @@
|
||||
#ifndef __OPENSPACE_CORE___RENDERENGINE___H__
|
||||
#define __OPENSPACE_CORE___RENDERENGINE___H__
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
#include <openspace/performance/performancemanager.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/triggerproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/triggerproperty.h>
|
||||
|
||||
#include <openspace/rendering/raycastermanager.h>
|
||||
#include <openspace/rendering/deferredcastermanager.h>
|
||||
#include <openspace/rendering/renderer.h>
|
||||
#include <openspace/rendering/screenspacerenderable.h>
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
#include <openspace/util/syncdata.h>
|
||||
|
||||
@@ -48,18 +54,11 @@ class SharedMemory;
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace performance {
|
||||
class PerformanceManager;
|
||||
}
|
||||
|
||||
// Forward declare to minimize dependencies
|
||||
class Camera;
|
||||
class SyncBuffer;
|
||||
|
||||
class Scene;
|
||||
class Renderer;
|
||||
class DeferredcasterManager;
|
||||
class RaycasterManager;
|
||||
class SceneManager;
|
||||
class ScreenLog;
|
||||
class ScreenSpaceRenderable;
|
||||
|
||||
@@ -78,14 +77,15 @@ public:
|
||||
};
|
||||
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
~RenderEngine() = default;
|
||||
|
||||
void initialize();
|
||||
void initializeGL();
|
||||
void deinitialize();
|
||||
|
||||
void setSceneGraph(Scene* sceneGraph);
|
||||
void setScene(Scene* scene);
|
||||
Scene* scene();
|
||||
void updateScene();
|
||||
|
||||
Camera* camera() const;
|
||||
Renderer* renderer() const;
|
||||
@@ -95,12 +95,13 @@ public:
|
||||
|
||||
// sgct wrapped functions
|
||||
|
||||
void updateSceneGraph();
|
||||
|
||||
void updateShaderPrograms();
|
||||
void updateFade();
|
||||
void updateRenderer();
|
||||
void updateScreenSpaceRenderables();
|
||||
void render(const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix);
|
||||
void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
|
||||
const glm::mat4& projectionMatrix);
|
||||
|
||||
void renderScreenLog();
|
||||
void renderShutdownInformation(float timer, float fullTime);
|
||||
@@ -146,6 +147,11 @@ public:
|
||||
*/
|
||||
void postRaycast(ghoul::opengl::ProgramObject& programObject);
|
||||
|
||||
/**
|
||||
* Set the camera to use for rendering
|
||||
*/
|
||||
void setCamera(Camera* camera);
|
||||
|
||||
|
||||
void setRendererFromString(const std::string& method);
|
||||
|
||||
@@ -183,10 +189,10 @@ private:
|
||||
|
||||
void renderInformation();
|
||||
|
||||
Camera* _mainCamera;
|
||||
Scene* _sceneGraph;
|
||||
RaycasterManager* _raycasterManager;
|
||||
DeferredcasterManager* _deferredcasterManager;
|
||||
Camera* _camera;
|
||||
Scene* _scene;
|
||||
std::unique_ptr<RaycasterManager> _raycasterManager;
|
||||
std::unique_ptr<DeferredcasterManager> _deferredcasterManager;
|
||||
|
||||
properties::BoolProperty _performanceMeasurements;
|
||||
std::unique_ptr<performance::PerformanceManager> _performanceManager;
|
||||
@@ -209,6 +215,7 @@ private:
|
||||
properties::BoolProperty _applyWarping;
|
||||
properties::BoolProperty _showFrameNumber;
|
||||
properties::BoolProperty _disableMasterRendering;
|
||||
properties::BoolProperty _disableSceneOnMaster;
|
||||
|
||||
float _globalBlackOutFactor;
|
||||
float _fadeDuration;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct UpdateData;
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
class Rotation : public properties::PropertyOwner {
|
||||
@@ -42,7 +44,7 @@ public:
|
||||
static std::unique_ptr<Rotation> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
Rotation(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Rotation();
|
||||
virtual ~Rotation() = default;
|
||||
virtual bool initialize();
|
||||
const glm::dmat3& matrix() const;
|
||||
virtual void update(const UpdateData& data);
|
||||
|
||||
@@ -27,11 +27,16 @@
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct UpdateData;
|
||||
|
||||
namespace documentation { struct Documentation; };
|
||||
|
||||
class Scale : public properties::PropertyOwner {
|
||||
@@ -39,7 +44,7 @@ public:
|
||||
static std::unique_ptr<Scale> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
Scale();
|
||||
virtual ~Scale();
|
||||
virtual ~Scale() = default;
|
||||
virtual bool initialize();
|
||||
virtual double scaleValue() const = 0;
|
||||
virtual void update(const UpdateData& data);
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#include <openspace/util/camera.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/scene/scenegraph.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
@@ -49,61 +47,99 @@ class SceneGraphNode;
|
||||
// SceneGraphFinishedLoading
|
||||
class Scene {
|
||||
public:
|
||||
|
||||
using UpdateDependencies = ghoul::Boolean;
|
||||
|
||||
struct InvalidSceneError : ghoul::RuntimeError {
|
||||
/**
|
||||
* \param message The reason that caused this exception to be thrown
|
||||
* \param component The optional compoment that caused this exception to be thrown
|
||||
* \pre message may not be empty
|
||||
*/
|
||||
explicit InvalidSceneError(const std::string& message, const std::string& component = "");
|
||||
};
|
||||
|
||||
// constructors & destructor
|
||||
Scene();
|
||||
~Scene();
|
||||
|
||||
/**
|
||||
* Initalizes the SceneGraph by loading modules from the ${SCENEPATH} directory
|
||||
* Initalizes the SceneGraph
|
||||
*/
|
||||
bool initialize();
|
||||
void initialize();
|
||||
|
||||
/*
|
||||
* Clean up everything
|
||||
/**
|
||||
* Clear the scene graph,
|
||||
* i.e. set the root node to nullptr and deallocate all scene graph nodes.
|
||||
*/
|
||||
bool deinitialize();
|
||||
void clear();
|
||||
|
||||
/*
|
||||
* Load the scenegraph from the provided folder
|
||||
/**
|
||||
* Set the root node of the scene
|
||||
*/
|
||||
void scheduleLoadSceneFile(const std::string& sceneDescriptionFilePath);
|
||||
void clearSceneGraph();
|
||||
void setRoot(std::unique_ptr<SceneGraphNode> root);
|
||||
|
||||
void loadModule(const std::string& modulePath);
|
||||
/**
|
||||
* Set the camera of the scene
|
||||
*/
|
||||
void setCamera(std::unique_ptr<Camera> camera);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the camera
|
||||
*/
|
||||
Camera* camera() const;
|
||||
|
||||
/**
|
||||
* Updates all SceneGraphNodes relative positions
|
||||
*/
|
||||
void update(const UpdateData& data);
|
||||
|
||||
/*
|
||||
* Evaluates if the SceneGraphNodes are visible to the provided camera
|
||||
*/
|
||||
void evaluate(Camera* camera);
|
||||
|
||||
/*
|
||||
* Render visible SceneGraphNodes using the provided camera
|
||||
/**
|
||||
* Render visible SceneGraphNodes using the provided camera.
|
||||
*/
|
||||
void render(const RenderData& data, RendererTasks& tasks);
|
||||
|
||||
/*
|
||||
* Returns the root SceneGraphNode
|
||||
/**
|
||||
* Return the root SceneGraphNode.
|
||||
*/
|
||||
SceneGraphNode* root() const;
|
||||
|
||||
/**
|
||||
* Return the scenegraph node with the specified name or <code>nullptr</code> if that
|
||||
* name does not exist
|
||||
* name does not exist.
|
||||
*/
|
||||
SceneGraphNode* sceneGraphNode(const std::string& name) const;
|
||||
|
||||
std::vector<SceneGraphNode*> allSceneGraphNodes() const;
|
||||
/**
|
||||
* Add a node and all its children to the scene.
|
||||
*/
|
||||
void addNode(SceneGraphNode* node, UpdateDependencies updateDeps = UpdateDependencies::Yes);
|
||||
|
||||
SceneGraph& sceneGraph();
|
||||
/**
|
||||
* Remove a node and all its children from the scene.
|
||||
*/
|
||||
void removeNode(SceneGraphNode* node, UpdateDependencies updateDeps = UpdateDependencies::Yes);
|
||||
|
||||
/**
|
||||
* Update dependencies.
|
||||
*/
|
||||
void updateDependencies();
|
||||
|
||||
/**
|
||||
* Return a vector of all scene graph nodes in the scene.
|
||||
*/
|
||||
const std::vector<SceneGraphNode*>& allSceneGraphNodes() const;
|
||||
|
||||
/**
|
||||
* Return a a map from name to scene graph node.
|
||||
*/
|
||||
const std::map<std::string, SceneGraphNode*>& nodesByName() const;
|
||||
|
||||
/**
|
||||
* Output property documentation to a file.
|
||||
*/
|
||||
void writePropertyDocumentation(const std::string& filename, const std::string& type, const std::string& sceneFilename);
|
||||
|
||||
void addSceneGraphNode(SceneGraphNode* node){
|
||||
_graph.addSceneGraphNode(node);
|
||||
}
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to change the
|
||||
* scene graph. The functions contained are
|
||||
@@ -116,39 +152,18 @@ public:
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
bool loadSceneInternal(const std::string& sceneDescriptionFilePath);
|
||||
private:
|
||||
void sortTopologically();
|
||||
|
||||
void writePropertyDocumentation(const std::string& filename, const std::string& type, const std::string& sceneFilename);
|
||||
|
||||
std::string _focus;
|
||||
|
||||
// actual scenegraph
|
||||
SceneGraph _graph;
|
||||
//SceneGraphNode* _root;
|
||||
//std::vector<SceneGraphNode*> _nodes;
|
||||
//std::map<std::string, SceneGraphNode*> _allNodes;
|
||||
|
||||
std::string _sceneGraphToLoad;
|
||||
std::unique_ptr<SceneGraphNode> _root;
|
||||
std::unique_ptr<Camera> _camera;
|
||||
std::vector<SceneGraphNode*> _topologicallySortedNodes;
|
||||
std::vector<SceneGraphNode*> _circularNodes;
|
||||
std::map<std::string, SceneGraphNode*> _nodesByName;
|
||||
|
||||
std::mutex _programUpdateLock;
|
||||
std::set<ghoul::opengl::ProgramObject*> _programsToUpdate;
|
||||
std::vector<std::unique_ptr<ghoul::opengl::ProgramObject>> _programs;
|
||||
|
||||
typedef std::map<std::string, ghoul::Dictionary> NodeMap;
|
||||
typedef std::multimap<std::string, std::string> DependencyMap;
|
||||
typedef std::vector<std::string> LoadedList;
|
||||
|
||||
struct LoadMaps {
|
||||
NodeMap nodes;
|
||||
DependencyMap dependencies;
|
||||
LoadedList loadedNodes;
|
||||
};
|
||||
|
||||
void loadModules(const std::string& directory, const ghoul::Dictionary& dictionary);
|
||||
void loadModule(LoadMaps& m,const std::string& modulePath, lua_State* state);
|
||||
void loadNodes(const std::string& parentName, LoadMaps& m);
|
||||
void loadNode(const ghoul::Dictionary& dictionary);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
class SceneGraphNode : public properties::PropertyOwner {
|
||||
public:
|
||||
using UpdateScene = ghoul::Boolean;
|
||||
|
||||
struct PerformanceRecord {
|
||||
long long renderTime; // time in ns
|
||||
long long updateTimeRenderable; // time in ns
|
||||
@@ -59,25 +61,36 @@ public:
|
||||
static const std::string KeyName;
|
||||
static const std::string KeyParentName;
|
||||
static const std::string KeyDependencies;
|
||||
static const std::string KeyTag;
|
||||
|
||||
SceneGraphNode();
|
||||
~SceneGraphNode();
|
||||
|
||||
static SceneGraphNode* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static std::unique_ptr<SceneGraphNode> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
void traversePreOrder(std::function<void(SceneGraphNode*)> fn);
|
||||
void traversePostOrder(std::function<void(SceneGraphNode*)> fn);
|
||||
void update(const UpdateData& data);
|
||||
void evaluate(const Camera* camera, const psc& parentPosition = psc());
|
||||
void render(const RenderData& data, RendererTasks& tasks);
|
||||
void updateCamera(Camera* camera) const;
|
||||
|
||||
//void addNode(SceneGraphNode* child);
|
||||
void attachChild(std::unique_ptr<SceneGraphNode> child, UpdateScene updateScene = UpdateScene::Yes);
|
||||
std::unique_ptr<SceneGraphNode> detachChild(SceneGraphNode& child, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void setParent(SceneGraphNode& parent, UpdateScene updateScene = UpdateScene::Yes);
|
||||
|
||||
void addChild(SceneGraphNode* child);
|
||||
void setParent(SceneGraphNode* parent);
|
||||
//bool abandonChild(SceneGraphNode* child);
|
||||
void addDependency(SceneGraphNode& dependency, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void removeDependency(SceneGraphNode& dependency, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void clearDependencies(UpdateScene updateScene = UpdateScene::Yes);
|
||||
void setDependencies(const std::vector<SceneGraphNode*>& dependencies, UpdateScene updateScene = UpdateScene::Yes);
|
||||
|
||||
const std::vector<SceneGraphNode*>& dependencies() const;
|
||||
const std::vector<SceneGraphNode*>& dependentNodes() const;
|
||||
|
||||
Scene* scene();
|
||||
void setScene(Scene* scene);
|
||||
|
||||
glm::dvec3 position() const;
|
||||
const glm::dmat3& rotationMatrix() const;
|
||||
@@ -85,13 +98,14 @@ public:
|
||||
|
||||
glm::dvec3 worldPosition() const;
|
||||
const glm::dmat3& worldRotationMatrix() const;
|
||||
glm::dmat4 modelTransform() const;
|
||||
glm::dmat4 inverseModelTransform() const;
|
||||
double worldScale() const;
|
||||
|
||||
SceneGraphNode* parent() const;
|
||||
const std::vector<SceneGraphNode*>& children() const;
|
||||
std::vector<SceneGraphNode*> children() const;
|
||||
|
||||
PowerScaledScalar calculateBoundingSphere();
|
||||
PowerScaledScalar boundingSphere() const;
|
||||
float boundingSphere() const;
|
||||
|
||||
SceneGraphNode* childNode(const std::string& name);
|
||||
|
||||
@@ -104,22 +118,19 @@ public:
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
bool sphereInsideFrustum(const psc& s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
|
||||
|
||||
glm::dvec3 calculateWorldPosition() const;
|
||||
glm::dmat3 calculateWorldRotation() const;
|
||||
double calculateWorldScale() const;
|
||||
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
std::vector<std::unique_ptr<SceneGraphNode>> _children;
|
||||
SceneGraphNode* _parent;
|
||||
std::vector<SceneGraphNode*> _dependencies;
|
||||
std::vector<SceneGraphNode*> _dependentNodes;
|
||||
Scene* _scene;
|
||||
|
||||
PerformanceRecord _performanceRecord;
|
||||
|
||||
std::unique_ptr<Renderable> _renderable;
|
||||
bool _renderableVisible;
|
||||
|
||||
bool _boundingSphereVisible;
|
||||
PowerScaledScalar _boundingSphere;
|
||||
|
||||
// Transformation defined by ephemeris, rotation and scale
|
||||
struct {
|
||||
@@ -132,6 +143,9 @@ private:
|
||||
glm::dvec3 _worldPositionCached;
|
||||
glm::dmat3 _worldRotationCached;
|
||||
double _worldScaleCached;
|
||||
|
||||
glm::dmat4 _modelTransformCached;
|
||||
glm::dmat4 _inverseModelTransformCached;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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___SCENELOADER___H__
|
||||
#define __OPENSPACE_CORE___SCENELOADER___H__
|
||||
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/camera.h>
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Scene;
|
||||
|
||||
class SceneLoader {
|
||||
public:
|
||||
SceneLoader() = default;
|
||||
~SceneLoader() = default;
|
||||
|
||||
/**
|
||||
* Load a scene file.
|
||||
*/
|
||||
std::unique_ptr<Scene> loadScene(const std::string& path);
|
||||
|
||||
/**
|
||||
* Import a directory of scene contents into an existing scene.
|
||||
*/
|
||||
std::vector<SceneGraphNode*> importDirectory(Scene& scene, const std::string& directory);
|
||||
|
||||
/**
|
||||
* Import a scene graph node from a dictionary into an existing scene.
|
||||
*/
|
||||
SceneGraphNode* importNodeDictionary(Scene& scene, const ghoul::Dictionary& dictionary);
|
||||
|
||||
private:
|
||||
struct LoadedNode {
|
||||
LoadedNode(
|
||||
const std::string& nodeName,
|
||||
const std::string& parentName,
|
||||
const std::vector<std::string>& deps,
|
||||
std::unique_ptr<SceneGraphNode> n
|
||||
)
|
||||
: name(nodeName)
|
||||
, parent(parentName)
|
||||
, dependencies(deps)
|
||||
, node(std::move(n)) {}
|
||||
|
||||
std::string name;
|
||||
std::string parent;
|
||||
std::vector<std::string> dependencies;
|
||||
std::unique_ptr<SceneGraphNode> node;
|
||||
};
|
||||
|
||||
struct LoadedCamera {
|
||||
LoadedCamera(
|
||||
const std::string& parentName,
|
||||
std::unique_ptr<Camera> c
|
||||
)
|
||||
: parent(parentName)
|
||||
, camera(std::move(c)) {}
|
||||
std::string parent;
|
||||
std::unique_ptr<Camera> camera;
|
||||
};
|
||||
|
||||
/**
|
||||
* Load a scene graph node from a dictionary
|
||||
*/
|
||||
SceneLoader::LoadedNode loadNode(const ghoul::Dictionary& dictionary);
|
||||
|
||||
/**
|
||||
* Load a mod file.
|
||||
*/
|
||||
std::vector<SceneLoader::LoadedNode> loadModule(const std::string& path, lua_State* luaState);
|
||||
|
||||
/**
|
||||
* Load a directory.
|
||||
*/
|
||||
std::vector<SceneLoader::LoadedNode> loadDirectory(const std::string& path, lua_State* luaState);
|
||||
|
||||
/**
|
||||
* Load a camera from a dictionary
|
||||
*/
|
||||
SceneLoader::LoadedCamera loadCamera(const ghoul::Dictionary& dictionary);
|
||||
|
||||
/**
|
||||
* Add loaded nodes to an existing scene
|
||||
*/
|
||||
std::vector<SceneGraphNode*> addLoadedNodes(Scene& scene, std::vector<SceneLoader::LoadedNode>&& nodes);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___SCENELOADER___H__
|
||||
@@ -0,0 +1,48 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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___SCENEMANAGER___H__
|
||||
#define __OPENSPACE_CORE___SCENEMANAGER___H__
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Scene;
|
||||
|
||||
class SceneManager {
|
||||
public:
|
||||
SceneManager() = default;
|
||||
~SceneManager() = default;
|
||||
Scene* loadScene(const std::string& path);
|
||||
void unloadScene(Scene& scene);
|
||||
void unloadAll();
|
||||
private:
|
||||
std::vector<std::unique_ptr<Scene>> _scenes;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // __OPENSPACE_CORE___SCENEMANAGER___H__
|
||||
@@ -27,14 +27,17 @@
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct UpdateData;
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
class Translation : public properties::PropertyOwner {
|
||||
@@ -42,7 +45,7 @@ public:
|
||||
static std::unique_ptr<Translation> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
Translation();
|
||||
virtual ~Translation();
|
||||
virtual ~Translation() = default;
|
||||
virtual bool initialize();
|
||||
|
||||
virtual glm::dvec3 position() const = 0;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
namespace openspace {
|
||||
class SyncBuffer;
|
||||
class SceneGraphNode;
|
||||
|
||||
/**
|
||||
* This class still needs some more love. Suggested improvements:
|
||||
@@ -92,6 +93,7 @@ public:
|
||||
void setRotation(Quat rotation);
|
||||
void setScaling(glm::vec2 scaling);
|
||||
void setMaxFov(float fov);
|
||||
void setParent(SceneGraphNode* parent);
|
||||
|
||||
// Relative mutators
|
||||
void rotate(Quat rotation);
|
||||
@@ -109,6 +111,7 @@ public:
|
||||
const Quat& rotationQuaternion() const;
|
||||
float maxFov() const;
|
||||
float sinMaxFov() const;
|
||||
SceneGraphNode* parent() const;
|
||||
|
||||
// @TODO this should simply be called viewMatrix!
|
||||
// Or it needs to be changed so that it actually is combined. Right now it is
|
||||
@@ -181,6 +184,7 @@ private:
|
||||
SyncData<Vec3> _position;
|
||||
SyncData<Quat> _rotation;
|
||||
SyncData<glm::vec2> _scaling;
|
||||
SceneGraphNode* _parent;
|
||||
|
||||
|
||||
// _focusPosition to be removed
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
namespace openspace {
|
||||
|
||||
namespace distanceconstants {
|
||||
const float EarthRadius = 6371;
|
||||
const float LightYear = 9.4607304725808E15;
|
||||
const float AstronomicalUnit = 1.495978707E11;
|
||||
const float Parsec = 3.0856776E16;
|
||||
const float EarthRadius = 6371;
|
||||
const float LightYear = 9.4607304725808E15;
|
||||
const float AstronomicalUnit = 1.495978707E11;
|
||||
const float Parsec = 3.0856776E16;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Histogram {
|
||||
public:
|
||||
Histogram();
|
||||
Histogram(float minValue, float maxValue, int numBins);
|
||||
Histogram(float minValue, float maxValue, int numBins, float *data);
|
||||
Histogram(float minValue, float maxValue, int numBins, float* data);
|
||||
Histogram(Histogram&& other);
|
||||
~Histogram();
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public:
|
||||
// initializers
|
||||
PowerScaledSphere(const PowerScaledScalar& radius,
|
||||
int segments = 8);
|
||||
PowerScaledSphere(properties::Vec4Property &radius,
|
||||
int segments, std::string planetName);
|
||||
|
||||
PowerScaledSphere(glm::vec3 radius, int segments);
|
||||
|
||||
~PowerScaledSphere();
|
||||
PowerScaledSphere(const PowerScaledSphere& cpy);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef __OPENSPACE_CORE___TIMEMANAGER___H__
|
||||
#define __OPENSPACE_CORE___TIMEMANAGER___H__
|
||||
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <openspace/network/messagestructures.h>
|
||||
|
||||
@@ -35,7 +36,9 @@ public:
|
||||
void preSynchronization(double dt);
|
||||
void addKeyframe(const datamessagestructures::TimeKeyframe& kf);
|
||||
void removeKeyframesBefore(double timestamp);
|
||||
void removeKeyframesAfter(double timestamp);
|
||||
void clearKeyframes();
|
||||
const std::deque<datamessagestructures::TimeKeyframe>& keyframes() const;
|
||||
private:
|
||||
void consumeKeyframes(double dt);
|
||||
std::deque<datamessagestructures::TimeKeyframe> _keyframes;
|
||||
|
||||
Reference in New Issue
Block a user