Bring back changes for transparency and added new error protection for big components.

This commit is contained in:
Jonathas Costa
2019-07-15 10:31:08 -04:00
parent cb36a25d5a
commit 0f09c36aa2
11 changed files with 66 additions and 20 deletions

View File

@@ -127,7 +127,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
_blendMode.onChange([&]() {
switch (_blendMode) {
case BlendModeNormal:
setRenderBin(Renderable::RenderBin::Opaque);
setRenderBinFromOpacity();
break;
case BlendModeAdditive:
setRenderBin(Renderable::RenderBin::Transparent);
@@ -137,6 +137,12 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
}
});
_opacity.onChange([&]() {
if (_blendMode == BlendModeNormal) {
setRenderBinFromOpacity();
}
});
if (dictionary.hasKey(BlendModeInfo.identifier)) {
const std::string v = dictionary.value<std::string>(BlendModeInfo.identifier);
if (v == "Normal") {

View File

@@ -67,12 +67,14 @@ protected:
virtual void bindTexture();
virtual void unbindTexture();
protected:
properties::OptionProperty _blendMode;
private:
void createPlane();
properties::BoolProperty _billboard;
properties::FloatProperty _size;
properties::OptionProperty _blendMode;
ghoul::opengl::ProgramObject* _shader = nullptr;

View File

@@ -85,6 +85,8 @@ RenderablePlaneImageLocal::RenderablePlaneImageLocal(const ghoul::Dictionary& di
"RenderablePlaneImageLocal"
);
addProperty(_blendMode);
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);

View File

@@ -178,8 +178,10 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
properties::OptionProperty::DisplayType::Dropdown
)
{
setRenderBin(RenderBin::Overlay);
addProperty(_opacity);
registerUpdateRenderBinFromOpacity();
//registerUpdateRenderBinFromOpacity();
_translation = Translation::createFromDictionary(
dictionary.value<ghoul::Dictionary>(KeyTranslation)
@@ -289,7 +291,7 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) {
if (usingFramebufferRenderer) {
glDepthMask(false);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
const bool renderLines = (_renderingModes == RenderingModeLines) |

View File

@@ -100,8 +100,8 @@ namespace {
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."
"This value specifies if the orbit should be rendered in the Background,"
"Opaque, Transparent, or Overlay rendering step. Default is Transparent."
};
} // namespace
@@ -192,7 +192,7 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
}
}
else {
setRenderBin(Renderable::RenderBin::Opaque);
setRenderBin(Renderable::RenderBin::Overlay);
}
}