mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-26 05:58:48 -05:00
Merge branch 'master' into feature/loadingscreen-refactor
# Conflicts: # modules/base/rendering/renderabletrailorbit.h # modules/digitaluniverse/rendering/renderablebillboardscloud.cpp # modules/digitaluniverse/rendering/renderableplanescloud.cpp # modules/digitaluniverse/rendering/renderablepoints.cpp # modules/galaxy/rendering/renderablegalaxy.cpp # modules/galaxy/rendering/renderablegalaxy.h # modules/kameleonvolume/rendering/renderablekameleonvolume.cpp # modules/kameleonvolume/rendering/renderablekameleonvolume.h # modules/spacecraftinstruments/rendering/renderablefov.h # modules/spacecraftinstruments/rendering/renderableplaneprojection.h # modules/toyvolume/rendering/renderabletoyvolume.cpp # modules/toyvolume/rendering/renderabletoyvolume.h # modules/volume/rendering/renderabletimevaryingvolume.cpp # modules/volume/rendering/renderabletimevaryingvolume.h
This commit is contained in:
@@ -219,7 +219,7 @@ void RenderableCrawlingLine::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
glDrawArrays(GL_LINES, 0, 2);
|
||||
glBindVertexArray(0);
|
||||
|
||||
|
||||
_program->deactivate();
|
||||
}
|
||||
|
||||
@@ -228,12 +228,12 @@ void RenderableCrawlingLine::update(const UpdateData& data) {
|
||||
_program->rebuildFromFile();
|
||||
}
|
||||
|
||||
glm::dmat3 transformMatrix = SpiceManager::ref().positionTransformMatrix(
|
||||
_source,
|
||||
//"ECLIPJ2000",
|
||||
"GALACTIC",
|
||||
data.time.j2000Seconds()
|
||||
);
|
||||
// glm::dmat3 transformMatrix = SpiceManager::ref().positionTransformMatrix(
|
||||
// _source,
|
||||
// //"ECLIPJ2000",
|
||||
// "GALACTIC",
|
||||
// data.time.j2000Seconds()
|
||||
// );
|
||||
|
||||
glm::dmat3 tm = SpiceManager::ref().frameTransformationMatrix(_instrumentName, "ECLIPJ2000", data.time.j2000Seconds());
|
||||
|
||||
@@ -249,9 +249,9 @@ void RenderableCrawlingLine::update(const UpdateData& data) {
|
||||
//catch (const SpiceManager::SpiceException& e) {
|
||||
//LERROR(e.what());
|
||||
//}
|
||||
|
||||
|
||||
glm::vec4 target(boresight[0], boresight[1], boresight[2], 12);
|
||||
//target = glm::dmat4(tm) * target;
|
||||
target = glm::dmat4(tm) * target;
|
||||
|
||||
//_positions[TargetPosition] = target;
|
||||
//_positions[TargetPosition] = {
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
std::string _source;
|
||||
std::string _target;
|
||||
std::string _referenceFrame;
|
||||
|
||||
|
||||
glm::vec4 _lineColorBegin;
|
||||
glm::vec4 _lineColorEnd;
|
||||
|
||||
|
||||
@@ -241,10 +241,10 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
|
||||
dictionary,
|
||||
"RenderableFov"
|
||||
);
|
||||
|
||||
|
||||
_instrument.spacecraft = dictionary.value<std::string>(KeyBody);
|
||||
_instrument.referenceFrame = dictionary.value<std::string>(KeyFrame);
|
||||
|
||||
|
||||
_instrument.name = dictionary.value<std::string>(
|
||||
std::string(KeyInstrument) + "." + KeyInstrumentName
|
||||
);
|
||||
@@ -506,7 +506,6 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
|
||||
|
||||
//intersects[i] = r.interceptFound;
|
||||
|
||||
|
||||
if (r.interceptFound) {
|
||||
// This point intersected the target
|
||||
first.color = RenderInformation::VertexColorTypeIntersectionStart;
|
||||
@@ -546,7 +545,7 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
|
||||
// After finding the positions for the field of view boundaries, we can create the
|
||||
// vertices for the orthogonal plane as well, reusing the computations we performed
|
||||
// earlier
|
||||
|
||||
|
||||
// Each boundary in _instrument.bounds has 'InterpolationSteps' steps between
|
||||
auto indexForBounds = [](size_t idx) -> size_t {
|
||||
return idx * InterpolationSteps;
|
||||
@@ -572,7 +571,6 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
|
||||
// item (the first one is (0,0,0)) and replicate it 'InterpolationSteps' times
|
||||
copyFieldOfViewValues(i, indexForBounds(i), indexForBounds(i + 1));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// At least one point will intersect
|
||||
@@ -642,10 +640,7 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
|
||||
RenderInformation::VertexColorTypeSquare
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,7 +700,7 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
|
||||
// _orthogonalPlane-space
|
||||
const size_t p1 = static_cast<size_t>(indexForBounds(i) + t1 * InterpolationSteps);
|
||||
const size_t p2 = static_cast<size_t>(indexForBounds(i) + t2 * InterpolationSteps);
|
||||
|
||||
|
||||
// We can copy the non-intersecting parts
|
||||
copyFieldOfViewValues(i, indexForBounds(i), p1);
|
||||
copyFieldOfViewValues(i, p2, indexForBounds(j));
|
||||
@@ -852,17 +847,17 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
|
||||
else {
|
||||
bodyfixed = _instrument.referenceFrame;
|
||||
}
|
||||
|
||||
|
||||
SpiceManager::SurfaceInterceptResult res =
|
||||
SpiceManager::ref().surfaceIntercept(target, _instrument.spacecraft,
|
||||
_instrument.name, bodyfixed, _instrument.aberrationCorrection, data.time, _instrument.bounds[r]);
|
||||
|
||||
|
||||
if (convert) {
|
||||
res.surfaceVector = SpiceManager::ref().frameTransformationMatrix(bodyfixed, _instrument.referenceFrame, data.time) * res.surfaceVector;
|
||||
}
|
||||
|
||||
|
||||
interceptTag[r] = res.interceptFound;
|
||||
|
||||
|
||||
// if not found, use the orthogonal projected point
|
||||
glm::dvec3 b;
|
||||
if (!interceptTag[r]) {
|
||||
@@ -1030,7 +1025,7 @@ void RenderableFov::render(const RenderData& data, RendererTasks&) {
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) *
|
||||
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
|
||||
|
||||
|
||||
glm::mat4 modelViewProjectionTransform =
|
||||
data.camera.projectionMatrix() *
|
||||
glm::mat4(data.camera.combinedViewMatrix() *
|
||||
|
||||
@@ -146,7 +146,7 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
|
||||
_colorTexturePath = absPath(dictionary.value<std::string>(
|
||||
ColorTextureInfo.identifier
|
||||
));
|
||||
|
||||
|
||||
addPropertySubOwner(_geometry.get());
|
||||
addPropertySubOwner(_projectionComponent);
|
||||
|
||||
@@ -156,7 +156,7 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
|
||||
_projectionComponent.initialize(
|
||||
dictionary.value<ghoul::Dictionary>(keyProjection)
|
||||
);
|
||||
|
||||
|
||||
float boundingSphereRadius = 1.0e9;
|
||||
dictionary.getValue(keyBoundingSphereRadius, boundingSphereRadius);
|
||||
setBoundingSphere(boundingSphereRadius);
|
||||
@@ -252,7 +252,7 @@ void RenderableModelProjection::render(const RenderData& data, RendererTasks&) {
|
||||
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
|
||||
glm::vec3 directionToSun = glm::normalize(_sunPosition.vec3() - glm::vec3(bodyPosition));
|
||||
glm::vec3 directionToSunViewSpace = glm::mat3(data.camera.combinedViewMatrix()) * directionToSun;
|
||||
|
||||
|
||||
_programObject->setUniform("_performShading", _performShading);
|
||||
_programObject->setUniform("directionToSunViewSpace", directionToSunViewSpace);
|
||||
_programObject->setUniform("modelViewTransform", glm::mat4(modelViewTransform));
|
||||
@@ -261,7 +261,7 @@ void RenderableModelProjection::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
|
||||
_geometry->setUniforms(*_programObject);
|
||||
|
||||
|
||||
ghoul::opengl::TextureUnit unit[2];
|
||||
unit[0].activate();
|
||||
_baseTexture->bind();
|
||||
@@ -272,7 +272,7 @@ void RenderableModelProjection::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->setUniform("projectionTexture", unit[1]);
|
||||
|
||||
_geometry->render();
|
||||
|
||||
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ void RenderableModelProjection::update(const UpdateData& data) {
|
||||
}
|
||||
|
||||
_projectionComponent.update();
|
||||
|
||||
|
||||
if (_depthFboProgramObject->isDirty()) {
|
||||
_depthFboProgramObject->rebuildFromFile();
|
||||
}
|
||||
@@ -303,9 +303,9 @@ void RenderableModelProjection::update(const UpdateData& data) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_stateMatrix = data.modelTransform.rotation;
|
||||
|
||||
|
||||
glm::dvec3 p =
|
||||
OsEng.renderEngine().scene()->sceneGraphNode("Sun")->worldPosition() -
|
||||
data.modelTransform.translation;
|
||||
@@ -395,7 +395,7 @@ void RenderableModelProjection::attitudeParameters(double time) {
|
||||
);
|
||||
|
||||
psc position = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
|
||||
|
||||
position[3] += 4;
|
||||
glm::vec3 cpos = position.vec3();
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
double _time;
|
||||
|
||||
bool _capture;
|
||||
|
||||
|
||||
psc _sunPosition;
|
||||
properties::BoolProperty _performShading;
|
||||
};
|
||||
|
||||
@@ -97,7 +97,7 @@ bool RenderablePlaneProjection::isReady() const {
|
||||
void RenderablePlaneProjection::initializeGL() {
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
|
||||
|
||||
// Image Plane Program
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram(
|
||||
@@ -156,16 +156,16 @@ void RenderablePlaneProjection::render(const RenderData& data, RendererTasks&) {
|
||||
void RenderablePlaneProjection::update(const UpdateData& data) {
|
||||
double time = data.time.j2000Seconds();
|
||||
const Image img = openspace::ImageSequencer::ref().getLatestImageForInstrument(_instrument);
|
||||
|
||||
|
||||
if (img.path == "")
|
||||
return;
|
||||
else
|
||||
_hasImage = true;
|
||||
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_target.frame, GalacticFrame, time);
|
||||
|
||||
|
||||
double timePast = std::abs(img.timeRange.start - _previousTime);
|
||||
|
||||
|
||||
std::string tex = _texturePath;
|
||||
if (_moving || _planeIsDirty)
|
||||
updatePlane(img, time);
|
||||
@@ -264,7 +264,7 @@ void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime
|
||||
thisNode->setParent(*newParent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const GLfloat vertex_data[] = { // square of two triangles drawn within fov in target coordinates
|
||||
// x y z w s t
|
||||
projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 0, // Lower left 1
|
||||
|
||||
@@ -302,7 +302,7 @@ void RenderablePlanetProjection::imageProjectGPU(
|
||||
unitFbo.activate();
|
||||
projectionTexture->bind();
|
||||
_fboProgramObject->setUniform("projectionTexture", unitFbo);
|
||||
|
||||
|
||||
_fboProgramObject->setUniform("ProjectorMatrix", _projectorMatrix);
|
||||
_fboProgramObject->setUniform("ModelTransform" , _transform);
|
||||
_fboProgramObject->setUniform("_scaling" , _camScaling);
|
||||
@@ -373,7 +373,7 @@ void RenderablePlanetProjection::attitudeParameters(double time) {
|
||||
lightTime
|
||||
);
|
||||
psc position = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
|
||||
|
||||
//change to KM and add psc camera scaling.
|
||||
position[3] += (3 + _camScaling[1]);
|
||||
//position[3] += 3;
|
||||
@@ -472,7 +472,7 @@ void RenderablePlanetProjection::render(const RenderData& data, RendererTasks&)
|
||||
_heightMapTexture->bind();
|
||||
_programObject->setUniform("heightTexture", unit[2]);
|
||||
}
|
||||
|
||||
|
||||
_geometry->render();
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
properties::BoolProperty _meridianShift;
|
||||
|
||||
std::unique_ptr<planetgeometry::PlanetGeometry> _geometry;
|
||||
|
||||
|
||||
glm::vec2 _camScaling;
|
||||
glm::vec3 _up;
|
||||
glm::mat4 _transform;
|
||||
|
||||
@@ -288,7 +288,7 @@ void RenderableShadowCylinder::deinitializeGL() {
|
||||
bool RenderableShadowCylinder::isReady() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RenderableShadowCylinder::render(const RenderData& data, RendererTasks&) {
|
||||
glDepthMask(false);
|
||||
_shader->activate();
|
||||
@@ -309,7 +309,7 @@ void RenderableShadowCylinder::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
_shader->setUniform("shadowColor", _shadowColor);
|
||||
//setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, static_cast<GLsizei>(_vertices.size()));
|
||||
glBindVertexArray(0);
|
||||
@@ -358,7 +358,7 @@ void RenderableShadowCylinder::createCylinder(double time) {
|
||||
time,
|
||||
_numberOfPoints
|
||||
);
|
||||
|
||||
|
||||
std::vector<psc> terminatorPoints;
|
||||
std::transform(
|
||||
res.terminatorPoints.begin(),
|
||||
@@ -370,7 +370,7 @@ void RenderableShadowCylinder::createCylinder(double time) {
|
||||
return coord;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
double lt;
|
||||
glm::dvec3 vecLightSource = SpiceManager::ref().targetPosition(
|
||||
_body,
|
||||
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
properties::OptionProperty _aberration;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
GLuint _vao;
|
||||
|
||||
Reference in New Issue
Block a user