mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-30 07:58:42 -06:00
Merge branch 'thesis/2018/dsn' of github.com:OpenSpace/OpenSpace into thesis/2018/dsn
This commit is contained in:
@@ -10,6 +10,7 @@ local Signals = {
|
||||
Type = "RenderableSignals",
|
||||
DataFolder = dataFolder,
|
||||
DataFileType = "json",
|
||||
BaseOpacity = 0.3,
|
||||
SiteColors = stationsAsset.siteColorMap,
|
||||
StationSites = stationsAsset.stationSiteMap
|
||||
},
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace {
|
||||
constexpr const char* _loggerCat = "RenderableSignals";
|
||||
constexpr const char* KeyStationSites = "StationSites";
|
||||
|
||||
constexpr const std::array<const char*, 3> UniformNames = {
|
||||
"modelViewStation","modelViewSpacecraft", "projectionTransform"
|
||||
constexpr const std::array < const char*, openspace::RenderableSignals::_uniformCacheSize > UniformNames = {
|
||||
"modelViewStation","modelViewSpacecraft", "projectionTransform", "baseOpacity"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SiteColorsInfo = {
|
||||
@@ -58,6 +58,11 @@ namespace {
|
||||
"This value specifies the line width of the signals. "
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo BaseOpacityInfo = {
|
||||
"BaseOpacity",
|
||||
"Base Opacity",
|
||||
"This value specifies the opacity of the base line. "
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -86,6 +91,12 @@ documentation::Documentation RenderableSignals::Documentation() {
|
||||
new DoubleVerifier,
|
||||
Optional::Yes,
|
||||
LineWidthInfo.description
|
||||
},
|
||||
{
|
||||
BaseOpacityInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::Yes,
|
||||
BaseOpacityInfo.description
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -94,6 +105,7 @@ documentation::Documentation RenderableSignals::Documentation() {
|
||||
RenderableSignals::RenderableSignals(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _lineWidth(LineWidthInfo, 2.5f, 1.f, 10.f)
|
||||
, _baseOpacity(BaseOpacityInfo, 0.3f, 0.0f, 1.0f)
|
||||
{
|
||||
if (dictionary.hasKeyAndValue<ghoul::Dictionary>(SiteColorsInfo.identifier)) {
|
||||
ghoul::Dictionary siteColorDictionary = dictionary.value<ghoul::Dictionary>(SiteColorsInfo.identifier);
|
||||
@@ -135,6 +147,13 @@ RenderableSignals::RenderableSignals(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
addProperty(_lineWidth);
|
||||
|
||||
if (dictionary.hasKeyAndValue<double>(BaseOpacityInfo.identifier)) {
|
||||
_baseOpacity = static_cast<float>(dictionary.value<double>(
|
||||
BaseOpacityInfo.identifier
|
||||
));
|
||||
}
|
||||
addProperty(_baseOpacity);
|
||||
|
||||
std::unique_ptr<ghoul::Dictionary> dictionaryPtr = std::make_unique<ghoul::Dictionary>(dictionary);
|
||||
extractData(dictionaryPtr);
|
||||
}
|
||||
@@ -228,6 +247,8 @@ void RenderableSignals::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
_programObject->setUniform(_uniformCache.projection, data.camera.sgctInternal.projectionMatrix());
|
||||
|
||||
_programObject->setUniform(_uniformCache.baseOpacity, _baseOpacity);
|
||||
|
||||
const bool usingFramebufferRenderer =
|
||||
global::renderEngine.rendererImplementation() ==
|
||||
RenderEngine::RendererImplementation::Framebuffer;
|
||||
|
||||
@@ -109,6 +109,8 @@ namespace openspace {
|
||||
float d;
|
||||
};
|
||||
|
||||
/// Number of variables in _uniformCache
|
||||
static const GLuint _uniformCacheSize = 4;
|
||||
|
||||
const char* _identifier = "Signals";
|
||||
protected:
|
||||
@@ -177,10 +179,12 @@ namespace openspace {
|
||||
|
||||
/// Line width for the line rendering part
|
||||
properties::FloatProperty _lineWidth;
|
||||
/// Opacity for the base line
|
||||
properties::FloatProperty _baseOpacity;
|
||||
/// Program object used to render the data stored in RenderInformation
|
||||
ghoul::opengl::ProgramObject* _programObject = nullptr;
|
||||
|
||||
UniformCache(modelViewStation, modelViewSpacecraft, projection) _uniformCache;
|
||||
/// Cache for uniform variables, update _uniformCacheSize accordingly
|
||||
UniformCache(modelViewStation, modelViewSpacecraft, projection, baseOpacity) _uniformCache;
|
||||
|
||||
/*Checks if the current time is within a signal's start and endtime*/
|
||||
bool isSignalActive(double currentTime, SignalManager::Signal signal);
|
||||
|
||||
@@ -33,7 +33,7 @@ in float timeSinceStart;
|
||||
|
||||
float lightSpeed = 299792458.0; // expressed in m/s
|
||||
float signalSizeFactor = 2000;
|
||||
float baseOpacity = 0.3;
|
||||
uniform float baseOpacity;
|
||||
|
||||
Fragment getFragment() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user