Added property for line width to the renderable contellation bounds (closes #1214)

This commit is contained in:
Alexander Bock
2020-06-24 11:06:14 +02:00
parent 841b7f1543
commit 8f090cfeab
2 changed files with 25 additions and 0 deletions
@@ -63,6 +63,12 @@ namespace {
"full opacity."
};
constexpr openspace::properties::Property::PropertyInfo LineWidthInfo = {
"LineWidth",
"Line Width",
"The line width of the constellation bounds"
};
constexpr openspace::properties::Property::PropertyInfo SelectionInfo = {
"ConstellationSelection",
"Constellation Selection",
@@ -98,6 +104,12 @@ documentation::Documentation RenderableConstellationBounds::Documentation() {
Optional::Yes,
ColorInfo.description
},
{
LineWidthInfo.identifier,
new DoubleVerifier,
Optional::Yes,
LineWidthInfo.description
},
{
SelectionInfo.identifier,
new StringListVerifier,
@@ -115,6 +127,7 @@ RenderableConstellationBounds::RenderableConstellationBounds(
, _vertexFilename(VertexInfo)
, _constellationFilename(ConstellationInfo)
, _color(ColorInfo, glm::vec3(1.f, 0.f, 0.f), glm::vec3(0.f), glm::vec3(1.f))
, _lineWidth(LineWidthInfo, 2.f, 1.f, 32.f)
, _constellationSelection(SelectionInfo)
{
documentation::testSpecificationAndThrow(
@@ -141,6 +154,13 @@ RenderableConstellationBounds::RenderableConstellationBounds(
_color = glm::vec3(dictionary.value<glm::dvec3>(ColorInfo.identifier));
}
addProperty(_lineWidth);
if (dictionary.hasKey(LineWidthInfo.identifier)) {
_lineWidth = static_cast<float>(
dictionary.value<double>(LineWidthInfo.identifier)
);
}
fillSelectionProperty();
_constellationSelection.onChange([this]() { selectionPropertyHasChanged(); });
addProperty(_constellationSelection);
@@ -244,6 +264,8 @@ void RenderableConstellationBounds::render(const RenderData& data, RendererTasks
_program->setUniform("ModelTransform", glm::mat4(modelTransform));
_program->setUniform("color", _color);
glLineWidth(_lineWidth);
glBindVertexArray(_vao);
for (const ConstellationBound& bound : _constellationBounds) {
if (bound.isEnabled) {