fix merge conflict

This commit is contained in:
Lovisa Hassler
2018-11-12 18:33:06 -05:00
8 changed files with 97 additions and 65 deletions

View File

@@ -21,6 +21,7 @@ asset.require('scene/solarsystem/dsn/stations')
--Communication
--assetHelper.requestAll(asset, 'scene/solarsystem/dsn')
asset.require('scene/solarsystem/dsn/communicationlines/communicationlines')
asset.require('scene/solarsystem/dsn/spacecrafts')
-- Load default key bindings applicable to most scenes
asset.require('util/default_keybindings')

View File

@@ -0,0 +1,36 @@
local assetHelper = asset.require('util/asset_helper')
local models = asset.syncedResource({
Name = "Dsn models",
Type = "HttpSynchronization",
Identifier = "dsn_stations",
Version = 1
})
local testSpaceCraft = {
Identifier = "testSpaceCraft",
Transform = {
Translation = {
Type = "RadecTranslation"
},
Scale = {
Type = "StaticScale",
Scale = 1000.0
}
},
Renderable = {
Type = "RenderableModel",
Geometry = {
Type = "MultiModelGeometry",
GeometryFile = models .. "/34m_dish/34m_dish.obj"
},
ColorTexture = models .. "/34m_dish/base_AO.png",
},
GUI = {
Name = "testSpaceCraft",
Path = "/Solar System/testSpaceCraft"
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, {testSpaceCraft})

View File

@@ -191,10 +191,7 @@ namespace openspace {
//loop through all signals in the data
for (const auto& signalsInJson : j["Signals"]) {
structSignal.signalId = signalsInJson["activityid"].get<int>();
structSignal.dishName = signalsInJson["facility"].get<std::string>();
structSignal.year = signalsInJson["year"].get<int>();
structSignal.spacecraft = signalsInJson["projuser"].get<std::string>();
structSignal.endTime = signalsInJson["eot"].get<std::string>();
structSignal.startTime = signalsInJson["bot"].get<std::string>();
@@ -202,7 +199,6 @@ namespace openspace {
//Add signals to vector of signals
_signalData.signals.push_back(structSignal);
//_dsnData.signalStartTimes.push_back(Time::convertTime(structSignal.startTime));
}
_signalData.isLoaded = true;

View File

@@ -46,15 +46,11 @@ namespace openspace {
public:
static struct Signal {
int signalId;
std::string dishName;
int year;
std::string spacecraft;
std::string direction;
std::string startTime;
std::string endTime;
glm::vec3 color;
};
static struct SignalData {

View File

@@ -382,8 +382,8 @@ void RenderableSignals::pushSignalDataToVertexArray(SignalManager::Signal signal
_vertexArray.push_back(color.b);
_vertexArray.push_back(color.a);
}
}
/* Since our station dishes have a static translation from Earth, we
* can get their local translation. The reason to handle it differently
@@ -400,21 +400,6 @@ glm::dvec3 RenderableSignals::getCoordinatePosFromFocusNode(SceneGraphNode* node
return diff;
}
glm::dvec3 RenderableSignals::getEstimatedCoordinatePosFromFocusNode(glm::vec3 pos) {
glm::dvec3 earthPos = global::renderEngine.scene()->sceneGraphNode("Earth")->worldPosition();
glm::dvec3 focusNodePos = _focusNode->worldPosition();
glm::dmat4 translationMatrixEarth = glm::translate(glm::dmat4(1.0), glm::dvec3(earthPos));
glm::dvec4 newPos = { pos, 1.0 };
glm::dvec4 nodePos = _rotEquatorialSphere * translationMatrixEarth *newPos;
glm::dvec3 diff = glm::vec3(nodePos.x - focusNodePos.x, nodePos.y - focusNodePos.y,
nodePos.z - focusNodePos.z);
return diff;
}
glm::vec3 RenderableSignals::getSuitablePrecisionPositionForSceneGraphNode(std::string id) {
@@ -425,8 +410,8 @@ glm::vec3 RenderableSignals::getSuitablePrecisionPositionForSceneGraphNode(std::
position = getCoordinatePosFromFocusNode(spacecraftNode);
}
else {
//If no scenegraphnode with proper id was found, estimate the position of the spacecraft by RA/DEC/RANGE
position = convertRaDecRangeToCartesian();
LERROR(fmt::format("No scengraphnode found for the spacecraft {}", id));
}
return position;
@@ -441,7 +426,7 @@ glm::vec3 RenderableSignals::getPositionForGeocentricSceneGraphNode(const char*
position = global::renderEngine.scene()->sceneGraphNode(id)->position();
}
else {
LERROR(fmt::format("No position data for the station dish {}, drawing line from center of Earth", id));
LERROR(fmt::format("No scengraphnode found for the station dish {}, drawing line from center of Earth", id));
position = glm::vec3(0, 0, 0);
}
@@ -449,25 +434,6 @@ glm::vec3 RenderableSignals::getPositionForGeocentricSceneGraphNode(const char*
}
glm::dvec3 RenderableSignals::convertRaDecRangeToCartesian() {
//Todo: stream data from file
//Dummy data for voyager 1
double ra = 257.777029167736; //2018-246
double dec = 12.2537708651048; // 2018-246
double range = 2.14044781771236e+13;
// Convert RA and DEC from degrees to radians
ra = glm::radians(ra);
dec = glm::radians(dec);
//Save array in vector
glm::dvec3 raDecPos = SpiceManager::getPositionFromRaDecRange(ra,dec,range);
//Get the RA / DEC values in world coordinates with respect to the current focus node
raDecPos = getEstimatedCoordinatePosFromFocusNode(raDecPos);
return raDecPos;
}
glm::vec3 RenderableSignals::getStationColor(std::string dishidentifier) {

View File

@@ -86,11 +86,7 @@ namespace openspace {
void pushSignalDataToVertexArray(SignalManager::Signal signal);
/* Returns a position relative the current focus node */
glm::dvec3 getCoordinatePosFromFocusNode(SceneGraphNode* node);
/* Returns the estimated position expressed relative to the current focusnode */
glm::dvec3 getEstimatedCoordinatePosFromFocusNode(glm::vec3 pos);
/* Converts the Ra Dec range coordinates into cartesian coordinates*/
glm::dvec3 convertRaDecRangeToCartesian();
/* Returns a position for a spacecraft*/
/*Returns a position for a spacecraft*/
glm::vec3 getSuitablePrecisionPositionForSceneGraphNode(std::string id);
/* Returns a position for a station that has Earth as parent*/
glm::vec3 getPositionForGeocentricSceneGraphNode(const char* id);
@@ -172,11 +168,8 @@ namespace openspace {
/*Checks if the current time is within a signal's start and endtime*/
bool isSignalActive(double currentTime, std::string signalStartTime, std::string signalEndTime);
/* Rotation matrix to transform into equatorial sphere coordinate system*/
glm::dmat4 _rotEquatorialSphere = { -0.05487554, 0.4941095, -0.8676661, 0.0,
-0.8734371 , -0.4448296, -0.1980764, 0.0,
-0.483835 , 0.7469823, 0.4559838, 0.0,
0.0 , 0.0 , 0.0 , 1.0 };
};
} // namespace openspace

View File

@@ -23,7 +23,6 @@
****************************************************************************************/
#include <modules/dsn/translation/radectranslation.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
@@ -51,7 +50,7 @@ documentation::Documentation RadecTranslation::Documentation() {
{
PositionInfo.identifier,
new DoubleVector3Verifier,
Optional::No,
Optional::Yes,
PositionInfo.description
}
}
@@ -66,7 +65,9 @@ RadecTranslation::RadecTranslation()
glm::dvec3(-std::numeric_limits<double>::max()),
glm::dvec3(std::numeric_limits<double>::max())
)
{
{
addProperty(_position);
_position.onChange([this]() {
@@ -83,11 +84,42 @@ RadecTranslation::RadecTranslation(const ghoul::Dictionary& dictionary)
dictionary,
"RadecTranslation"
);
_position = dictionary.value<glm::dvec3>(PositionInfo.identifier);
}
glm::dvec3 RadecTranslation::position(const UpdateData&) const {
glm::dvec3 RadecTranslation::convertRaDecRangeToCartesian() const{
//Todo: stream data from file
//Static data for voyager 1
double ra = 257.777029167736; //2018-246
double dec = 12.2537708651048; // 2018-246
double range = 2.14044781771236e+13;
//Convert RA and DEC from degrees to radians
ra = glm::radians(ra);
dec = glm::radians(dec);
//Save array in vector
glm::dvec3 raDecPos = SpiceManager::getPositionFromRaDecRange(ra, dec, range);
return raDecPos;
}
glm::dvec3 RadecTranslation::transformCartesianCoordinates() const {
glm::vec3 pos = convertRaDecRangeToCartesian();
glm::dvec3 earthPos = global::renderEngine.scene()->sceneGraphNode("Earth")->worldPosition();
glm::dmat4 translationMatrixEarth = glm::translate( glm::dmat4(1.0), glm::dvec3(earthPos) );
glm::dvec4 newPos = { pos, 1.0 };
glm::dvec4 nodePos = translationMatrixEarth * _rotEquatorialSphere * newPos;
glm::dvec3 worldposition = { nodePos.x, nodePos.y, nodePos.z };
return worldposition;
}
glm::dvec3 RadecTranslation::position(const UpdateData&) const{
glm::dvec3 _position = transformCartesianCoordinates();
return _position;
}

View File

@@ -26,8 +26,11 @@
#define __OPENSPACE_MODULE_DSN___RADECTRANSLATION___H__
#include <openspace/scene/translation.h>
#include <openspace/util/spicemanager.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/properties/vector/dvec3property.h>
#include <modules/dsn/rendering/renderablesignals.h>
namespace openspace {
@@ -39,14 +42,23 @@ class RadecTranslation : public Translation {
public:
RadecTranslation();
RadecTranslation(const ghoul::Dictionary& dictionary);
/* Converts the Ra Dec range coordinates into cartesian coordinates*/
glm::dvec3 convertRaDecRangeToCartesian() const;
/*Transforms the cartesian coordinates with a rotation and a translation*/
glm::dvec3 transformCartesianCoordinates() const;
glm::dvec3 position(const UpdateData& data) const override;
static documentation::Documentation Documentation();
private:
properties::DVec3Property _position;
};
glm::dmat4 _rotEquatorialSphere = { -0.05487554, 0.4941095, -0.8676661, 0.0,
-0.8734371 , -0.4448296, -0.1980764, 0.0,
-0.483835 , 0.7469823, 0.4559838, 0.0,
0.0 , 0.0 , 0.0 , 1.0
};
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_DSN___RADECTRANSLATION___H__