Merge branch 'develop' into plutoViz

This commit is contained in:
Alexander Bock
2015-02-27 09:01:55 +01:00
25 changed files with 459 additions and 390 deletions
@@ -25,13 +25,11 @@
#ifndef __RENDERABLEMODEL_H__
#define __RENDERABLEMODEL_H__
// open space includes
#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>
@@ -44,7 +42,6 @@ class ModelGeometry;
class RenderableModel : public Renderable {
public:
RenderableModel(const ghoul::Dictionary& dictionary);
~RenderableModel();
bool initialize() override;
bool deinitialize() override;
@@ -70,7 +67,8 @@ private:
std::string _source;
std::string _destination;
double _time;
psc _sunPosition;
properties::BoolProperty _performShading;
};
@@ -26,7 +26,6 @@
#define __WAVEFRONTOBJECT_H__
#include <openspace/rendering/model/modelgeometry.h>
#include <tiny_obj_loader.h>
namespace openspace {
@@ -37,40 +36,29 @@ namespace modelgeometry {
class WavefrontGeometry : public ModelGeometry {
public:
WavefrontGeometry(const ghoul::Dictionary& dictionary);
~WavefrontGeometry();
bool initialize(RenderableModel* parent) override;
void deinitialize() override;
void render() override;
typedef struct
{
GLfloat location[4];
GLfloat tex[2];
GLfloat normal[3];
GLfloat padding[7];
//GLubyte padding[4]; // Pads the struct out to 64 bytes for performance increase
} Vertex;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
protected:
void loadObj(const char *filename);
private:
void createSphere();
struct Vertex {
GLfloat location[4];
GLfloat tex[2];
GLfloat normal[3];
};
bool loadObj(const std::string& filename);
bool loadCachedFile(const std::string& filename);
bool saveCachedFile(const std::string& filename);
bool loadModel(const std::string& filename);
GLuint _vaoID;
GLuint _vBufferID;
GLuint _iBufferID;
GLuint _vbo;
GLuint _ibo;
GLuint _tBufferID;
unsigned int _tsize;
float* _tarray;
unsigned int _isize;
unsigned int _vsize;
Vertex* _varray;
int* _iarray;
std::vector<Vertex> _vertices;
std::vector<int> _indices;
};
} // namespace modelgeometry
+2 -1
View File
@@ -50,8 +50,9 @@ public:
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
properties::StringProperty _colorTexturePath;
properties::FloatProperty _lineWidth;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
openspace::SceneGraphNode* _targetNode;
+18 -6
View File
@@ -25,14 +25,21 @@
#ifndef RENDERABLEPLANE_H_
#define RENDERABLEPLANE_H_
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/util/updatestructures.h>
// ghoul includes
#include <openspace/properties/stringproperty.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace ghoul {
namespace filesystem {
class File;
}
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {
struct LinePoint;
@@ -57,16 +64,21 @@ public:
private:
void loadTexture();
void createPlane();
properties::StringProperty _texturePath;
properties::BoolProperty _billboard;
properties::Vec2Property _size;
glm::vec2 _size;
Origin _origin;
bool _planeIsDirty;
ghoul::opengl::ProgramObject* _shader;
bool _programIsDirty;
bool _textureIsDirty;
ghoul::opengl::Texture* _texture;
ghoul::filesystem::File* _textureFile;
GLuint _quad;
GLuint _vertexPositionBuffer;
};
+3 -3
View File
@@ -74,8 +74,8 @@ public:
void serialize(SyncBuffer* syncBuffer);
void deserialize(SyncBuffer* syncBuffer);
float globalOpacity();
void setGlobalOpacity(float opacity);
float globalBlackOutFactor();
void setGlobalBlackOutFactor(float factor);
void setSGCTRenderStatistics(bool visible);
@@ -114,7 +114,7 @@ private:
void generateGlslConfig();
float _globalOpactity;
float _globalBlackOutFactor;
float _fadeDuration;
float _currentFadeTime;
int _fadeDirection;
+1 -1
View File
@@ -85,7 +85,7 @@ private:
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
void addLibraryFunctions(lua_State* state, const LuaLibrary& library, bool replace);
bool isLibraryNameAllowed(const std::string& name);
bool isLibraryNameAllowed(lua_State* state, const std::string& name);
void addBaseLibrary();
void remapPrintFunction();
-5
View File
@@ -88,11 +88,6 @@ namespace renderablemodel {
const std::string keyGeometry = "Geometry";
} // namespace renderablemodel
namespace modelgeometry {
const std::string keyType = "Type";
const std::string keyObjFile = "ObjFile";
} // namespace modelgeometry
namespace renderablestars {
const std::string keyFile = "File";
const std::string keyTexture = "Texture";
+19 -12
View File
@@ -126,6 +126,24 @@ public:
*/
double deltaTime() const;
/**
* Sets the pause function, i.e. setting the deltaTime to 0 (<code>pause</code> =
* <code>true</code>) and restoring it when the function is called with a parameter of
* <code>false</code>.
* \param If <code>true</code>, the simulation time stops; if <code>false</code>, the
* simulation time continues at the previous rate
*/
void setPause(bool pause);
/**
* Toggles the pause function, i.e. setting the deltaTime to 0 and restoring it when
* the function is called a second time. It returns the pause state (<code>true</code>
* if the time is now paused, <code>false</code> otherwise)
* \return The new pause state (<code>true</code> if the time is now paused,
* <code>false</code> otherwise)
*/
bool togglePause();
/**
* Advances the simulation time using the deltaTime() and the <code>tickTime</code>.
* The deltaTime() is the number of simulation seconds that pass for each real-time
@@ -138,18 +156,6 @@ public:
*/
double advanceTime(double tickTime);
/**
* Retreats the simulation time using the deltaTime() and the <code>tickTime</code>.
* The deltaTime() is the number of simulation seconds that pass for each real-time
* second. <code>tickTime</code> is the number of real-time seconds that passed since
* the last call to this method. If this method is called in the render loop, the
* <code>tickTime</code> should be equivalent to the frame time.
* \param tickTime The number of real-time seconds that passed since the last call
* to this method
* \return The new time value after retreating the time
*/
double retreatTime(double tickTime);
void serialize(SyncBuffer* syncBuffer);
void deserialize(SyncBuffer* syncBuffer);
@@ -192,6 +198,7 @@ private:
double _time; ///< The time stored as the number of seconds past the J2000 epoch
double _dt;
bool _timeJumped;
bool _timePaused;
bool _jockeHasToFixThisLater;
//shared copies