Merge branch 'master' into issue/1099

This commit is contained in:
Jonathas Costa
2021-01-12 14:20:26 -05:00
16 changed files with 50 additions and 148 deletions

View File

@@ -154,12 +154,6 @@ if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT)
set_cef_targets("${CEF_ROOT}" OpenSpace)
run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}")
# @TODO (abock, 2020-12-12) This should be handled more gracefully. Right now we *have*
# to build OpenSpace or otherwise the necessary files will not be copied over
# Copy binary and resource files to the target output directory.
copy_files("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "$<TARGET_FILE_DIR:${CEF_TARGET}>")
copy_files("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "$<TARGET_FILE_DIR:${CEF_TARGET}>")
elseif ()
message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.")
endif ()

View File

@@ -33,7 +33,7 @@ local deepSkyPoints = {
TextColor = { 0.1, 0.4, 0.6 },
TextSize = 20.50,
TextMinSize = 16.0,
Unit = "Mpc",
Unit = "pc",
-- Fade in value in the same unit as "Unit"
--FadeInDistances = { 0.05, 1.0 },
-- Max size in pixels
@@ -68,7 +68,7 @@ local deepSkyImages = {
TexturePath = textures,
Luminosity = "radius",
ScaleLuminosity = 0.001,
Unit = "Mpc",
Unit = "pc",
-- Fade in value in the same unit as "Unit"
--FadeInDistances = {0.001, 0.05010},
PlaneMinSize = 5.0

View File

@@ -299,7 +299,7 @@ documentation::Documentation RenderablePlanesCloud::Documentation() {
RenderablePlanesCloud::RenderablePlanesCloud(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 100.f)
, _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 300000.f)
, _textColor(TextColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
, _textOpacity(TextOpacityInfo, 1.f, 0.f, 1.f)
, _textSize(TextSizeInfo, 8.0, 0.5, 24.0)
@@ -569,7 +569,7 @@ void RenderablePlanesCloud::renderPlanes(const RenderData&,
glDisable(GL_CULL_FACE);
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
global::renderEngine->openglStateCache().viewport(viewport);
ghoul::opengl::TextureUnit unit;
unit.activate();

View File

@@ -695,24 +695,7 @@ void RenderableGalaxy::renderBillboards(const RenderData& data) {
return;
}
// Saving current OpenGL state
GLenum blendEquationRGB;
GLenum blendEquationAlpha;
GLenum blendDestAlpha;
GLenum blendDestRGB;
GLenum blendSrcAlpha;
GLenum blendSrcRGB;
GLboolean depthMask;
glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDestAlpha);
glGetIntegerv(GL_BLEND_DST_RGB, &blendDestRGB);
glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
// Change OpenGL Blending and Depth states
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDepthMask(false);
glDisable(GL_DEPTH_TEST);
@@ -764,14 +747,9 @@ void RenderableGalaxy::renderBillboards(const RenderData& data) {
_billboardsProgram->deactivate();
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Restores OpenGL blending state
glBlendEquationSeparate(blendEquationRGB, blendEquationAlpha);
glBlendFuncSeparate(blendSrcRGB, blendDestRGB, blendSrcAlpha, blendDestAlpha);
glDepthMask(depthMask);
// Restores OpenGL Rendering State
global::renderEngine->openglStateCache().resetBlendState();
global::renderEngine->openglStateCache().resetDepthState();
}
float RenderableGalaxy::safeLength(const glm::vec3& vector) const {

View File

@@ -44,6 +44,7 @@
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/profiling.h>
#include <ghoul/opengl/openglstatecache.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
@@ -320,20 +321,9 @@ RenderData ShadowComponent::begin(const RenderData& data) {
// Saves current state
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO);
glGetIntegerv(GL_VIEWPORT, _mViewport);
_faceCulling = glIsEnabled(GL_CULL_FACE);
glGetIntegerv(GL_CULL_FACE_MODE, &_faceToCull);
_polygonOffSet = glIsEnabled(GL_POLYGON_OFFSET_FILL);
glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &_polygonOffSetFactor);
glGetFloatv(GL_POLYGON_OFFSET_UNITS, &_polygonOffSetUnits);
glGetFloatv(GL_COLOR_CLEAR_VALUE, _colorClearValue);
glGetFloatv(GL_DEPTH_CLEAR_VALUE, &_depthClearValue);
_depthIsEnabled = glIsEnabled(GL_DEPTH_TEST);
glGetIntegerv(GL_DEPTH_FUNC, &_depthFunction);
_blendIsEnabled = glIsEnabled(GL_BLEND);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_currentFBO);
global::renderEngine->openglStateCache().viewport(_mViewport);
glBindFramebuffer(GL_FRAMEBUFFER, _shadowFBO);
GLenum drawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_NONE, GL_NONE };
glDrawBuffers(3, drawBuffers);
@@ -370,45 +360,18 @@ void ShadowComponent::end() {
}
// Restores system state
glBindFramebuffer(GL_FRAMEBUFFER, _defaultFBO);
glBindFramebuffer(GL_FRAMEBUFFER, _currentFBO);
GLenum drawBuffers[] = {
GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2
};
glDrawBuffers(3, drawBuffers);
glViewport(_mViewport[0], _mViewport[1], _mViewport[2], _mViewport[3]);
if (_faceCulling) {
glEnable(GL_CULL_FACE);
glCullFace(_faceToCull);
}
else {
glDisable(GL_CULL_FACE);
}
if (_depthIsEnabled) {
glEnable(GL_DEPTH_TEST);
}
else {
glDisable(GL_DEPTH_TEST);
}
glDepthFunc(_depthFunction);
if (_polygonOffSet) {
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(_polygonOffSetFactor, _polygonOffSetUnits);
}
else {
glDisable(GL_POLYGON_OFFSET_FILL);
}
glClearColor(
_colorClearValue[0],
_colorClearValue[1],
_colorClearValue[2],
_colorClearValue[3]
);
glClearDepth(_depthClearValue);
// Restores OpenGL Rendering State
global::renderEngine->openglStateCache().resetColorState();
global::renderEngine->openglStateCache().resetBlendState();
global::renderEngine->openglStateCache().resetDepthState();
global::renderEngine->openglStateCache().resetPolygonAndClippingState();
if (_blendIsEnabled) {
glEnable(GL_BLEND);
@@ -467,7 +430,7 @@ void ShadowComponent::createDepthTexture() {
void ShadowComponent::createShadowFBO() {
// Saves current FBO first
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_currentFBO);
glGenFramebuffers(1, &_shadowFBO);
glBindFramebuffer(GL_FRAMEBUFFER, _shadowFBO);
@@ -492,7 +455,7 @@ void ShadowComponent::createShadowFBO() {
checkFrameBufferState("createShadowFBO()");
// Restores system state
glBindFramebuffer(GL_FRAMEBUFFER, _defaultFBO);
glBindFramebuffer(GL_FRAMEBUFFER, _currentFBO);
}
void ShadowComponent::updateDepthTexture() {

View File

@@ -117,7 +117,7 @@ private:
GLuint _dDepthTexture = 0;
GLuint _positionInLightSpaceTexture = 0;
GLuint _shadowFBO = 0;
GLint _defaultFBO = 0;
GLint _currentFBO = 0;
GLint _mViewport[4];
GLboolean _faceCulling;

View File

@@ -213,7 +213,7 @@ Tile tile(TextTileProvider& t, const TileIndex& tileIndex) {
// Keep track of defaultFBO and viewport to be able to reset state when done
GLint defaultFBO;
//GLint viewport[4];
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
defaultFBO = global::renderEngine->openglStateCache().defaultFramebuffer();
//glGetIntegerv(GL_VIEWPORT, viewport);
// Render to texture

View File

@@ -184,7 +184,7 @@ void IswaCygnet::render(const RenderData& data, RendererTasks&) {
_data.spatialScale.x * _data.offset,
_data.spatialScale.w
);
glm::vec3 position = glm::vec3(pposition) * pow(10.f, pposition.w);
glm::vec3 position = glm::vec3(pposition) * static_cast<float>(pow(10.f, pposition.w));
// Activate shader
_shader->activate();

View File

@@ -860,7 +860,7 @@ void RenderableStars::loadPSFTexture() {
void RenderableStars::renderPSFToTexture() {
// Saves current FBO first
GLint defaultFBO;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
defaultFBO = global::renderEngine->openglStateCache().defaultFramebuffer();
// GLint m_viewport[4];
// global::renderEngine.openglStateCache().viewPort(m_viewport);
@@ -973,24 +973,6 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
return;
}
// Saving current OpenGL state
GLenum blendEquationRGB;
GLenum blendEquationAlpha;
GLenum blendDestAlpha;
GLenum blendDestRGB;
GLenum blendSrcAlpha;
GLenum blendSrcRGB;
GLboolean depthMask;
glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDestAlpha);
glGetIntegerv(GL_BLEND_DST_RGB, &blendDestRGB);
glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDepthMask(false);
@@ -1093,13 +1075,9 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
glBindVertexArray(0);
_program->deactivate();
glDepthMask(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Restores OpenGL blending state
glBlendEquationSeparate(blendEquationRGB, blendEquationAlpha);
glBlendFuncSeparate(blendSrcRGB, blendDestRGB, blendSrcAlpha, blendDestAlpha);
glDepthMask(depthMask);
global::renderEngine->openglStateCache().resetBlendState();
global::renderEngine->openglStateCache().resetDepthState();
}
void RenderableStars::update(const UpdateData&) {

View File

@@ -236,6 +236,15 @@ set_folder_location(openspace_web_helper "Helper")
# Display CEF configuration settings.
PRINT_CEF_CONFIG()
# PRINT_CEF_CONFIG()
target_include_directories(${webbrowser_module} SYSTEM PUBLIC ${CEF_ROOT})
set(deps "")
foreach (i ${CEF_BINARY_FILES})
list(APPEND deps "${CEF_BINARY_DIR}/${i}")
endforeach()
foreach (j ${CEF_RESOURCE_FILES})
list(APPEND deps "${CEF_RESOURCE_DIR}/${j}")
endforeach()
add_external_library_dependencies("${deps}")

View File

@@ -556,27 +556,6 @@ void FramebufferRenderer::updateDownscaleTextures() {
}
void FramebufferRenderer::writeDownscaledVolume() {
// Saving current OpenGL state
GLboolean blendEnabled = glIsEnabledi(GL_BLEND, 0);
GLenum blendEquationRGB;
glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
GLenum blendEquationAlpha;
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
GLenum blendDestAlpha;
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDestAlpha);
GLenum blendDestRGB;
glGetIntegerv(GL_BLEND_DST_RGB, &blendDestRGB);
GLenum blendSrcAlpha;
glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
GLenum blendSrcRGB;
glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);
glEnablei(GL_BLEND, 0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
@@ -620,14 +599,9 @@ void FramebufferRenderer::writeDownscaledVolume() {
_downscaledVolumeProgram->deactivate();
// Restores blending state
glBlendEquationSeparate(blendEquationRGB, blendEquationAlpha);
glBlendFuncSeparate(blendSrcRGB, blendDestRGB, blendSrcAlpha, blendDestAlpha);
if (!blendEnabled) {
glDisablei(GL_BLEND, 0);
}
// Restores OpenGL Rendering State
global::renderEngine->openglStateCache().resetBlendState();
global::renderEngine->openglStateCache().resetDepthState();
}
void FramebufferRenderer::update() {
@@ -1125,6 +1099,7 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
TracyGpuZone("FramebufferRenderer")
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO);
global::renderEngine->openglStateCache().setDefaultFramebuffer(_defaultFBO);
GLint viewport[4] = { 0 };
global::renderEngine->openglStateCache().viewport(viewport);

View File

@@ -1,5 +1,4 @@
assert(type(asset.require) == "function", "require should be function")
assert(type(asset.request) == "function", "request should be function")
assert(type(asset.localResource) == "function", "localResource should be function")
assert(type(asset.syncedResource) == "function", "syncedResource should be function")
assert(type(asset.export) == "function", "export should be function")

View File

@@ -2738,7 +2738,8 @@ TEST_CASE("Documentation: DeprecatedVerifier", "[documentation]") {
TestResult positiveRes = testSpecification(doc, positive);
REQUIRE(positiveRes.success);
REQUIRE(positiveRes.offenses.empty());
REQUIRE(positiveRes.warnings.size() == 13);
REQUIRE(positiveRes.warnings.size() == doc.entries.size());
REQUIRE(positiveRes.warnings[0].offender == "bool");
REQUIRE(positiveRes.warnings[0].reason == TestResult::Warning::Reason::Deprecated);
REQUIRE(positiveRes.warnings[1].offender == "double");

View File

@@ -77,6 +77,7 @@
#include <openspace/properties/stringproperty.h>
#include <ghoul/lua/ghoul_lua.h>
#include <random>
#include <iostream>
namespace {
constexpr const int NumberFuzzTests = 10000;
@@ -304,8 +305,12 @@ TEMPLATE_TEST_CASE("LuaConversion Float Fuzz", "[luaconversion]", float, double,
success2
);
REQUIRE(success2);
REQUIRE(value == val);
if (typeid(T) == typeid(long double)) {
if (value != std::numeric_limits<long double>::infinity()) {
REQUIRE(value == val);
}
}
lua_pop(state, 1);
}