git-svn-id: svn://db.shs.com.ru/libs@655 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-12-06 10:13:41 +00:00
parent d5eaa289b2
commit edfe165f90
3 changed files with 10 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ RendererSelection::RendererSelection(Renderer * r_): r(r_),
sel_frame = Primitive::plane(2., 2.);
id_hover = 0;
line_thick_ = 2.;
scale_ = 0.5;
}
@@ -46,7 +47,7 @@ void RendererSelection::init(int width, int height) {
void RendererSelection::resize(int width, int height) {
fbo_selection.enablePixelBuffer();
fbo_selection.resize(width, height);
fbo_selection.resize(width*scale_, height*scale_);
line_thick_ = lineThickness() + 1.;
}
@@ -126,9 +127,10 @@ void RendererSelection::renderSelection(Scene & scene) {
//mouse_rect = fbo_selection.rect();
if (r->mouse_rect.isNull())
fbo_selection.queryPoint(0, r->mouse_pos);
fbo_selection.queryPoint(0, r->mouse_pos * scale_);
else
fbo_selection.queryPoints(0, r->mouse_rect);
fbo_selection.queryPoints(0, QRect(r->mouse_rect.topLeft() * scale_,
r->mouse_rect.size() * scale_));
//qDebug() << id_hover;
fbo_selection.bindColorTexture(sbrSrcHover , sbrSrcHover );

View File

@@ -54,7 +54,7 @@ private:
Framebuffer fbo_selection;
Mesh * sel_frame;
float line_thick_;
float line_thick_, scale_;
QVector<uchar> cur_selections_;
QHash<uint, ObjectBase * > ids;

View File

@@ -1,6 +1,7 @@
// vert //
void main(void) {
qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform();
}
@@ -11,9 +12,10 @@ uniform sampler2D fb_out, fb_hover, fb_select;
void main(void) {
ivec2 tc = ivec2(gl_FragCoord.xy);
vec2 stc = qgl_FragTexture.xy;
vec4 src = texelFetch(fb_out , tc, 0);
vec4 hov = texelFetch(fb_hover , tc, 0);
vec4 sel = texelFetch(fb_select, tc, 0);
vec4 hov = texture(fb_hover , stc);
vec4 sel = texture(fb_select, stc);
src.rgb = mix(src.rgb, sel.rgb, sel.a);
src.rgb = mix(src.rgb, hov.rgb, hov.a * 0.667f);
//src.rgb = src.rgb + (sel.rgb*sel.a);