Fixed depth sorting for Sun's glare. (#868)

* Fixed depth sorting for Sun's glare.
This commit is contained in:
Jonathas Costa
2019-05-18 13:12:05 -04:00
committed by Alexander Bock
parent 0eabffe752
commit ae5392dbeb
4 changed files with 70 additions and 4 deletions

View File

@@ -14,7 +14,8 @@ local SunGlare = {
Origin = "Center",
Billboard = true,
Texture = textures .. "/halo.png",
BlendMode = "Additive"
BlendMode = "Additive",
RenderableType = "Transparent"
},
Transform = {
Translation = {

View File

@@ -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 {

View File

@@ -243,8 +243,6 @@ void RenderableTrail::initializeGL() {
);
ghoul::opengl::updateUniformLocations(*_programObject, _uniformCache, UniformNames);
setRenderBin(Renderable::RenderBin::Overlay);
}
void RenderableTrail::deinitializeGL() {

View File

@@ -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() {