Merge branch 'develop' into solarsystem2

Conflicts:
	.gitignore
	include/openspace/rendering/renderablefov.h
	src/CMakeLists.txt
	src/rendering/model/renderablemodel.cpp
	src/rendering/renderablefov.cpp
	src/rendering/renderablepath.cpp
	src/rendering/renderabletrail.cpp
	src/util/factorymanager.cpp
This commit is contained in:
Michal Marcinkowski
2014-12-15 13:23:30 -05:00
63 changed files with 1045 additions and 1390 deletions

View File

@@ -47,6 +47,7 @@ public:
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;
@@ -60,7 +61,6 @@ private:
GLuint _vBufferID = 7;
GLuint _iBufferID = 8;
GLenum _mode;
unsigned int _isize;
unsigned int _vsize;
Vertex* _varray;

View File

@@ -32,8 +32,12 @@
#include <openspace/util/updatestructures.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
namespace ghoul {
namespace opengl {
class ProgramObject;
class Texture;
}
}
namespace openspace {

View File

@@ -28,11 +28,11 @@
#include <openspace/rendering/planets/planetgeometry.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/util/powerscaledsphere.h>
namespace openspace {
class RenderablePlanet;
class PowerScaledSphere;
namespace planetgeometry {

View File

@@ -28,22 +28,25 @@
// openspace
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/util/powerscaledcoordinate.h>
#include <openspace/util/powerscaledscalar.h>
#include <openspace/util/updatestructures.h>
// ghoul
#include <ghoul/misc/dictionary.h>
// Forward declare to minimize dependencies
namespace ghoul {
namespace opengl {
class ProgramObject;
class Texture;
}
class Dictionary;
}
namespace openspace {
// Forward declare to minimize dependencies
struct RenderData;
struct UpdateData;
class Camera;
class PowerScaledCoordinate;
class Renderable : public properties::PropertyOwner {
public:
static Renderable* createFromDictionary(const ghoul::Dictionary& dictionary);
@@ -68,7 +71,7 @@ public:
protected:
std::string findPath(const std::string& path);
void setPscUniforms(ghoul::opengl::ProgramObject* program, const Camera* camera, const psc& position);
void setPscUniforms(ghoul::opengl::ProgramObject* program, const Camera* camera, const PowerScaledCoordinate& position);
private:
properties::BoolProperty _enabled;

View File

@@ -1,93 +0,0 @@
/*****************************************************************************************
* *
* 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 __RENDERABLEEPHEMERIS_H__
#define __RENDERABLEEPHEMERIS_H__
// 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>
//#include <openspace/util/runtimedata.h>
namespace openspace {
class RenderableEphemeris : public Renderable{
public:
RenderableEphemeris(const ghoul::Dictionary& dictionary);
~RenderableEphemeris();
bool initialize() override;
bool deinitialize() override;
bool isReady() const override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
properties::StringProperty _colorTexturePath; // not used now, will be later though.
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
void loadTexture();
typedef struct {
GLfloat location[4];
GLfloat velocity[4];
GLubyte padding[32]; // Pads the struct out to 64 bytes for performance increase
} Vertex;
GLuint _vaoID = 6;
GLuint _vBufferID = 7;
GLuint _iBufferID = 8;
void nextIndex();
GLenum _mode;
unsigned int _isize;
unsigned int _vsize;
Vertex* _varray;
int* _iarray;
//Vertex* batchArray;
bool* _updated;
psc _pscpos, _pscvel;
std::vector<std::pair<int, double>> _intervals;
double _increment;
// etc...
int _index[2];
int _prev[2];
int _delta;
double _time = 0;
double _previousTime = 0;
};
}
#endif

View File

@@ -55,6 +55,7 @@ private:
ghoul::opengl::ProgramObject* _shader;
GLuint _fieldlineVAO;
GLuint _vertexPositionBuffer;
std::vector<GLint> _lineStart;
std::vector<GLsizei> _lineCount;

View File

@@ -22,19 +22,14 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RenderableFov_H__
#define __RenderableFov_H__
#ifndef __RENDERABLEFOV_H__
#define __RENDERABLEFOV_H__
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/query/query.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
//#include <openspace/util/runtimedata.h>
#include <openspace/util/powerscaledcoordinate.h>
#include <ghoul/opengl/ghoul_gl.h>
namespace openspace {
class RenderableFov : public Renderable{
@@ -53,123 +48,54 @@ public:
properties::StringProperty _colorTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
openspace::SceneGraphNode* _targetNode;
void loadTexture();
void allocateData();
void insertPoint(std::vector<float>& arr, psc& p, glm::vec4& c);
void fovProjection(bool H[], std::vector<glm::dvec3> bounds);
psc orthogonalProjection(glm::dvec3 camvec);
psc checkForIntercept(glm::dvec3 ray);
psc pscInterpolate(psc p0, psc p1, float t);
psc sphericalInterpolate(glm::dvec3 p0, glm::dvec3 p1, float t);
glm::dvec3 interpolate(glm::dvec3 p0, glm::dvec3 p1, float t);
glm::dvec3 bisection(glm::dvec3 p1, glm::dvec3 p2, double tolerance);
double distanceBetweenPoints(psc p1, psc p2);
// instance variables
int _nrInserted = 0;
int _isteps;
bool _rebuild = false;
bool _interceptTag[5];
bool _withinFOV;
psc _projectionBounds[4];
psc _interceptVector;
void fullYearSweep();
// modfile reads
// spice
std::string _spacecraft;
std::string _target;
std::string _observer;
std::string _frame;
std::string _instrumentID;
std::string _method;
std::string _aberrationCorrection;
std::string _fovTarget;
glm::dvec3 ipoint, ivec;
glm::dvec3 _previousHalf;
// color
glm::vec3 _c;
double _r, _g, _b;
// orbit relational data
double _tropic;
double _ratio;
double _day;
// GPU stuff
GLuint _vaoID[2] ;
GLuint _vboID[2] ;
GLuint _iboID[2];
GLenum _mode;
unsigned int _isize[2];
unsigned int _vsize[2];
unsigned int _vtotal[2];
unsigned int _stride[2];
std::vector<float> _varray1;
std::vector<float> _varray2;
int* _iarray1[2];
// need to write robust method for vbo id selection
// (right now galactic grid has to be present) (why though?) solve later...
GLuint _vaoID ;
GLuint _vBufferID ;
GLuint _iBufferID;
void updateData();
void sendToGPU();
glm::dmat3 _stateMatrix;
// time
unsigned int _isize;
unsigned int _vsize;
unsigned int _vtotal;
unsigned int _stride;
double _startTrail;
//Vertex* _varray;
std::vector<float> _varray;
std::vector<int> _iarray;
bool _once = false;
//used for update of trail
psc _pscpos, _pscvel;
double _increment;
double _time = 0;
double _oldTime = 0;
int _delta = 0;
int _dtprogress = 0;
};
}
#endif
// Scrap stuff i need to keep for now (michal)
/* // idk how we will compute the aberrated state.
double RenderableFov::computeTargetLocalTime(PowerScaledScalar d){
double c = 299792456.075; // m/s
double dt = ( (d[0]*pow(10, d[1])) / c );
double t_local = _time - dt*86400;
std::string localTime;
std::string currentTime;
openspace::SpiceManager::ref().getDateFromET(t_local, localTime);
openspace::SpiceManager::ref().getDateFromET(_time , currentTime);
std::cout << "time at jupiter : " << localTime << "\time at NH" << currentTime << std::endl;
return t_local;
}*/
/*
psc RenderableFov::sphericalInterpolate(glm::dvec3 p0, glm::dvec3 p1, float t){
double targetEt, lt;
glm::dvec3 ip, iv;
psc targetPos;
SpiceManager::ref().getTargetPosition("JUPITER", _spacecraft, _frame, _aberrationCorrection, _time, targetPos, lt);
openspace::SpiceManager::ref().getSurfaceIntercept(_fovTarget, _spacecraft, _instrumentID,
_frame, _method, _aberrationCorrection, _time, targetEt, p0, ip, iv);
psc psc0 = PowerScaledCoordinate::CreatePowerScaledCoordinate(iv[0], iv[1], iv[2]);
openspace::SpiceManager::ref().getSurfaceIntercept(_fovTarget, _spacecraft, _instrumentID,
_frame, _method, _aberrationCorrection, _time, targetEt, p1, ip, iv);
psc psc1 = PowerScaledCoordinate::CreatePowerScaledCoordinate(iv[0], iv[1], iv[2]);
psc0[3] += 3;
psc1[3] += 3;
psc0 -= targetPos;
psc1 -= targetPos;
double angle = psc0.angle(psc1);
std::cout << angle << std::endl;
double sin_a = sin(angle); // opt
double l[2] = { sin((1.f - t)*angle) / sin_a, sin((t)*angle) / sin_a };
std::cout << l[0] << " " << l[1] << std::endl;
float s = ((t-1)*psc0[3] + (t)*psc1[3]);
float x = (l[0]*psc0[0] + l[1]*psc1[0]);
float y = (l[0]*psc0[1] + l[1]*psc1[1]);
float z = (l[0]*psc0[2] + l[1]*psc1[2]);
psc interpolated = PowerScaledCoordinate::PowerScaledCoordinate(x, y, z, 10);
return interpolated;
}
*/
#endif

View File

@@ -29,6 +29,7 @@
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/powerscaledcoordinate.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
@@ -49,11 +50,9 @@ namespace openspace {
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
private:
properties::StringProperty _colorTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
void loadTexture();
void fullYearSweep();
bool fullYearSweep();
// modfile reads
// spice
@@ -72,7 +71,6 @@ namespace openspace {
void nextIndex();
GLenum _mode;
unsigned int _isize;
unsigned int _vsize;
unsigned int _vtotal;
@@ -80,7 +78,7 @@ namespace openspace {
//Vertex* _varray;
std::vector<float> _varray;
int* _iarray;
std::vector<int> _iarray;
//used for update of trail
psc _pscpos, _pscvel;

View File

@@ -67,6 +67,7 @@ private:
ghoul::opengl::ProgramObject* _shader;
ghoul::opengl::Texture* _texture;
GLuint _quad;
GLuint _vertexPositionBuffer;
};
} // namespace openspace

View File

@@ -27,8 +27,8 @@
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/powerscaledcoordinate.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
@@ -55,6 +55,8 @@ public:
void loadTexture();
void fullYearSweep();
bool _successfullDictionaryFetch;
// modfile reads
// spice
std::string _target;
@@ -87,7 +89,7 @@ public:
//Vertex* _varray;
std::vector<float> _varray;
int* _iarray;
std::vector<int> _iarray;
//bool _once = false;
double lightTime;

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef RENDERABLEVOLUME_H
#define RENDERABLEVOLUME_H
#ifndef __RENDERABLEVOLUME_H__
#define __RENDERABLEVOLUME_H__
// open space includes
#include <openspace/rendering/renderable.h>

View File

@@ -70,12 +70,12 @@ private:
ghoul::opengl::Texture* _volume;
ghoul::opengl::Texture* _transferFunction;
GLuint _boxArray;
GLuint _boxArray;
GLuint _vertexPositionBuffer;
ghoul::opengl::ProgramObject *_boxProgram;
glm::vec3 _boxScaling;
psc _pscOffset;
float _w;
GLint _MVPLocation, _modelTransformLocation, _typeLocation;
bool _updateTransferfunction;
int _id;

View File

@@ -65,6 +65,8 @@ public:
void takeScreenshot();
void toggleVisualizeABuffer(bool b);
void toggleInfoText(bool b);
void setPerformanceMeasurements(bool performanceMeasurements);
bool doesPerformanceMeasurements() const;

View File

@@ -53,6 +53,7 @@ namespace openspace {
class RenderableConstellationBounds : public Renderable {
public:
RenderableConstellationBounds(const ghoul::Dictionary& dictionary);
~RenderableConstellationBounds();
bool initialize() override;
bool deinitialize() override;

View File

@@ -35,8 +35,9 @@
namespace openspace {
class RenderableStars : public Renderable {
public:
public:
RenderableStars(const ghoul::Dictionary& dictionary);
~RenderableStars();
bool initialize() override;
bool deinitialize() override;