mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-14 15:40:19 -06:00
Merge branch 'develop' into solarsystem2
Conflicts: .gitignore src/rendering/renderablefov.cpp src/rendering/renderablepath.cpp src/scenegraph/scenegraph.cpp src/util/factorymanager.cpp
This commit is contained in:
@@ -40,7 +40,7 @@ public:
|
||||
virtual void preRender();
|
||||
virtual void postRender();
|
||||
|
||||
virtual std::string settings();
|
||||
std::vector<fragmentData> pixelData();
|
||||
protected:
|
||||
virtual bool reinitializeInternal();
|
||||
|
||||
|
||||
87
include/openspace/engine/gui.h
Normal file
87
include/openspace/engine/gui.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 __GUI_H__
|
||||
#define __GUI_H__
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace properties {
|
||||
class Property;
|
||||
}
|
||||
|
||||
class GUI {
|
||||
public:
|
||||
GUI();
|
||||
~GUI();
|
||||
|
||||
bool isEnabled() const;
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
void initialize();
|
||||
|
||||
void initializeGL();
|
||||
void deinitializeGL();
|
||||
|
||||
void registerProperty(properties::Property* prop);
|
||||
|
||||
bool mouseButtonCallback(int key, int action);
|
||||
bool mouseWheelCallback(int position);
|
||||
bool keyCallback(int key, int action);
|
||||
bool charCallback(unsigned int character);
|
||||
|
||||
void startFrame(float deltaTime, const glm::vec2& windowSize, const glm::vec2& mousePos, bool mouseButtonsPressed[2]);
|
||||
void endFrame();
|
||||
|
||||
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
private:
|
||||
void renderPropertyWindow();
|
||||
|
||||
bool _isEnabled;
|
||||
|
||||
std::set<properties::Property*> _boolProperties;
|
||||
std::set<properties::Property*> _intProperties;
|
||||
std::set<properties::Property*> _floatProperties;
|
||||
std::set<properties::Property*> _vec2Properties;
|
||||
std::set<properties::Property*> _vec3Properties;
|
||||
std::set<properties::Property*> _stringProperties;
|
||||
std::set<properties::Property*> _optionProperty;
|
||||
|
||||
std::map<std::string, std::vector<properties::Property*>> _propertiesByOwner;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __GUI_H__
|
||||
45
include/openspace/engine/logfactory.h
Normal file
45
include/openspace/engine/logfactory.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 __LOGFACTORY_H__
|
||||
#define __LOGFACTORY_H__
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace logging {
|
||||
class Log;
|
||||
} // logging
|
||||
} // ghoul
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class LogFactory {
|
||||
public:
|
||||
static ghoul::logging::Log* createLog(const ghoul::Dictionary& dictionary);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __LOGFACTORY_H__
|
||||
@@ -29,12 +29,12 @@
|
||||
#include <openspace/interaction/luaconsole.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
|
||||
#include <openspace/engine/gui.h>
|
||||
#include <ghoul/cmdparser/commandlineparser.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
// Forward declare to minimize dependencies
|
||||
class GUI;
|
||||
class SyncBuffer;
|
||||
class LuaConsole;
|
||||
|
||||
@@ -59,6 +59,8 @@ public:
|
||||
scripting::ScriptEngine& scriptEngine();
|
||||
LuaConsole& console();
|
||||
|
||||
GUI& gui();
|
||||
|
||||
// SGCT callbacks
|
||||
bool initializeGL();
|
||||
void preSynchronization();
|
||||
@@ -78,13 +80,14 @@ public:
|
||||
|
||||
private:
|
||||
OpenSpaceEngine(std::string programName);
|
||||
~OpenSpaceEngine();
|
||||
~OpenSpaceEngine() = default;
|
||||
|
||||
void clearAllWindows();
|
||||
bool gatherCommandlineArguments();
|
||||
bool loadSpiceKernels();
|
||||
void runStartupScripts();
|
||||
void loadFonts();
|
||||
void configureLogging();
|
||||
|
||||
static OpenSpaceEngine* _engine;
|
||||
|
||||
@@ -94,6 +97,7 @@ private:
|
||||
scripting::ScriptEngine _scriptEngine;
|
||||
ghoul::cmdparser::CommandlineParser _commandlineParser;
|
||||
LuaConsole _console;
|
||||
GUI _gui;
|
||||
|
||||
SyncBuffer* _syncBuffer;
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ public:
|
||||
LuaConsole();
|
||||
~LuaConsole();
|
||||
|
||||
void loadHistory();
|
||||
|
||||
void keyboardCallback(int key, int action);
|
||||
void charCallback(unsigned int codepoint);
|
||||
|
||||
@@ -67,6 +69,8 @@ private:
|
||||
size_t _activeCommand;
|
||||
std::vector<std::string> _commands;
|
||||
|
||||
std::string _filename;
|
||||
|
||||
bool _isVisible;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ public:
|
||||
bool setLua(lua_State* state) override;
|
||||
int typeLua() const override;
|
||||
|
||||
T minValue() const;
|
||||
T maxValue() const;
|
||||
|
||||
virtual std::string className() const override;
|
||||
|
||||
using TemplateProperty<T>::operator=;
|
||||
|
||||
@@ -200,5 +200,15 @@ int NumericalProperty<T>::typeLua() const {
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::minValue() const {
|
||||
return _minimumValue;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::maxValue() const {
|
||||
return _maximumValue;
|
||||
}
|
||||
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
97
include/openspace/properties/optionproperty.h
Normal file
97
include/openspace/properties/optionproperty.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 __OPTIONPROPERTY_H__
|
||||
#define __OPTIONPROPERTY_H__
|
||||
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
namespace properties {
|
||||
|
||||
/**
|
||||
* The OptionProperty is a property that provides a number of predefined (using the
|
||||
* addOption method) options consisting of a <code>description</code> and a
|
||||
* <code>value</code>. The available options can be queried using the options method.
|
||||
* Only values representing valid options can be used to set this property, or an error
|
||||
* will be logged
|
||||
*/
|
||||
class OptionProperty : public IntProperty {
|
||||
public:
|
||||
/**
|
||||
* The struct storing a single option consisting of an integer <code>value</code> and
|
||||
* a <code>string</code> description.
|
||||
*/
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
/**
|
||||
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
|
||||
* to its super class.
|
||||
* \param identifier A unique identifier for this property
|
||||
* \param guiName The GUI name that should be used to represent this property
|
||||
*/
|
||||
OptionProperty(std::string identifier, std::string guiName);
|
||||
|
||||
/**
|
||||
* Returns the name of the class for reflection purposes.
|
||||
* \return The name of this class for reflection purposes
|
||||
*/
|
||||
std::string className() const override;
|
||||
using IntProperty::operator=;
|
||||
|
||||
/**
|
||||
* Adds the passed option to the list of available options. The <code>value</code> of
|
||||
* the <code>option</code> must not have been registered previously, or a warning will
|
||||
* be logged.
|
||||
* \param option The option that will be added to the list of available options
|
||||
*/
|
||||
void addOption(int value, std::string desc);
|
||||
|
||||
/**
|
||||
* Returns the list of available options.
|
||||
* /return The list of available options
|
||||
*/
|
||||
const std::vector<Option>& options() const;
|
||||
|
||||
/**
|
||||
* The overritten TemplateProperty::setValue method that checks if the provided value
|
||||
* represents a valid Option
|
||||
* \param value The value of the Option that should be set
|
||||
*/
|
||||
void setValue(int value) override;
|
||||
|
||||
private:
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __STRINGPROPERTY_H__
|
||||
@@ -167,6 +167,15 @@ public:
|
||||
* \return The unique identifier of this Property
|
||||
*/
|
||||
const std::string& identifier() const;
|
||||
|
||||
/**
|
||||
* Returns the fully qualified name for this Property that uniquely identifies this
|
||||
* Property within OpenSpace. It consists of the <code>identifier</code> preceded by
|
||||
* all levels of PropertyOwner%s separated with <code>.</code>; for example:
|
||||
* <code>owner1.owner2.identifier</code>.
|
||||
* \return The fully qualified identifier for this Property
|
||||
*/
|
||||
std::string fullyQualifiedIdentifier() const;
|
||||
|
||||
/**
|
||||
* Returns the PropertyOwner of this Property or <code>nullptr</code>, if it does not
|
||||
@@ -189,7 +198,7 @@ public:
|
||||
* key.
|
||||
* \return The human-readable GUI name for this Property
|
||||
*/
|
||||
const std::string& guiName() const;
|
||||
std::string guiName() const;
|
||||
|
||||
/**
|
||||
* Sets the identifier of the group that this Property belongs to. Property groups can
|
||||
|
||||
@@ -84,6 +84,12 @@ public:
|
||||
*/
|
||||
const std::vector<Property*>& properties() const;
|
||||
|
||||
/**
|
||||
* Returns a list of all Propertys directly or indirectly owned by this PropertyOwner.
|
||||
* \return A list of all Propertys directly or indirectly owned by this PropertyOwner
|
||||
*/
|
||||
std::vector<Property*> propertiesRecursive() const;
|
||||
|
||||
/**
|
||||
* Retrieves a Property identified by <code>URI</code> from this PropertyOwner. If
|
||||
* <code>id</code> does not contain a <code>.</code> the identifier must refer to a
|
||||
@@ -108,6 +114,9 @@ public:
|
||||
*/
|
||||
bool hasProperty(const std::string& URI) const;
|
||||
|
||||
void setPropertyOwner(PropertyOwner* owner) { _owner = owner; }
|
||||
PropertyOwner* owner() const { return _owner; }
|
||||
|
||||
/**
|
||||
* Returns a list of all sub-owners this PropertyOwner has. Each name of a sub-owner
|
||||
* has to be unique with respect to other sub-owners as well as Property's owned by
|
||||
@@ -201,6 +210,8 @@ protected:
|
||||
private:
|
||||
/// The name of this PropertyOwner
|
||||
std::string _name;
|
||||
/// The owner of this PropertyOwner
|
||||
PropertyOwner* _owner;
|
||||
/// A list of all registered Property's
|
||||
std::vector<Property*> _properties;
|
||||
/// A list of all sub-owners
|
||||
|
||||
74
include/openspace/properties/selectionproperty.h
Normal file
74
include/openspace/properties/selectionproperty.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 __SELECTIONPROPERTY_H__
|
||||
#define __SELECTIONPROPERTY_H__
|
||||
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
namespace properties {
|
||||
|
||||
//REGISTER_TEMPLATEPROPERTY_HEADER(SelectionProperty, std::vector<int>);
|
||||
|
||||
class SelectionProperty : public TemplateProperty<std::vector<int>> {
|
||||
public:
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
SelectionProperty(std::string identifier, std::string guiName);
|
||||
|
||||
void addOption(Option option);
|
||||
const std::vector<Option>& options() const;
|
||||
|
||||
void setValue(std::vector<int> value) override;
|
||||
|
||||
private:
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
std::vector<int> _values;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(lua_State* state, std::vector<int> value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
|
||||
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __SELECTIONPROPERTY_H__
|
||||
@@ -52,6 +52,8 @@ namespace properties {
|
||||
template <typename T>
|
||||
class TemplateProperty : public Property {
|
||||
public:
|
||||
typedef T ValueType;
|
||||
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code> and human-readable <code>guiName</code>. The default value
|
||||
@@ -158,7 +160,7 @@ public:
|
||||
* <code>T</code>. If the value are different, the listeners are notified.
|
||||
* \param val The new value for this TemplateProperty
|
||||
*/
|
||||
void setValue(T val);
|
||||
virtual void setValue(T val);
|
||||
|
||||
/**
|
||||
* Returns the currently stored value.
|
||||
|
||||
@@ -32,11 +32,13 @@ namespace openspace {
|
||||
namespace properties {
|
||||
class Property;
|
||||
}
|
||||
class Renderable;
|
||||
class SceneGraph;
|
||||
class SceneGraphNode;
|
||||
|
||||
SceneGraph* sceneGraph();
|
||||
SceneGraphNode* sceneGraphNode(const std::string& name);
|
||||
Renderable* renderable(const std::string& name);
|
||||
properties::Property* property(const std::string& uri);
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
bool isReady() const override;
|
||||
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
|
||||
virtual bool isReady() const = 0;
|
||||
|
||||
void setBoundingSphere(const PowerScaledScalar& boundingSphere);
|
||||
const PowerScaledScalar& getBoundingSphere();
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
@@ -27,11 +27,9 @@
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
// ghoul includes
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/filesystem/file.h>
|
||||
|
||||
namespace openspace {
|
||||
struct LinePoint;
|
||||
@@ -44,8 +42,9 @@ public:
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
std::vector<std::vector<LinePoint> > getFieldlinesData(std::string filename, ghoul::Dictionary hintsDictionary);
|
||||
@@ -54,18 +53,11 @@ private:
|
||||
std::vector<std::string> _filenames;
|
||||
std::vector<glm::vec3> _seedPoints;
|
||||
|
||||
ghoul::opengl::ProgramObject *_fieldlinesProgram;
|
||||
GLuint _VAO, _seedpointVAO;
|
||||
|
||||
ghoul::filesystem::File* _vertexSourceFile;
|
||||
ghoul::filesystem::File* _fragmentSourceFile;
|
||||
ghoul::opengl::ProgramObject* _shader;
|
||||
GLuint _fieldlineVAO;
|
||||
|
||||
std::vector<GLint> _lineStart;
|
||||
std::vector<GLsizei> _lineCount;
|
||||
|
||||
bool _programUpdateOnSave;
|
||||
bool _update;
|
||||
void safeShaderCompilation();
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
private:
|
||||
@@ -170,4 +172,4 @@ float z = (l[0]*psc0[2] + l[1]*psc1[2]);
|
||||
psc interpolated = PowerScaledCoordinate::PowerScaledCoordinate(x, y, z, 10);
|
||||
return interpolated;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace openspace {
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
private:
|
||||
|
||||
@@ -47,8 +47,10 @@ public:
|
||||
RenderablePlane(const ghoul::Dictionary& dictionary);
|
||||
~RenderablePlane();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
@@ -57,6 +59,7 @@ private:
|
||||
void loadTexture();
|
||||
|
||||
properties::StringProperty _texturePath;
|
||||
properties::BoolProperty _billboard;
|
||||
|
||||
glm::vec2 _size;
|
||||
Origin _origin;
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
private:
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
private:
|
||||
|
||||
@@ -46,8 +46,10 @@ public:
|
||||
RenderableVolumeGL(const ghoul::Dictionary& dictionary);
|
||||
~RenderableVolumeGL();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
virtual void render(const RenderData& data) override;
|
||||
virtual void update(const UpdateData& data) override;
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 __RENDERABLECONSTELLATIONBOUNDS_H__
|
||||
#define __RENDERABLECONSTELLATIONBOUNDS_H__
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <array>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
/**
|
||||
* This class renders the constellation bounds as defined in
|
||||
* http://cdsarc.u-strasbg.fr/viz-bin/Cat?cat=VI%2F49. It contains the bounds on the
|
||||
* celestial sky for the different constellations and is used to determine in which region
|
||||
* of the sky a specific object is located.
|
||||
* The bounds are drawn as lines on a sphere with variable radius, set by the
|
||||
* <code>_distance</code> property. Currently, all constellation bounds are lines, which
|
||||
* leads to artifacts if the radius is very small.
|
||||
* Renderable configuration attributes:
|
||||
* <code>File</code> [string] (required): The file that contains the bounds and the
|
||||
* abbreviations for the different constellations
|
||||
* <code>ConstellationFile</code> [string]: The file that contains the mapping between
|
||||
* abbreviations and full names. If the file is omitted, the abbreviations are used as the
|
||||
* full names.
|
||||
* <code>ReferenceFrame</code> [string]: The reference frame in which the points contained
|
||||
* in the <code>File</code> are stored in. Defaults to <code>J2000</code>
|
||||
*/
|
||||
class RenderableConstellationBounds : public Renderable {
|
||||
public:
|
||||
RenderableConstellationBounds(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
/// Stores the constellation bounds
|
||||
struct ConstellationBound {
|
||||
std::string constellationAbbreviation; ///< The abbreviation of the constellation
|
||||
std::string constellationFullName;
|
||||
bool isEnabled;
|
||||
size_t startIndex; ///< The index of the first vertex describing the bounds
|
||||
size_t nVertices; ///< The number of vertices describing the bounds
|
||||
};
|
||||
|
||||
/**
|
||||
* Loads the file specified in <code>_vertexFilename</code> and fills the
|
||||
* <code>_constellationBounds</code> variable, as well as the
|
||||
* <code>_vertexValues</code> list. If this method fails, the content of either
|
||||
* destination is undefined.
|
||||
* \return <code>true</code> if the loading succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
bool loadVertexFile();
|
||||
|
||||
/**
|
||||
* Loads the file specified in <code>_constellationFilename</code> that contains the
|
||||
* mapping between abbreviations and full names of constellations.
|
||||
* \return <code>true</code> if the loading succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
bool loadConstellationFile();
|
||||
|
||||
/// Fills the <code>_constellationSelection</code> property with all constellations
|
||||
void fillSelectionProperty();
|
||||
|
||||
/**
|
||||
* Callback method that gets triggered when <code>_constellationSelection</code>
|
||||
* changes.
|
||||
*/
|
||||
void selectionPropertyHasChanged();
|
||||
|
||||
std::string _vertexFilename; ///< The filename containing the constellation bounds
|
||||
std::string _constellationFilename; ///< The file containing constellation names
|
||||
|
||||
ghoul::opengl::ProgramObject* _program;
|
||||
bool _programIsDirty;
|
||||
|
||||
/// The list of all loaded constellation bounds
|
||||
std::vector<ConstellationBound> _constellationBounds;
|
||||
|
||||
typedef std::array<float, 3> Vertex;
|
||||
std::vector<Vertex> _vertexValues; ///< A list of all vertices of all bounds
|
||||
|
||||
/// The radius of the celestial sphere onto which the bounds are drawn
|
||||
properties::FloatProperty _distance;
|
||||
|
||||
/// The property that stores all indices of constellations that should be drawn
|
||||
properties::SelectionProperty _constellationSelection;
|
||||
|
||||
std::string _originReferenceFrame; ///< Reference frame in which bounds are defined
|
||||
|
||||
/// Used to translate between the origin reference frame and the target frame
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLECONSTELLATIONBOUNDS_H__
|
||||
@@ -25,11 +25,10 @@
|
||||
#ifndef __RENDERABLESTARS_H__
|
||||
#define __RENDERABLESTARS_H__
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
|
||||
// ghoul includes
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
@@ -38,71 +37,54 @@ namespace openspace {
|
||||
class RenderableStars : public Renderable {
|
||||
public:
|
||||
RenderableStars(const ghoul::Dictionary& dictionary);
|
||||
~RenderableStars();
|
||||
|
||||
bool initialize() override;
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
//class DataSource {
|
||||
//public:
|
||||
// const std::vector<float>& data() const;
|
||||
enum ColorOption {
|
||||
Color = 0,
|
||||
Velocity = 1,
|
||||
Speed = 2
|
||||
};
|
||||
|
||||
// virtual bool loadData() = 0;
|
||||
|
||||
//protected:
|
||||
// std::vector<float> _data;
|
||||
//};
|
||||
|
||||
//class SpeckDataSource : public DataSource {
|
||||
//public:
|
||||
// SpeckDataSource(const ghoul::Dictionary& dictionary);
|
||||
|
||||
// bool loadData() override;
|
||||
|
||||
//private:
|
||||
// bool readSpeckFile();
|
||||
// bool loadCachedFile(const std::string& file);
|
||||
// bool saveCachedFile(const std::string& file) const;
|
||||
|
||||
// std::string _file;
|
||||
//};
|
||||
|
||||
|
||||
void loadTexture();
|
||||
|
||||
const std::vector<float>& data() const;
|
||||
void createDataSlice(ColorOption option);
|
||||
|
||||
bool loadData();
|
||||
bool readSpeckFile();
|
||||
bool loadCachedFile(const std::string& file);
|
||||
bool saveCachedFile(const std::string& file) const;
|
||||
|
||||
void generateBufferObjects(const void* data);
|
||||
properties::StringProperty _pointSpreadFunctionTexturePath;
|
||||
ghoul::opengl::Texture* _pointSpreadFunctionTexture;
|
||||
bool _pointSpreadFunctionTextureIsDirty;
|
||||
|
||||
properties::StringProperty _colorTexturePath;
|
||||
ghoul::opengl::Texture* _colorTexture;
|
||||
bool _colorTextureIsDirty;
|
||||
|
||||
ghoul::opengl::ProgramObject* _haloProgram;
|
||||
ghoul::opengl::ProgramObject* _pointProgram;
|
||||
|
||||
ghoul::opengl::Texture* _texture;
|
||||
properties::OptionProperty _colorOption;
|
||||
bool _dataIsDirty;
|
||||
|
||||
std::string _speckPath;
|
||||
properties::FloatProperty _spriteSize;
|
||||
|
||||
std::vector<float> _data;
|
||||
ghoul::opengl::ProgramObject* _program;
|
||||
bool _programIsDirty;
|
||||
|
||||
//GLint vertsToDraw;
|
||||
std::string _speckFile;
|
||||
|
||||
GLuint _vboID;
|
||||
GLuint _vaoID;
|
||||
GLint positionAttrib;
|
||||
GLint brightnessDataAttrib;
|
||||
int v_size;
|
||||
int v_stride;
|
||||
int v_total;
|
||||
std::vector<float> _slicedData;
|
||||
std::vector<float> _fullData;
|
||||
int _nValuesPerStar;
|
||||
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
private:
|
||||
bool loadSceneInternal(const std::string& sceneDescriptionFilePath);
|
||||
|
||||
std::string _focus, _position;
|
||||
std::string _focus;
|
||||
|
||||
// actual scenegraph
|
||||
SceneGraphNode* _root;
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
struct Function {
|
||||
std::string name;
|
||||
lua_CFunction function;
|
||||
std::string argumentText;
|
||||
std::string helpText;
|
||||
};
|
||||
std::string name;
|
||||
@@ -57,12 +58,13 @@ public:
|
||||
|
||||
void initializeLuaState(lua_State* state);
|
||||
|
||||
void addLibrary(const LuaLibrary& library);
|
||||
void addLibrary(LuaLibrary library);
|
||||
bool hasLibrary(const std::string& name);
|
||||
|
||||
bool runScript(const std::string& script);
|
||||
bool runScriptFile(const std::string& filename);
|
||||
|
||||
bool writeDocumentation(const std::string& filename, const std::string& type) const;
|
||||
|
||||
private:
|
||||
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
|
||||
|
||||
@@ -42,10 +42,16 @@ namespace configurationmanager {
|
||||
const std::string keyCachePath = keyPaths + "." + keyCache;
|
||||
const std::string keyFonts = "Fonts";
|
||||
const std::string keyConfigSgct = "SGCTConfig";
|
||||
const std::string keyLuaDocumentationType = "LuaDocumentationFile.Type";
|
||||
const std::string keyLuaDocumentationFile = "LuaDocumentationFile.File";
|
||||
const std::string keyConfigScene = "Scene";
|
||||
const std::string keyEnableGui = "EnableGUI";
|
||||
const std::string keyStartupScript = "StartupScripts";
|
||||
const std::string keySpiceTimeKernel = "SpiceKernel.Time";
|
||||
const std::string keySpiceLeapsecondKernel = "SpiceKernel.LeapSecond";
|
||||
const std::string keyLogLevel = "Logging.LogLevel";
|
||||
const std::string keyLogImmediateFlush = "Logging.ImmediateFlush";
|
||||
const std::string keyLogs = "Logging.Logs";
|
||||
} // namespace configurationmanager
|
||||
|
||||
namespace scenegraph {
|
||||
@@ -90,6 +96,7 @@ namespace modelgeometry {
|
||||
namespace renderablestars {
|
||||
const std::string keyFile = "File";
|
||||
const std::string keyTexture = "Texture";
|
||||
const std::string keyColorMap = "ColorMap";
|
||||
} // namespace renderablestars
|
||||
|
||||
namespace renderablevolumegl {
|
||||
|
||||
Reference in New Issue
Block a user