mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
mirror backside parameter of renderableplane, renamed renderabletimevaryingplaneimagelocal to renderableplanetimevaryingimage. mm.
This commit is contained in:
@@ -58,6 +58,14 @@ namespace {
|
||||
"transformations."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo MirrorBacksideInfo = {
|
||||
"MirrorBackside",
|
||||
"Mirror backside of image plane",
|
||||
"If this value is set to false, the image plane will not be mirrored when "
|
||||
"looking from the backside. This is usually desirable when the image shows "
|
||||
"data at a specific location, but not if it is desplaying text for example."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size (in meters)",
|
||||
@@ -74,6 +82,9 @@ namespace {
|
||||
// [[codegen::verbatim(BillboardInfo.description)]]
|
||||
std::optional<bool> billboard;
|
||||
|
||||
// [[codegen::verbatim(MirrorBacksideInfo.description)]]
|
||||
std::optional<bool> mirrorBackside;
|
||||
|
||||
// [[codegen::verbatim(SizeInfo.description)]]
|
||||
float size;
|
||||
|
||||
@@ -99,6 +110,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _billboard(BillboardInfo, false)
|
||||
, _mirrorBackside(MirrorBacksideInfo, true)
|
||||
, _size(SizeInfo, 10.f, 0.f, 1e25f)
|
||||
{
|
||||
Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
@@ -108,6 +120,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_size = p.size;
|
||||
_billboard = p.billboard.value_or(_billboard);
|
||||
_mirrorBackside = p.mirrorBackside.value_or(_mirrorBackside);
|
||||
|
||||
_blendMode.addOptions({
|
||||
{ BlendModeNormal, "Normal" },
|
||||
@@ -196,6 +209,8 @@ void RenderablePlane::render(const RenderData& data, RendererTasks&) {
|
||||
_shader->activate();
|
||||
_shader->setUniform("opacity", _opacity);
|
||||
|
||||
_shader->setUniform("mirrorBackside", _mirrorBackside);
|
||||
|
||||
glm::dvec3 objectPositionWorld = glm::dvec3(
|
||||
glm::translate(
|
||||
glm::dmat4(1.0),
|
||||
|
||||
@@ -74,6 +74,7 @@ private:
|
||||
void createPlane();
|
||||
|
||||
properties::BoolProperty _billboard;
|
||||
properties::BoolProperty _mirrorBackside;
|
||||
properties::FloatProperty _size;
|
||||
|
||||
ghoul::opengl::ProgramObject* _shader = nullptr;
|
||||
|
||||
@@ -32,6 +32,7 @@ in vec3 vs_gNormal;
|
||||
uniform sampler2D texture1;
|
||||
uniform bool additiveBlending;
|
||||
uniform float opacity = 1.0;
|
||||
uniform bool mirrorBackside = true;
|
||||
|
||||
|
||||
Fragment getFragment() {
|
||||
@@ -40,7 +41,12 @@ Fragment getFragment() {
|
||||
frag.color = texture(texture1, vs_st);
|
||||
}
|
||||
else {
|
||||
frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t));
|
||||
if (mirrorBackside){
|
||||
frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t));
|
||||
}
|
||||
else {
|
||||
frag.color = texture(texture1, vs_st);
|
||||
}
|
||||
}
|
||||
|
||||
frag.color.a *= opacity;
|
||||
|
||||
Reference in New Issue
Block a user