Add soft shadow behind icons decoration to improve visibility in white

background.
This commit is contained in:
brunoherbelin
2020-11-24 19:22:41 +01:00
parent 4a6a110e3d
commit b6af17f283
3 changed files with 13 additions and 6 deletions

View File

@@ -350,7 +350,10 @@ Symbol::Symbol(Type t, glm::vec3 pos) : Node(), type_(t)
icons[EMPTY] = new Mesh("mesh/icon_empty.ply"); icons[EMPTY] = new Mesh("mesh/icon_empty.ply");
} }
static Mesh *shadow= new Mesh("mesh/border_handles_shadow.ply", "images/soft_shadow.dds");
symbol_ = icons[type_]; symbol_ = icons[type_];
shadow_ = shadow;
translation_ = pos; translation_ = pos;
color = glm::vec4( 1.f, 1.f, 1.f, 1.f); color = glm::vec4( 1.f, 1.f, 1.f, 1.f);
} }
@@ -365,6 +368,8 @@ void Symbol::draw(glm::mat4 modelview, glm::mat4 projection)
if ( !initialized() ) { if ( !initialized() ) {
if(symbol_ && !symbol_->initialized()) if(symbol_ && !symbol_->initialized())
symbol_->init(); symbol_->init();
if(shadow_ && !shadow_->initialized())
shadow_->init();
init(); init();
} }
@@ -391,6 +396,7 @@ void Symbol::draw(glm::mat4 modelview, glm::mat4 projection)
// generate matrix // generate matrix
ctm = GlmToolkit::transform(tran, rot, sca); ctm = GlmToolkit::transform(tran, rot, sca);
shadow_->draw( ctm, projection );
symbol_->draw( ctm, projection); symbol_->draw( ctm, projection);
} }
} }

View File

@@ -51,8 +51,8 @@ public:
glm::vec4 color; glm::vec4 color;
protected: protected:
Primitive *handle_; Mesh *handle_;
Primitive *shadow_; Mesh *shadow_;
glm::vec2 corner_; glm::vec2 corner_;
Type type_; Type type_;
@@ -74,6 +74,7 @@ public:
protected: protected:
Mesh *symbol_; Mesh *symbol_;
Mesh *shadow_;
Type type_; Type type_;
}; };

View File

@@ -14,9 +14,9 @@ property uchar alpha
element face 2 element face 2
property list uchar uint vertex_indices property list uchar uint vertex_indices
end_header end_header
0.1500000 -0.1500000 0.000000 1.000000 0.000000 255 255 255 45 0.1500000 -0.1500000 0.000000 1.000000 0.000000 255 255 255 65
-0.1500000 0.1500000 0.000000 0.000000 1.000000 255 255 255 45 -0.1500000 0.1500000 0.000000 0.000000 1.000000 255 255 255 65
-0.1500000 -0.1500000 0.000000 0.000000 0.000000 255 255 255 45 -0.1500000 -0.1500000 0.000000 0.000000 0.000000 255 255 255 65
0.1500000 0.1500000 0.000000 1.000000 1.000000 255 255 255 45 0.1500000 0.1500000 0.000000 1.000000 1.000000 255 255 255 65
3 0 1 2 3 0 1 2
3 0 3 1 3 0 3 1