started building on a new renderable from scratch

This commit is contained in:
Elon
2019-03-28 17:24:07 -06:00
committed by ElonOlsson
parent 1aeee50c2a
commit 2d6ca18ec3
8 changed files with 1088 additions and 857 deletions

View File

@@ -25,7 +25,8 @@
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesatellites.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/elonstest.h
# ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesatellites.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometry.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableconstellationbounds.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanet.h
@@ -43,7 +44,8 @@ set(HEADER_FILES
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesatellites.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/elonstest.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesatellites.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableconstellationbounds.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanet.cpp

View File

@@ -0,0 +1,164 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* *
* 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 <modules/space/rendering/elonstest.h>
#include <ghoul/filesystem/filesystem.h>
#include <modules/space/spacemodule.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
namespace {
constexpr const char* ProgramName = "ElonsTest";
static const openspace::properties::Property::PropertyInfo PathInfo = {
"Path",
"Path",
"The file path to the CSV file to read"
};
static const openspace::properties::Property::PropertyInfo SegmentsInfo = {
"Segments",
"Segments",
"The number of segments to use for each orbit ellipse"
};
static const openspace::properties::Property::PropertyInfo EccentricityColumnInfo = {
"EccentricityColumn",
"EccentricityColumn",
"The header of the column where the eccentricity is stored"
};
static const openspace::properties::Property::PropertyInfo SemiMajorAxisColumnInfo = {
"SemiMajorAxisColumn",
"SemiMajorAxisColumn",
"The header of the column where the semi-major axis is stored"
};
static const openspace::properties::Property::PropertyInfo SemiMajorAxisUnitInfo = {
"SemiMajorAxisUnit",
"SemiMajorAxisUnit",
"The unit of the semi major axis. For example: If specified in km, set this to 1000."
};
static const openspace::properties::Property::PropertyInfo InclinationColumnInfo = {
"InclinationColumn",
"InclinationColumn",
"The header of the column where the inclination is stored"
};
static const openspace::properties::Property::PropertyInfo AscendingNodeColumnInfo = {
"AscendingNodeColumn",
"AscendingNodeColumn",
"The header of the column where the ascending node is stored"
};
static const openspace::properties::Property::PropertyInfo ArgumentOfPeriapsisColumnInfo = {
"ArgumentOfPeriapsisColumn",
"ArgumentOfPeriapsisColumn",
"The header of the column where the argument of periapsis is stored"
};
static const openspace::properties::Property::PropertyInfo MeanAnomalyAtEpochColumnInfo = {
"MeanAnomalyAtEpochColumn",
"MeanAnomalyAtEpochColumn",
"The header of the column where the mean anomaly at epoch is stored"
};
static const openspace::properties::Property::PropertyInfo EpochColumnInfo = {
"EpochColumn",
"EpochColumn",
"The header of the column where the epoch is stored"
};
}
namespace openspace {
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)
{
_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);
}
// uses Renderables destructor?
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) {
}
void ElonsTest::update(const UpdateData& data) {}
}

View File

@@ -0,0 +1,75 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* *
* 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 __OPENSPACE_MODULE_SPACE___RENDERABLEPLANET___H__
#define __OPENSPACE_MODULE_SPACE___RENDERABLEPLANET___H__
#include <openspace/rendering/renderable.h>
#include <modules/space/translation/keplertranslation.h>
#include <modules/space/translation/tletranslation.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/uintproperty.h>
namespace openspace {
class ElonsTest : public Renderable {
public:
// constructors & destructor
ElonsTest(const ghoul::Dictionary& dictionary);
// override?
void initialize() override;
void initializeGL() override;
// void deinitialize();
// void deinitialize();
//
// bool isReady() const;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void update(const UpdateData& data) override;
protected:
private:
TLETranslation _tleTranslator;
std::vector<KeplerTranslation::KeplerOrbit> _orbits;
ghoul::opengl::ProgramObject* _programObject;
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;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACE___RENDERABLEPLANET___H__

File diff suppressed because it is too large Load Diff

View File

@@ -1,136 +1,123 @@
/****************************************************************************************
* *
* 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 <openspace/rendering/renderable.h>
#include <modules/base/rendering/renderabletrail.h>
#include <modules/space/translation/keplertranslation.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 <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>
// #include <ghoul/opengl/programobject.h>
#ifndef __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
#define __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
// #ifndef __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
// #define __OPENSPACE_MODULE_BASE___RenderableSatellites___H__
namespace openspace {
// 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;
// void initialize() override;
// void deinitialize() override;
// void initializeGL() override;
// void deinitializeGL() override;
bool isReady() const override;
// bool isReady() const override;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void update(const UpdateData& data) 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);
*/
// /*
// void setKeplerElements(double eccentricity, double semiMajorAxis, double inclination,
// double ascendingNode, double argumentOfPeriapsis, double meanAnomalyAtEpoch,
// double orbitalPeriod, double epoch);
// */
static documentation::Documentation Documentation();
// static documentation::Documentation Documentation();
private:
/// The layout of the VBOs
struct TrailVBOLayout {
float x, y, z, time;
};
// 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 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;
// /// 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;
// GLuint _vertexArray;
// GLuint _vertexBuffer;
// GLuint _indexBuffer;
void readFromCsvFile();
void updateBuffers();
// void readFromCsvFile();
// void updateBuffers();
std::vector<KeplerTranslation::KeplerOrbit> _orbits;
ghoul::opengl::ProgramObject* _programObject;
//ghoul::ObjectManager* _objectManager;
// std::vector<KeplerTranslation::KeplerOrbit> _orbits;
// ghoul::opengl::ProgramObject* _programObject;
// 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;
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;
// UniformCache(opacity, modelView, projection, color, useLineFade, lineFade)
// _uniformCache;
RenderableTrail::Appearance _appearance;
// /**
// * 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);
// };
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__
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> some code to test 1 sgn, more renderables
=======
}
>>>>>>> merge
// #endif // __OPENSPACE_MODULE_BASE___RenderableSatellites___H__

View File

@@ -29,6 +29,7 @@
#include <modules/space/rendering/renderablerings.h>
#include <modules/space/rendering/renderablestars.h>
#include <modules/space/rendering/simplespheregeometry.h>
// #include <modules/space/rendering/elonstest.h>
#include <modules/space/translation/keplertranslation.h>
#include <modules/space/translation/spicetranslation.h>
#include <modules/space/translation/tletranslation.h>
@@ -80,6 +81,7 @@ void SpaceModule::internalInitialize(const ghoul::Dictionary&) {
fRenderable->registerClass<RenderablePlanet>("RenderablePlanet");
fRenderable->registerClass<RenderableRings>("RenderableRings");
fRenderable->registerClass<RenderableStars>("RenderableStars");
// fRenderable->registerClass<ElonsTest>("ElonsTest");
auto fTranslation = FactoryManager::ref().factory<Translation>();
ghoul_assert(fTranslation, "Ephemeris factory was not created");