Merged master. It broke the bloom filter.

This commit is contained in:
Jonathas Costa
2019-06-19 20:47:37 -04:00
1393 changed files with 16974 additions and 11009 deletions
+100 -100
View File
@@ -25,116 +25,116 @@
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemangle.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdate.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdistance.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemframerate.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemmission.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemparallelconnection.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditempropertyvalue.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemsimulationincrement.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemspacing.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemvelocity.h
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/cameralightsource.h
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/scenegraphlightsource.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableboxgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecartesianaxes.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimagelocal.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimageonline.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphericalgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h
${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.h
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/constantrotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/timedependentscale.h
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeinterval.h
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeunion.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemangle.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdate.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdistance.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemframerate.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemmission.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemparallelconnection.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditempropertyvalue.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemsimulationincrement.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemspacing.h
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemvelocity.h
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/cameralightsource.h
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/scenegraphlightsource.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableboxgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecartesianaxes.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimagelocal.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimageonline.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphericalgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h
${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.h
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/constantrotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/timedependentscale.h
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeinterval.h
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeunion.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemangle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdistance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemframerate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemmission.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemparallelconnection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditempropertyvalue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemsimulationincrement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemspacing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemvelocity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/cameralightsource.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/scenegraphlightsource.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableboxgrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecartesianaxes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimagelocal.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimageonline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphericalgrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/constantrotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/timedependentscale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeinterval.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeunion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemangle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdistance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemframerate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemmission.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemparallelconnection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditempropertyvalue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemsimulationincrement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemspacing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemvelocity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/cameralightsource.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lightsource/scenegraphlightsource.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableboxgrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecartesianaxes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimagelocal.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimageonline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphericalgrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/constantrotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/timedependentscale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeinterval.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeunion.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/axes_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/axes_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/grid_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/grid_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/axes_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/axes_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/grid_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/grid_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_vs.glsl
)
source_group("Shader Files" FILES ${SHADER_FILES})
create_new_module(
"Base"
base_module
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
"Base"
base_module
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+4 -10
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -214,9 +214,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
_fontName = dictionary.value<std::string>(FontNameInfo.identifier);
}
if (dictionary.hasKey(FontSizeInfo.identifier)) {
_fontSize = static_cast<float>(
dictionary.value<double>(FontSizeInfo.identifier)
);
_fontSize = static_cast<float>(dictionary.value<double>(FontSizeInfo.identifier));
}
_fontName.onChange([this]() {
@@ -256,9 +254,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
}
addProperty(_source.type);
_source.nodeName.onChange([this]() {
_source.node = nullptr;
});
_source.nodeName.onChange([this]() { _source.node = nullptr; });
if (_source.type == Type::Node) {
if (dictionary.hasKey(SourceNodeNameInfo.identifier)) {
_source.nodeName = dictionary.value<std::string>(
@@ -297,9 +293,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
}
addProperty(_reference.type);
_reference.nodeName.onChange([this]() {
_reference.node = nullptr;
});
_reference.nodeName.onChange([this]() { _reference.node = nullptr; });
if (_reference.type == Type::Node) {
if (dictionary.hasKey(ReferenceNodeNameInfo.identifier)) {
_reference.nodeName = dictionary.value<std::string>(
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+2 -4
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -99,9 +99,7 @@ DashboardItemDate::DashboardItemDate(const ghoul::Dictionary& dictionary)
addProperty(_fontName);
if (dictionary.hasKey(FontSizeInfo.identifier)) {
_fontSize = static_cast<float>(
dictionary.value<double>(FontSizeInfo.identifier)
);
_fontSize = static_cast<float>(dictionary.value<double>(FontSizeInfo.identifier));
}
_fontSize.onChange([this](){
_font = global::fontManager.font(_fontName, _fontSize);
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -407,10 +407,9 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
if (!anchor) {
return { glm::dvec3(0.0), "Unknown" };
}
return {
global::navigationHandler.orbitalNavigator().anchorNode()->worldPosition(),
"focus"
};
else {
return { anchor->worldPosition(), "focus" };
}
}
case Type::Camera:
return { global::renderEngine.scene()->camera()->positionVec3(), "camera" };
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+165 -69
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -54,6 +54,90 @@ namespace {
"Type of the frame time display",
"This value determines the units in which the frame time is displayed."
};
constexpr openspace::properties::Property::PropertyInfo ClearCacheInfo = {
"ClearCache",
"Clear Cache",
"Clears the cache of this DashboardItemFramerate item. If the selected option "
"does not use any caching, this trigger does not do anything."
};
constexpr const char* ValueDtAvg = "Average Deltatime";
constexpr const char* ValueDtExtremes = "Deltatime extremes";
constexpr const char* ValueDtStandardDeviation = "Deltatime standard deviation";
constexpr const char* ValueDtCov = "Deltatime coefficient of variation";
constexpr const char* ValueFps = "Frames per second";
constexpr const char* ValueFpsAvg = "Average frames per second";
constexpr const char* ValueNone = "None";
std::string formatDt() {
return fmt::format(
"Avg. Frametime: {:.2f} ms",
openspace::global::windowDelegate.averageDeltaTime() * 1000.0
);
}
std::string formatDtExtremes(double minFrametimeCache, double maxFrametimeCache) {
return fmt::format(
"Last frametimes between: {:.2f} and {:.2f} ms\n"
"Overall between: {:.2f} and {:.2f} ms",
openspace::global::windowDelegate.minDeltaTime() * 1000.0,
openspace::global::windowDelegate.maxDeltaTime() * 1000.0,
minFrametimeCache,
maxFrametimeCache
);
}
std::string formatDtStandardDeviation() {
return fmt::format(
"Frametime standard deviation : {:.2f} ms",
openspace::global::windowDelegate.deltaTimeStandardDeviation() * 1000.0
);
}
std::string formatDtCoefficientOfVariation() {
return fmt::format(
"Frametime coefficient of variation : {:.2f} %",
openspace::global::windowDelegate.deltaTimeStandardDeviation() /
openspace::global::windowDelegate.averageDeltaTime() * 100.0
);
}
std::string formatFps() {
return fmt::format(
"FPS: {:3.2f}",
1.0 / openspace::global::windowDelegate.deltaTime()
);
}
std::string formatAverageFps() {
return fmt::format(
"Avg. FPS: {:3.2f}",
1.0 / openspace::global::windowDelegate.averageDeltaTime()
);
}
std::string format(openspace::DashboardItemFramerate::FrametimeType frametimeType,
double minFrametimeCache, double maxFrametimeCache)
{
using namespace openspace;
switch (frametimeType) {
case DashboardItemFramerate::FrametimeType::DtTimeAvg:
return formatDt();
case DashboardItemFramerate::FrametimeType::DtTimeExtremes:
return formatDtExtremes(minFrametimeCache, maxFrametimeCache);
case DashboardItemFramerate::FrametimeType::DtStandardDeviation:
return formatDtStandardDeviation();
case DashboardItemFramerate::FrametimeType::DtCoefficientOfVariation:
return formatDtCoefficientOfVariation();
case DashboardItemFramerate::FrametimeType::FPS:
return formatFps();
case DashboardItemFramerate::FrametimeType::FPSAvg:
return formatAverageFps();
default:
return "";
}
}
} // namespace
namespace openspace {
@@ -84,9 +168,8 @@ documentation::Documentation DashboardItemFramerate::Documentation() {
},
{
FrametimeInfo.identifier,
new StringInListVerifier({
"Average Deltatime", "Frames per second", "Average frames per second",
"None"
new StringInListVerifier({ ValueDtAvg, ValueDtExtremes,
ValueDtStandardDeviation, ValueDtCov, ValueFps, ValueFpsAvg, ValueNone
}),
Optional::Yes,
FrametimeInfo.description
@@ -100,6 +183,7 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
, _fontName(FontNameInfo, KeyFontMono)
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
, _frametimeType(FrametimeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _clearCache(ClearCacheInfo)
{
documentation::testSpecificationAndThrow(
Documentation(),
@@ -126,21 +210,41 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
addProperty(_fontSize);
_frametimeType.addOptions({
{ static_cast<int>(FrametimeType::DtTimeAvg), "Average Deltatime" },
{ static_cast<int>(FrametimeType::FPS), "Frames per second" },
{ static_cast<int>(FrametimeType::FPSAvg), "Average frames per second" },
{ static_cast<int>(FrametimeType::None), "None" }
{ static_cast<int>(FrametimeType::DtTimeAvg), ValueDtAvg },
{ static_cast<int>(FrametimeType::DtTimeExtremes), ValueDtExtremes },
{
static_cast<int>(FrametimeType::DtStandardDeviation),
ValueDtStandardDeviation
},
{
static_cast<int>(FrametimeType::DtCoefficientOfVariation),
ValueDtCov
},
{ static_cast<int>(FrametimeType::FPS), ValueFps },
{ static_cast<int>(FrametimeType::FPSAvg), ValueFpsAvg },
{ static_cast<int>(FrametimeType::None), ValueNone }
});
if (dictionary.hasKey(FrametimeInfo.identifier)) {
const std::string& v = dictionary.value<std::string>(FrametimeInfo.identifier);
if (v == "Average Deltatime") {
if (v == ValueDtAvg) {
_frametimeType = static_cast<int>(FrametimeType::DtTimeAvg);
}
else if (v == "Frames per second") {
else if (v == ValueDtExtremes) {
_frametimeType = static_cast<int>(FrametimeType::DtTimeExtremes);
}
else if (v == ValueDtStandardDeviation) {
_frametimeType =
static_cast<int>(FrametimeType::DtStandardDeviation);
}
else if (v == ValueDtCov) {
_frametimeType =
static_cast<int>(FrametimeType::DtCoefficientOfVariation);
}
else if (v == ValueFps) {
_frametimeType = static_cast<int>(FrametimeType::FPS);
}
else if (v == "Average frames per second") {
else if (v == ValueFpsAvg) {
_frametimeType = static_cast<int>(FrametimeType::FPSAvg);
}
else {
@@ -152,74 +256,66 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
}
addProperty(_frametimeType);
_clearCache.onChange([this]() {
_shouldClearCache = true;
});
addProperty(_clearCache);
_font = global::fontManager.font(_fontName, _fontSize);
}
void DashboardItemFramerate::render(glm::vec2& penPosition) {
FrametimeType frametimeType = FrametimeType(_frametimeType.value());
switch (frametimeType) {
case FrametimeType::DtTimeAvg:
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format(
"Avg. Frametime: {:.5f}", global::windowDelegate.averageDeltaTime()
)
);
break;
case FrametimeType::FPS:
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format("FPS: {:3.2f}", 1.0 / global::windowDelegate.deltaTime())
);
break;
case FrametimeType::FPSAvg:
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format(
"Avg. FPS: {:3.2f}", 1.0 / global::windowDelegate.averageDeltaTime()
)
);
break;
case FrametimeType::None:
break;
if (_shouldClearCache) {
_minDeltaTimeCache = 1.0;
_maxDeltaTimeCache = -1.0;
_shouldClearCache = false;
}
_minDeltaTimeCache = std::min(
_minDeltaTimeCache,
global::windowDelegate.minDeltaTime() * 1000.0
);
_maxDeltaTimeCache = std::max(
_maxDeltaTimeCache,
global::windowDelegate.maxDeltaTime() * 1000.0
);
FrametimeType frametimeType = FrametimeType(_frametimeType.value());
const std::string output = format(
frametimeType,
_minDeltaTimeCache,
_maxDeltaTimeCache
);
int nLines = output.empty() ? 0 :
(std::count(output.begin(), output.end(), '\n') + 1);
penPosition.y -= _font->height() * static_cast<float>(nLines);
ghoul::fontrendering::FontRenderer::defaultRenderer().render(
*_font,
penPosition,
output
);
}
glm::vec2 DashboardItemFramerate::size() const {
FrametimeType frametimeType = FrametimeType(_frametimeType.value());
switch (frametimeType) {
case FrametimeType::DtTimeAvg:
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
*_font,
fmt::format(
"Avg. Frametime: {:.5f}", global::windowDelegate.averageDeltaTime()
)
).boundingBox;
case FrametimeType::FPS:
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
*_font,
fmt::format(
"FPS: {:3.2f}", 1.0 / global::windowDelegate.deltaTime()
)
).boundingBox;
case FrametimeType::FPSAvg:
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
*_font,
fmt::format(
"Avg. FPS: %3.2f", 1.0 / global::windowDelegate.averageDeltaTime()
)
).boundingBox;
case FrametimeType::None:
return { 0.f, 0.f };
default:
return { 0.f, 0.f };
const std::string output = format(
frametimeType,
_minDeltaTimeCache,
_maxDeltaTimeCache
);
if (output.empty()) {
return { 0.f, 0.f };
}
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
*_font,
output
).boundingBox;
}
} // namespace openspace
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -29,6 +29,7 @@
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
namespace ghoul { class Dictionary; }
@@ -42,6 +43,9 @@ class DashboardItemFramerate : public DashboardItem {
public:
enum class FrametimeType {
DtTimeAvg = 0,
DtTimeExtremes,
DtStandardDeviation,
DtCoefficientOfVariation,
FPS,
FPSAvg,
None
@@ -57,8 +61,13 @@ private:
properties::StringProperty _fontName;
properties::FloatProperty _fontSize;
properties::OptionProperty _frametimeType;
properties::TriggerProperty _clearCache;
std::shared_ptr<ghoul::fontrendering::Font> _font;
double _minDeltaTimeCache = 1.0;
double _maxDeltaTimeCache = -1.0;
bool _shouldClearCache = true;
};
} // openspace
+99 -99
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -118,9 +118,7 @@ DashboardItemMission::DashboardItemMission(const ghoul::Dictionary& dictionary)
addProperty(_fontName);
if (dictionary.hasKey(FontSizeInfo.identifier)) {
_fontSize = static_cast<float>(
dictionary.value<double>(FontSizeInfo.identifier)
);
_fontSize = static_cast<float>(dictionary.value<double>(FontSizeInfo.identifier));
}
_fontSize.onChange([this](){
_font = global::fontManager.font(_fontName, _fontSize);
@@ -131,114 +129,116 @@ DashboardItemMission::DashboardItemMission(const ghoul::Dictionary& dictionary)
}
void DashboardItemMission::render(glm::vec2& penPosition) {
if (global::missionManager.hasCurrentMission()) {
double currentTime = global::timeManager.time().j2000Seconds();
const Mission& mission = global::missionManager.currentMission();
if (!global::missionManager.hasCurrentMission()) {
return;
}
double currentTime = global::timeManager.time().j2000Seconds();
const Mission& mission = global::missionManager.currentMission();
if (!mission.phases().empty()) {
static const glm::vec4 nextMissionColor(0.7f, 0.3f, 0.3f, 1.f);
static const glm::vec4 currentMissionColor(0.f, 0.5f, 0.5f, 1.f);
static const glm::vec4 missionProgressColor = currentMissionColor;
static const glm::vec4 nonCurrentMissionColor(0.3f, 0.3f, 0.3f, 1.f);
if (mission.phases().empty()) {
return;
}
static const glm::vec4 nextMissionColor(0.7f, 0.3f, 0.3f, 1.f);
static const glm::vec4 currentMissionColor(0.f, 0.5f, 0.5f, 1.f);
static const glm::vec4 missionProgressColor = currentMissionColor;
static const glm::vec4 nonCurrentMissionColor(0.3f, 0.3f, 0.3f, 1.f);
// Add spacing
// Add spacing
RenderFont(
*_font,
penPosition,
" ",
nonCurrentMissionColor,
ghoul::fontrendering::CrDirection::Down
);
auto phaseTrace = mission.phaseTrace(currentTime);
if (!phaseTrace.empty()) {
const MissionPhase& phase = phaseTrace.back().get();
const std::string title = "Current Mission Phase: " + phase.name();
penPosition.y -= _font->height();
RenderFont(*_font, penPosition, title, missionProgressColor);
double remaining = phase.timeRange().end - currentTime;
float t = static_cast<float>(
1.0 - remaining / phase.timeRange().duration()
);
std::string progress = progressToStr(25, t);
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format("{:.0f} s {:s} {:.1f} %", remaining, progress, t * 100),
missionProgressColor
);
}
else {
penPosition.y -= _font->height();
RenderFont(*_font, penPosition, "Next Mission:", nextMissionColor);
const double remaining = mission.timeRange().start - currentTime;
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format("{:.0f} s", remaining),
nextMissionColor
);
}
bool showAllPhases = false;
using PhaseWithDepth = std::pair<const MissionPhase*, int>;
std::stack<PhaseWithDepth> S;
constexpr const int PixelIndentation = 20;
S.push({ &mission, 0 });
while (!S.empty()) {
const MissionPhase* phase = S.top().first;
const int depth = S.top().second;
S.pop();
const bool isCurrentPhase = phase->timeRange().includes(currentTime);
penPosition.x += depth * PixelIndentation;
if (isCurrentPhase) {
const double remaining = phase->timeRange().end - currentTime;
const float t = static_cast<float>(
1.0 - remaining / phase->timeRange().duration()
);
const std::string progress = progressToStr(25, t);
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
" ",
nonCurrentMissionColor,
ghoul::fontrendering::CrDirection::Down
fmt::format(
"{:s} {:s} {:.1f} %",
phase->name(),progress,t * 100
),
currentMissionColor
);
auto phaseTrace = mission.phaseTrace(currentTime);
if (!phaseTrace.empty()) {
const MissionPhase& phase = phaseTrace.back().get();
const std::string title = "Current Mission Phase: " + phase.name();
penPosition.y -= _font->height();
RenderFont(*_font, penPosition, title, missionProgressColor);
double remaining = phase.timeRange().end - currentTime;
float t = static_cast<float>(
1.0 - remaining / phase.timeRange().duration()
);
std::string progress = progressToStr(25, t);
}
else {
if (!phase->name().empty()) {
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format("{:.0f} s {:s} {:.1f} %", remaining, progress, t * 100),
missionProgressColor
);
}
else {
penPosition.y -= _font->height();
RenderFont(*_font, penPosition, "Next Mission:", nextMissionColor);
const double remaining = mission.timeRange().start - currentTime;
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format("{:.0f} s", remaining),
nextMissionColor
phase->name(),
nonCurrentMissionColor
);
}
}
penPosition.x -= depth * PixelIndentation;
bool showAllPhases = false;
using PhaseWithDepth = std::pair<const MissionPhase*, int>;
std::stack<PhaseWithDepth> S;
constexpr const int PixelIndentation = 20;
S.push({ &mission, 0 });
while (!S.empty()) {
const MissionPhase* phase = S.top().first;
const int depth = S.top().second;
S.pop();
const bool isCurrentPhase = phase->timeRange().includes(currentTime);
penPosition.x += depth * PixelIndentation;
if (isCurrentPhase) {
const double remaining = phase->timeRange().end - currentTime;
const float t = static_cast<float>(
1.0 - remaining / phase->timeRange().duration()
);
const std::string progress = progressToStr(25, t);
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format(
"{:s} {:s} {:.1f} %",
phase->name(),progress,t * 100
),
currentMissionColor
);
}
else {
if (!phase->name().empty()) {
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
phase->name(),
nonCurrentMissionColor
);
}
}
penPosition.x -= depth * PixelIndentation;
if (isCurrentPhase || showAllPhases) {
// phases are sorted increasingly by start time, and will be
// popped last-in-first-out from the stack, so add them in
// reversed order.
int indexLastPhase = static_cast<int>(
phase->phases().size()
) - 1;
for (int i = indexLastPhase; 0 <= i; --i) {
S.push({ &phase->phases()[i], depth + 1 });
}
}
if (isCurrentPhase || showAllPhases) {
// phases are sorted increasingly by start time, and will be
// popped last-in-first-out from the stack, so add them in
// reversed order.
int indexLastPhase = static_cast<int>(
phase->phases().size()
) - 1;
for (int i = indexLastPhase; 0 <= i; --i) {
S.push({ &phase->phases()[i], depth + 1 });
}
}
}
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -103,9 +103,7 @@ DashboardItemParallelConnection::DashboardItemParallelConnection(
addProperty(_fontName);
if (dictionary.hasKey(FontSizeInfo.identifier)) {
_fontSize = static_cast<float>(
dictionary.value<double>(FontSizeInfo.identifier)
);
_fontSize = static_cast<float>(dictionary.value<double>(FontSizeInfo.identifier));
}
_fontSize.onChange([this](){
_font = global::fontManager.font(_fontName, _fontSize);
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -27,8 +27,8 @@
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/util/timemanager.h>
#include <openspace/query/query.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -129,9 +129,7 @@ DashboardItemPropertyValue::DashboardItemPropertyValue(
addProperty(_fontName);
if (dictionary.hasKey(FontSizeInfo.identifier)) {
_fontSize = static_cast<float>(
dictionary.value<double>(FontSizeInfo.identifier)
);
_fontSize = static_cast<float>(dictionary.value<double>(FontSizeInfo.identifier));
}
_fontSize.onChange([this](){
_font = global::fontManager.font(_fontName, _fontSize);
@@ -141,9 +139,7 @@ DashboardItemPropertyValue::DashboardItemPropertyValue(
if (dictionary.hasKey(PropertyUriInfo.identifier)) {
_propertyUri = dictionary.value<std::string>(PropertyUriInfo.identifier);
}
_propertyUri.onChange([this]() {
_propertyIsDirty = true;
});
_propertyUri.onChange([this]() { _propertyIsDirty = true; });
addProperty(_propertyUri);
if (dictionary.hasKey(DisplayStringInfo.identifier)) {
@@ -165,11 +161,7 @@ void DashboardItemPropertyValue::render(glm::vec2& penPosition) {
_property->getStringValue(value);
penPosition.y -= _font->height();
RenderFont(
*_font,
penPosition,
fmt::format(_displayString.value(), value)
);
RenderFont(*_font, penPosition, fmt::format(_displayString.value(), value));
}
}
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -59,8 +59,6 @@ private:
properties::StringProperty _propertyUri;
properties::StringProperty _displayString;
std::shared_ptr<ghoul::fontrendering::Font> _font;
};
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -152,12 +152,11 @@ DashboardItemSimulationIncrement::DashboardItemSimulationIncrement(
_doSimplification = dictionary.value<bool>(SimplificationInfo.identifier);
}
_doSimplification.onChange([this]() {
if (_doSimplification) {
_requestedUnit.setVisibility(properties::Property::Visibility::Hidden);
}
else {
_requestedUnit.setVisibility(properties::Property::Visibility::User);
}
_requestedUnit.setVisibility(
_doSimplification ?
properties::Property::Visibility::Hidden :
properties::Property::Visibility::User
);
});
addProperty(_doSimplification);
@@ -221,8 +220,7 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) {
penPosition,
fmt::format(
"Simulation increment: {:.1f} {:s} / second{:s}",
targetDeltaTime.first, targetDeltaTime.second,
pauseText
targetDeltaTime.first, targetDeltaTime.second, pauseText
)
);
}
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+58 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -85,6 +85,12 @@ namespace {
"of the Sun."
};
constexpr openspace::properties::Property::PropertyInfo DisableFaceCullingInfo = {
"DisableFaceCulling",
"Disable Face Culling",
"Disable OpenGL automatic face culling optimization."
};
constexpr openspace::properties::Property::PropertyInfo ModelTransformInfo = {
"ModelTransform",
"Model Transform",
@@ -92,6 +98,12 @@ namespace {
"all other transformations are applied."
};
constexpr openspace::properties::Property::PropertyInfo RotationVecInfo = {
"RotationVector",
"Rotation Vector",
"Rotation Vector using degrees"
};
constexpr openspace::properties::Property::PropertyInfo LightSourcesInfo = {
"LightSources",
"Light Sources",
@@ -143,12 +155,24 @@ documentation::Documentation RenderableModel::Documentation() {
Optional::Yes,
ShadingInfo.description
},
{
DisableFaceCullingInfo.identifier,
new BoolVerifier,
Optional::Yes,
DisableFaceCullingInfo.description
},
{
ModelTransformInfo.identifier,
new DoubleMatrix3Verifier,
Optional::Yes,
ModelTransformInfo.description
},
{
RotationVecInfo.identifier,
new DoubleVector3Verifier,
Optional::Yes,
RotationVecInfo.description
},
{
LightSourcesInfo.identifier,
new TableVerifier({
@@ -172,7 +196,14 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
, _diffuseIntensity(DiffuseIntensityInfo, 1.f, 0.f, 1.f)
, _specularIntensity(SpecularIntensityInfo, 1.f, 0.f, 1.f)
, _performShading(ShadingInfo, true)
, _modelTransform(ModelTransformInfo, glm::mat3(1.f))
, _disableFaceCulling(DisableFaceCullingInfo, false)
, _modelTransform(
ModelTransformInfo,
glm::dmat3(1.0),
glm::dmat3(-1.0),
glm::dmat3(1.0)
)
, _rotationVec(RotationVecInfo, glm::dvec3(0.0), glm::dvec3(0.0), glm::dvec3(360.0))
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
{
documentation::testSpecificationAndThrow(
@@ -214,6 +245,10 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
_performShading = dictionary.value<bool>(ShadingInfo.identifier);
}
if (dictionary.hasKey(DisableFaceCullingInfo.identifier)) {
_disableFaceCulling = dictionary.value<bool>(DisableFaceCullingInfo.identifier);
}
if (dictionary.hasKey(LightSourcesInfo.identifier)) {
const ghoul::Dictionary& lsDictionary =
dictionary.value<ghoul::Dictionary>(LightSourcesInfo.identifier);
@@ -238,6 +273,19 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
addProperty(_diffuseIntensity);
addProperty(_specularIntensity);
addProperty(_performShading);
addProperty(_disableFaceCulling);
addProperty(_modelTransform);
addProperty(_rotationVec);
_rotationVec.onChange([this]() {
glm::vec3 degreeVector = _rotationVec;
glm::vec3 radianVector = glm::vec3(
glm::radians(degreeVector.x),
glm::radians(degreeVector.y),
glm::radians(degreeVector.z)
);
_modelTransform = glm::mat4_cast(glm::quat(radianVector));
});
}
bool RenderableModel::isReady() const {
@@ -361,8 +409,16 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
_texture->bind();
_program->setUniform(_uniformCache.texture, unit);
if (_disableFaceCulling) {
glDisable(GL_CULL_FACE);
}
_geometry->render();
if (_disableFaceCulling) {
glEnable(GL_CULL_FACE);
}
_program->deactivate();
}
+9 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -33,6 +33,10 @@
#include <openspace/properties/scalar/floatproperty.h>
#include <ghoul/opengl/uniformcache.h>
#include <memory>
#include <openspace/properties/matrix/dmat4property.h>
#include <openspace/properties/vector/vec3property.h>
namespace ghoul::opengl {
class ProgramObject;
@@ -73,11 +77,14 @@ private:
properties::StringProperty _colorTexturePath;
properties::FloatProperty _ambientIntensity;
properties::FloatProperty _diffuseIntensity;
properties::FloatProperty _specularIntensity;
properties::BoolProperty _performShading;
properties::Mat3Property _modelTransform;
properties::BoolProperty _disableFaceCulling;
properties::DMat4Property _modelTransform;
properties::Vec3Property _rotationVec;
ghoul::opengl::ProgramObject* _program = nullptr;
UniformCache(opacity, nLightSources, lightDirectionsViewSpace, lightIntensities,
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -42,6 +42,13 @@ namespace {
"This value specifies an image that is loaded from disk and is used as a texture "
"that is applied to this plane. This image has to be square."
};
constexpr openspace::properties::Property::PropertyInfo RenderableTypeInfo = {
"RenderableType",
"RenderableType",
"This value specifies if the plane should be rendered in the Background,"
"Opaque, Transparent, or Overlay rendering step."
};
} // namespace
namespace openspace {
@@ -56,7 +63,13 @@ documentation::Documentation RenderablePlaneImageLocal::Documentation() {
TextureInfo.identifier,
new StringVerifier,
Optional::No,
TextureInfo.description,
TextureInfo.description
},
{
RenderableTypeInfo.identifier,
new StringVerifier,
Optional::Yes,
RenderableTypeInfo.description
}
}
};
@@ -80,6 +93,26 @@ RenderablePlaneImageLocal::RenderablePlaneImageLocal(const ghoul::Dictionary& di
_textureFile->setCallback(
[this](const ghoul::filesystem::File&) { _textureIsDirty = true; }
);
if (dictionary.hasKey(RenderableTypeInfo.identifier)) {
std::string renderType = dictionary.value<std::string>(
RenderableTypeInfo.identifier
);
if (renderType == "Background") {
setRenderBin(Renderable::RenderBin::Background);
} else if (renderType == "Opaque") {
setRenderBin(Renderable::RenderBin::Opaque);
}
else if (renderType == "Transparent") {
setRenderBin(Renderable::RenderBin::Transparent);
}
else if (renderType == "Overlay") {
setRenderBin(Renderable::RenderBin::Overlay);
}
}
else {
setRenderBin(Renderable::RenderBin::Opaque);
}
}
bool RenderablePlaneImageLocal::isReady() const {
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+186 -77
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -29,7 +29,6 @@
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/powerscaledscalar.h>
#include <openspace/util/powerscaledsphere.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/glm.h>
@@ -43,13 +42,15 @@
namespace {
constexpr const char* ProgramName = "Sphere";
constexpr const std::array<const char*, 4> UniformNames = {
"opacity", "ViewProjection", "ModelTransform", "texture1"
constexpr const std::array<const char*, 5> UniformNames = {
"opacity", "modelViewProjection", "modelViewRotation", "colorTexture",
"mirrorTexture"
};
enum Orientation {
Outside = 1,
Inside = 2
enum class Orientation : int {
Outside = 0,
Inside,
Both
};
constexpr openspace::properties::Property::PropertyInfo TextureInfo = {
@@ -60,6 +61,12 @@ namespace {
"projection."
};
constexpr openspace::properties::Property::PropertyInfo MirrorTextureInfo = {
"MirrorTexture",
"Mirror Texture",
"Mirror the texture along the x-axis."
};
constexpr openspace::properties::Property::PropertyInfo OrientationInfo = {
"Orientation",
"Orientation",
@@ -67,6 +74,12 @@ namespace {
"outside of the sphere, or both."
};
constexpr openspace::properties::Property::PropertyInfo UseAdditiveBlendingInfo = {
"UseAdditiveBlending",
"Use Additive Blending",
"Render the object using additive blending."
};
constexpr openspace::properties::Property::PropertyInfo SegmentsInfo = {
"Segments",
"Number of Segments",
@@ -79,25 +92,31 @@ namespace {
"This value specifies the radius of the sphere in meters."
};
constexpr openspace::properties::Property::PropertyInfo FadeOutThreshouldInfo = {
"FadeOutThreshould",
"Fade-Out Threshould",
constexpr openspace::properties::Property::PropertyInfo FadeOutThresholdInfo = {
"FadeOutThreshold",
"Fade-Out Threshold",
"This value determines percentage of the sphere is visible before starting "
"fading-out it."
};
constexpr openspace::properties::Property::PropertyInfo FadeInThreshouldInfo = {
"FadeInThreshould",
"Fade-In Threshould",
constexpr openspace::properties::Property::PropertyInfo FadeInThresholdInfo = {
"FadeInThreshold",
"Fade-In Threshold",
"Distance from center of MilkyWay from where the astronomical object starts to "
"fade in."
};
constexpr openspace::properties::Property::PropertyInfo DisableFadeInOuInfo = {
"DisableFadeInOu",
constexpr openspace::properties::Property::PropertyInfo DisableFadeInOutInfo = {
"DisableFadeInOut",
"Disable Fade-In/Fade-Out effects",
"Enables/Disables the Fade-In/Out effects."
};
constexpr openspace::properties::Property::PropertyInfo BackgroundInfo = {
"Background",
"Sets the current sphere rendering as a background rendering type",
"Enables/Disables background rendering."
};
} // namespace
namespace openspace {
@@ -128,27 +147,45 @@ documentation::Documentation RenderableSphere::Documentation() {
},
{
OrientationInfo.identifier,
new StringInListVerifier({ "Inside", "Outside", "Inside/Outside" }),
new StringInListVerifier({ "Inside", "Outside", "Both" }),
Optional::Yes,
OrientationInfo.description
},
{
FadeOutThreshouldInfo.identifier,
new DoubleInRangeVerifier(0.0, 1.0),
Optional::Yes,
FadeOutThreshouldInfo.description
},
{
FadeInThreshouldInfo.identifier,
new DoubleVerifier,
Optional::Yes,
FadeInThreshouldInfo.description
},
{
DisableFadeInOuInfo.identifier,
UseAdditiveBlendingInfo.identifier,
new BoolVerifier,
Optional::Yes,
DisableFadeInOuInfo.description
UseAdditiveBlendingInfo.description
},
{
MirrorTextureInfo.identifier,
new BoolVerifier,
Optional::Yes,
MirrorTextureInfo.description
},
{
FadeOutThresholdInfo.identifier,
new DoubleInRangeVerifier(0.0, 1.0),
Optional::Yes,
FadeOutThresholdInfo.description
},
{
FadeInThresholdInfo.identifier,
new DoubleVerifier,
Optional::Yes,
FadeInThresholdInfo.description
},
{
DisableFadeInOutInfo.identifier,
new BoolVerifier,
Optional::Yes,
DisableFadeInOutInfo.description
},
{
BackgroundInfo.identifier,
new BoolVerifier,
Optional::Yes,
BackgroundInfo.description
},
}
};
@@ -161,7 +198,12 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
, _orientation(OrientationInfo, properties::OptionProperty::DisplayType::Dropdown)
, _size(SizeInfo, 1.f, 0.f, 1e35f)
, _segments(SegmentsInfo, 8, 4, 1000)
, _disableFadeInDistance(DisableFadeInOuInfo, true)
, _mirrorTexture(MirrorTextureInfo, false)
, _useAdditiveBlending(UseAdditiveBlendingInfo, false)
, _disableFadeInDistance(DisableFadeInOutInfo, true)
, _backgroundRendering(BackgroundInfo, false)
, _fadeInThreshold(FadeInThresholdInfo, -1.f, 0.f, 1.f)
, _fadeOutThreshold(FadeOutThresholdInfo, -1.f, 0.f, 1.f)
{
documentation::testSpecificationAndThrow(
Documentation(),
@@ -177,28 +219,28 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
_orientation.addOptions({
{ Outside, "Outside" },
{ Inside, "Inside" },
{ Outside | Inside, "Inside/Outside" }
{ static_cast<int>(Orientation::Outside), "Outside" },
{ static_cast<int>(Orientation::Inside), "Inside" },
{ static_cast<int>(Orientation::Both), "Both" }
});
if (dictionary.hasKey(OrientationInfo.identifier)) {
const std::string& v = dictionary.value<std::string>(OrientationInfo.identifier);
if (v == "Inside") {
_orientation = Inside;
_orientation = static_cast<int>(Orientation::Inside);
}
else if (v == "Outside") {
_orientation = Outside;
_orientation = static_cast<int>(Orientation::Outside);
}
else if (v == "Inside/Outside") {
_orientation = Outside | Inside;
else if (v == "Both") {
_orientation = static_cast<int>(Orientation::Both);
}
else {
throw ghoul::MissingCaseException();
}
}
else {
_orientation = Outside;
_orientation = static_cast<int>(Orientation::Outside);
}
addProperty(_orientation);
@@ -211,23 +253,48 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
addProperty(_texturePath);
_texturePath.onChange([this]() { loadTexture(); });
if (dictionary.hasKey(FadeOutThreshouldInfo.identifier)) {
addProperty(_mirrorTexture);
addProperty(_useAdditiveBlending);
if (dictionary.hasKey(MirrorTextureInfo.identifier)) {
_mirrorTexture = dictionary.value<bool>(MirrorTextureInfo.identifier);
}
if (dictionary.hasKey(UseAdditiveBlendingInfo.identifier)) {
_useAdditiveBlending = dictionary.value<bool>(UseAdditiveBlendingInfo.identifier);
if (_useAdditiveBlending) {
setRenderBin(Renderable::RenderBin::Transparent);
}
}
if (dictionary.hasKey(FadeOutThresholdInfo.identifier)) {
_fadeOutThreshold = static_cast<float>(
dictionary.value<double>(FadeOutThreshouldInfo.identifier)
dictionary.value<double>(FadeOutThresholdInfo.identifier)
);
addProperty(_fadeOutThreshold);
}
if (dictionary.hasKey(FadeInThreshouldInfo.identifier)) {
if (dictionary.hasKey(FadeInThresholdInfo.identifier)) {
_fadeInThreshold = static_cast<float>(
dictionary.value<double>(FadeInThreshouldInfo.identifier)
dictionary.value<double>(FadeInThresholdInfo.identifier)
);
addProperty(_fadeInThreshold);
}
if (dictionary.hasKey(FadeOutThreshouldInfo.identifier) ||
dictionary.hasKey(FadeInThreshouldInfo.identifier)) {
if (dictionary.hasKey(FadeOutThresholdInfo.identifier) ||
dictionary.hasKey(FadeInThresholdInfo.identifier)) {
_disableFadeInDistance.set(false);
addProperty(_disableFadeInDistance);
}
if (dictionary.hasKey(BackgroundInfo.identifier)) {
_backgroundRendering = dictionary.value<bool>(BackgroundInfo.identifier);
if (_backgroundRendering) {
setRenderBin(Renderable::RenderBin::Background);
}
}
}
bool RenderableSphere::isReady() const {
@@ -235,10 +302,7 @@ bool RenderableSphere::isReady() const {
}
void RenderableSphere::initializeGL() {
_sphere = std::make_unique<PowerScaledSphere>(
PowerScaledScalar::CreatePSS(_size),
_segments
);
_sphere = std::make_unique<PowerScaledSphere>(_size, _segments);
_sphere->initialize();
_shader = BaseModule::ProgramObjectManager.request(
@@ -270,41 +334,72 @@ void RenderableSphere::deinitializeGL() {
}
void RenderableSphere::render(const RenderData& data, RendererTasks&) {
glm::mat4 transform = glm::mat4(1.0);
Orientation orientation = static_cast<Orientation>(_orientation.value());
transform = glm::rotate(transform, glm::half_pi<float>(), glm::vec3(1, 0, 0));
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
glm::dmat3 modelRotation =
glm::dmat3(data.modelTransform.rotation);
// Activate shader
using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError;
_shader->activate();
_shader->setIgnoreUniformLocationError(IgnoreError::Yes);
_shader->setUniform(_uniformCache.viewProjection, data.camera.viewProjectionMatrix());
_shader->setUniform(_uniformCache.modelTransform, transform);
glm::mat4 modelViewProjection = data.camera.projectionMatrix() *
glm::mat4(data.camera.combinedViewMatrix() * modelTransform);
_shader->setUniform(_uniformCache.modelViewProjection, modelViewProjection);
setPscUniforms(*_shader, data.camera, data.position);
glm::mat3 modelViewRotation = glm::mat3(
glm::dmat3(data.camera.viewRotationMatrix()) * modelRotation
);
_shader->setUniform(_uniformCache.modelViewRotation, modelViewRotation);
float adjustedTransparency = _opacity;
if (_fadeInThreshold > 0.0) {
const double distCamera = glm::length(data.camera.positionVec3());
const float funcValue = static_cast<float>(
(1.0 / double(_fadeInThreshold / 1E24)) * (distCamera / 1E24)
);
if (_fadeInThreshold > -1.0) {
const float logDistCamera = glm::log(static_cast<float>(
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
));
const float startLogFadeDistance = glm::log(_size * _fadeInThreshold);
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
adjustedTransparency *= (funcValue > 1.f) ? 1.f : funcValue;
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
const float fadeFactor = glm::clamp(
(logDistCamera - startLogFadeDistance) /
(stopLogFadeDistance - startLogFadeDistance),
0.f,
1.f
);
adjustedTransparency *= fadeFactor;
}
else if (logDistCamera <= startLogFadeDistance) {
adjustedTransparency = 0.f;
}
}
if (_fadeOutThreshold > -1.0) {
const double distCamera = glm::distance(
data.camera.positionVec3(),
data.position.dvec3()
);
const double term = std::exp(
(-distCamera + _size * _fadeOutThreshold) / (_size * _fadeOutThreshold)
);
const float logDistCamera = glm::log(static_cast<float>(
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
));
const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold);
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
adjustedTransparency *= static_cast<float>(term / (term + 1.0));
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
const float fadeFactor = glm::clamp(
(logDistCamera - startLogFadeDistance) /
(stopLogFadeDistance - startLogFadeDistance),
0.f,
1.f
);
adjustedTransparency *= (1.f - fadeFactor);
}
else if (logDistCamera >= stopLogFadeDistance) {
adjustedTransparency = 0.f;
}
}
// Performance wise
@@ -312,38 +407,55 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
return;
}
_shader->setUniform(_uniformCache.opacity, _opacity);
_shader->setUniform(_uniformCache.opacity, adjustedTransparency);
_shader->setUniform(_uniformCache._mirrorTexture, _mirrorTexture.value());
ghoul::opengl::TextureUnit unit;
unit.activate();
_texture->bind();
_shader->setUniform(_uniformCache.texture, unit);
_shader->setUniform(_uniformCache.colorTexture, unit);
// Setting these states should not be necessary,
// since they are the default state in OpenSpace.
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
if (orientation == Orientation::Inside) {
glCullFace(GL_FRONT);
} else if (orientation == Orientation::Both) {
glDisable(GL_CULL_FACE);
}
bool usingFramebufferRenderer = global::renderEngine.rendererImplementation() ==
RenderEngine::RendererImplementation::Framebuffer;
bool usingABufferRenderer = global::renderEngine.rendererImplementation() ==
RenderEngine::RendererImplementation::ABuffer;
if (usingABufferRenderer) {
if (usingABufferRenderer && _useAdditiveBlending) {
_shader->setUniform("additiveBlending", true);
}
if (usingFramebufferRenderer) {
if (usingFramebufferRenderer && _useAdditiveBlending) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDepthMask(false);
}
_sphere->render();
if (usingFramebufferRenderer) {
if (usingFramebufferRenderer && _useAdditiveBlending) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(true);
}
_shader->setIgnoreUniformLocationError(IgnoreError::No);
_shader->deactivate();
if (orientation == Orientation::Inside) {
glCullFace(GL_BACK);
} else if (orientation == Orientation::Both) {
glEnable(GL_CULL_FACE);
}
}
void RenderableSphere::update(const UpdateData&) {
@@ -353,10 +465,7 @@ void RenderableSphere::update(const UpdateData&) {
}
if (_sphereIsDirty) {
_sphere = std::make_unique<PowerScaledSphere>(
PowerScaledScalar::CreatePSS(_size),
_segments
);
_sphere = std::make_unique<PowerScaledSphere>(_size, _segments);
_sphere->initialize();
_sphereIsDirty = false;
}
+8 -4
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -69,17 +69,21 @@ private:
properties::FloatProperty _size;
properties::IntProperty _segments;
properties::BoolProperty _mirrorTexture;
properties::BoolProperty _useAdditiveBlending;
properties::BoolProperty _disableFadeInDistance;
properties::BoolProperty _backgroundRendering;
float _fadeOutThreshold = -1.0;
float _fadeInThreshold = 0.0;
properties::FloatProperty _fadeInThreshold;
properties::FloatProperty _fadeOutThreshold;
ghoul::opengl::ProgramObject* _shader = nullptr;
std::unique_ptr<ghoul::opengl::Texture> _texture;
std::unique_ptr<PowerScaledSphere> _sphere;
UniformCache(opacity, viewProjection, modelTransform, texture) _uniformCache;
UniformCache(opacity, modelViewProjection, modelViewRotation, colorTexture,
_mirrorTexture) _uniformCache;
bool _sphereIsDirty = false;
};
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -243,8 +243,6 @@ void RenderableTrail::initializeGL() {
);
ghoul::opengl::updateUniformLocations(*_programObject, _uniformCache, UniformNames);
setRenderBin(Renderable::RenderBin::Overlay);
}
void RenderableTrail::deinitializeGL() {
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -97,6 +97,13 @@ namespace {
"smoother the trail, but also more memory will be used."
};
constexpr openspace::properties::Property::PropertyInfo RenderableTypeInfo = {
"RenderableType",
"RenderableType",
"This value specifies if the plane should be rendered in the Background,"
"Opaque, Transparent, or Overlay rendering step."
};
} // namespace
namespace openspace {
@@ -118,6 +125,12 @@ documentation::Documentation RenderableTrailOrbit::Documentation() {
new IntVerifier,
Optional::No,
ResolutionInfo.description
},
{
RenderableTypeInfo.identifier,
new StringVerifier,
Optional::Yes,
RenderableTypeInfo.description
}
}
};
@@ -160,6 +173,27 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
// We store the vertices with (excluding the wrapping) decending temporal order
_primaryRenderInformation.sorting = RenderInformation::VertexSorting::NewestFirst;
if (dictionary.hasKey(RenderableTypeInfo.identifier)) {
std::string renderType = dictionary.value<std::string>(
RenderableTypeInfo.identifier
);
if (renderType == "Background") {
setRenderBin(Renderable::RenderBin::Background);
}
else if (renderType == "Opaque") {
setRenderBin(Renderable::RenderBin::Opaque);
}
else if (renderType == "Transparent") {
setRenderBin(Renderable::RenderBin::Transparent);
}
else if (renderType == "Overlay") {
setRenderBin(Renderable::RenderBin::Overlay);
}
}
else {
setRenderBin(Renderable::RenderBin::Opaque);
}
}
void RenderableTrailOrbit::initializeGL() {
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -134,13 +134,14 @@ void ScreenSpaceFramebuffer::render() {
static_cast<GLsizei>(resolution.y)
);
const glm::mat4 rotation = rotationMatrix();
const glm::mat4 globalRotation = globalRotationMatrix();
const glm::mat4 translation = translationMatrix();
const glm::mat4 localRotation = localRotationMatrix();
const glm::mat4 scale = glm::scale(
scaleMatrix(),
glm::vec3((1.f / xratio), (1.f / yratio), 1.f)
);
const glm::mat4 modelTransform = rotation*translation*scale;
const glm::mat4 modelTransform = globalRotation*translation*localRotation*scale;
draw(modelTransform);
}
}
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -1,133 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/base/rendering/wavefrontgeometry.h>
#include "ghoul/logging/logmanager.h"
#include <tiny_obj_loader.h>
namespace {
static const std::string _loggerCat = "WavefrontGeometry";
}
namespace openspace {
namespace modelgeometry {
WavefrontGeometry::WavefrontGeometry(const ghoul::Dictionary& dictionary)
: ModelGeometry(dictionary)
{
loadObj(_file);
}
bool WavefrontGeometry::initialize(Renderable* parent) {
bool success = ModelGeometry::initialize(parent);
return success;
}
void WavefrontGeometry::deinitialize() {
ModelGeometry::deinitialize();
}
bool WavefrontGeometry::loadModel(const std::string& filename) {
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool success = tinyobj::LoadObj(
shapes,
materials,
err,
filename.c_str(),
filename.c_str()
);
if (!success) {
LERROR(err);
return false;
}
if (shapes.size() > 1) {
LWARNING("Loading models with more than one shape is currently untested");
}
size_t totalSizeIndex = 0;
size_t totalSizeVertex = 0;
for (int i = 0; i < shapes.size(); ++i) {
totalSizeIndex += shapes[i].mesh.indices.size();
totalSizeVertex += shapes[i].mesh.positions.size();
if (shapes[i].mesh.positions.size() != shapes[i].mesh.normals.size())
LERROR(
"#positions (" << shapes[i].mesh.positions.size() << ")"
" != #normals (" << shapes[i].mesh.normals.size()
);
}
_vertices.resize(totalSizeVertex);
std::memset(_vertices.data(), 0, _vertices.size() * sizeof(Vertex));
_indices.resize(totalSizeIndex);
std::memset(_indices.data(), 0, _indices.size() * sizeof(int));
// We add all shapes of the model into the same vertex array, one after the other
// The _shapeCounts array stores for each shape, how many vertices that shape has
size_t currentPosition = 0;
size_t p = 0;
psc tmp;
for (int i = 0; i < shapes.size(); ++i) {
for (int j = 0; j < shapes[i].mesh.positions.size() / 3; ++j) {
tmp = PowerScaledCoordinate::CreatePowerScaledCoordinate(
shapes[i].mesh.positions[3 * j + 0],
shapes[i].mesh.positions[3 * j + 1],
shapes[i].mesh.positions[3 * j + 2]
);
_vertices[j + currentPosition].location[0] = tmp[0];
_vertices[j + currentPosition].location[1] = tmp[1];
_vertices[j + currentPosition].location[2] = tmp[2];
_vertices[j + currentPosition].location[3] = tmp[3];
_vertices[j + currentPosition].normal[0] = shapes[i].mesh.normals[3 * j + 0];
_vertices[j + currentPosition].normal[1] = shapes[i].mesh.normals[3 * j + 1];
_vertices[j + currentPosition].normal[2] = shapes[i].mesh.normals[3 * j + 2];
if (2 * j + 1 < shapes[i].mesh.texcoords.size()) {
_vertices[j + currentPosition].tex[0] = shapes[i].mesh.texcoords[2*j + 0];
_vertices[j + currentPosition].tex[1] = shapes[i].mesh.texcoords[2*j + 1];
}
}
currentPosition += shapes[i].mesh.positions.size() / 3;
std::copy(
shapes[i].mesh.indices.begin(),
shapes[i].mesh.indices.end(),
_indices.begin() + p
);
p += shapes[i].mesh.indices.size();
}
return true;
}
} // namespace modelgeometry
} // namespace openspace
@@ -1,51 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_BASE___WAVEFRONTGEOMETRY___H__
#define __OPENSPACE_MODULE_BASE___WAVEFRONTGEOMETRY___H__
#include <modules/base/rendering/modelgeometry.h>
namespace openspace {
class RenderableModel;
class RenderableModelProjection;
namespace modelgeometry {
class WavefrontGeometry : public ModelGeometry {
public:
WavefrontGeometry(const ghoul::Dictionary& dictionary);
bool initialize(Renderable* parent) override;
void deinitialize() override;
private:
bool loadModel(const std::string& filename);
};
} // namespace modelgeometry
} // namespace openspace
#endif // __OPENSPACE_MODULE_BASE___WAVEFRONTGEOMETRY___H__
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -31,7 +31,6 @@
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/vector/vec3property.h>
#include <ghoul/glm.h>
namespace openspace {
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+56 -14
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -34,6 +34,27 @@ namespace {
"This value is the used as a 3x3 rotation matrix that is applied to the scene "
"graph node that this transformation is attached to relative to its parent."
};
// Conversion from rotation matrix to euler angles,
// given that the rotation is a pure rotation matrix.
// Inspired by:
// https://www.learnopencv.com/rotation-matrix-to-euler-angles/
glm::dvec3 rotationMatrixToEulerAngles(glm::dmat4 mat) {
double sy = glm::sqrt(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]);
bool singular = sy < 1e-6;
double x, y, z;
if (singular) {
x = glm::atan(-mat[2][1], mat[1][1]);
y = glm::atan(-mat[0][2], sy);
z = 0;
} else {
x = glm::atan(mat[1][2], mat[2][2]);
y = glm::atan(-mat[0][2], sy);
z = glm::atan(mat[0][1], mat[0][0]);
}
return glm::dvec3(x, y, z);
}
} // namespace
namespace openspace {
@@ -53,21 +74,27 @@ documentation::Documentation StaticRotation::Documentation() {
RotationInfo.identifier,
new OrVerifier({
new DoubleVector3Verifier(),
new DoubleVector4Verifier(),
new DoubleMatrix3Verifier()
}),
Optional::No,
"Stores the static rotation as either a vector containing Euler angles "
"or by specifiying the 3x3 rotation matrix directly"
"Stores the static rotation as a vector containing Euler angles, "
" a quaternion or a rotation matrix."
}
}
};
}
StaticRotation::StaticRotation()
: _rotationMatrix(RotationInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0))
: _eulerRotation(
RotationInfo,
glm::vec3(0.f),
glm::vec3(-glm::pi<float>()),
glm::vec3(glm::pi<float>())
)
{
addProperty(_rotationMatrix);
_rotationMatrix.onChange([this]() { requireUpdate(); });
addProperty(_eulerRotation);
_eulerRotation.onChange([this]() { requireUpdate(); });
}
StaticRotation::StaticRotation(const ghoul::Dictionary& dictionary) : StaticRotation() {
@@ -77,20 +104,35 @@ StaticRotation::StaticRotation(const ghoul::Dictionary& dictionary) : StaticRota
"StaticRotation"
);
if (dictionary.hasKeyAndValue<glm::dvec3>(RotationInfo.identifier)) {
_rotationMatrix = glm::mat3_cast(
glm::dquat(dictionary.value<glm::dvec3>(RotationInfo.identifier))
_eulerRotation = static_cast<glm::vec3>(
dictionary.value<glm::dvec3>(RotationInfo.identifier)
);
_matrixIsDirty = true;
} else if (dictionary.hasKeyAndValue<glm::dvec4>(RotationInfo.identifier)) {
glm::dvec4 data = dictionary.value<glm::dvec4>(RotationInfo.identifier);
_eulerRotation = rotationMatrixToEulerAngles(
glm::mat3_cast(glm::dquat(data.w, data.x, data.y, data.z))
);
_matrixIsDirty = true;
} else if (dictionary.hasKeyAndValue<glm::dmat3>(RotationInfo.identifier)) {
_eulerRotation = rotationMatrixToEulerAngles(
dictionary.value<glm::dmat3>(RotationInfo.identifier)
);
_matrixIsDirty = true;
}
else {
// Must be glm::dmat3 due to specification restriction
_rotationMatrix = dictionary.value<glm::dmat3>(RotationInfo.identifier);
}
_eulerRotation.onChange([this]() {
_matrixIsDirty = true;
});
}
glm::dmat3 StaticRotation::matrix(const UpdateData&) const {
return _rotationMatrix;
if (_matrixIsDirty) {
_cachedMatrix = glm::mat3_cast(glm::quat(_eulerRotation.value()));
_matrixIsDirty = false;
}
return _cachedMatrix;
}
} // namespace openspace
+5 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -27,7 +27,7 @@
#include <openspace/scene/rotation.h>
#include <openspace/properties/matrix/dmat3property.h>
#include <openspace/properties/vector/vec3property.h>
namespace openspace {
@@ -43,7 +43,9 @@ public:
static documentation::Documentation Documentation();
private:
properties::DMat3Property _rotationMatrix;
properties::Vec3Property _eulerRotation;
mutable glm::dmat3 _cachedMatrix;
mutable bool _matrixIsDirty = true;
};
} // namespace openspace
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+3 -5
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -36,15 +36,13 @@ uniform float Alpha;
Fragment getFragment() {
Fragment frag;
// power scale coordinates for depth. w value is set to 1.0.
float depth = (1.0 + log(abs(OcclusionDepth) + 1/pow(k, 1.0))/log(k)) / 27.0;
frag.color = texture(texture1, vs_st);
frag.color.a = (frag.color.a != 0.0) ? Alpha : frag.color.a;
frag.color.a = Alpha * frag.color.a;
if (frag.color.a == 0.0) {
discard;
}
frag.depth = denormalizeFloat(depth);
frag.depth = vs_position.z;
return frag;
}
+3 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -24,7 +24,7 @@
#version __CONTEXT__
layout(location = 0) in vec2 in_position;
layout(location = 0) in vec3 in_position;
layout(location = 1) in vec2 in_st;
out vec2 vs_st;
@@ -36,6 +36,6 @@ uniform mat4 ViewProjectionMatrix;
void main() {
vs_st = in_st;
vs_position = ViewProjectionMatrix * ModelTransform * vec4(in_position, 0.0, 1.0);
vs_position = ViewProjectionMatrix * ModelTransform * vec4(in_position, 1.0);
gl_Position = vec4(vs_position);
}
+16 -17
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -25,31 +25,30 @@
#include "fragment.glsl"
#include "PowerScaling/powerScaling_fs.hglsl"
in vec2 vs_st;
in vec4 vs_position;
in vec4 vs_gPosition;
in vec2 vs_textureCoords;
in vec3 vs_normal;
uniform float time;
uniform sampler2D texture1;
uniform sampler2D colorTexture;
uniform float opacity;
uniform bool mirrorTexture;
Fragment getFragment() {
vec4 position = vs_position;
vec2 texCoord = vs_st;
// Why is this here? ---abock
texCoord.s = 1 - texCoord.s;
texCoord.t = 1 - texCoord.y;
vec2 texCoord = vs_textureCoords;
Fragment frag;
frag.color = texture(texture1, texCoord) * vec4(1.0, 1.0, 1.0, opacity);
frag.depth = pscDepth(position);
if (mirrorTexture) {
texCoord.x = 1.0 - texCoord.x;
}
frag.color = texture(colorTexture, texCoord);
frag.color.a *= opacity;
frag.depth = vs_position.w;
// G-Buffer
frag.gPosition = vs_gPosition;
// There is no normal here
// TODO: Add the correct normal (JCC)
frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0);
frag.gPosition = vs_position;
frag.gNormal = vec4(vs_normal, 1.0);
return frag;
}
}
+13 -25
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -24,35 +24,23 @@
#version __CONTEXT__
#include "PowerScaling/powerScaling_vs.hglsl"
layout(location = 0) in vec4 in_position;
layout(location = 1) in vec2 in_st;
layout(location = 1) in vec2 in_textureCoords;
out vec2 vs_st;
uniform mat4 modelViewProjection;
uniform mat3 modelViewRotation;
out vec2 vs_textureCoords;
out vec4 vs_position;
out float s;
out vec4 vs_gPosition;
uniform mat4 ViewProjection;
uniform mat4 ModelTransform;
out vec3 vs_normal;
void main() {
vec4 tmp = in_position;
vs_normal = modelViewRotation * normalize(in_position.xyz);
vs_textureCoords = in_textureCoords;
mat4 mt = mat4(0.0, -1.0, 0.0, 0.0,
1.0, 0.0, 0.0, 0.0,
0.0, 0.0, -1.0, 0.0,
0.0, 0.0, 0.0, 1.0) * ModelTransform;
vec4 position = pscTransform(tmp, mt);
vs_position = tmp;
vs_st = in_st;
vs_gPosition = position;
position = ViewProjection * position;
gl_Position = z_normalization(position);
vec4 position = modelViewProjection * vec4(in_position.xyz, 1.0);
vs_position = position;
// Set z to 0 to disable near/far-plane clipping
gl_Position = vec4(position.xy, 0.0, position.w);
}
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

Some files were not shown because too many files have changed in this diff Show More