fixing stupid git mistake.

This commit is contained in:
michal
2014-11-28 17:15:13 -05:00
parent a5c232eb88
commit bd74acedd3
30 changed files with 1984 additions and 408 deletions

View File

@@ -67,7 +67,6 @@ private:
std::string _source;
std::string _destination;
};
} // namespace openspace

View File

@@ -0,0 +1,53 @@
/*****************************************************************************************
* *
* 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 __PlanetGeometryProjection_H__
#define __PlanetGeometryProjection_H__
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/planets/RenderablePlanetProjection.h>
#include <ghoul/misc/dictionary.h>
namespace openspace {
namespace planetgeometryprojection {
class PlanetGeometryProjection : public properties::PropertyOwner {
public:
static PlanetGeometryProjection* createFromDictionary(const ghoul::Dictionary& dictionary);
PlanetGeometryProjection();
virtual ~PlanetGeometryProjection();
virtual bool initialize(RenderablePlanetProjection* parent);
virtual void deinitialize();
virtual void render() = 0;
protected:
RenderablePlanetProjection* _parent;
};
} // namespace planetgeometry
} // namespace openspace
#endif // __PLANETGEOMETRY_H__

View File

@@ -0,0 +1,82 @@
/*****************************************************************************************
* *
* 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 __RENDERABLEPLANETPROJECTION_H__
#define __RENDERABLEPLANETPROJECTION_H__
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/framebufferobject.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <openspace/query/query.h>
namespace openspace {
namespace planetgeometryprojection {
class PlanetGeometryProjection;
}
class RenderablePlanetProjection : public Renderable {
public:
RenderablePlanetProjection(const ghoul::Dictionary& dictionary);
~RenderablePlanetProjection();
bool initialize() override;
bool deinitialize() override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
private:
properties::StringProperty _colorTexturePath;
properties::StringProperty _projectionTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
ghoul::opengl::Texture* _textureProj;
planetgeometryprojection::PlanetGeometryProjection* _geometry;
glm::dmat3 _stateMatrix;
glm::dmat3 _instrumentMatrix;
double _time;
openspace::SceneGraphNode* _targetNode;
std::string _target;
};
} // namespace openspace
#endif // __RENDERABLEPLANETPROJECTION_H__

View File

@@ -0,0 +1,61 @@
/*****************************************************************************************
* *
* 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 __SIMPLESPHEREGEOMETRYPROJECTION_H__
#define __SIMPLESPHEREGEOMETRYPROJECTION_H__
#include <openspace/rendering/planets/planetgeometryprojection.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/util/powerscaledsphere.h>
namespace openspace {
class RenderablePlanet;
namespace planetgeometryprojection {
class SimpleSphereGeometryProjection : public PlanetGeometryProjection {
public:
SimpleSphereGeometryProjection(const ghoul::Dictionary& dictionary);
~SimpleSphereGeometryProjection();
bool initialize(RenderablePlanetProjection* parent) override;
void deinitialize() override;
void render() override;
private:
void createSphere();
properties::Vec2Property _radius;
properties::IntProperty _segments;
PowerScaledSphere* _planet;
};
} // namespace planetgeometry
} // namespace openspace
#endif // __SIMPLESPHEREGEOMETRY_H__

View File

@@ -0,0 +1,71 @@
/*****************************************************************************************
* *
* 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 __RENDERABLEPLANET_H__
#define __RENDERABLEPLANET_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>
namespace openspace {
namespace planetgeometry {
class PlanetGeometry;
}
class RenderablePlanet : public Renderable {
public:
RenderablePlanet(const ghoul::Dictionary& dictionary);
~RenderablePlanet();
bool initialize() override;
bool deinitialize() override;
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
protected:
void loadTexture();
private:
properties::StringProperty _colorTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
planetgeometry::PlanetGeometry* _geometry;
glm::dmat3 _stateMatrix;
std::string _target;
};
} // namespace openspace
#endif // __RENDERABLEPLANET_H__

View File

@@ -29,6 +29,7 @@
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/query/query.h>
// ghoul includes
#include <ghoul/opengl/programobject.h>
@@ -50,55 +51,123 @@ public:
properties::StringProperty _colorTexturePath;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::Texture* _texture;
void loadTexture();
void fullYearSweep();
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;
// modfile reads
// spice
std::string _target;
std::string _spacecraft;
std::string _observer;
std::string _frame;
// color
std::string _instrumentID;
std::string _method;
std::string _aberrationCorrection;
std::string _fovTarget;
glm::dvec3 ipoint, ivec;
glm::dvec3 _previousHalf;
glm::vec3 _c;
double _r, _g, _b;
// orbit relational data
double _tropic;
double _ratio;
double _day;
// 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;
// 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];
void updateData();
void sendToGPU();
glm::dmat3 _stateMatrix;
GLenum _mode;
unsigned int _isize;
unsigned int _vsize;
unsigned int _vtotal;
unsigned int _stride;
double _startTrail;
//Vertex* _varray;
std::vector<float> _varray;
int* _iarray;
bool _once = false;
//used for update of trail
psc _pscpos, _pscvel;
double _increment;
// time
double _time = 0;
double _oldTime = 0;
int _delta = 0;
int _dtprogress = 0;
};
}
#endif
#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;
}
*/

View File

@@ -62,6 +62,11 @@ protected:
glm::mat4 _gridMatrix;
int _segments;
bool staticGrid;
std::string _parentsRotation;
glm::dmat3 _parentMatrix;
PowerScaledScalar _radius;
GLuint _vaoID = 3;
GLuint _vBufferID = 4;
GLuint _iBufferID = 5;