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;

View File

@@ -107,6 +107,8 @@ namespace renderablesphericalgrid {
const std::string gridColor = "GridColor";
const std::string gridMatrix = "GridMatrix";
const std::string gridSegments = "GridSegments";
const std::string gridRadius = "GridRadius";
const std::string gridPatentsRotiation = "ParentsRotation";
} // namespace renderablesphericalgrid
namespace ephemeris {

View File

@@ -60,6 +60,13 @@ public:
// returns the rescaled, "normal" coordinates
glm::vec3 vec3() const;
// return the full psc as dvec4()
glm::dvec4& dvec4() const;
// rescaled return as dvec3
glm::dvec3 dvec3() const;
// length of the vector as a pss
PowerScaledScalar length() const;
glm::vec3 direction() const;

View File

@@ -26,6 +26,7 @@
#define __SPICEMANAGER_H__
#include "SpiceUsr.h"
#include "SpiceZpr.h"
#include <openspace/util/powerscaledcoordinate.h>
@@ -250,6 +251,24 @@ public:
bool getDateFromET(double ephemerisTime, std::string& date,
const std::string& format = "YYYY MON DDTHR:MN:SC.### ::RND");
/**
* This helper method converts a 3 dimensional vector from one reference frame to another.
* \param v The vector to be converted
* \param from The frame to be converted from
* \param to The frame to be converted to
* \param ephemerisTime Time at which to get rotational matrix that transforms vector
*/
void frameConversion(glm::dvec3& v, const std::string from, const std::string to, double ephemerisTime) const;
/**
* Finds the projection of one vector onto another vector.
* All vectors are 3-dimensional.
* \param v1 The vector to be projected.
* \param v2 The vector onto which v1 is to be projected.
* \return The projection of v1 onto v2.
*/
glm::dvec3 orthogonalProjection(glm::dvec3& v1, glm::dvec3& v2);
/**
* Returns the <code>position</code> of a <code>target</code> body relative to an
* <code>observer</code> in a specific <code>referenceFrame</code>, optionally
@@ -290,7 +309,71 @@ public:
psc& position,
double& lightTime) const;
void getPointingAttitude();
/**
* Given an observer and a direction vector defining a ray, compute
* the surface intercept of the ray on a target body at a specified
* epoch, optionally corrected for light time and stellar
* aberration.
* \param method Computation method.
* \param target Name of target body.
* \param et Epoch in ephemeris seconds past J2000 TDB.
* \param fixref Body-fixed, body-centered target body frame.
* \param abcorr Aberration correction.
* \param obsrvr Name of observing body.
* \param dref Reference frame of ray's direction vector.
* \param dvec Ray's direction vector.
* \param spoint Surface intercept point on the target body.
* \param trgepc Intercept epoch.
* \param srfvec Vector from observer to intercept point.
* \param found Flag indicating whether intercept was found.
* For further details, refer to
* http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sincpt_c.html
*/
bool getSurfaceIntercept(const std::string& target,
const std::string& observer,
const std::string& fovFrame,
const std::string& bodyFixedFrame,
const std::string& method,
const std::string& aberrationCorrection,
double ephemerisTime,
double& targetEpoch,
glm::dvec3& directionVector,
glm::dvec3& surfaceIntercept,
glm::dvec3& surfaceVector) const;
/**
* Determine if a specified ephemeris object is within the
* field-of-view (FOV) of a specified instrument at a given time.
* \param Name or ID code string of the instrument.
* \param Name or ID code string of the target.
* \param Type of shape model used for the target.
* \param Body-fixed, body-centered frame for target body.
* \param Aberration correction method.
* \param Name or ID code string of the observer.
* \param Time of the observation (seconds past J2000).
* \param Visibility flag (SPICETRUE/SPICEFALSE).
* For further detail, refer to
* http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/fovtrg_c.html
*/
bool targetWithinFieldOfView(const std::string& instrument,
const std::string& target,
const std::string& observer,
const std::string& method,
const std::string& referenceFrame,
const std::string& aberrationCorrection,
double& targetEpoch) const;
/**
* This method performs the same computation as the function its overloading
* with the exception that in doing so it assumes the inertial bodyfixed frame
* is that of 'IAU' type, allowing the client to omitt the
* <code>referenceFrame</code> for planetary objects.
*/
bool targetWithinFieldOfView(const std::string& instrument,
const std::string& target,
const std::string& observer,
const std::string& method,
const std::string& aberrationCorrection,
double& targetEpoch) const;
/**
* Returns the state vector (<code>position</code> and <code>velocity</code>) of a
@@ -375,6 +458,25 @@ public:
double ephemerisTime,
glm::dmat3& transformationMatrix) const;
/**
* The following overloaded function performs similar to its default - the exception being
* that it computes <code>transformationMatrix</code> with respect to local time offset
* between an observer and its target. This allows for the accountance of light travel of
* photons, e.g to account for instrument pointing offsets due to said phenomenon.
* \param sourceFrame The name of the source reference frame
* \param destinationFrame The name of the destination reference frame
* \param ephemerisTimeFrom Recorded/observed observation time
* \param ephemerisTimeTo Emission local target-time
* \param transformationMatrix The output containing the transformation matrix that
*/
bool getPositionTransformMatrix(const std::string& sourceFrame,
const std::string& destinationFrame,
double ephemerisTimeFrom,
double ephemerisTimeTo,
glm::dmat3& transformationMatrix) const;
bool getPositionPrimeMeridian(const std::string& sourceFrame,
const std::string& destinationFrame,
double ephemerisTime,
@@ -523,34 +625,6 @@ public:
glm::dvec3& subObserverPoint,
double& targetEphemerisTime,
glm::dvec3& vectorToSurfacePoint) const;
/**
* Computes the rectangular coordinates of the sub-solar point on
* a target body at a specified epoch, optionally corrected for
* light time and stellar aberration.
* For further details, please refer to 'subslr_c ' in SPICE Docummentation
*
* \param computationMethod Computation method.
* \param target Name of target body.
* \param ephemeris Epoch in ephemeris seconds past J2000 TDB.
* \param bodyFixedFrame Body-fixed, body-centered target body frame.
* \param aberrationCorrection Aberration correction.
* \param observer Name of observing body.
* \param subObserverPoint Sub-observer point on the target body.
* \param targetEpoch Sub-observer point epoch.
* \param observerToSubObserverVec Vector from observer to sub-observer point.
* \return Whether the function succeeded or not
*/
//bool getSubSolarPoint(std::string target,
// std::string computationMethod,
//
// double ephemeris,
// std::string bodyFixedFrame,
// std::string aberrationCorrection,
//
// glm::dvec3& subSolarPoint,
// double& targetEpoch,
// glm::dvec3& vectorToSurfacePoint) const;
/**
* This method checks if one of the previous SPICE methods has failed. If it has, the