GLES2: Implement pixel snap 2D option
This commit is contained in:
parent
9c93a401b9
commit
ac2a4771d5
@ -1185,7 +1185,6 @@ void RasterizerCanvasGLES2::initialize() {
|
|||||||
_EIDX(1, 1), _EIDX(1, 2), _EIDX(2, 2),
|
_EIDX(1, 1), _EIDX(1, 2), _EIDX(2, 2),
|
||||||
_EIDX(2, 2), _EIDX(2, 1), _EIDX(1, 1)
|
_EIDX(2, 2), _EIDX(2, 1), _EIDX(1, 1)
|
||||||
};
|
};
|
||||||
;
|
|
||||||
#undef _EIDX
|
#undef _EIDX
|
||||||
|
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elems), elems, GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elems), elems, GL_STATIC_DRAW);
|
||||||
@ -1200,6 +1199,8 @@ void RasterizerCanvasGLES2::initialize() {
|
|||||||
state.canvas_shader.bind();
|
state.canvas_shader.bind();
|
||||||
|
|
||||||
state.lens_shader.init();
|
state.lens_shader.init();
|
||||||
|
|
||||||
|
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerCanvasGLES2::finalize() {
|
void RasterizerCanvasGLES2::finalize() {
|
||||||
|
@ -96,6 +96,10 @@ VERTEX_SHADER_CODE
|
|||||||
|
|
||||||
color_interp = color;
|
color_interp = color;
|
||||||
|
|
||||||
|
#ifdef USE_PIXEL_SNAP
|
||||||
|
outvec.xy = floor(outvec + 0.5).xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
gl_Position = projection_matrix * outvec;
|
gl_Position = projection_matrix * outvec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,6 @@ VERTEX_SHADER_CODE
|
|||||||
color_interp = color;
|
color_interp = color;
|
||||||
|
|
||||||
#ifdef USE_PIXEL_SNAP
|
#ifdef USE_PIXEL_SNAP
|
||||||
|
|
||||||
outvec.xy = floor(outvec + 0.5).xy;
|
outvec.xy = floor(outvec + 0.5).xy;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user