mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Start addressing PR comments
This commit is contained in:
@@ -127,12 +127,7 @@ RenderableBoxGrid::RenderableBoxGrid(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
bool RenderableBoxGrid::isReady() const {
|
||||
bool isReady = _gridProgram != nullptr;
|
||||
|
||||
if (_hasLabels) {
|
||||
isReady = isReady && _labels->isReady();
|
||||
}
|
||||
return isReady;
|
||||
return _hasLabels ? _gridProgram && _labels->isReady() : _gridProgram != nullptr;
|
||||
}
|
||||
|
||||
void RenderableBoxGrid::initialize() {
|
||||
@@ -232,7 +227,7 @@ void RenderableBoxGrid::render(const RenderData& data, RendererTasks&){
|
||||
);
|
||||
|
||||
if (orthoRight == glm::vec3(0.0)) {
|
||||
glm::vec3 otherVector(lookup.y, lookup.x, lookup.z);
|
||||
glm::vec3 otherVector = glm::vec3(lookup.y, lookup.x, lookup.z);
|
||||
right = glm::cross(viewDirection, otherVector);
|
||||
orthoRight = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(right, 0.0))
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
// Labels
|
||||
bool _hasLabels = false;
|
||||
properties::BoolProperty _drawLabels;
|
||||
std::unique_ptr<LabelsComponent> _labels = nullptr;
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
};
|
||||
|
||||
}// namespace openspace
|
||||
|
||||
@@ -188,12 +188,7 @@ RenderableGrid::RenderableGrid(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
bool RenderableGrid::isReady() const {
|
||||
bool isReady = _gridProgram != nullptr;
|
||||
|
||||
if (_hasLabels) {
|
||||
isReady = isReady && _labels->isReady();
|
||||
}
|
||||
return isReady;
|
||||
return _hasLabels ? _gridProgram && _labels->isReady() : _gridProgram != nullptr;
|
||||
}
|
||||
|
||||
void RenderableGrid::initialize() {
|
||||
@@ -273,7 +268,7 @@ void RenderableGrid::render(const RenderData& data, RendererTasks&){
|
||||
);
|
||||
|
||||
if (orthoRight == glm::vec3(0.0)) {
|
||||
glm::vec3 otherVector(lookup.y, lookup.x, lookup.z);
|
||||
glm::vec3 otherVector = glm::vec3(lookup.y, lookup.x, lookup.z);
|
||||
right = glm::cross(viewDirection, otherVector);
|
||||
orthoRight = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(right, 0.0))
|
||||
|
||||
@@ -86,9 +86,7 @@ protected:
|
||||
// Labels
|
||||
bool _hasLabels = false;
|
||||
properties::BoolProperty _drawLabels;
|
||||
|
||||
// Everything related to the labels are handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels = nullptr;
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
};
|
||||
|
||||
}// namespace openspace
|
||||
|
||||
@@ -167,12 +167,7 @@ RenderableRadialGrid::RenderableRadialGrid(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
bool RenderableRadialGrid::isReady() const {
|
||||
bool isReady = _gridProgram != nullptr;
|
||||
|
||||
if (_hasLabels) {
|
||||
isReady = isReady && _labels->isReady();
|
||||
}
|
||||
return isReady;
|
||||
return _hasLabels ? _gridProgram && _labels->isReady() : _gridProgram != nullptr;
|
||||
}
|
||||
|
||||
void RenderableRadialGrid::initialize() {
|
||||
@@ -261,7 +256,7 @@ void RenderableRadialGrid::render(const RenderData& data, RendererTasks&) {
|
||||
);
|
||||
|
||||
if (orthoRight == glm::vec3(0.0)) {
|
||||
glm::vec3 otherVector(lookup.y, lookup.x, lookup.z);
|
||||
glm::vec3 otherVector = glm::vec3(lookup.y, lookup.x, lookup.z);
|
||||
right = glm::cross(viewDirection, otherVector);
|
||||
orthoRight = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(right, 0.0))
|
||||
|
||||
@@ -91,7 +91,7 @@ protected:
|
||||
// Labels
|
||||
bool _hasLabels = false;
|
||||
properties::BoolProperty _drawLabels;
|
||||
std::unique_ptr<LabelsComponent> _labels = nullptr;
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
};
|
||||
|
||||
}// namespace openspace
|
||||
|
||||
@@ -137,12 +137,7 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
}
|
||||
|
||||
bool RenderableSphericalGrid::isReady() const {
|
||||
bool isReady = _gridProgram != nullptr;
|
||||
|
||||
if (_hasLabels) {
|
||||
isReady = isReady && _labels->isReady();
|
||||
}
|
||||
return isReady;
|
||||
return _hasLabels ? _gridProgram && _labels->isReady() : _gridProgram != nullptr;
|
||||
}
|
||||
|
||||
void RenderableSphericalGrid::initialize() {
|
||||
@@ -249,7 +244,7 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
);
|
||||
|
||||
if (orthoRight == glm::vec3(0.0)) {
|
||||
glm::vec3 otherVector(lookup.y, lookup.x, lookup.z);
|
||||
glm::vec3 otherVector = glm::vec3(lookup.y, lookup.x, lookup.z);
|
||||
right = glm::cross(viewDirection, otherVector);
|
||||
orthoRight = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(right, 0.0))
|
||||
|
||||
@@ -81,7 +81,7 @@ protected:
|
||||
// Labels
|
||||
bool _hasLabels = false;
|
||||
properties::BoolProperty _drawLabels;
|
||||
std::unique_ptr<LabelsComponent> _labels = nullptr;
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
};
|
||||
|
||||
}// namespace openspace
|
||||
|
||||
@@ -708,7 +708,7 @@ void RenderableBillboardsCloud::render(const RenderData& data, RendererTasks&) {
|
||||
glm::cross(cameraUpDirectionWorld, cameraViewDirectionWorld)
|
||||
);
|
||||
if (orthoRight == glm::dvec3(0.0)) {
|
||||
glm::dvec3 otherVector(
|
||||
glm::dvec3 otherVector = glm::vec3(
|
||||
cameraUpDirectionWorld.y,
|
||||
cameraUpDirectionWorld.x,
|
||||
cameraUpDirectionWorld.z
|
||||
|
||||
@@ -135,8 +135,8 @@ private:
|
||||
speck::Dataset _dataset;
|
||||
speck::ColorMap _colorMap;
|
||||
|
||||
// Everything related to the labels are handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels = nullptr;
|
||||
// Everything related to the labels is handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
|
||||
std::vector<glm::vec2> _colorRangeData;
|
||||
std::unordered_map<int, std::string> _optionConversionMap;
|
||||
|
||||
@@ -440,23 +440,24 @@ void RenderablePlanesCloud::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
const glm::dmat4 modelViewMatrix = data.camera.combinedViewMatrix() * modelMatrix;
|
||||
const glm::mat4 projectionMatrix = data.camera.projectionMatrix();
|
||||
const glm::dmat4 mvpMatrix = glm::dmat4(projectionMatrix) * modelViewMatrix;
|
||||
|
||||
const glm::dmat4 invMVPParts = glm::inverse(modelMatrix) *
|
||||
glm::inverse(data.camera.combinedViewMatrix()) *
|
||||
glm::inverse(glm::dmat4(projectionMatrix));
|
||||
const glm::dvec3 orthoRight = glm::normalize(
|
||||
glm::dvec3(invMVPParts * glm::dvec4(1.0, 0.0, 0.0, 0.0))
|
||||
);
|
||||
const glm::dvec3 orthoUp = glm::normalize(
|
||||
glm::dvec3(invMVPParts * glm::dvec4(0.0, 1.0, 0.0, 0.0))
|
||||
);
|
||||
|
||||
if (_hasSpeckFile) {
|
||||
renderPlanes(data, modelViewMatrix, projectionMatrix, fadeInVariable);
|
||||
}
|
||||
|
||||
if (_hasLabels) {
|
||||
const glm::dmat4 mvpMatrix = glm::dmat4(projectionMatrix) * modelViewMatrix;
|
||||
|
||||
const glm::dmat4 invMVPParts = glm::inverse(modelMatrix) *
|
||||
glm::inverse(data.camera.combinedViewMatrix()) *
|
||||
glm::inverse(glm::dmat4(projectionMatrix));
|
||||
const glm::dvec3 orthoRight = glm::normalize(
|
||||
glm::dvec3(invMVPParts * glm::dvec4(1.0, 0.0, 0.0, 0.0))
|
||||
);
|
||||
const glm::dvec3 orthoUp = glm::normalize(
|
||||
glm::dvec3(invMVPParts * glm::dvec4(0.0, 1.0, 0.0, 0.0))
|
||||
);
|
||||
|
||||
_labels->render(data, mvpMatrix, orthoRight, orthoUp, fadeInVariable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ private:
|
||||
|
||||
speck::Dataset _dataset;
|
||||
|
||||
// Everything related to the labels are handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels = nullptr;
|
||||
// Everything related to the labels is handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
|
||||
float _sluminosity = 1.f;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
namespace ghoul::fontrendering { class Font; }
|
||||
|
||||
namespace openspace {
|
||||
struct RenderData;
|
||||
struct RenderData;
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
@@ -214,11 +214,7 @@ void RenderableConstellationsBase::initialize() {
|
||||
}
|
||||
|
||||
bool RenderableConstellationsBase::isReady() const {
|
||||
// If we have labels, they also need to be loaded
|
||||
if (_hasLabels) {
|
||||
return _labels->isReady();
|
||||
}
|
||||
return true;
|
||||
return _hasLabels ? _labels->isReady() : true;
|
||||
}
|
||||
|
||||
void RenderableConstellationsBase::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
Reference in New Issue
Block a user