mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-28 14:59:31 -05:00
merge
This commit is contained in:
committed by
ElonOlsson
parent
86f961a0a1
commit
3ca62aba83
@@ -434,7 +434,7 @@ RenderableSatellites::RenderableSatellites(const ghoul::Dictionary& dictionary)
|
||||
_epochColumnName =
|
||||
dictionary.value<std::string>(EpochColumnInfo.identifier);
|
||||
|
||||
addPropertySubOwner(_appearance);
|
||||
//addPropertySubOwner(_appearance);
|
||||
addProperty(_path);
|
||||
addProperty(_nSegments);
|
||||
addProperty(_semiMajorAxisUnit);
|
||||
@@ -593,6 +593,7 @@ void RenderableSatellites::deinitialize() {
|
||||
}
|
||||
|
||||
void RenderableSatellites::initializeGL() {
|
||||
|
||||
glGenVertexArrays(1, &_vertexArray);
|
||||
glGenBuffers(1, &_vertexBuffer);
|
||||
glGenBuffers(1, &_indexBuffer);
|
||||
@@ -607,25 +608,26 @@ void RenderableSatellites::initializeGL() {
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// _uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
// _uniformCache.modelView = _programObject->uniformLocation("modelViewTransform");
|
||||
// _uniformCache.projection = _programObject->uniformLocation("projectionTransform");
|
||||
// _uniformCache.color = _programObject->uniformLocation("color");
|
||||
// _uniformCache.useLineFade = _programObject->uniformLocation("useLineFade");
|
||||
// _uniformCache.lineFade = _programObject->uniformLocation("lineFade");
|
||||
/*
|
||||
_uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
_uniformCache.modelView = _programObject->uniformLocation("modelViewTransform");
|
||||
_uniformCache.projection = _programObject->uniformLocation("projectionTransform");
|
||||
_uniformCache.color = _programObject->uniformLocation("color");
|
||||
_uniformCache.useLineFade = _programObject->uniformLocation("useLineFade");
|
||||
_uniformCache.lineFade = _programObject->uniformLocation("lineFade");
|
||||
|
||||
setRenderBin(Renderable::RenderBin::Overlay);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
void RenderableSatellites::deinitializeGL() {
|
||||
|
||||
|
||||
SpaceModule::ProgramObjectManager.release(ProgramName);
|
||||
|
||||
// glDeleteBuffers(1, &_vertexBuffer);
|
||||
// glDeleteBuffers(1, &_indexBuffer);
|
||||
// glDeleteVertexArrays(1, &_vertexArray);
|
||||
glDeleteBuffers(1, &_vertexBuffer);
|
||||
glDeleteBuffers(1, &_indexBuffer);
|
||||
glDeleteVertexArrays(1, &_vertexArray);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -638,44 +640,45 @@ bool RenderableSatellites::isReady() const {
|
||||
void RenderableSatellites::update(const UpdateData&) {}
|
||||
|
||||
void RenderableSatellites::render(const RenderData& data, RendererTasks&) {
|
||||
// _programObject->activate();
|
||||
// _programObject->setUniform(_uniformCache.opacity, _opacity);
|
||||
/*
|
||||
_programObject->activate();
|
||||
_programObject->setUniform(_uniformCache.opacity, _opacity);
|
||||
|
||||
// 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 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));
|
||||
|
||||
// _programObject->setUniform(
|
||||
// _uniformCache.modelView,
|
||||
// data.camera.combinedViewMatrix() * modelTransform
|
||||
// );
|
||||
_programObject->setUniform(
|
||||
_uniformCache.modelView,
|
||||
data.camera.combinedViewMatrix() * modelTransform
|
||||
);
|
||||
|
||||
// _programObject->setUniform(_uniformCache.projection, data.camera.projectionMatrix());
|
||||
// _programObject->setUniform(_uniformCache.color, _appearance.lineColor);
|
||||
// _programObject->setUniform(_uniformCache.useLineFade, _appearance.useLineFade);
|
||||
_programObject->setUniform(_uniformCache.projection, data.camera.projectionMatrix());
|
||||
_programObject->setUniform(_uniformCache.color, _appearance.lineColor);
|
||||
//_programObject->setUniform(_uniformCache.useLineFade, _appearance.useLineFade);
|
||||
|
||||
// if (_appearance.useLineFade) {
|
||||
// _programObject->setUniform(_uniformCache.lineFade, _appearance.lineFade);
|
||||
// }
|
||||
//if (_appearance.useLineFade) {
|
||||
// _programObject->setUniform(_uniformCache.lineFade, _appearance.lineFade);
|
||||
//}
|
||||
|
||||
// glDepthMask(false);
|
||||
// //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glDepthMask(false);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
// glBindVertexArray(_vertexArray);
|
||||
// glDrawElements(GL_LINES,
|
||||
// static_cast<unsigned int>(_indexBufferData.size()),
|
||||
// GL_UNSIGNED_INT,
|
||||
// 0);
|
||||
// glBindVertexArray(0);
|
||||
// _programObject->deactivate();
|
||||
glBindVertexArray(_vertexArray);
|
||||
glDrawElements(GL_LINES,
|
||||
static_cast<unsigned int>(_indexBufferData.size()),
|
||||
GL_UNSIGNED_INT,
|
||||
0);
|
||||
glBindVertexArray(0);
|
||||
_programObject->deactivate();
|
||||
*/
|
||||
}
|
||||
|
||||
void RenderableSatellites::updateBuffers() {
|
||||
const size_t nVerticesPerOrbit = _nSegments + 1;
|
||||
_vertexBufferData.resize(_TLEData.size() * nVerticesPerOrbit);
|
||||
_indexBufferData.resize(_TLEData.size() * _nSegments * 2);
|
||||
|
||||
size_t orbitindex = 0;
|
||||
size_t elementindex = 0;
|
||||
|
||||
@@ -697,7 +700,7 @@ void RenderableSatellites::updateBuffers() {
|
||||
float timeOffset = orbit.period *
|
||||
static_cast<float>(i) / static_cast<float>(_nSegments);
|
||||
|
||||
glm::vec3 position = _keplerTranslator.debrisPos(Time(orbit.epoch + timeOffset));
|
||||
glm::vec3 position = _keplerTranslator.debrisPos(Time(orbit.epoch + timeOffset));
|
||||
|
||||
_vertexBufferData[index].x = position.x;
|
||||
_vertexBufferData[index].y = position.y;
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace openspace {
|
||||
properties::StringProperty _meanAnomalyAtEpochColumnName;
|
||||
properties::StringProperty _epochColumnName;
|
||||
|
||||
RenderableTrail::Appearance _appearance;
|
||||
//RenderableTrail::Appearance _appearance;
|
||||
|
||||
//UniformCache(opacity, modelView, projection, color, useLineFade, lineFade)
|
||||
// _uniformCache;
|
||||
|
||||
Reference in New Issue
Block a user