Untabify and start cleanup

This commit is contained in:
Emma Broman
2020-08-25 16:19:43 +02:00
parent 993be1b504
commit 9fac7fbd83
12 changed files with 1132 additions and 1181 deletions

View File

@@ -27,22 +27,22 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule.h
${CMAKE_CURRENT_SOURCE_DIR}/tasks/exoplanetscsvtobintask.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.h
${CMAKE_CURRENT_SOURCE_DIR}/discoverymethods/discoverymethods.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.h
${CMAKE_CURRENT_SOURCE_DIR}/discoverymethods/discoverymethods.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tasks/exoplanetscsvtobintask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/discoverymethods/discoverymethods.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_vs.glsl
)
source_group("Shader Files" FILES ${SHADER_FILES})

View File

@@ -41,31 +41,30 @@
namespace {
constexpr const char* _loggerCat = "DiscoveryMethods";
constexpr const char* _loggerCat = "DiscoveryMethods";
static const openspace::properties::Property::PropertyInfo TransitMethodInfo = {
"TransitMethod",
"Show transit method",
"Change the view so that the transit method can be presented."
};
static const openspace::properties::Property::PropertyInfo DopplerMethodInfo = {
"DopplerMethod",
"Show doppler method",
"Change the view so that the doppler method can be presented."
};
static const openspace::properties::Property::PropertyInfo TransitMethodInfo = {
"TransitMethod",
"Show transit method",
"Change the view so that the transit method can be presented."
};
static const openspace::properties::Property::PropertyInfo DopplerMethodInfo = {
"DopplerMethod",
"Show doppler method",
"Change the view so that the doppler method can be presented."
};
static const openspace::properties::Property::PropertyInfo SolarSystemReferenceInfo = {
"SolarSystemReference",
"Show solar system reference",
"Show the size of the solar system as a reference for size."
};
"SolarSystemReference",
"Show solar system reference",
"Show the size of the solar system as a reference for size."
};
} // namespace
namespace openspace::exoplanets{
namespace openspace::exoplanets {
void DiscoveryMethods::addDirectionsMarkers(glm::dvec3 viewDirecionPos, glm::dvec3 northDirectionPos, float starRadius) {
const std::string markerView = "{"
"Identifier = 'markerView',"
"Parent = 'SolarSystemBarycenter',"
@@ -147,22 +146,21 @@ namespace openspace::exoplanets{
}
void addDopplerGraphs() {
std::string script = "openspace.addScreenSpaceRenderable("
"{"
std::string script =
"openspace.addScreenSpaceRenderable("
"{"
"Identifier = 'DopplerShift2',"
"Type = 'ScreenSpaceImageLocal',"
"TexturePath = openspace.absPath('${BASE}/modules/exoplanets/stripes2.png'),"
"EuclideanPosition = {0.0, -0.7}"
"}"
");"
"});"
"openspace.addScreenSpaceRenderable("
"{"
"{"
"Identifier = 'DopplerShift1',"
"Type = 'ScreenSpaceImageLocal',"
"TexturePath = openspace.absPath('${BASE}/modules/exoplanets/spectrum.jpg'),"
"EuclideanPosition = {0.0, -0.7}"
"}"
");";
"});";
openspace::global::scriptEngine.queueScript(
script,
@@ -171,7 +169,8 @@ namespace openspace::exoplanets{
}
void addTransitGraphs() {
std::string script = "openspace.addScreenSpaceRenderable("
std::string script =
"openspace.addScreenSpaceRenderable("
"{"
"Identifier = 'Transit2',"
"Type = 'ScreenSpaceImageLocal',"
@@ -201,8 +200,6 @@ namespace openspace::exoplanets{
);
}
void DiscoveryMethods::scaleNode(std::string nodeName, float scalefactor) {
std::string script = "openspace.setPropertyValueSingle( 'Scene."+ nodeName +".Scale.Scale', " + std::to_string(scalefactor) + ", 1);"; //get name of current star from em
openspace::global::scriptEngine.queueScript(
@@ -226,7 +223,6 @@ namespace openspace::exoplanets{
{
//keeping first planet in the list, wich dosn't neccesarily mean the closest one...
for (size_t i = 1; i < planetNames.size(); i++) {
std::string script = "";
//remove planetglobe
if (!isnan(planets[i].R)) {
@@ -256,7 +252,6 @@ namespace openspace::exoplanets{
}
void DiscoveryMethods::moveCamera(glm::dvec3 pos) {
Camera* cam = global::navigationHandler.camera();
cam->setPositionVec3(pos);
global::navigationHandler.resetCameraDirection();
@@ -299,8 +294,7 @@ namespace openspace::exoplanets{
float semiMajorAxis = planets[0].A; // in AU
float starSemiMajorAxis = 0.1 * semiMajorAxis; // 10% of exoplanets semiMajorAxis
float eccentricity = planets[0].ECC;
if (isnan(planets[0].ECC))
{
if (isnan(planets[0].ECC)) {
eccentricity = 0.0;
}
float starRadius = planets[0].RSTAR; // in Solar Radii
@@ -344,7 +338,6 @@ namespace openspace::exoplanets{
glm::dvec3 viewDirectionPos = starPosition + (double(starRadius * scale) * starToSunVec);
//addDirectionsMarkers(viewDirectionPos, northDirectionPos, starRadius);
// END MARKERS
}
void DiscoveryMethods::removeDopplerMethodVisualization() {
@@ -379,7 +372,6 @@ namespace openspace::exoplanets{
}
void DiscoveryMethods::addTransitMethodVisualization() {
const SceneGraphNode* focusNode = global::navigationHandler.anchorNode();
std::string starName = global::moduleEngine.module<ExoplanetsModule>()->getStarName(); // getStarName
glm::dvec3 starPosition = focusNode->worldPosition(); // can get from Exoplanet.POSITIONX/.POSITIONY/.POSITIONZ (in parsecs)
@@ -389,8 +381,7 @@ namespace openspace::exoplanets{
float semiMajorAxis = planets[0].A; // in AU (1AU = 149 597 870 700m)
float eccentricity = planets[0].ECC;
if (isnan(planets[0].ECC))
{
if (isnan(planets[0].ECC)) {
eccentricity = 0.0;
}
float starRadius = planets[0].RSTAR; // in Solar Radii
@@ -402,7 +393,6 @@ namespace openspace::exoplanets{
glm::dvec3 cameraPosition = starPosition + ((4.0 * semiMajorAxis * 149597870700.0) * starToSunVec);
//glm::dvec3 cameraPosition = starPosition + ((3.0 * semiMajorAxis * 149597870700.0) * faceOnVector);
moveCamera(cameraPosition);
// END CAMERA
toggleVisabilityPlanet(planetNames[0], "true");
@@ -430,6 +420,7 @@ namespace openspace::exoplanets{
//addDirectionsMarkers(viewDirectionPos, northDirectionPos, starRadius);
// END MARKERS
}
void DiscoveryMethods::removeTransitMethodVisualization() {
std::vector<std::string> planetNames = global::moduleEngine.module<ExoplanetsModule>()->getPlna();
//SCALE STAR AND PLANET
@@ -438,7 +429,10 @@ namespace openspace::exoplanets{
scaleNode(planetNames[0], 1);
// REMOVE GRAPH
std::string script = "openspace.removeScreenSpaceRenderable('Transit3');openspace.removeScreenSpaceRenderable('Transit2');openspace.removeScreenSpaceRenderable('Transit1');";
std::string script = "openspace.removeScreenSpaceRenderable('Transit3');"
"openspace.removeScreenSpaceRenderable('Transit2');"
"openspace.removeScreenSpaceRenderable('Transit1');";
openspace::global::scriptEngine.queueScript(
script,
openspace::scripting::ScriptEngine::RemoteScripting::Yes
@@ -448,24 +442,22 @@ namespace openspace::exoplanets{
//removeDirectionsMarkers();
}
void DiscoveryMethods::addSolarSystemReferenceVisualization() {
std::string starName = global::moduleEngine.module<ExoplanetsModule>()->getStarName();
std::vector<Exoplanet> planets = global::moduleEngine.module<ExoplanetsModule>()->getPlsy();
std::vector<std::string> planetNames = global::moduleEngine.module<ExoplanetsModule>()->getPlna();
// SUN
const std::string sunRef = "{"
"Identifier = 'SunReference',"
"Parent = '" + starName + "',"
"Renderable = {"
"Type = 'RenderablePlaneImageLocal',"
"Size = 6.957E8," //RSTAR. in meters. 1 solar radii = 6.95700×10e8 m
"Billboard = true,"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/target-blue-ring.png'),"
"BlendMode = 'Additive'"
"},"
"Identifier = 'SunReference',"
"Parent = '" + starName + "',"
"Renderable = {"
"Type = 'RenderablePlaneImageLocal',"
"Size = 6.957E8," //RSTAR. in meters. 1 solar radii = 6.95700×10e8 m
"Billboard = true,"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/target-blue-ring.png'),"
"BlendMode = 'Additive'"
"},"
"Transform = {"
"Translation = {"
"Type = 'StaticTranslation',"
@@ -507,9 +499,9 @@ namespace openspace::exoplanets{
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
}
glm::dmat3 rotation = global::moduleEngine.module<ExoplanetsModule>()->getRotation();
// ORBIT
const std::string orbitRef = "{"
"Identifier = 'OrbitReference',"
@@ -546,46 +538,40 @@ namespace openspace::exoplanets{
);
}
DiscoveryMethods::DiscoveryMethods()
: PropertyOwner({ "DiscoveryMethods" })
, _showTransit(TransitMethodInfo, false)
, _showDoppler(DopplerMethodInfo, false)
, _showSolarSystemReference(SolarSystemReferenceInfo, false)
{
DiscoveryMethods::DiscoveryMethods()
: PropertyOwner({ "DiscoveryMethods" })
, _showTransit(TransitMethodInfo, false)
, _showDoppler(DopplerMethodInfo, false)
, _showSolarSystemReference(SolarSystemReferenceInfo, false)
{
_showTransit.onChange([&]() {
if (_showTransit) //just changed to true
{
if (_showDoppler) //only one viz at the time
{
if (_showDoppler) { //only one viz at the time
_showDoppler = false;
removeDopplerMethodVisualization();
}
addTransitMethodVisualization();
}
else //just changed to false
{
else { //just changed to false
removeTransitMethodVisualization();
}
});
addProperty(_showTransit);
_showDoppler.onChange([&]() {
if (_showDoppler) //just changed to true
{
if (_showTransit)
{
if (_showTransit) {
_showTransit = false;
removeTransitMethodVisualization();
}
addDopplerMethodVisualization();
}
else //just changed to false
{
else { //just changed to false
removeDopplerMethodVisualization();
}
});
addProperty(_showDoppler);
@@ -598,7 +584,5 @@ namespace openspace::exoplanets{
}
});
addProperty(_showSolarSystemReference);
}
}
} // namespce

View File

@@ -28,12 +28,11 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
namespace openspace::exoplanets {
class DiscoveryMethods : public properties::PropertyOwner {
public:
DiscoveryMethods();
DiscoveryMethods();
bool isDoppler();
bool isTransit();
bool isReference();
@@ -42,9 +41,9 @@ public:
float getTransitScaleFactor();
private:
properties::BoolProperty _showTransit;
properties::BoolProperty _showDoppler;
properties::BoolProperty _showSolarSystemReference;
properties::BoolProperty _showTransit;
properties::BoolProperty _showDoppler;
properties::BoolProperty _showSolarSystemReference;
void addSolarSystemReferenceVisualization();
void removeSolarSystemReferenceVisualization();
@@ -62,7 +61,6 @@ private:
void toggleVisabilityPlanet(std::string, std::string);
float _transitScaleFactor;
};
} // namespace

View File

@@ -90,7 +90,6 @@ glm::dvec3 ExoplanetsModule::getNorthVector() {
}
scripting::LuaLibrary ExoplanetsModule::luaLibrary() const {
scripting::LuaLibrary res;
res.name = "exoplanets";
res.functions = {
@@ -108,14 +107,12 @@ scripting::LuaLibrary ExoplanetsModule::luaLibrary() const {
"string",
"Removes the nodes from the scene graph of the exoplanet system."
}
};
return res;
}
void ExoplanetsModule::internalInitialize(const ghoul::Dictionary&) {
auto fTask = FactoryManager::ref().factory<Task>();
auto fRenderable = FactoryManager::ref().factory<Renderable>();
ghoul_assert(fTask, "No task factory existed");
@@ -129,9 +126,7 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary&) {
// Render
global::callback::render.push_back([&]() {
if (_discoveryMethods->isDoppler())
{
if (_discoveryMethods->isDoppler()) {
std::string starName = global::moduleEngine.module<ExoplanetsModule>()->getStarName();
std::vector<std::string> planetNames = global::moduleEngine.module<ExoplanetsModule>()->getPlna();
SceneGraphNode* planetNode = global::renderEngine.scene()->sceneGraphNode(planetNames[0]);
@@ -141,34 +136,31 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary&) {
glm::dvec3 starToPosVec = normalize(planetPos - starPos);
glm::dvec3 starToSunVec = normalize(glm::dvec3(0.0, 0.0, 0.0) - starPos);
glm::dvec3 north = glm::dvec3(0.0, 0.0, 1.0);
glm::dvec3 northProjected = glm::normalize(glm::length(north)*glm::sin(glm::dot(north, starToSunVec)) * glm::cross(starToSunVec, glm::cross(north, starToSunVec)));
glm::dvec3 northProjected = glm::normalize(
glm::length(north) * glm::sin(glm::dot(north, starToSunVec)) * glm::cross(starToSunVec, glm::cross(north, starToSunVec))
);
float northAngle = glm::acos(glm::dot(starToPosVec, northProjected)) * 57.2957795;
float viewAngle = glm::acos(glm::dot(starToPosVec, starToSunVec)) * 57.2957795;
float imagePos = 0;
if ( viewAngle <= 90.0 && northAngle <= 90.0)
{
if ( viewAngle <= 90.0 && northAngle <= 90.0) {
imagePos = viewAngle / -90.0;
}
else if (viewAngle > 90.0 && northAngle <= 90.0)
{
else if (viewAngle > 90.0 && northAngle <= 90.0) {
imagePos = (180.0 - viewAngle) / -90.0;
}
else if (viewAngle > 90.0 && northAngle > 90.0)
{
else if (viewAngle > 90.0 && northAngle > 90.0) {
imagePos = (180.0 - viewAngle) / 90.0;
}
else if (viewAngle <= 90.0 && northAngle > 90.0)
{
else if (viewAngle <= 90.0 && northAngle > 90.0) {
imagePos = viewAngle / 90.0;
}
imagePos *= 0.01;
_discoveryMethods->setDopplerImagePos(imagePos);
}
if (_discoveryMethods->isTransit()) {
if (_discoveryMethods->isTransit()) {
std::string starName = global::moduleEngine.module<ExoplanetsModule>()->getStarName();
std::vector<std::string> planetNames = global::moduleEngine.module<ExoplanetsModule>()->getPlna();
SceneGraphNode* planetNode = global::renderEngine.scene()->sceneGraphNode(planetNames[0]);
@@ -189,32 +181,27 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary&) {
glm::dvec3 posVecProjected = starToPosVec - (((dot(starToPosVec, starToSunVec)) / (glm::length(starToSunVec)))*starToSunVec);
float l = glm::length(posVecProjected); //in m
float imageYPos = -0.60;
if (l<(starRadius*0.82) && viewAngle <= 90.0) {
imageYPos = -0.80;
}
float imageXPos = 0;
if (viewAngle <= 90.0 && northAngle <= 90.0)
{
imageXPos = (viewAngle / 90.0) * 0.5;
if (viewAngle <= 90.0 && northAngle <= 90.0) {
imageXPos = (viewAngle / 90.0) * 0.5;
}
else if (viewAngle > 90.0 && northAngle <= 90.0)
{
imageXPos = (viewAngle / 90.0) * 0.5;
else if (viewAngle > 90.0 && northAngle <= 90.0) {
imageXPos = (viewAngle / 90.0) * 0.5;
}
else if (viewAngle > 90.0 && northAngle > 90.0)
{
imageXPos = (viewAngle / 90.0) * -0.5;
else if (viewAngle > 90.0 && northAngle > 90.0) {
imageXPos = (viewAngle / 90.0) * -0.5;
}
else if (viewAngle <= 90.0 && northAngle > 90.0)
{
imageXPos = (viewAngle / 90.0) * -0.5;
else if (viewAngle <= 90.0 && northAngle > 90.0) {
imageXPos = (viewAngle / 90.0) * -0.5;
}
imageXPos *= 0.5;
_discoveryMethods->setTransitImagePos(imageXPos, imageYPos);
}
});
}

View File

@@ -33,50 +33,50 @@
#include <modules/exoplanets/discoverymethods/discoverymethods.h>
namespace openspace {
struct Exoplanet {
float A;
double AUPPER;
double ALOWER;
double UA;
float BIGOM;
float BIGOMUPPER;
float BIGOMLOWER;
float UBIGOM;
bool BINARY;
float BMV;
float ECC;
float ECCUPPER;
float ECCLOWER;
float UECC;
float I;
float IUPPER;
float ILOWER;
float UI;
int NCOMP;
float OM;
float OMUPPER;
float OMLOWER;
float UOM;
double PER;
float PERUPPER;
float PERLOWER;
float UPER;
double R;
double RUPPER;
double RLOWER;
double UR;
float RSTAR;
float RSTARUPPER;
float RSTARLOWER;
float URSTAR;
double TT;
float TTUPPER;
float TTLOWER;
float UTT;
float POSITIONX;
float POSITIONY;
float POSITIONZ;
};
struct Exoplanet {
float A;
double AUPPER;
double ALOWER;
double UA;
float BIGOM;
float BIGOMUPPER;
float BIGOMLOWER;
float UBIGOM;
bool BINARY;
float BMV;
float ECC;
float ECCUPPER;
float ECCLOWER;
float UECC;
float I;
float IUPPER;
float ILOWER;
float UI;
int NCOMP;
float OM;
float OMUPPER;
float OMLOWER;
float UOM;
double PER;
float PERUPPER;
float PERLOWER;
float UPER;
double R;
double RUPPER;
double RLOWER;
double UR;
float RSTAR;
float RSTARUPPER;
float RSTARLOWER;
float URSTAR;
double TT;
float TTUPPER;
float TTLOWER;
float UTT;
float POSITIONX;
float POSITIONY;
float POSITIONZ;
};
class ExoplanetsModule : public OpenSpaceModule {
public:
@@ -89,25 +89,25 @@ public:
std::vector<documentation::Documentation> documentations() const override;
void setClosestExoplanet(Exoplanet);
Exoplanet getClosestExoplanet();
void setStarName(std::string);
std::string getStarName();
void setClosestExoplanet(Exoplanet);
Exoplanet getClosestExoplanet();
void setStarName(std::string);
std::string getStarName();
void setPlsy(std::vector<Exoplanet>);
std::vector<Exoplanet> getPlsy();
void setPlna(std::vector<std::string>);
std::vector<std::string> getPlna();
void setRotation(glm::dmat3);
glm::dmat3 getRotation();
void setNorthVector(glm::dvec3);
void setNorthVector(glm::dvec3);
glm::dvec3 getNorthVector();
protected:
void internalInitialize(const ghoul::Dictionary&) override;
std::unique_ptr<openspace::exoplanets::DiscoveryMethods> _discoveryMethods;
Exoplanet _exo;
std::string _starName;
Exoplanet _exo;
std::string _starName;
std::vector<Exoplanet> _plsy;
std::vector<std::string> _plna;
glm::dmat3 _rotation;

View File

@@ -41,31 +41,31 @@
namespace openspace{
std::string getStarColor(float bv) {
std::string colorString;
std::string colorString;
std::ifstream colormap(absPath("${MODULE_EXOPLANETS}/colorbv.cmap"), std::ios::in);
if (!colormap.good()) {
std::cout << "Failed to open colormap data file";
}
std::ifstream colormap(absPath("${MODULE_EXOPLANETS}/colorbv.cmap"), std::ios::in);
if (!colormap.good()) {
std::cout << "Failed to open colormap data file";
}
int t = round(((bv + 0.4) / (2.0 + 0.4)) * 255);
int t = round(((bv + 0.4) / (2.0 + 0.4)) * 255);
std::string color;
for (size_t i = 0; i < t + 12; i++)
{
getline(colormap, color);
}
std::string color;
for (size_t i = 0; i < t + 12; i++)
{
getline(colormap, color);
}
std::istringstream colorstream(color);
std::string r, g, b;
getline(colorstream, r, ' ');
getline(colorstream, g, ' ');
getline(colorstream, b, ' ');
colorString = "{" + r + ", " + g + ", " + b + "}";
std::istringstream colorstream(color);
std::string r, g, b;
getline(colorstream, r, ' ');
getline(colorstream, g, ' ');
getline(colorstream, b, ' ');
colorString = "{" + r + ", " + g + ", " + b + "}";
colormap.close();
colormap.close();
return colorString;
return colorString;
}
glm::dmat4 computeOrbitPlaneRotationMatrix(float i, float bigom, float om , glm::dmat3 rot) {
@@ -75,24 +75,24 @@ glm::dmat4 computeOrbitPlaneRotationMatrix(float i, float bigom, float om , glm:
//const glm::dvec3 ascendingNodeAxisRot = glm::dvec3(0.f, 0.f, 1.f);
const glm::dvec3 inclinationAxisRot = rot * glm::dvec3(1.f, 0.f, 0.f );
//const glm::dvec3 inclinationAxisRot = glm::dvec3(1.f, 0.f, 0.f );
const glm::vec3 argPeriapsisAxisRot = rot * glm::dvec3( 0.f, 0.f, 1.f );
//const glm::vec3 argPeriapsisAxisRot = glm::dvec3( 0.f, 0.f, 1.f );
const glm::vec3 argPeriapsisAxisRot = rot * glm::dvec3( 0.f, 0.f, 1.f );
//const glm::vec3 argPeriapsisAxisRot = glm::dvec3( 0.f, 0.f, 1.f );
/*const glm::vec3 ascendingNodeAxisRot = { 0.f, 0.f, 1.f };
const glm::vec3 inclinationAxisRot = { 1.f, 0.f, 0.f };
const glm::vec3 argPeriapsisAxisRot = { 0.f, 0.f, 1.f };*/
const double asc = glm::radians(bigom);
const double inc = glm::radians(i);
const double per = glm::radians(om);
const double asc = glm::radians(bigom);
const double inc = glm::radians(i);
const double per = glm::radians(om);
glm::dmat4 orbitPlaneRotation =
glm::dmat4 orbitPlaneRotation =
glm::rotate(asc, glm::dvec3(ascendingNodeAxisRot)) *
glm::rotate(inc, glm::dvec3(inclinationAxisRot)) *
glm::rotate(per, glm::dvec3(argPeriapsisAxisRot));
glm::rotate(inc, glm::dvec3(inclinationAxisRot)) *
glm::rotate(per, glm::dvec3(argPeriapsisAxisRot));
return orbitPlaneRotation;
//return std::to_string(orbitPlaneRotation);
return orbitPlaneRotation;
//return std::to_string(orbitPlaneRotation);
}
std::string getSpeckStarname(std::string csvName) {
@@ -190,97 +190,97 @@ std::string getSpeckStarname(std::string csvName) {
}
std::string getCsvStarname(std::string explName) {
std::string csvName = explName;
if (explName == "GJ 3021")
csvName = "HD 1237";
else if (explName == "MOA 2009-BLG-387L")
csvName = "MOA-2009-BLG-387L";
else if (explName == "HD 126614")
csvName = "HD 126614 A";
else if (explName == "HD 27442")
csvName = "epsilon Ret";
else if (explName == "PH1")
csvName = "PH-1";
else if (explName == "gam 1 Leo")
csvName = "gamma Leo A";
else if (explName == "OGLE 2007-BLG-368L")
csvName = "OGLE-2007-BLG-368L";
else if (explName == "alf Ari")
csvName = "alpha Ari";
else if (explName == "HD 160691")
csvName = "mu Ara";
else if (explName == "OGLE 2005-BLG-169L")
csvName = "OGLE-05-169L";
else if (explName == "HD 216435")
csvName = "tau Gru";
else if (explName == "HR 810")
csvName = "iota Hor";
else if (explName == "OGLE 2005-BLG-71L")
csvName = "OGLE-05-071L";
else if (explName == "OGLE 2003-BLG-235L")
csvName = "OGLE235-MOA53";
else if (explName == "MOA 2008-BLG-310L")
csvName = "MOA-2008-BLG-310L";
else if (explName == "KOI-351")
csvName = "KIC 11442793";
else if (explName == "OGLE 2006-BLG-109L")
csvName = "OGLE-2006-BLG-109L";
else if (explName == "HD 137388 A")
csvName = "HD 137388";
else if (explName == "kap CrB")
csvName = "kappa CrB";
else if (explName == "XO-2 N")
csvName = "XO-2";
else if (explName == "eps Tau")
csvName = "epsilon Tau";
else if (explName == "eps Eri")
csvName = "epsilon Eri";
else if (explName == "KOI-12")
csvName = "Kepler-448";
else if (explName == "ome Ser")
csvName = "omega Ser";
else if (explName == "MOA 2010-BLG-477L")
csvName = "MOA-2010-BLG-477L";
else if (explName == "HD 285968")
csvName = "GJ 176";
else if (explName == "BD-17 63")
csvName = "HIP 2247";
else if (explName == "MOA 2009-BLG-266L")
csvName = "MOA-2009-BLG-266L";
else if (explName == "KOI-94")
csvName = "Kepler-89";
else if (explName == "HIP 75458")
csvName = "iota Dra";
else if (explName == "MOA 2007-BLG-400L")
csvName = "MOA-2007-BLG-400L";
else if (explName == "ups And")
csvName = "upsilon And";
else if (explName == "OGLE 2011-BLG-251L")
csvName = "OGLE-2011-BLG-0251";
else if (explName == "OGLE 2005-BLG-390L")
csvName = "OGLE-05-390L";
else if (explName == "KOI-1257")
csvName = "Kepler-420";
else if (explName == "bet Pic")
csvName = "beta Pic";
else if (explName == "gam Cep")
csvName = "gamma Cep";
else if (explName == "MOA 2007-BLG-192L")
csvName = "MOA-2007-BLG-192L";
else if (explName == "MOA 2009-BLG-319L")
csvName = "MOA-2009-BLG-319L";
else if (explName == "omi CrB")
csvName = "omicron CrB";
else if (explName == "HD 62509")
csvName = "beta Gem";
else if (explName == "eps CrB")
csvName = "epsilon CrB";
else if (explName == "omi UMa")
csvName = "omicron UMa";
else if (explName == "HD 142022 A")
csvName = "HD 142022";
std::string csvName = explName;
if (explName == "GJ 3021")
csvName = "HD 1237";
else if (explName == "MOA 2009-BLG-387L")
csvName = "MOA-2009-BLG-387L";
else if (explName == "HD 126614")
csvName = "HD 126614 A";
else if (explName == "HD 27442")
csvName = "epsilon Ret";
else if (explName == "PH1")
csvName = "PH-1";
else if (explName == "gam 1 Leo")
csvName = "gamma Leo A";
else if (explName == "OGLE 2007-BLG-368L")
csvName = "OGLE-2007-BLG-368L";
else if (explName == "alf Ari")
csvName = "alpha Ari";
else if (explName == "HD 160691")
csvName = "mu Ara";
else if (explName == "OGLE 2005-BLG-169L")
csvName = "OGLE-05-169L";
else if (explName == "HD 216435")
csvName = "tau Gru";
else if (explName == "HR 810")
csvName = "iota Hor";
else if (explName == "OGLE 2005-BLG-71L")
csvName = "OGLE-05-071L";
else if (explName == "OGLE 2003-BLG-235L")
csvName = "OGLE235-MOA53";
else if (explName == "MOA 2008-BLG-310L")
csvName = "MOA-2008-BLG-310L";
else if (explName == "KOI-351")
csvName = "KIC 11442793";
else if (explName == "OGLE 2006-BLG-109L")
csvName = "OGLE-2006-BLG-109L";
else if (explName == "HD 137388 A")
csvName = "HD 137388";
else if (explName == "kap CrB")
csvName = "kappa CrB";
else if (explName == "XO-2 N")
csvName = "XO-2";
else if (explName == "eps Tau")
csvName = "epsilon Tau";
else if (explName == "eps Eri")
csvName = "epsilon Eri";
else if (explName == "KOI-12")
csvName = "Kepler-448";
else if (explName == "ome Ser")
csvName = "omega Ser";
else if (explName == "MOA 2010-BLG-477L")
csvName = "MOA-2010-BLG-477L";
else if (explName == "HD 285968")
csvName = "GJ 176";
else if (explName == "BD-17 63")
csvName = "HIP 2247";
else if (explName == "MOA 2009-BLG-266L")
csvName = "MOA-2009-BLG-266L";
else if (explName == "KOI-94")
csvName = "Kepler-89";
else if (explName == "HIP 75458")
csvName = "iota Dra";
else if (explName == "MOA 2007-BLG-400L")
csvName = "MOA-2007-BLG-400L";
else if (explName == "ups And")
csvName = "upsilon And";
else if (explName == "OGLE 2011-BLG-251L")
csvName = "OGLE-2011-BLG-0251";
else if (explName == "OGLE 2005-BLG-390L")
csvName = "OGLE-05-390L";
else if (explName == "KOI-1257")
csvName = "Kepler-420";
else if (explName == "bet Pic")
csvName = "beta Pic";
else if (explName == "gam Cep")
csvName = "gamma Cep";
else if (explName == "MOA 2007-BLG-192L")
csvName = "MOA-2007-BLG-192L";
else if (explName == "MOA 2009-BLG-319L")
csvName = "MOA-2009-BLG-319L";
else if (explName == "omi CrB")
csvName = "omicron CrB";
else if (explName == "HD 62509")
csvName = "beta Gem";
else if (explName == "eps CrB")
csvName = "epsilon CrB";
else if (explName == "omi UMa")
csvName = "omicron UMa";
else if (explName == "HD 142022 A")
csvName = "HD 142022";
return csvName;
return csvName;
}
// Rotate the original coordinate system (where x is pointing to First Point of Aries)
@@ -325,8 +325,8 @@ glm::dmat3 getExoplanetSystemRotation(glm::dvec3 start, glm::dvec3 end) {
int addExoplanetSystem(lua_State* L) {
const int StringLocation = -1;
const std::string starname = luaL_checkstring(L, StringLocation);
const int StringLocation = -1;
const std::string starname = luaL_checkstring(L, StringLocation);
//change expl-starname to exoplanet.csv-starname
std::string starname_csv = getCsvStarname(starname);
@@ -336,58 +336,58 @@ int addExoplanetSystem(lua_State* L) {
global::moduleEngine.module<ExoplanetsModule>()->setStarName(starname_speck);
std::ifstream data(absPath("${MODULE_EXOPLANETS}/expl_data.bin"), std::ios::in | std::ios::binary);
if (!data.good()) {
std::cout << "Failed to open exoplanets data file";
}
std::ifstream data(absPath("${MODULE_EXOPLANETS}/expl_data.bin"), std::ios::in | std::ios::binary);
if (!data.good()) {
std::cout << "Failed to open exoplanets data file";
}
std::ifstream lut(absPath("${MODULE_EXOPLANETS}/lookup.txt"));
if (!lut.good()) {
std::cout << "Failed to open exoplanets look-up table file";
}
std::ifstream lut(absPath("${MODULE_EXOPLANETS}/lookup.txt"));
if (!lut.good()) {
std::cout << "Failed to open exoplanets look-up table file";
}
//1. search lut for the starname and return the corresponding location
//2. go to that location in the data file
//3. read sizeof(exoplanet) bytes into an exoplanet object.
std::string planetname;
size_t len = 0;
Exoplanet p;
std::string line;
bool found = false;
//1. search lut for the starname and return the corresponding location
//2. go to that location in the data file
//3. read sizeof(exoplanet) bytes into an exoplanet object.
std::string planetname;
size_t len = 0;
Exoplanet p;
std::string line;
bool found = false;
std::vector<Exoplanet> plsy;
std::vector<std::string> plna;
while (getline(lut, line)) {
std::vector<Exoplanet> plsy;
std::vector<std::string> plna;
while (getline(lut, line)) {
std::istringstream ss(line);
getline(ss, planetname, ',');
std::istringstream ss(line);
getline(ss, planetname, ',');
if (planetname.compare(0, planetname.length() - 2, starname_speck) == 0) {
std::string location_s;
getline(ss, location_s);
long location = std::stol(location_s.c_str());
if (planetname.compare(0, planetname.length() - 2, starname_speck) == 0) {
std::string location_s;
getline(ss, location_s);
long location = std::stol(location_s.c_str());
data.seekg(location);
data.read((char*)&p, sizeof(struct Exoplanet));
data.seekg(location);
data.read((char*)&p, sizeof(struct Exoplanet));
plna.push_back(planetname);
plsy.push_back(p);
found = true;
plna.push_back(planetname);
plsy.push_back(p);
found = true;
}
}
}
}
data.close();
lut.close();
data.close();
lut.close();
global::moduleEngine.module<ExoplanetsModule>()->setPlna(plna);
global::moduleEngine.module<ExoplanetsModule>()->setPlsy(plsy);
global::moduleEngine.module<ExoplanetsModule>()->setClosestExoplanet(p);
if (found && !isnan(p.POSITIONX) && !isnan(p.A) && !isnan(p.PER)) //&& !p.BINARY
{
Time epoch;
double parsec = 0.308567756E17;
std::string script = "";
if (found && !isnan(p.POSITIONX) && !isnan(p.A) && !isnan(p.PER)) //&& !p.BINARY
{
Time epoch;
double parsec = 0.308567756E17;
std::string script = "";
glm::dvec3 position = glm::dvec3(p.POSITIONX * parsec , p.POSITIONY * parsec, p.POSITIONZ * parsec);
@@ -415,29 +415,29 @@ int addExoplanetSystem(lua_State* L) {
std::replace(starname_speck.begin(), starname_speck.end(), ' ', '_');
const std::string starParent = "{"
"Identifier = '" + starname_speck + "',"
"Parent = 'SolarSystemBarycenter',"
"Transform = {"
const std::string starParent = "{"
"Identifier = '" + starname_speck + "',"
"Parent = 'SolarSystemBarycenter',"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(exoplanetSystemRot) + ","
"},"
"Translation = {"
"Type = 'StaticTranslation',"
"Position = " + ghoul::to_string(position) + ","
"},"
"}"
"}";
"Translation = {"
"Type = 'StaticTranslation',"
"Position = " + ghoul::to_string(position) + ","
"},"
"}"
"}";
script = "openspace.addSceneGraphNode(" + starParent + ");";
script = "openspace.addSceneGraphNode(" + starParent + ");";
openspace::global::scriptEngine.queueScript(
script,
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
if (!isnan(p.RSTAR))
{
std::string color = getStarColor(p.BMV);
if (!isnan(p.RSTAR))
{
std::string color = getStarColor(p.BMV);
if (isnan(plsy[0].ECC))
{
@@ -463,37 +463,37 @@ int addExoplanetSystem(lua_State* L) {
else
sepoch_star = "2009-05-19T07:11:34.080";
const std::string starGlobe = "{"
"Identifier = '" + starname_speck + "Globe',"
"Parent = '" + starname_speck + "',"
"Renderable = {"
"Type = 'RenderableGlobe',"
"Radii = " + std::to_string(p.RSTAR) + " * 6.957E8,"
"SegmentsPerPatch = 64,"
"PerformShading = false,"
"Layers = {"
"ColorLayers = {"
"{"
"Identifier = 'StarColor',"
"Type = 'SolidColor',"
"Color = " + color + ","
"BlendMode = 'Normal',"
"Enabled = true"
"},"
"{"
"Identifier = 'StarTexture',"
"FilePath = openspace.absPath('${MODULE_EXOPLANETS}/sun.jpg'),"
"BlendMode = 'Color',"
"Enabled = true"
"}"
"}"
"}"
"},"
"Transform = {"
"Scale = {"
"Type = 'StaticScale',"
"Scale = 1.0,"
"},"
const std::string starGlobe = "{"
"Identifier = '" + starname_speck + "Globe',"
"Parent = '" + starname_speck + "',"
"Renderable = {"
"Type = 'RenderableGlobe',"
"Radii = " + std::to_string(p.RSTAR) + " * 6.957E8,"
"SegmentsPerPatch = 64,"
"PerformShading = false,"
"Layers = {"
"ColorLayers = {"
"{"
"Identifier = 'StarColor',"
"Type = 'SolidColor',"
"Color = " + color + ","
"BlendMode = 'Normal',"
"Enabled = true"
"},"
"{"
"Identifier = 'StarTexture',"
"FilePath = openspace.absPath('${MODULE_EXOPLANETS}/sun.jpg'),"
"BlendMode = 'Color',"
"Enabled = true"
"}"
"}"
"}"
"},"
"Transform = {"
"Scale = {"
"Type = 'StaticScale',"
"Scale = 1.0,"
"},"
"Translation = {"
"Type = 'KeplerTranslation',"
"Eccentricity = " + std::to_string(plsy[0].ECC) + "," //ECC
@@ -505,8 +505,8 @@ int addExoplanetSystem(lua_State* L) {
"Epoch = '" + sepoch_star + "'," //TT. JD to YYYY MM DD hh:mm:ss
"Period = " + std::to_string(plsy[0].PER) + "* 86400" //PER. 86 400sec = 1 day.
"}"
"}"
"}";
"}"
"}";
script = "";
script = " openspace.addSceneGraphNode(" + starGlobe + ");";
openspace::global::scriptEngine.queueScript(
@@ -515,26 +515,26 @@ int addExoplanetSystem(lua_State* L) {
);
//script = "";
//const std::string starGlare = "{"
// "Identifier = '" + starname_speck + "Glare',"
// "Parent = '" + starname_speck + "',"
// "Renderable = {"
// "Type = 'RenderablePlaneImageLocal',"
// "Size = " + std::to_string(p.RSTAR) + " * 5E9," //RSTAR. in meters. 1 solar radii = 6.95700×10e8 m
// "Billboard = true,"
// "Texture = 'C:/Users/Karin/Documents/OpenSpace/modules/exoplanets/target-blue.png',"
// "BlendMode = 'Additive'"
// "}"
// "}";
//const std::string starGlare = "{"
// "Identifier = '" + starname_speck + "Glare',"
// "Parent = '" + starname_speck + "',"
// "Renderable = {"
// "Type = 'RenderablePlaneImageLocal',"
// "Size = " + std::to_string(p.RSTAR) + " * 5E9," //RSTAR. in meters. 1 solar radii = 6.95700×10e8 m
// "Billboard = true,"
// "Texture = 'C:/Users/Karin/Documents/OpenSpace/modules/exoplanets/target-blue.png',"
// "BlendMode = 'Additive'"
// "}"
// "}";
//
//script = "openspace.addSceneGraphNode(" + starGlare + ");";
//script = "openspace.addSceneGraphNode(" + starGlare + ");";
//global::scriptEngine.queueScript(
// script,
// scripting::ScriptEngine::RemoteScripting::Yes
//);
}
}
for (size_t i = 0; i < plsy.size(); i++)
@@ -654,135 +654,135 @@ int addExoplanetSystem(lua_State* L) {
"},"
"Color = { 1, 1, 1 }"
"},"
"}";
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + planetTrail + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + planetTrail + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
if (!isnan(plsy[i].AUPPER) && !isnan(plsy[i].ALOWER))
{
if (!isnan(plsy[i].AUPPER) && !isnan(plsy[i].ALOWER))
{
// Get the orbit plane that the trail orbit and planet have from the KeplerTranslation
glm::dmat4 orbitPlaneRotationMatrix = computeOrbitPlaneRotationMatrix(plsy[i].I, plsy[i].BIGOM, plsy[i].OM, exoplanetSystemRot);
//glm::dmat4 orbitPlaneRotationMatrix = computeOrbitPlaneRotationMatrix(plsy[i].I, plsy[i].BIGOM, plsy[i].OM); // , exoplanetSystemRot);
glm::dmat3 rot = orbitPlaneRotationMatrix;
global::moduleEngine.module<ExoplanetsModule>()->setRotation(rot);
const std::string disc = "{"
"Identifier = '" + plna[i] + "Disc',"
"Parent = '" + starname_speck + "',"
const std::string disc = "{"
"Identifier = '" + plna[i] + "Disc',"
"Parent = '" + starname_speck + "',"
"Enabled = true,"
"Renderable = {"
"Type = 'RenderableOrbitdisc',"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/disc3.png'),"
"Size = " + std::to_string(plsy[i].A) + " * 149597870700," // 149 597 870 700 m = 1 AU. A
"Eccentricity = " + std::to_string(plsy[i].ECC) + ","
"Offset = { " + std::to_string(plsy[i].ALOWER) + ", " + std::to_string(plsy[i].AUPPER) + " }," //min / max extend
"Transparency = 0.5"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(rot) + ","
"}"
"},"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + disc + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
"Renderable = {"
"Type = 'RenderableOrbitdisc',"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/disc3.png'),"
"Size = " + std::to_string(plsy[i].A) + " * 149597870700," // 149 597 870 700 m = 1 AU. A
"Eccentricity = " + std::to_string(plsy[i].ECC) + ","
"Offset = { " + std::to_string(plsy[i].ALOWER) + ", " + std::to_string(plsy[i].AUPPER) + " }," //min / max extend
"Transparency = 0.5"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(rot) + ","
"}"
"},"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + disc + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
if (!isnan(plsy[i].ECCUPPER) && !isnan(plsy[i].ECCLOWER) && plsy[i].ECCUPPER > 0.0 && plsy[i].ECCLOWER > 0.0)
{
double lower_ecc = plsy[i].ECC - plsy[i].ECCLOWER;
if (lower_ecc < 0.0)
{
lower_ecc = 0.0;
}
const std::string discECCLOWER = "{"
"Identifier = '" + plna[i] + "discECCLOWER',"
"Parent = '" + starname_speck + "',"
"Renderable = {"
"Type = 'RenderableOrbitdisc',"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/discL.png'),"
"Size = " + std::to_string(plsy[i].A) + " * 149597870700," // 149 597 870 700 m = 1 AU. A
"Eccentricity = " + std::to_string(lower_ecc) + ","
"Offset = { " + std::to_string(plsy[i].ALOWER) + ", " + std::to_string(plsy[i].AUPPER) + " }," //min / max extend
"Transparency = 0.98,"
"Enabled = false"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
if (!isnan(plsy[i].ECCUPPER) && !isnan(plsy[i].ECCLOWER) && plsy[i].ECCUPPER > 0.0 && plsy[i].ECCLOWER > 0.0)
{
double lower_ecc = plsy[i].ECC - plsy[i].ECCLOWER;
if (lower_ecc < 0.0)
{
lower_ecc = 0.0;
}
const std::string discECCLOWER = "{"
"Identifier = '" + plna[i] + "discECCLOWER',"
"Parent = '" + starname_speck + "',"
"Renderable = {"
"Type = 'RenderableOrbitdisc',"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/discL.png'),"
"Size = " + std::to_string(plsy[i].A) + " * 149597870700," // 149 597 870 700 m = 1 AU. A
"Eccentricity = " + std::to_string(lower_ecc) + ","
"Offset = { " + std::to_string(plsy[i].ALOWER) + ", " + std::to_string(plsy[i].AUPPER) + " }," //min / max extend
"Transparency = 0.98,"
"Enabled = false"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(rot) + ","
"}"
"},"
"}";
"}"
"},"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + discECCLOWER + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + discECCLOWER + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
double upper_ecc = plsy[i].ECC + plsy[i].ECCUPPER;
if (upper_ecc > 1.0)
{
upper_ecc = 1.0;
}
const std::string discECCUPPER = "{"
"Identifier = '" + plna[i] + "discECCUPPER',"
"Parent = '" + starname_speck + "',"
"Renderable = {"
"Type = 'RenderableOrbitdisc',"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/discU.png'),"
"Size = " + std::to_string(plsy[i].A) + " * 149597870700," // 149 597 870 700 m = 1 AU. A
"Eccentricity = " + std::to_string(upper_ecc) + ","
"Offset = { " + std::to_string(plsy[i].ALOWER) + ", " + std::to_string(plsy[i].AUPPER) + " }," //min / max extend
"Transparency = 0.98,"
"Enabled = false"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
double upper_ecc = plsy[i].ECC + plsy[i].ECCUPPER;
if (upper_ecc > 1.0)
{
upper_ecc = 1.0;
}
const std::string discECCUPPER = "{"
"Identifier = '" + plna[i] + "discECCUPPER',"
"Parent = '" + starname_speck + "',"
"Renderable = {"
"Type = 'RenderableOrbitdisc',"
"Texture = openspace.absPath('${MODULE_EXOPLANETS}/discU.png'),"
"Size = " + std::to_string(plsy[i].A) + " * 149597870700," // 149 597 870 700 m = 1 AU. A
"Eccentricity = " + std::to_string(upper_ecc) + ","
"Offset = { " + std::to_string(plsy[i].ALOWER) + ", " + std::to_string(plsy[i].AUPPER) + " }," //min / max extend
"Transparency = 0.98,"
"Enabled = false"
"},"
"Transform = {"
"Rotation = {"
"Type = 'StaticRotation',"
"Rotation = " + ghoul::to_string(rot) + ","
"}"
"},"
"}";
"}"
"},"
"}";
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + discECCUPPER + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
}
}
openspace::global::scriptEngine.queueScript(
"openspace.addSceneGraphNode(" + discECCUPPER + ");",
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
}
}
}
}
}
else
{
printf("No star with that name or not enough data about it.");
}
}
else
{
printf("No star with that name or not enough data about it.");
}
return 0;
return 0;
}
int removeExoplanetSystem(lua_State* L) {
const int StringLocation = -1;
const std::string starname = luaL_checkstring(L, StringLocation);
const int StringLocation = -1;
const std::string starname = luaL_checkstring(L, StringLocation);
std::string starname_speck = getSpeckStarname(starname);
std::replace(starname_speck.begin(), starname_speck.end(), ' ', '_');
std::string script = "openspace.removeSceneGraphNode('" + starname_speck + "');";
openspace::global::scriptEngine.queueScript(
script,
scripting::ScriptEngine::RemoteScripting::Yes
);
std::string script = "openspace.removeSceneGraphNode('" + starname_speck + "');";
openspace::global::scriptEngine.queueScript(
script,
scripting::ScriptEngine::RemoteScripting::Yes
);
return 0;
return 0;
}
} //namespace

View File

@@ -219,9 +219,9 @@ void RenderableOrbitdisc::deinitializeGL() {
void RenderableOrbitdisc::render(const RenderData& data, RendererTasks&) {
_shader->activate();
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;

View File

@@ -79,7 +79,6 @@ private:
GLuint _quad;
GLuint _vertexPositionBuffer;
bool _planeIsDirty;
};
} // namespace openspace

View File

@@ -44,7 +44,6 @@ uniform vec3 sunPosition;
Fragment getFragment() {
// Moving the origin to the center
vec2 st = (vs_st - vec2(0.5)) * 2.0;
// The length of the texture coordinates vector is our distance from the center
float outer;

View File

@@ -43,5 +43,4 @@ void main() {
modelViewProjectionTransform * vec4(in_position.xy, 0.0, 1.0)
);
gl_Position = vs_position;
}

File diff suppressed because it is too large Load Diff

View File

@@ -50,48 +50,48 @@ private:
glm::vec3 getStarPosition(std::string starName);
struct Exoplanet {
float A;
double AUPPER;
double ALOWER;
double UA;
float BIGOM;
float BIGOMUPPER;
float BIGOMLOWER;
float UBIGOM;
int BINARY; // **one or more stars**
float A;
double AUPPER;
double ALOWER;
double UA;
float BIGOM;
float BIGOMUPPER;
float BIGOMLOWER;
float UBIGOM;
int BINARY; // **one or more stars**
float BMV;
float ECC;
float ECCUPPER;
float ECCLOWER;
float UECC;
float I;
float IUPPER;
float ILOWER;
float UI;
int NCOMP; // **number of planets**
float OM;
float OMUPPER;
float OMLOWER;
float UOM;
double PER;
float PERUPPER;
float PERLOWER;
float UPER;
double R;
double RUPPER;
double RLOWER;
double UR;
float RSTAR;
float RSTARUPPER;
float RSTARLOWER;
float URSTAR;
double TT;
float TTUPPER;
float TTLOWER;
float UTT;
float POSITIONX;
float POSITIONY;
float POSITIONZ;
float ECC;
float ECCUPPER;
float ECCLOWER;
float UECC;
float I;
float IUPPER;
float ILOWER;
float UI;
int NCOMP; // **number of planets**
float OM;
float OMUPPER;
float OMLOWER;
float UOM;
double PER;
float PERUPPER;
float PERLOWER;
float UPER;
double R;
double RUPPER;
double RLOWER;
double UR;
float RSTAR;
float RSTARUPPER;
float RSTARLOWER;
float URSTAR;
double TT;
float TTUPPER;
float TTLOWER;
float UTT;
float POSITIONX;
float POSITIONY;
float POSITIONZ;
};
};