adding opacity to the sitecolor properties

This commit is contained in:
Lovisa Hassler
2018-12-06 11:38:27 -05:00
parent 17fe8330b8
commit 72864ddfea
3 changed files with 9 additions and 8 deletions

View File

@@ -59,7 +59,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo BaseOpacityInfo = {
"BaseOpacity",
"Base Opacity",
"This value specifies the opacity of the base line. "
"This value specifies the base opacity of all the signal transmissions "
};
} // namespace
@@ -120,7 +120,7 @@ RenderableSignals::RenderableSignals(const ghoul::Dictionary& dictionary)
};
std::string site = siteNames[siteIndex];
glm::vec3 siteColor = siteColorDictionary.value<glm::vec3>(siteNames.at(siteIndex));
_siteColors.push_back(std::make_unique<properties::Vec3Property>(SiteColorsInfo, siteColor, glm::vec3(0.f), glm::vec3(1.f)));
_siteColors.push_back(std::make_unique<properties::Vec4Property>(SiteColorsInfo, glm::vec4(siteColor,1.0), glm::vec4(0.f), glm::vec4(1.f)));
_siteToIndex[siteNames.at(siteIndex)] = siteIndex;
addProperty(_siteColors.back().get());
}
@@ -363,7 +363,7 @@ void RenderableSignals::extractData(std::unique_ptr<ghoul::Dictionary> &dictiona
void RenderableSignals::pushSignalDataToVertexArray(SignalManager::Signal signal) {
glm::vec4 color = { getStationColor(signal.dishName), 1.0 };
glm::vec4 color = getStationColor(signal.dishName);
glm::dvec3 posStation = getPositionForGeocentricSceneGraphNode(signal.dishName.c_str());
glm::dvec3 posSpacecraft = getSuitablePrecisionPositionForSceneGraphNode(signal.spacecraft.c_str());
double distance = getDistance(signal.dishName, signal.spacecraft);
@@ -452,9 +452,9 @@ glm::dvec3 RenderableSignals::getPositionForGeocentricSceneGraphNode(const char*
return position;
}
glm::vec3 RenderableSignals::getStationColor(std::string dishidentifier) {
glm::vec4 RenderableSignals::getStationColor(std::string dishidentifier) {
glm::vec3 color(0.0f, 0.0f, 1.0f);
glm::vec4 color(0.0f, 0.0f, 0.0f, 0.0f);
std::string site;
try {

View File

@@ -37,6 +37,7 @@
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vector/vec3property.h>
#include <openspace/properties/vector/vec4property.h>
namespace ghoul::opengl {
@@ -90,7 +91,7 @@ namespace openspace {
/* Returns a position for a station that has Earth as parent*/
glm::dvec3 getPositionForGeocentricSceneGraphNode(const char* id);
/* Returns a color based on what site the station is located to */
glm::vec3 getStationColor(std::string dishidentifier);
glm::vec4 getStationColor(std::string dishidentifier);
/* Returns a distance between two scenegraphnodes */
double getDistance(std::string nodeIdA, std::string nodeIdB);
@@ -145,7 +146,7 @@ namespace openspace {
RenderInformation _lineRenderInformation;
/// Specifies the base color for the different sites
std::vector<std::unique_ptr<properties::Vec3Property>> _siteColors;
std::vector<std::unique_ptr<properties::Vec4Property>> _siteColors;
/// Maps a station identifier to a site location
std::map<std::string, std::string> _stationToSite;

View File

@@ -57,7 +57,7 @@ Fragment getFragment() {
distLightTravel-signalSize+edgeLength,
distanceFromStart);
frag.color = vec4(vs_color.xyz, min(smoothFront,smoothBack)+baseOpacity);
frag.color = vec4(vs_color.rgb, baseOpacity*vs_color.a + vs_color.a*min(smoothFront,smoothBack));
// G-Buffer
// JCC: The depthCorrection here is a temporary tweak