mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 09:20:26 -05:00
Merge branch 'master' into issue/1438
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <ghoul/glm.h>
|
||||
@@ -39,9 +38,9 @@
|
||||
namespace {
|
||||
constexpr const char* ProgramName = "GridProgram";
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GridColorInfo = {
|
||||
"GridColor",
|
||||
"Grid Color",
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"This value determines the color of the grid lines that are rendered."
|
||||
};
|
||||
|
||||
@@ -67,10 +66,10 @@ documentation::Documentation RenderableBoxGrid::Documentation() {
|
||||
"base_renderable_boxgrid",
|
||||
{
|
||||
{
|
||||
GridColorInfo.identifier,
|
||||
ColorInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
Optional::Yes,
|
||||
GridColorInfo.description
|
||||
ColorInfo.description
|
||||
},
|
||||
{
|
||||
LineWidthInfo.identifier,
|
||||
@@ -88,17 +87,11 @@ documentation::Documentation RenderableBoxGrid::Documentation() {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
RenderableBoxGrid::RenderableBoxGrid(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _gridColor(
|
||||
GridColorInfo,
|
||||
glm::vec3(0.5f, 0.5, 0.5f),
|
||||
glm::vec3(0.f),
|
||||
glm::vec3(1.f)
|
||||
)
|
||||
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
|
||||
, _size(SizeInfo, glm::vec3(1e20f), glm::vec3(1.f), glm::vec3(1e35f))
|
||||
, _size(SizeInfo, glm::vec3(1.f), glm::vec3(1.f), glm::vec3(100.f))
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
@@ -109,11 +102,11 @@ RenderableBoxGrid::RenderableBoxGrid(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
if (dictionary.hasKey(GridColorInfo.identifier)) {
|
||||
_gridColor = dictionary.value<glm::dvec3>(GridColorInfo.identifier);
|
||||
if (dictionary.hasKey(ColorInfo.identifier)) {
|
||||
_color = dictionary.value<glm::dvec3>(ColorInfo.identifier);
|
||||
}
|
||||
_gridColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_gridColor);
|
||||
_color.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_color);
|
||||
|
||||
if (dictionary.hasKey(LineWidthInfo.identifier)) {
|
||||
_lineWidth = static_cast<float>(
|
||||
@@ -173,8 +166,6 @@ void RenderableBoxGrid::deinitializeGL() {
|
||||
void RenderableBoxGrid::render(const RenderData& data, RendererTasks&){
|
||||
_gridProgram->activate();
|
||||
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) * // Spice rotation
|
||||
@@ -187,14 +178,19 @@ void RenderableBoxGrid::render(const RenderData& data, RendererTasks&){
|
||||
"MVPTransform",
|
||||
glm::dmat4(data.camera.projectionMatrix()) * modelViewTransform
|
||||
);
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
_gridProgram->setUniform("gridColor", _color);
|
||||
|
||||
_gridProgram->setUniform("gridColor", _gridColor);
|
||||
|
||||
// Changes GL state:
|
||||
// Change GL state:
|
||||
#ifndef __APPLE__
|
||||
glLineWidth(_lineWidth);
|
||||
#else
|
||||
glLineWidth(1.f);
|
||||
#endif
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnablei(GL_BLEND, 0);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glDepthMask(false);
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glDrawArrays(_mode, 0, static_cast<GLsizei>(_varray.size()));
|
||||
@@ -202,16 +198,14 @@ void RenderableBoxGrid::render(const RenderData& data, RendererTasks&){
|
||||
|
||||
_gridProgram->deactivate();
|
||||
|
||||
// Restores GL State
|
||||
// Restore GL State
|
||||
global::renderEngine->openglStateCache().resetBlendState();
|
||||
global::renderEngine->openglStateCache().resetLineState();
|
||||
global::renderEngine->openglStateCache().resetDepthState();
|
||||
}
|
||||
|
||||
void RenderableBoxGrid::update(const UpdateData&) {
|
||||
if (_gridIsDirty) {
|
||||
//_vsize = (_segments + 1) * (_segments + 1);
|
||||
//_varray.resize(_vsize);
|
||||
|
||||
const glm::vec3 llf = -_size.value() / 2.f;
|
||||
const glm::vec3 urb = _size.value() / 2.f;
|
||||
|
||||
@@ -244,6 +238,9 @@ void RenderableBoxGrid::update(const UpdateData&) {
|
||||
const glm::vec3 v6 = glm::vec3(urb.x, urb.y, urb.z);
|
||||
const glm::vec3 v7 = glm::vec3(llf.x, urb.y, urb.z);
|
||||
|
||||
_varray.clear();
|
||||
_varray.reserve(16);
|
||||
|
||||
// First add the bounds
|
||||
_varray.push_back({ v0.x, v0.y, v0.z });
|
||||
_varray.push_back({ v1.x, v1.y, v1.z });
|
||||
@@ -262,7 +259,6 @@ void RenderableBoxGrid::update(const UpdateData&) {
|
||||
_varray.push_back({ v7.x, v7.y, v7.z });
|
||||
_varray.push_back({ v3.x, v3.y, v3.z });
|
||||
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vBufferID);
|
||||
glBufferData(
|
||||
@@ -273,7 +269,6 @@ void RenderableBoxGrid::update(const UpdateData&) {
|
||||
);
|
||||
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), nullptr);
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
_gridIsDirty = false;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
|
||||
@@ -59,7 +60,7 @@ protected:
|
||||
|
||||
ghoul::opengl::ProgramObject* _gridProgram = nullptr;
|
||||
|
||||
properties::Vec3Property _gridColor;
|
||||
properties::Vec3Property _color;
|
||||
properties::FloatProperty _lineWidth;
|
||||
properties::Vec3Property _size;
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/glm.h>
|
||||
@@ -39,9 +38,9 @@
|
||||
namespace {
|
||||
constexpr const char* ProgramName = "GridProgram";
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GridColorInfo = {
|
||||
"GridColor",
|
||||
"Grid Color",
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"This value determines the color of the grid lines that are rendered."
|
||||
};
|
||||
|
||||
@@ -74,10 +73,10 @@ documentation::Documentation RenderableGrid::Documentation() {
|
||||
"base_renderable_grid",
|
||||
{
|
||||
{
|
||||
GridColorInfo.identifier,
|
||||
ColorInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
Optional::Yes,
|
||||
GridColorInfo.description
|
||||
ColorInfo.description
|
||||
},
|
||||
{
|
||||
SegmentsInfo.identifier,
|
||||
@@ -104,7 +103,7 @@ documentation::Documentation RenderableGrid::Documentation() {
|
||||
|
||||
RenderableGrid::RenderableGrid(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _gridColor(GridColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _segments(SegmentsInfo, glm::uvec2(10), glm::uvec2(1), glm::uvec2(200))
|
||||
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
|
||||
, _size(SizeInfo, glm::vec2(1e20f), glm::vec2(1.f), glm::vec2(1e35f))
|
||||
@@ -118,11 +117,11 @@ RenderableGrid::RenderableGrid(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
if (dictionary.hasKey(GridColorInfo.identifier)) {
|
||||
_gridColor = dictionary.value<glm::dvec3>(GridColorInfo.identifier);
|
||||
if (dictionary.hasKey(ColorInfo.identifier)) {
|
||||
_color = dictionary.value<glm::dvec3>(ColorInfo.identifier);
|
||||
}
|
||||
_gridColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_gridColor);
|
||||
_color.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_color);
|
||||
|
||||
if (dictionary.hasKey(SegmentsInfo.identifier)) {
|
||||
_segments = static_cast<glm::uvec2>(
|
||||
@@ -190,8 +189,6 @@ void RenderableGrid::deinitializeGL() {
|
||||
void RenderableGrid::render(const RenderData& data, RendererTasks&){
|
||||
_gridProgram->activate();
|
||||
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) * // Spice rotation
|
||||
@@ -204,14 +201,19 @@ void RenderableGrid::render(const RenderData& data, RendererTasks&){
|
||||
"MVPTransform",
|
||||
glm::dmat4(data.camera.projectionMatrix()) * modelViewTransform
|
||||
);
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
_gridProgram->setUniform("gridColor", _color);
|
||||
|
||||
_gridProgram->setUniform("gridColor", _gridColor);
|
||||
|
||||
// Changes GL state:
|
||||
// Change GL state:
|
||||
#ifndef __APPLE__
|
||||
glLineWidth(_lineWidth);
|
||||
#else
|
||||
glLineWidth(1.f);
|
||||
#endif
|
||||
glEnablei(GL_BLEND, 0);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glDepthMask(false);
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glDrawArrays(_mode, 0, static_cast<GLsizei>(_varray.size()));
|
||||
@@ -219,9 +221,10 @@ void RenderableGrid::render(const RenderData& data, RendererTasks&){
|
||||
|
||||
_gridProgram->deactivate();
|
||||
|
||||
// Restores GL State
|
||||
// Restore GL State
|
||||
global::renderEngine->openglStateCache().resetBlendState();
|
||||
global::renderEngine->openglStateCache().resetLineState();
|
||||
global::renderEngine->openglStateCache().resetDepthState();
|
||||
}
|
||||
|
||||
void RenderableGrid::update(const UpdateData&) {
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/matrix/dmat4property.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/vector/uvec2property.h>
|
||||
#include <openspace/properties/vector/vec2property.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
@@ -61,7 +60,7 @@ protected:
|
||||
|
||||
ghoul::opengl::ProgramObject* _gridProgram = nullptr;
|
||||
|
||||
properties::Vec3Property _gridColor;
|
||||
properties::Vec3Property _color;
|
||||
properties::UVec2Property _segments;
|
||||
properties::FloatProperty _lineWidth;
|
||||
properties::Vec2Property _size;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <modules/base/basemodule.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <ghoul/glm.h>
|
||||
@@ -39,9 +38,9 @@
|
||||
namespace {
|
||||
constexpr const char* ProgramName = "GridProgram";
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GridColorInfo = {
|
||||
"GridColor",
|
||||
"Grid Color",
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"This value determines the color of the grid lines that are rendered."
|
||||
};
|
||||
|
||||
@@ -49,7 +48,7 @@ namespace {
|
||||
"GridSegments",
|
||||
"Number of Grid Segments",
|
||||
"Specifies the number of segments for the grid, in the radial and angular "
|
||||
" direction respectively"
|
||||
"direction respectively"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo CircleSegmentsInfo = {
|
||||
@@ -88,10 +87,10 @@ documentation::Documentation RenderableRadialGrid::Documentation() {
|
||||
"base_renderable_radialgrid",
|
||||
{
|
||||
{
|
||||
GridColorInfo.identifier,
|
||||
ColorInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
Optional::Yes,
|
||||
GridColorInfo.description
|
||||
ColorInfo.description
|
||||
},
|
||||
{
|
||||
GridSegmentsInfo.identifier,
|
||||
@@ -129,13 +128,8 @@ documentation::Documentation RenderableRadialGrid::Documentation() {
|
||||
|
||||
RenderableRadialGrid::RenderableRadialGrid(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _gridColor(GridColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _gridSegments(
|
||||
GridSegmentsInfo,
|
||||
glm::ivec2(1, 1),
|
||||
glm::ivec2(1),
|
||||
glm::ivec2(200)
|
||||
)
|
||||
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _gridSegments(GridSegmentsInfo, glm::ivec2(1), glm::ivec2(1), glm::ivec2(200))
|
||||
, _circleSegments(CircleSegmentsInfo, 36, 4, 200)
|
||||
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
|
||||
, _maxRadius(OuterRadiusInfo, 1.f, 0.f, 20.f)
|
||||
@@ -150,11 +144,11 @@ RenderableRadialGrid::RenderableRadialGrid(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
if (dictionary.hasKey(GridColorInfo.identifier)) {
|
||||
_gridColor = dictionary.value<glm::dvec3>(GridColorInfo.identifier);
|
||||
if (dictionary.hasKey(ColorInfo.identifier)) {
|
||||
_color = dictionary.value<glm::dvec3>(ColorInfo.identifier);
|
||||
}
|
||||
_gridColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_gridColor);
|
||||
_color.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_color);
|
||||
|
||||
if (dictionary.hasKey(GridSegmentsInfo.identifier)) {
|
||||
_gridSegments = static_cast<glm::ivec2>(
|
||||
@@ -243,8 +237,6 @@ void RenderableRadialGrid::deinitializeGL() {
|
||||
void RenderableRadialGrid::render(const RenderData& data, RendererTasks&) {
|
||||
_gridProgram->activate();
|
||||
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
|
||||
const glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) * // Spice rotation
|
||||
@@ -258,20 +250,19 @@ void RenderableRadialGrid::render(const RenderData& data, RendererTasks&) {
|
||||
"MVPTransform",
|
||||
glm::dmat4(data.camera.projectionMatrix()) * modelViewTransform
|
||||
);
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
_gridProgram->setUniform("gridColor", _color);
|
||||
|
||||
_gridProgram->setUniform("gridColor", _gridColor);
|
||||
|
||||
float adjustedLineWidth = 1.f;
|
||||
|
||||
// Change GL state:
|
||||
#ifndef __APPLE__
|
||||
adjustedLineWidth = _lineWidth;
|
||||
glLineWidth(_lineWidth);
|
||||
#else
|
||||
glLineWidth(1.f);
|
||||
#endif
|
||||
|
||||
// Changes GL state:
|
||||
glLineWidth(adjustedLineWidth);
|
||||
glEnablei(GL_BLEND, 0);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glDepthMask(false);
|
||||
|
||||
for (GeometryData& c : _circles) {
|
||||
c.render();
|
||||
@@ -281,9 +272,10 @@ void RenderableRadialGrid::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
_gridProgram->deactivate();
|
||||
|
||||
// Restores GL State
|
||||
// Restore GL State
|
||||
global::renderEngine->openglStateCache().resetBlendState();
|
||||
global::renderEngine->openglStateCache().resetLineState();
|
||||
global::renderEngine->openglStateCache().resetDepthState();
|
||||
}
|
||||
|
||||
void RenderableRadialGrid::update(const UpdateData&) {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/vector/ivec2property.h>
|
||||
@@ -75,7 +74,7 @@ protected:
|
||||
|
||||
ghoul::opengl::ProgramObject* _gridProgram;
|
||||
|
||||
properties::Vec3Property _gridColor;
|
||||
properties::Vec3Property _color;
|
||||
properties::IVec2Property _gridSegments;
|
||||
properties::IntProperty _circleSegments;
|
||||
properties::FloatProperty _lineWidth;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <modules/base/basemodule.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <ghoul/glm.h>
|
||||
@@ -38,9 +37,9 @@
|
||||
namespace {
|
||||
constexpr const char* ProgramName = "GridProgram";
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GridColorInfo = {
|
||||
"GridColor",
|
||||
"Grid Color",
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"This value determines the color of the grid lines that are rendered."
|
||||
};
|
||||
|
||||
@@ -67,10 +66,10 @@ documentation::Documentation RenderableSphericalGrid::Documentation() {
|
||||
"base_renderable_sphericalgrid",
|
||||
{
|
||||
{
|
||||
GridColorInfo.identifier,
|
||||
ColorInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
Optional::Yes,
|
||||
GridColorInfo.description
|
||||
ColorInfo.description
|
||||
},
|
||||
{
|
||||
SegmentsInfo.identifier,
|
||||
@@ -88,16 +87,10 @@ documentation::Documentation RenderableSphericalGrid::Documentation() {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _gridProgram(nullptr)
|
||||
, _gridColor(
|
||||
GridColorInfo,
|
||||
glm::vec3(0.5f, 0.5, 0.5f),
|
||||
glm::vec3(0.f),
|
||||
glm::vec3(1.f)
|
||||
)
|
||||
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _segments(SegmentsInfo, 36, 4, 200)
|
||||
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
|
||||
{
|
||||
@@ -110,11 +103,11 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
if (dictionary.hasKey(GridColorInfo.identifier)) {
|
||||
_gridColor = dictionary.value<glm::dvec3>(GridColorInfo.identifier);
|
||||
if (dictionary.hasKey(ColorInfo.identifier)) {
|
||||
_color = dictionary.value<glm::dvec3>(ColorInfo.identifier);
|
||||
}
|
||||
_gridColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_gridColor);
|
||||
_color.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_color);
|
||||
|
||||
if (dictionary.hasKey(SegmentsInfo.identifier)) {
|
||||
_segments = static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
@@ -186,8 +179,6 @@ void RenderableSphericalGrid::deinitializeGL() {
|
||||
void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
_gridProgram->activate();
|
||||
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
|
||||
const glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) * // Spice rotation
|
||||
@@ -201,20 +192,19 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
"MVPTransform",
|
||||
glm::dmat4(data.camera.projectionMatrix()) * modelViewTransform
|
||||
);
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
_gridProgram->setUniform("gridColor", _color);
|
||||
|
||||
_gridProgram->setUniform("gridColor", _gridColor);
|
||||
|
||||
float adjustedLineWidth = 1.f;
|
||||
|
||||
// Change GL state:
|
||||
#ifndef __APPLE__
|
||||
adjustedLineWidth = _lineWidth;
|
||||
glLineWidth(_lineWidth);
|
||||
#else
|
||||
glLineWidth(1.f);
|
||||
#endif
|
||||
|
||||
// Changes GL state:
|
||||
glLineWidth(adjustedLineWidth);
|
||||
glEnablei(GL_BLEND, 0);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glDepthMask(false);
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _iBufferID);
|
||||
@@ -223,9 +213,10 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
|
||||
_gridProgram->deactivate();
|
||||
|
||||
// Restores GL State
|
||||
// Restore GL State
|
||||
global::renderEngine->openglStateCache().resetBlendState();
|
||||
global::renderEngine->openglStateCache().resetLineState();
|
||||
global::renderEngine->openglStateCache().resetDepthState();
|
||||
}
|
||||
|
||||
void RenderableSphericalGrid::update(const UpdateData&) {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
@@ -61,7 +60,7 @@ protected:
|
||||
|
||||
ghoul::opengl::ProgramObject* _gridProgram;
|
||||
|
||||
properties::Vec3Property _gridColor;
|
||||
properties::Vec3Property _color;
|
||||
properties::IntProperty _segments;
|
||||
properties::FloatProperty _lineWidth;
|
||||
|
||||
|
||||
@@ -410,19 +410,49 @@ void createExoplanetSystem(const std::string& starName) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float meanInclination = 0.f;
|
||||
for (const ExoplanetDataEntry& p : system.planetsData) {
|
||||
meanInclination += p.i;
|
||||
}
|
||||
meanInclination /= static_cast<float>(system.planetsData.size());
|
||||
const glm::dmat4 rotation = computeOrbitPlaneRotationMatrix(meanInclination);
|
||||
const glm::dmat3 meanOrbitPlaneRotationMatrix = static_cast<glm::dmat3>(rotation);
|
||||
|
||||
// 1 AU Size Comparison Ring
|
||||
const std::string ringIdentifier = starIdentifier + "_1AU_Ring";
|
||||
const std::string ring = "{"
|
||||
"Identifier = '" + starIdentifier + "_1AU_Ring',"
|
||||
"Parent = '" + starIdentifier + "',"
|
||||
"Enabled = false,"
|
||||
"Renderable = {"
|
||||
"Type = 'RenderableRadialGrid',"
|
||||
"OuterRadius = " + std::to_string(AU) + ","
|
||||
"CircleSegments = 64,"
|
||||
"LineWidth = 2.0,"
|
||||
"},"
|
||||
"Transform = {"
|
||||
"Rotation = {"
|
||||
"Type = 'StaticRotation',"
|
||||
"Rotation = " + ghoul::to_string(meanOrbitPlaneRotationMatrix) + ""
|
||||
"}"
|
||||
"},"
|
||||
"GUI = {"
|
||||
"Name = '1 AU Size Comparison Ring',"
|
||||
"Path = '" + guiPath + "'"
|
||||
"}"
|
||||
"}";
|
||||
|
||||
openspace::global::scriptEngine->queueScript(
|
||||
"openspace.addSceneGraphNode(" + ring + ");",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
|
||||
// Habitable Zone
|
||||
bool hasTeff = !std::isnan(system.starData.teff);
|
||||
bool hasLuminosity = !std::isnan(system.starData.luminosity);
|
||||
|
||||
if (hasTeff && hasLuminosity) {
|
||||
float meanInclination = 0.f;
|
||||
for (const ExoplanetDataEntry& p : system.planetsData) {
|
||||
meanInclination += p.i;
|
||||
}
|
||||
meanInclination /= static_cast<float>(system.planetsData.size());
|
||||
const glm::dmat4 rotation = computeOrbitPlaneRotationMatrix(meanInclination);
|
||||
const glm::dmat3 rotationMat3 = static_cast<glm::dmat3>(rotation);
|
||||
|
||||
constexpr const char* description =
|
||||
"The habitable zone is the region around a star in which an Earth-like "
|
||||
"planet can potentially have liquid water on its surface."
|
||||
@@ -448,7 +478,7 @@ void createExoplanetSystem(const std::string& starName) {
|
||||
"Transform = {"
|
||||
"Rotation = {"
|
||||
"Type = 'StaticRotation',"
|
||||
"Rotation = " + ghoul::to_string(rotationMat3) + ""
|
||||
"Rotation = " + ghoul::to_string(meanOrbitPlaneRotationMatrix) + ""
|
||||
"}"
|
||||
"},"
|
||||
"GUI = {"
|
||||
|
||||
@@ -39,7 +39,7 @@ openspace.gaia.addClippingBox = function (name, size, position)
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableBoxGrid",
|
||||
GridColor = { 0.6, 0.5, 0.7 },
|
||||
Color = { 0.6, 0.5, 0.7 },
|
||||
LineWidth = 2.0,
|
||||
Size = { size[1] * kilo_parsec_in_meter, size[2] * kilo_parsec_in_meter, size[3] * kilo_parsec_in_meter}
|
||||
},
|
||||
@@ -84,7 +84,7 @@ openspace.gaia.addClippingSphere = function (name, radius)
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid",
|
||||
GridColor = { 0.6, 0.5, 0.7 },
|
||||
Color = { 0.6, 0.5, 0.7 },
|
||||
LineWidth = 1.0,
|
||||
},
|
||||
GUI = {
|
||||
|
||||
@@ -68,7 +68,7 @@ function(download_cef platform version download_dir)
|
||||
set(CEF_DOWNLOAD_FILENAME "${CEF_DISTRIBUTION}.tar.bz2")
|
||||
set(CEF_DOWNLOAD_PATH "${CEF_DOWNLOAD_DIR}/${CEF_DOWNLOAD_FILENAME}")
|
||||
if (NOT EXISTS "${CEF_DOWNLOAD_PATH}")
|
||||
string(REPLACE "+" "%2B" CEF_DOWNLOAD_URL "http://opensource.spotify.com/cefbuilds/${CEF_DOWNLOAD_FILENAME}")
|
||||
string(REPLACE "+" "%2B" CEF_DOWNLOAD_URL "http://cef-builds.spotifycdn.com/${CEF_DOWNLOAD_FILENAME}")
|
||||
|
||||
# Download the SHA1 hash for the binary distribution.
|
||||
message(STATUS "Downloading CEF: ${CEF_DOWNLOAD_PATH}.sha1...")
|
||||
|
||||
Reference in New Issue
Block a user