Merge branch 'develop' of openspace.itn.liu.se:/openspace into develop

Conflicts:
	src/rendering/planets/renderableplanet.cpp
	src/rendering/renderablefieldlines.cpp
	src/rendering/renderablevolumegl.cpp
	src/rendering/stars/renderablestars.cpp
This commit is contained in:
Jonas Strandstedt
2014-09-26 17:17:18 +02:00
36 changed files with 1033 additions and 1007 deletions
@@ -25,6 +25,10 @@
#ifndef __OPENSPACEENGINE_H__
#define __OPENSPACEENGINE_H__
// sgct header has to be included before all others due to Windows header
#define SGCT_WINDOWS_INCLUDE
#include "sgct.h"
#include <openspace/interaction/interactionhandler.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/misc/dictionary.h>
+69 -67
View File
@@ -22,71 +22,73 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __FLARE_H__
#define __FLARE_H__
// Source is still in here to cannibalize later (ab)
#include <GL/glew.h>
#include <ghoul/logging/logmanager.h>
#define SGCT_WINDOWS_INCLUDE
#include <sgct.h>
#include <openspace/flare/Animator.h>
#include <openspace/flare/Raycaster.h>
#include <openspace/flare/Config.h>
#include <openspace/rendering/renderable.h>
namespace openspace {
class Flare: public Renderable {
public:
Flare();
~Flare();
bool initialize();
bool deinitialize();
virtual void render(const Camera *camera, const psc& thisPosition, RuntimeData* runtimeData);
virtual void update();
void render();
void initNavigation();
void keyboard(int key, int action);
void mouse(int button, int action);
void preSync();
void postSyncPreDraw();
void postDraw();
void encode();
void decode();
private:
void init();
osp::Config* _config;
osp::Raycaster* _raycaster;
osp::Animator* _animator;
sgct::SharedInt _timeStep;
sgct::SharedBool _animationPaused;
sgct::SharedBool _fpsMode;
sgct::SharedFloat _elapsedTime;
sgct::SharedInt _manualTimestep;
sgct::SharedFloat _pitch;
sgct::SharedFloat _yaw;
sgct::SharedFloat _roll;
sgct::SharedFloat _translateX;
sgct::SharedFloat _translateY;
sgct::SharedFloat _translateZ;
sgct::SharedBool _reloadFlag;
float _oldTime;
float _currentTime;
bool _leftMouseButton;
double _currentMouseX;
double _currentMouseY;
double _lastMouseX;
double _lastMouseY;
};
} // namespace openspace
#endif // __FLARE_H__
//#ifndef __FLARE_H__
//#define __FLARE_H__
//
//#include <GL/glew.h>
//#include <ghoul/logging/logmanager.h>
//#define SGCT_WINDOWS_INCLUDE
//#include <sgct.h>
//#include <openspace/flare/Animator.h>
//#include <openspace/flare/Raycaster.h>
//#include <openspace/flare/Config.h>
//#include <openspace/rendering/renderable.h>
//
//namespace openspace {
//
//class Flare: public Renderable {
//public:
// Flare();
// ~Flare();
//
// bool initialize();
// bool deinitialize();
//
// virtual void render(const Camera *camera, const psc& thisPosition, RuntimeData* runtimeData);
// virtual void update();
//
// void render();
// void initNavigation();
//
// void keyboard(int key, int action);
// void mouse(int button, int action);
// void preSync();
// void postSyncPreDraw();
// void postDraw();
// void encode();
// void decode();
//
//private:
// void init();
//
// osp::Config* _config;
// osp::Raycaster* _raycaster;
// osp::Animator* _animator;
//
// sgct::SharedInt _timeStep;
// sgct::SharedBool _animationPaused;
// sgct::SharedBool _fpsMode;
// sgct::SharedFloat _elapsedTime;
// sgct::SharedInt _manualTimestep;
// sgct::SharedFloat _pitch;
// sgct::SharedFloat _yaw;
// sgct::SharedFloat _roll;
// sgct::SharedFloat _translateX;
// sgct::SharedFloat _translateY;
// sgct::SharedFloat _translateZ;
// sgct::SharedBool _reloadFlag;
//
// float _oldTime;
// float _currentTime;
// bool _leftMouseButton;
// double _currentMouseX;
// double _currentMouseY;
// double _lastMouseX;
// double _lastMouseY;
//};
//
//} // namespace openspace
//
//#endif // __FLARE_H__
+1 -1
View File
@@ -200,7 +200,7 @@ protected:
private:
/// The name of this PropertyOwner
std::string _name;
/// A list of all owned Property's
/// A list of all registered Property's
std::vector<Property*> _properties;
/// A list of all sub-owners
std::vector<PropertyOwner*> _subOwners;
@@ -29,11 +29,11 @@
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/updatestructures.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <openspace/util/runtimedata.h>
namespace openspace {
@@ -49,8 +49,8 @@ public:
bool initialize() override;
bool deinitialize() override;
void render(const Camera* camera, const psc& thisPosition, RuntimeData* runtimeData) override;
void update() override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
@@ -62,6 +62,8 @@ private:
ghoul::opengl::Texture* _texture;
planetgeometry::PlanetGeometry* _geometry;
glm::dmat3 _stateMatrix;
std::string _target;
};
+3 -4
View File
@@ -34,7 +34,7 @@
#include <ghoul/misc/dictionary.h>
#include <ghoul/opengl/programobject.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/util/runtimedata.h>
#include <openspace/util/updatestructures.h>
namespace openspace {
@@ -52,8 +52,8 @@ public:
void setBoundingSphere(const PowerScaledScalar& boundingSphere);
const PowerScaledScalar& getBoundingSphere();
virtual void render(const Camera* camera, const psc& thisPosition, RuntimeData* runtimeData) = 0;
virtual void update();
virtual void render(const RenderData& data) = 0;
virtual void update(const UpdateData& data);
bool isVisible() const;
@@ -65,7 +65,6 @@ private:
properties::BoolProperty _enabled;
PowerScaledScalar boundingSphere_;
RuntimeData* _runtimeData;
std::string _relativePath;
};
@@ -27,6 +27,7 @@
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/util/updatestructures.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
@@ -43,8 +44,8 @@ public:
bool initialize();
bool deinitialize();
virtual void render(const Camera *camera, const psc& thisPosition, RuntimeData* runtimeData);
virtual void update();
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);
@@ -30,6 +30,7 @@
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
@@ -43,8 +44,8 @@ public:
bool initialize() override;
bool deinitialize() override;
void render(const Camera* camera, const psc& position, RuntimeData* runtimeData) override;
void update() override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
protected:
typedef struct {
@@ -44,8 +44,8 @@ public:
bool initialize();
bool deinitialize();
virtual void render(const Camera *camera, const psc& thisPosition, RuntimeData* runtimeData);
virtual void update();
virtual void render(const RenderData& data) override;
virtual void update(const UpdateData& data) override;
private:
ghoul::Dictionary _hintsDictionary;
@@ -69,7 +69,6 @@ private:
float _w;
GLint _MVPLocation, _modelTransformLocation, _typeLocation;
RuntimeData* _runtimeData;
bool _updateTransferfunction;
int _id;
};
@@ -26,7 +26,6 @@
#define __RENDERENGINE_H__
#include <openspace/scenegraph/scenegraph.h>
#include <openspace/util/runtimedata.h>
#include <memory>
#include <string>
@@ -44,7 +43,6 @@ public:
bool initialize();
void setRuntimeData(RuntimeData* runtimeData);
void setSceneGraph(SceneGraph* sceneGraph);
SceneGraph* sceneGraph();
@@ -63,7 +61,6 @@ public:
private:
Camera* _mainCamera;
SceneGraph* _sceneGraph;
RuntimeData* _runtimeData;
ABuffer* _abuffer;
};
@@ -28,6 +28,7 @@
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
@@ -43,8 +44,8 @@ public:
bool initialize() override;
bool deinitialize() override;
void render(const Camera* camera, const psc& position, RuntimeData* runtimeData) override;
void update() override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
@@ -72,8 +73,6 @@ private:
int v_size;
int v_stride;
int v_total;
RuntimeData* _runtimeData;
};
} // namespace openspace
+2 -7
View File
@@ -27,8 +27,7 @@
#include <openspace/util/powerscaledcoordinate.h>
#include <ghoul/misc/dictionary.h>
#include <openspace/util/runtimedata.h>
#include <openspace/util/updatestructures.h>
namespace openspace {
@@ -40,14 +39,10 @@ public:
virtual ~Ephemeris();
virtual bool initialize();
virtual const psc& position() const = 0;
virtual void update(RuntimeData* runtimeData) = 0;
virtual void update();
virtual void update(const UpdateData& data);
protected:
Ephemeris();
private:
RuntimeData* _runtimeData;
};
} // namespace openspace
+9 -9
View File
@@ -30,13 +30,12 @@
#include <map>
#include <openspace/util/camera.h>
#include <openspace/util/updatestructures.h>
#include <openspace/scripting/scriptengine.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/misc/dictionary.h>
#include <openspace/util/runtimedata.h>
namespace openspace {
@@ -49,8 +48,6 @@ public:
SceneGraph();
~SceneGraph();
void setRuntimeData(RuntimeData* runtimeData);
/**
* Initalizes the SceneGraph by loading modules from the ${SCENEPATH} directory
*/
@@ -64,15 +61,15 @@ public:
/*
* Load the scenegraph from the provided folder
*/
bool loadScene(const std::string& sceneDescriptionFilePath,
const std::string& defaultModulePath);
void scheduleLoadSceneFile(const std::string& sceneDescriptionFilePath);
void clearSceneGraph();
void loadModule(const std::string& modulePath);
/*
* Updates all SceneGraphNodes relative positions
*/
void update();
void update(const UpdateData& data);
/*
* Evaluates if the SceneGraphNodes are visible to the provided camera
@@ -82,7 +79,7 @@ public:
/*
* Render visible SceneGraphNodes using the provided camera
*/
void render(Camera* camera);
void render(const RenderData& data);
/*
* Prints the SceneGraph tree. For debugging purposes
@@ -111,13 +108,16 @@ public:
static scripting::ScriptEngine::LuaLibrary luaLibrary();
private:
bool loadSceneInternal(const std::string& sceneDescriptionFilePath);
std::string _focus, _position;
// actual scenegraph
SceneGraphNode* _root;
std::vector<SceneGraphNode*> _nodes;
std::map<std::string, SceneGraphNode*> _allNodes;
RuntimeData* _runtimeData;
std::string _sceneGraphToLoad;
};
} // namespace openspace
@@ -32,7 +32,7 @@
#include <openspace/scenegraph/scenegraph.h>
#include <ghoul/misc/dictionary.h>
#include <openspace/util/runtimedata.h>
#include <openspace/util/updatestructures.h>
// std includes
#include <iostream>
@@ -52,13 +52,13 @@ public:
static SceneGraphNode* createFromDictionary(const ghoul::Dictionary& dictionary);
bool initialize(RuntimeData* runtimeData);
bool initialize();
bool deinitialize();
// essential
void update();
void update(const UpdateData& data);
void evaluate(const Camera* camera, const psc& parentPosition = psc());
void render(const Camera* camera, const psc& parentPosition = psc());
void render(const RenderData& data);
// set & get
void addNode(SceneGraphNode* child);
@@ -88,7 +88,6 @@ private:
std::vector<SceneGraphNode*> _children;
SceneGraphNode* _parent;
Ephemeris* _ephemeris;
RuntimeData* _runtimeData;
// renderable
Renderable* _renderable;
@@ -34,10 +34,10 @@ namespace openspace {
class SpiceEphemeris : public Ephemeris {
public:
SpiceEphemeris(const ghoul::Dictionary& dictionary);
virtual ~SpiceEphemeris();
virtual bool initialize();
virtual const psc& position() const;
virtual void update(RuntimeData* runtimeData);
~SpiceEphemeris();
bool initialize();
const psc& position() const;
void update(const UpdateData& data) override;
private:
std::string _targetName;
@@ -45,8 +45,6 @@ private:
int _target;
int _origin;
psc _position;
double _currentEphemerisTime = -1;
};
} // namespace openspace
@@ -35,7 +35,7 @@ public:
= ghoul::Dictionary());
virtual ~StaticEphemeris();
virtual const psc& position() const;
virtual void update(RuntimeData* runtimeData);
virtual void update(const UpdateData& data) override;
private:
psc _position;
};
+2 -1
View File
@@ -31,7 +31,6 @@ namespace openspace {
namespace constants {
namespace openspaceengine {
const std::string keyPaths = "Paths";
const std::string keyPathScene = "Paths.SCENEPATH";
const std::string keyConfigSgct = "SGCTConfig";
const std::string keyConfigScene = "Scene";
const std::string keyStartupScript = "StartupScripts";
@@ -39,6 +38,7 @@ namespace openspaceengine {
} // namespace openspaceengine
namespace scenegraph {
const std::string keyPathScene = "ScenePath";
const std::string keyModules = "Modules";
const std::string keyCamera = "Camera";
const std::string keyFocusObject = "Focus";
@@ -59,6 +59,7 @@ namespace renderable {
namespace renderableplanet {
const std::string keyGeometry = "Geometry";
const std::string keyFrame = "Frame";
} // namespace renderableplanet
namespace renderablestars {
-39
View File
@@ -1,39 +0,0 @@
#ifndef __RUNTIMEDATA_H__
#define __RUNTIMEDATA_H__
enum increment{
YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MILLISECOND
};
struct RuntimeData{
public:
RuntimeData() :_openspaceTime(0.0){
};
void setTime(double time) { _openspaceTime = time; }
double getTime() { return _openspaceTime; }
// cant come up with proper user friendly-method, this will do.
void advanceTimeBy(double nr, increment incr){
switch (incr){
case YEAR: _openspaceTime += (nr * year); break;
case MONTH: _openspaceTime += (nr * month); break;
case DAY: _openspaceTime += (nr * day); break;
case HOUR: _openspaceTime += (nr * hour); break;
case MINUTE: _openspaceTime += (nr * minute); break;
case MILLISECOND: _openspaceTime += (nr * millisec); break;
default : _openspaceTime += (nr);
}
}
private:
double _openspaceTime;
double year = 3.154*pow(10, 7);
double month = 2.628*pow(10, 6);
double day = 86400;
double hour = 3600;
double minute = 60;
double millisec = 0.001;
};
#endif // __RUNTIMEDATA_H__
+45
View 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 __UPDATESTRUCTURES_H__
#define __UPDATESTRUCTURES_H__
#include <openspace/util/camera.h>
#include <openspace/util/powerscaledcoordinate.h>
namespace openspace {
struct UpdateData {
double time;
};
struct RenderData {
const Camera& camera;
psc position;
};
}
#endif // __UPDATESTRUCTURES_H__