mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-20 03:00:03 -06:00
Fail to initialize asset, debris, satellites_shared:184
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
asset.request('./debris/debris_breezem')
|
||||
-- asset.request('./debris/debris_fengyun')
|
||||
asset.request('./debris/debris_fengyun')
|
||||
asset.request('./debris/debris_iridium33')
|
||||
asset.request('./debris/debris_kosmos2251')
|
||||
|
||||
@@ -100,7 +100,7 @@ local addSatelliteGroupObjects = function(group, tleFolder, shouldAddDuplicates)
|
||||
-- }
|
||||
-- end
|
||||
-- -------------------------------------------------------------------------------------
|
||||
function test(title, file, lineNum, per, color, group)
|
||||
function test(title, file, per, color, group)
|
||||
return {
|
||||
Identifier = title,
|
||||
Parent = transforms.EarthInertial.Identifier,
|
||||
@@ -113,8 +113,7 @@ local addSatelliteGroupObjects = function(group, tleFolder, shouldAddDuplicates)
|
||||
Type = "TLETranslation",
|
||||
Body = title,
|
||||
Observer = transforms.EarthInertial.Identifier,
|
||||
File = file,
|
||||
LineNumber = lineNum
|
||||
File = file
|
||||
},
|
||||
|
||||
-- Size = 3e4,
|
||||
@@ -181,7 +180,7 @@ local addSatelliteGroupObjects = function(group, tleFolder, shouldAddDuplicates)
|
||||
|
||||
if shouldAddNotes then
|
||||
-- Register satellite object and trail
|
||||
local test_var = test(satName, path, n, per, group.TrailColor, group.Title)
|
||||
local test_var = test(satName, path, per, group.TrailColor, group.Title)
|
||||
openspace.addSceneGraphNode(test_var)
|
||||
table.insert(obj, test_var.Identifier)
|
||||
|
||||
|
||||
@@ -105,6 +105,12 @@ namespace {
|
||||
constexpr const char* KeyFile = "File";
|
||||
constexpr const char* KeyLineNumber = "LineNumber";
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
// The list of leap years only goes until 2056 as we need to touch this file then
|
||||
// again anyway ;)
|
||||
const std::vector<int> LeapYears = {
|
||||
@@ -297,300 +303,305 @@ namespace {
|
||||
return semiMajorAxis / 1000.0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation ElonsTest::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"ElonsTest",
|
||||
"space_elons_test",
|
||||
{
|
||||
documentation::Documentation ElonsTest::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"ElonsTest",
|
||||
"space_elons_test",
|
||||
{
|
||||
SegmentsInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::No,
|
||||
SegmentsInfo.description
|
||||
},
|
||||
{
|
||||
PathInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
PathInfo.description
|
||||
},
|
||||
{
|
||||
EccentricityColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
EccentricityColumnInfo.description
|
||||
},
|
||||
{
|
||||
SemiMajorAxisColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
SemiMajorAxisColumnInfo.description
|
||||
},
|
||||
{
|
||||
SemiMajorAxisUnitInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::No,
|
||||
SemiMajorAxisUnitInfo.description
|
||||
},
|
||||
{
|
||||
InclinationColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
InclinationColumnInfo.description
|
||||
},
|
||||
{
|
||||
AscendingNodeColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
AscendingNodeColumnInfo.description
|
||||
},
|
||||
{
|
||||
ArgumentOfPeriapsisColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
ArgumentOfPeriapsisColumnInfo.description
|
||||
},
|
||||
{
|
||||
MeanAnomalyAtEpochColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
MeanAnomalyAtEpochColumnInfo.description
|
||||
},
|
||||
{
|
||||
EpochColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
EpochColumnInfo.description
|
||||
{
|
||||
SegmentsInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::No,
|
||||
SegmentsInfo.description
|
||||
},
|
||||
{
|
||||
PathInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
PathInfo.description
|
||||
},
|
||||
{
|
||||
EccentricityColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
EccentricityColumnInfo.description
|
||||
},
|
||||
{
|
||||
SemiMajorAxisColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
SemiMajorAxisColumnInfo.description
|
||||
},
|
||||
{
|
||||
SemiMajorAxisUnitInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::No,
|
||||
SemiMajorAxisUnitInfo.description
|
||||
},
|
||||
{
|
||||
InclinationColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
InclinationColumnInfo.description
|
||||
},
|
||||
{
|
||||
AscendingNodeColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
AscendingNodeColumnInfo.description
|
||||
},
|
||||
{
|
||||
ArgumentOfPeriapsisColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
ArgumentOfPeriapsisColumnInfo.description
|
||||
},
|
||||
{
|
||||
MeanAnomalyAtEpochColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
MeanAnomalyAtEpochColumnInfo.description
|
||||
},
|
||||
{
|
||||
EpochColumnInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
EpochColumnInfo.description
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ElonsTest::ElonsTest(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _path(PathInfo)
|
||||
, _nSegments(SegmentsInfo)
|
||||
, _eccentricityColumnName(EccentricityColumnInfo)
|
||||
, _semiMajorAxisColumnName(SemiMajorAxisColumnInfo)
|
||||
, _semiMajorAxisUnit(SemiMajorAxisUnitInfo)
|
||||
, _inclinationColumnName(InclinationColumnInfo)
|
||||
, _ascendingNodeColumnName(AscendingNodeColumnInfo)
|
||||
, _argumentOfPeriapsisColumnName(ArgumentOfPeriapsisColumnInfo)
|
||||
, _meanAnomalyAtEpochColumnName(MeanAnomalyAtEpochColumnInfo)
|
||||
, _epochColumnName(EpochColumnInfo)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"ElonsTest"
|
||||
);
|
||||
|
||||
_path =
|
||||
dictionary.value<std::string>(PathInfo.identifier);
|
||||
_nSegments =
|
||||
static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
_eccentricityColumnName =
|
||||
dictionary.value<std::string>(EccentricityColumnInfo.identifier);
|
||||
_semiMajorAxisColumnName =
|
||||
dictionary.value<std::string>(SemiMajorAxisColumnInfo.identifier);
|
||||
_semiMajorAxisUnit =
|
||||
dictionary.value<double>(SemiMajorAxisUnitInfo.identifier);
|
||||
_inclinationColumnName =
|
||||
dictionary.value<std::string>(InclinationColumnInfo.identifier);
|
||||
_ascendingNodeColumnName =
|
||||
dictionary.value<std::string>(AscendingNodeColumnInfo.identifier);
|
||||
_argumentOfPeriapsisColumnName =
|
||||
dictionary.value<std::string>(ArgumentOfPeriapsisColumnInfo.identifier);
|
||||
_meanAnomalyAtEpochColumnName =
|
||||
dictionary.value<std::string>(MeanAnomalyAtEpochColumnInfo.identifier);
|
||||
_epochColumnName =
|
||||
dictionary.value<std::string>(EpochColumnInfo.identifier);
|
||||
|
||||
addProperty(_path);
|
||||
addProperty(_nSegments);
|
||||
addProperty(_semiMajorAxisUnit);
|
||||
|
||||
// TLE
|
||||
// documentation::testSpecificationAndThrow(
|
||||
// Documentation(),
|
||||
// dictionary,
|
||||
// "TLETranslation"
|
||||
// );
|
||||
|
||||
const std::string& file = dictionary.value<std::string>(KeyFile);
|
||||
ElonsTest::readTLEFile(file);
|
||||
|
||||
// !TLE
|
||||
} // !constructor
|
||||
// uses Renderables destructor?
|
||||
|
||||
void ElonsTest::readTLEFile(const std::string& filename) {
|
||||
ghoul_assert(FileSys.fileExists(filename), "The filename must exist");
|
||||
|
||||
std::ifstream file;
|
||||
file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
||||
file.open(filename);
|
||||
|
||||
// All of the Kepler element information
|
||||
struct KeplerParameters{
|
||||
double inclination = 0.0;
|
||||
double semiMajorAxis = 0.0;
|
||||
double ascendingNode = 0.0;
|
||||
double eccentricity = 0.0;
|
||||
double argumentOfPeriapsis = 0.0;
|
||||
double meanAnomaly = 0.0;
|
||||
double meanMotion = 0.0;
|
||||
double epoch = 0.0;
|
||||
};
|
||||
|
||||
std::vector<KeplerParameters> TLEData;
|
||||
|
||||
LINFO("");
|
||||
// int numberOfLines = std::count(std::istreambuf_iterator<char>(file),
|
||||
// std::istreambuf_iterator<char>(), '\n' );
|
||||
// 3 because a TLE has 3 lines per element/ object.
|
||||
// int numberOfObjects = numberOfLines/3;
|
||||
// for(int i=0 ; i<numberOfObjects; ++i){
|
||||
|
||||
|
||||
// TLEData.push_back();
|
||||
|
||||
// }
|
||||
|
||||
|
||||
std::string line;
|
||||
while(std::getline(file, line)) {
|
||||
|
||||
KeplerParameters keplerElements;
|
||||
|
||||
std::getline(file, line);
|
||||
if (line[0] == '1') {
|
||||
// First line
|
||||
// Field Columns Content
|
||||
// 1 01-01 Line number
|
||||
// 2 03-07 Satellite number
|
||||
// 3 08-08 Classification (U = Unclassified)
|
||||
// 4 10-11 International Designator (Last two digits of launch year)
|
||||
// 5 12-14 International Designator (Launch number of the year)
|
||||
// 6 15-17 International Designator(piece of the launch) A
|
||||
// 7 19-20 Epoch Year(last two digits of year)
|
||||
// 8 21-32 Epoch(day of the year and fractional portion of the day)
|
||||
// 9 34-43 First Time Derivative of the Mean Motion divided by two
|
||||
// 10 45-52 Second Time Derivative of Mean Motion divided by six
|
||||
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
|
||||
// 12 63-63 The "Ephemeris type"
|
||||
// 13 65-68 Element set number.Incremented when a new TLE is generated
|
||||
// 14 69-69 Checksum (modulo 10)
|
||||
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
|
||||
} else {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"File {} @ line {} does not have '1' header", filename // linNum + 1
|
||||
));
|
||||
}
|
||||
std::getline(file, line);
|
||||
if (line[0] == '2') {
|
||||
// Second line
|
||||
// Field Columns Content
|
||||
// 1 01-01 Line number
|
||||
// 2 03-07 Satellite number
|
||||
// 3 09-16 Inclination (degrees)
|
||||
// 4 18-25 Right ascension of the ascending node (degrees)
|
||||
// 5 27-33 Eccentricity (decimal point assumed)
|
||||
// 6 35-42 Argument of perigee (degrees)
|
||||
// 7 44-51 Mean Anomaly (degrees)
|
||||
// 8 53-63 Mean Motion (revolutions per day)
|
||||
// 9 64-68 Revolution number at epoch (revolutions)
|
||||
// 10 69-69 Checksum (modulo 10)
|
||||
|
||||
std::stringstream stream;
|
||||
stream.exceptions(std::ios::failbit);
|
||||
|
||||
// Get inclination
|
||||
stream.str(line.substr(8, 8));
|
||||
stream >> keplerElements.inclination;
|
||||
stream.clear();
|
||||
|
||||
// Get Right ascension of the ascending node
|
||||
stream.str(line.substr(17, 8));
|
||||
stream >> keplerElements.ascendingNode;
|
||||
stream.clear();
|
||||
|
||||
// Get Eccentricity
|
||||
stream.str("0." + line.substr(26, 7));
|
||||
stream >> keplerElements.eccentricity;
|
||||
stream.clear();
|
||||
|
||||
// Get argument of periapsis
|
||||
stream.str(line.substr(34, 8));
|
||||
stream >> keplerElements.argumentOfPeriapsis;
|
||||
stream.clear();
|
||||
|
||||
// Get mean anomaly
|
||||
stream.str(line.substr(43, 8));
|
||||
stream >> keplerElements.meanAnomaly;
|
||||
stream.clear();
|
||||
|
||||
// Get mean motion
|
||||
stream.str(line.substr(52, 11));
|
||||
stream >> keplerElements.meanMotion;
|
||||
} else {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"File {} @ line {} does not have '2' header", filename // , lineNum + 2
|
||||
));
|
||||
}
|
||||
|
||||
// Calculate the semi major axis based on the mean motion using kepler's laws
|
||||
keplerElements.semiMajorAxis = calculateSemiMajorAxis(keplerElements.meanMotion);
|
||||
|
||||
// Converting the mean motion (revolutions per day) to period (seconds per revolution)
|
||||
using namespace std::chrono;
|
||||
double period = seconds(hours(24)).count() / keplerElements.meanMotion;
|
||||
|
||||
_keplerTranslator.setKeplerElements(
|
||||
keplerElements.eccentricity,
|
||||
keplerElements.semiMajorAxis,
|
||||
keplerElements.inclination,
|
||||
keplerElements.ascendingNode,
|
||||
keplerElements.argumentOfPeriapsis,
|
||||
keplerElements.meanAnomaly,
|
||||
period,
|
||||
keplerElements.epoch
|
||||
ElonsTest::ElonsTest(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _path(PathInfo)
|
||||
, _nSegments(SegmentsInfo)
|
||||
, _eccentricityColumnName(EccentricityColumnInfo)
|
||||
, _semiMajorAxisColumnName(SemiMajorAxisColumnInfo)
|
||||
, _semiMajorAxisUnit(SemiMajorAxisUnitInfo)
|
||||
, _inclinationColumnName(InclinationColumnInfo)
|
||||
, _ascendingNodeColumnName(AscendingNodeColumnInfo)
|
||||
, _argumentOfPeriapsisColumnName(ArgumentOfPeriapsisColumnInfo)
|
||||
, _meanAnomalyAtEpochColumnName(MeanAnomalyAtEpochColumnInfo)
|
||||
, _epochColumnName(EpochColumnInfo)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"ElonsTest"
|
||||
);
|
||||
|
||||
TLEData.push_back(keplerElements);
|
||||
} // !while loop
|
||||
_path =
|
||||
dictionary.value<std::string>(PathInfo.identifier);
|
||||
_nSegments =
|
||||
static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
_eccentricityColumnName =
|
||||
dictionary.value<std::string>(EccentricityColumnInfo.identifier);
|
||||
_semiMajorAxisColumnName =
|
||||
dictionary.value<std::string>(SemiMajorAxisColumnInfo.identifier);
|
||||
_semiMajorAxisUnit =
|
||||
dictionary.value<double>(SemiMajorAxisUnitInfo.identifier);
|
||||
_inclinationColumnName =
|
||||
dictionary.value<std::string>(InclinationColumnInfo.identifier);
|
||||
_ascendingNodeColumnName =
|
||||
dictionary.value<std::string>(AscendingNodeColumnInfo.identifier);
|
||||
_argumentOfPeriapsisColumnName =
|
||||
dictionary.value<std::string>(ArgumentOfPeriapsisColumnInfo.identifier);
|
||||
_meanAnomalyAtEpochColumnName =
|
||||
dictionary.value<std::string>(MeanAnomalyAtEpochColumnInfo.identifier);
|
||||
_epochColumnName =
|
||||
dictionary.value<std::string>(EpochColumnInfo.identifier);
|
||||
|
||||
addProperty(_path);
|
||||
addProperty(_nSegments);
|
||||
// addProperty(_semiMajorAxisUnit);
|
||||
|
||||
// TLE
|
||||
// documentation::testSpecificationAndThrow(
|
||||
// Documentation(),
|
||||
// dictionary,
|
||||
// "TLETranslation"
|
||||
// );
|
||||
|
||||
const std::string& file = dictionary.value<std::string>(KeyFile);
|
||||
readTLEFile(file);
|
||||
|
||||
// !TLE
|
||||
} // !constructor
|
||||
// uses Renderables destructor?
|
||||
|
||||
void ElonsTest::readTLEFile(const std::string& filename) {
|
||||
ghoul_assert(FileSys.fileExists(filename), "The filename must exist");
|
||||
|
||||
std::ifstream file;
|
||||
file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
||||
file.open(filename);
|
||||
|
||||
file.close();
|
||||
}
|
||||
// All of the Kepler element information
|
||||
struct KeplerParameters{
|
||||
double inclination = 0.0;
|
||||
double semiMajorAxis = 0.0;
|
||||
double ascendingNode = 0.0;
|
||||
double eccentricity = 0.0;
|
||||
double argumentOfPeriapsis = 0.0;
|
||||
double meanAnomaly = 0.0;
|
||||
double meanMotion = 0.0;
|
||||
double epoch = 0.0;
|
||||
};
|
||||
|
||||
void ElonsTest::initialize(){
|
||||
// note to self, se vad Gene skrev. Fyll _vertexArray i init och
|
||||
// rendera bara orbits, inga rörliga delar.
|
||||
}
|
||||
std::vector<KeplerParameters> TLEData;
|
||||
|
||||
void ElonsTest::initializeGL() {
|
||||
_programObject = SpaceModule::ProgramObjectManager.request(
|
||||
ProgramName,
|
||||
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
|
||||
return global::renderEngine.buildRenderProgram(
|
||||
ProgramName,
|
||||
absPath("${MODULE_SPACE}/shaders/renderablekeplerorbits_vs.glsl"),
|
||||
absPath("${MODULE_SPACE}/shaders/renderablekeplerorbits_fs.glsl")
|
||||
// int numberOfLines = std::count(std::istreambuf_iterator<char>(file),
|
||||
// std::istreambuf_iterator<char>(), '\n' );
|
||||
// 3 because a TLE has 3 lines per element/ object.
|
||||
// int numberOfObjects = numberOfLines/3;
|
||||
// LINFO("Number of data elements: " + numberOfObjects);
|
||||
|
||||
// for(int i=0 ; i<numberOfObjects; ++i){
|
||||
|
||||
|
||||
// TLEData.push_back();
|
||||
|
||||
// }
|
||||
|
||||
|
||||
std::string line;
|
||||
while(std::getline(file, line)) {
|
||||
|
||||
KeplerParameters keplerElements;
|
||||
|
||||
std::getline(file, line);
|
||||
if (line[0] == '1') {
|
||||
// First line
|
||||
// Field Columns Content
|
||||
// 1 01-01 Line number
|
||||
// 2 03-07 Satellite number
|
||||
// 3 08-08 Classification (U = Unclassified)
|
||||
// 4 10-11 International Designator (Last two digits of launch year)
|
||||
// 5 12-14 International Designator (Launch number of the year)
|
||||
// 6 15-17 International Designator(piece of the launch) A
|
||||
// 7 19-20 Epoch Year(last two digits of year)
|
||||
// 8 21-32 Epoch(day of the year and fractional portion of the day)
|
||||
// 9 34-43 First Time Derivative of the Mean Motion divided by two
|
||||
// 10 45-52 Second Time Derivative of Mean Motion divided by six
|
||||
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
|
||||
// 12 63-63 The "Ephemeris type"
|
||||
// 13 65-68 Element set number.Incremented when a new TLE is generated
|
||||
// 14 69-69 Checksum (modulo 10)
|
||||
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
|
||||
} else {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"File {} @ line {} does not have '1' header", filename // linNum + 1
|
||||
));
|
||||
}
|
||||
std::getline(file, line);
|
||||
if (line[0] == '2') {
|
||||
// Second line
|
||||
// Field Columns Content
|
||||
// 1 01-01 Line number
|
||||
// 2 03-07 Satellite number
|
||||
// 3 09-16 Inclination (degrees)
|
||||
// 4 18-25 Right ascension of the ascending node (degrees)
|
||||
// 5 27-33 Eccentricity (decimal point assumed)
|
||||
// 6 35-42 Argument of perigee (degrees)
|
||||
// 7 44-51 Mean Anomaly (degrees)
|
||||
// 8 53-63 Mean Motion (revolutions per day)
|
||||
// 9 64-68 Revolution number at epoch (revolutions)
|
||||
// 10 69-69 Checksum (modulo 10)
|
||||
|
||||
std::stringstream stream;
|
||||
stream.exceptions(std::ios::failbit);
|
||||
|
||||
// Get inclination
|
||||
stream.str(line.substr(8, 8));
|
||||
stream >> keplerElements.inclination;
|
||||
stream.clear();
|
||||
|
||||
// Get Right ascension of the ascending node
|
||||
stream.str(line.substr(17, 8));
|
||||
stream >> keplerElements.ascendingNode;
|
||||
stream.clear();
|
||||
|
||||
// Get Eccentricity
|
||||
stream.str("0." + line.substr(26, 7));
|
||||
stream >> keplerElements.eccentricity;
|
||||
stream.clear();
|
||||
|
||||
// Get argument of periapsis
|
||||
stream.str(line.substr(34, 8));
|
||||
stream >> keplerElements.argumentOfPeriapsis;
|
||||
stream.clear();
|
||||
|
||||
// Get mean anomaly
|
||||
stream.str(line.substr(43, 8));
|
||||
stream >> keplerElements.meanAnomaly;
|
||||
stream.clear();
|
||||
|
||||
// Get mean motion
|
||||
stream.str(line.substr(52, 11));
|
||||
stream >> keplerElements.meanMotion;
|
||||
} else {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"File {} @ line {} does not have '2' header", filename // , lineNum + 2
|
||||
));
|
||||
}
|
||||
|
||||
// Calculate the semi major axis based on the mean motion using kepler's laws
|
||||
keplerElements.semiMajorAxis = calculateSemiMajorAxis(keplerElements.meanMotion);
|
||||
|
||||
// Converting the mean motion (revolutions per day) to period (seconds per revolution)
|
||||
using namespace std::chrono;
|
||||
double period = seconds(hours(24)).count() / keplerElements.meanMotion;
|
||||
|
||||
_keplerTranslator.setKeplerElements(
|
||||
keplerElements.eccentricity,
|
||||
keplerElements.semiMajorAxis,
|
||||
keplerElements.inclination,
|
||||
keplerElements.ascendingNode,
|
||||
keplerElements.argumentOfPeriapsis,
|
||||
keplerElements.meanAnomaly,
|
||||
period,
|
||||
keplerElements.epoch
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
TLEData.push_back(keplerElements);
|
||||
} // !while loop
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
void ElonsTest::initialize(){
|
||||
// note to self, se vad Gene skrev. Fyll _vertexArray i init och
|
||||
// rendera bara orbits, inga rörliga delar.
|
||||
}
|
||||
|
||||
void ElonsTest::initializeGL() {
|
||||
_programObject = SpaceModule::ProgramObjectManager.request(
|
||||
ProgramName,
|
||||
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
|
||||
return global::renderEngine.buildRenderProgram(
|
||||
ProgramName,
|
||||
absPath("${MODULE_SPACE}/shaders/renderablekeplerorbits_vs.glsl"),
|
||||
absPath("${MODULE_SPACE}/shaders/renderablekeplerorbits_fs.glsl")
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void ElonsTest::render(const RenderData& data, RendererTasks& rendererTask) {
|
||||
_programObject->activate();
|
||||
LINFO("render data: ", data);
|
||||
|
||||
}
|
||||
|
||||
void ElonsTest::update(const UpdateData& data) {
|
||||
|
||||
}
|
||||
|
||||
bool ElonsTest::isReady() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ElonsTest::render(const RenderData& data, RendererTasks& rendererTask) {
|
||||
|
||||
}
|
||||
|
||||
void ElonsTest::update(const UpdateData& data) {}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,11 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/uintproperty.h>
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
@@ -47,7 +52,7 @@ public:
|
||||
// void deinitialize();
|
||||
// void deinitialize();
|
||||
//
|
||||
// bool isReady() const;
|
||||
bool isReady() const;
|
||||
|
||||
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
@@ -58,7 +63,7 @@ public:
|
||||
protected:
|
||||
private:
|
||||
TLETranslation _tleTranslator;
|
||||
std::vector<KeplerTranslation::KeplerOrbit> _orbits;
|
||||
// std::vector<KeplerTranslation::KeplerOrbit> _orbits;
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
|
||||
KeplerTranslation _keplerTranslator;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
// #include <modules/space/rendering/renderablesatellites.h>
|
||||
// #include <modules/space/translation/keplertranslation.h>
|
||||
// #include <modules/space/translation/TLEtranslation.h>
|
||||
// #include <modules/space/spacemodule.h>
|
||||
|
||||
|
||||
@@ -550,11 +551,25 @@
|
||||
|
||||
// // Converting the mean motion (revolutions per day) to period (seconds per revolution)
|
||||
// using namespace std::chrono;
|
||||
// double period = seconds(hours(24)).count() / keplerElements.meanMotion;
|
||||
// double period = seconds(hours(24)).count() / keplerElements.meanMotion;
|
||||
|
||||
|
||||
// //TODO: fix obv
|
||||
// size_t i = 0;
|
||||
|
||||
// _orbits[i++] = KeplerTranslation::KeplerOrbit{
|
||||
// keplerElements.eccentricity,
|
||||
// keplerElements.semiMajorAxis,
|
||||
// keplerElements.inclination,
|
||||
// keplerElements.ascendingNode,
|
||||
// keplerElements.argumentOfPeriapsis,
|
||||
// keplerElements.meanAnomaly,
|
||||
// period,
|
||||
// keplerElements.epoch
|
||||
// };
|
||||
|
||||
|
||||
// /*
|
||||
// setKeplerElements(
|
||||
// KeplerTranslation setKeplerElements(
|
||||
// keplerElements.eccentricity,
|
||||
// keplerElements.semiMajorAxis,
|
||||
// keplerElements.inclination,
|
||||
|
||||
@@ -1,120 +1,128 @@
|
||||
// /****************************************************************************************
|
||||
// * *
|
||||
// * OpenSpace *
|
||||
// * *
|
||||
// * Copyright (c) 2014-2018 *
|
||||
// * *
|
||||
// * 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. *
|
||||
// ****************************************************************************************/
|
||||
// // /****************************************************************************************
|
||||
// // * *
|
||||
// // * OpenSpace *
|
||||
// // * *
|
||||
// // * Copyright (c) 2014-2018 *
|
||||
// // * *
|
||||
// // * 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. *
|
||||
// // ****************************************************************************************/
|
||||
|
||||
// #include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <modules/base/rendering/renderabletrail.h>
|
||||
#include <modules/space/translation/keplertranslation.h>
|
||||
#include <modules/space/translation/TLEtranslation.h>
|
||||
|
||||
// #include <modules/base/rendering/renderabletrail.h>
|
||||
// #include <modules/space/translation/keplertranslation.h>
|
||||
|
||||
// // #include <openspace/util/circlegeometry.h>
|
||||
// #include <openspace/properties/stringproperty.h>
|
||||
// #include <openspace/properties/scalar/uintproperty.h>
|
||||
|
||||
// #include <ghoul/opengl/programobject.h>
|
||||
// #include <ghoul/misc/objectmanager.h>
|
||||
|
||||
// #ifndef __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
|
||||
// #define __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
|
||||
|
||||
// namespace openspace {
|
||||
|
||||
// class RenderableSatellites : public Renderable {
|
||||
// public:
|
||||
// RenderableSatellites(const ghoul::Dictionary& dictionary);
|
||||
// virtual ~RenderableSatellites();
|
||||
// class RenderableSatellites : public Renderable {
|
||||
// public:
|
||||
// RenderableSatellites(const ghoul::Dictionary& dictionary);
|
||||
// virtual ~RenderableSatellites();
|
||||
|
||||
// void initialize() override;
|
||||
// void deinitialize() override;
|
||||
// void initializeGL() override;
|
||||
// void deinitializeGL() override;
|
||||
|
||||
// bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
// static documentation::Documentation Documentation();
|
||||
// void initialize() override;
|
||||
// void deinitialize() override;
|
||||
// void initializeGL() override;
|
||||
// void deinitializeGL() override;
|
||||
|
||||
// private:
|
||||
// /// The layout of the VBOs
|
||||
// struct TrailVBOLayout {
|
||||
// float x, y, z, time;
|
||||
// bool isReady() const override;
|
||||
|
||||
// void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
// void update(const UpdateData& data) override;
|
||||
|
||||
// /*
|
||||
// void setKeplerElements(double eccentricity, double semiMajorAxis, double inclination,
|
||||
// double ascendingNode, double argumentOfPeriapsis, double meanAnomalyAtEpoch,
|
||||
// double orbitalPeriod, double epoch);
|
||||
// */
|
||||
|
||||
// static documentation::Documentation Documentation();
|
||||
|
||||
// private:
|
||||
// /// The layout of the VBOs
|
||||
// struct TrailVBOLayout {
|
||||
// float x, y, z, time;
|
||||
// };
|
||||
|
||||
// /// The backend storage for the vertex buffer object containing all points for this
|
||||
// /// trail.
|
||||
// std::vector<TrailVBOLayout> _vertexBufferData;
|
||||
|
||||
// /// The index array that is potentially used in the draw call. If this is empty, no
|
||||
// /// element draw call is used.
|
||||
// std::vector<unsigned int> _indexBufferData;
|
||||
|
||||
// GLuint _vertexArray;
|
||||
// GLuint _vertexBuffer;
|
||||
// GLuint _indexBuffer;
|
||||
|
||||
// void readFromCsvFile();
|
||||
// void updateBuffers();
|
||||
|
||||
// std::vector<KeplerTranslation::KeplerOrbit> _orbits;
|
||||
// ghoul::opengl::ProgramObject* _programObject;
|
||||
// //ghoul::ObjectManager* _objectManager;
|
||||
|
||||
|
||||
// properties::StringProperty _path;
|
||||
// properties::UIntProperty _nSegments;
|
||||
|
||||
// properties::StringProperty _eccentricityColumnName;
|
||||
// properties::StringProperty _semiMajorAxisColumnName;
|
||||
// properties::DoubleProperty _semiMajorAxisUnit;
|
||||
// properties::StringProperty _inclinationColumnName;
|
||||
// properties::StringProperty _ascendingNodeColumnName;
|
||||
// properties::StringProperty _argumentOfPeriapsisColumnName;
|
||||
// properties::StringProperty _meanAnomalyAtEpochColumnName;
|
||||
// properties::StringProperty _epochColumnName;
|
||||
|
||||
// RenderableTrail::Appearance _appearance;
|
||||
|
||||
// UniformCache(opacity, modelView, projection, color, useLineFade, lineFade)
|
||||
// _uniformCache;
|
||||
|
||||
// /**
|
||||
// * Reads the provided TLE file and calles the KeplerTranslation::setKeplerElments
|
||||
// * method with the correct values. If \p filename is a valid TLE file but contains
|
||||
// * disallowed values (see KeplerTranslation::setKeplerElements), a
|
||||
// * KeplerTranslation::RangeError is thrown.
|
||||
// *
|
||||
// * \param filename The path to the file that contains the TLE file.
|
||||
// * \param lineNum The line number in the file where the set of 3 TLE lines starts
|
||||
// *
|
||||
// * \throw std::system_error if the TLE file is malformed (does not contain at least
|
||||
// * two lines that start with \c 1 and \c 2.
|
||||
// * \throw KeplerTranslation::RangeError If the Keplerian elements are outside of
|
||||
// * the valid range supported by Kepler::setKeplerElements
|
||||
// * \pre The \p filename must exist
|
||||
// */
|
||||
// void readTLEFile(const std::string& filename, int lineNum);
|
||||
// };
|
||||
|
||||
// /// The backend storage for the vertex buffer object containing all points for this
|
||||
// /// trail.
|
||||
// std::vector<TrailVBOLayout> _vertexBufferData;
|
||||
|
||||
// /// The index array that is potentially used in the draw call. If this is empty, no
|
||||
// /// element draw call is used.
|
||||
// std::vector<unsigned int> _indexBufferData;
|
||||
|
||||
// GLuint _vertexArray;
|
||||
// GLuint _vertexBuffer;
|
||||
// GLuint _indexBuffer;
|
||||
|
||||
// void readFromCsvFile();
|
||||
// void updateBuffers();
|
||||
|
||||
std::vector<KeplerTranslation::KeplerOrbit> _orbits;
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
//ghoul::ObjectManager* _objectManager;
|
||||
|
||||
// properties::StringProperty _path;
|
||||
// properties::UIntProperty _nSegments;
|
||||
|
||||
// properties::StringProperty _eccentricityColumnName;
|
||||
// properties::StringProperty _semiMajorAxisColumnName;
|
||||
// properties::DoubleProperty _semiMajorAxisUnit;
|
||||
// properties::StringProperty _inclinationColumnName;
|
||||
// properties::StringProperty _ascendingNodeColumnName;
|
||||
// properties::StringProperty _argumentOfPeriapsisColumnName;
|
||||
// properties::StringProperty _meanAnomalyAtEpochColumnName;
|
||||
// properties::StringProperty _epochColumnName;
|
||||
|
||||
// RenderableTrail::Appearance _appearance;
|
||||
|
||||
// UniformCache(opacity, modelView, projection, color, useLineFade, lineFade)
|
||||
// _uniformCache;
|
||||
|
||||
// /**
|
||||
// * Reads the provided TLE file and calles the KeplerTranslation::setKeplerElments
|
||||
// * method with the correct values. If \p filename is a valid TLE file but contains
|
||||
// * disallowed values (see KeplerTranslation::setKeplerElements), a
|
||||
// * KeplerTranslation::RangeError is thrown.
|
||||
// *
|
||||
// * \param filename The path to the file that contains the TLE file.
|
||||
// * \param lineNum The line number in the file where the set of 3 TLE lines starts
|
||||
// *
|
||||
// * \throw std::system_error if the TLE file is malformed (does not contain at least
|
||||
// * two lines that start with \c 1 and \c 2.
|
||||
// * \throw KeplerTranslation::RangeError If the Keplerian elements are outside of
|
||||
// * the valid range supported by Kepler::setKeplerElements
|
||||
// * \pre The \p filename must exist
|
||||
// */
|
||||
// void readTLEFile(const std::string& filename, int lineNum);
|
||||
// };
|
||||
|
||||
// #endif // __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
|
||||
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user