mirror of
https://github.com/Relintai/sfw.git
synced 2024-12-20 21:06:49 +01:00
Added vertex color support for the FontMaterial.
This commit is contained in:
parent
caa9e4d39c
commit
8d7321f93c
@ -137,7 +137,7 @@ GameScene::GameScene() {
|
|||||||
//_font_test_mi->transform.scale(Vector2(10, 10));
|
//_font_test_mi->transform.scale(Vector2(10, 10));
|
||||||
_font_test_mi->transform.set_origin(Vector2(1000, 400));
|
_font_test_mi->transform.set_origin(Vector2(1000, 400));
|
||||||
|
|
||||||
_font->generate_mesh("asdfgh\nasdfvb", _font_test_mesh);
|
_font->generate_mesh("asdfgh\nasdfvb", _font_test_mesh, Color(1, 1, 0));
|
||||||
_font_test_mesh->upload();
|
_font_test_mesh->upload();
|
||||||
|
|
||||||
image.instance();
|
image.instance();
|
||||||
|
@ -45,11 +45,14 @@ public:
|
|||||||
"\n"
|
"\n"
|
||||||
"attribute vec4 a_position;\n"
|
"attribute vec4 a_position;\n"
|
||||||
"attribute vec2 a_uv;\n"
|
"attribute vec2 a_uv;\n"
|
||||||
|
"attribute vec4 a_color;\n"
|
||||||
"\n"
|
"\n"
|
||||||
"varying vec2 v_uv;\n"
|
"varying vec2 v_uv;\n"
|
||||||
|
"varying vec4 v_color;\n"
|
||||||
"\n"
|
"\n"
|
||||||
"void main() {\n"
|
"void main() {\n"
|
||||||
" v_uv = a_uv;\n"
|
" v_uv = a_uv;\n"
|
||||||
|
" v_color = a_color;\n"
|
||||||
" gl_Position = u_proj_matrix * u_model_view_matrix * a_position;\n"
|
" gl_Position = u_proj_matrix * u_model_view_matrix * a_position;\n"
|
||||||
"}"
|
"}"
|
||||||
};
|
};
|
||||||
@ -64,6 +67,7 @@ public:
|
|||||||
"uniform sampler2D u_texture;\n"
|
"uniform sampler2D u_texture;\n"
|
||||||
"\n"
|
"\n"
|
||||||
"varying vec2 v_uv;\n"
|
"varying vec2 v_uv;\n"
|
||||||
|
"varying vec4 v_color;\n"
|
||||||
"\n"
|
"\n"
|
||||||
"void main() {\n"
|
"void main() {\n"
|
||||||
" vec4 col = texture2D(u_texture, v_uv);\n"
|
" vec4 col = texture2D(u_texture, v_uv);\n"
|
||||||
@ -72,7 +76,7 @@ public:
|
|||||||
" discard;\n"
|
" discard;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" gl_FragColor = col;\n"
|
" gl_FragColor = col * v_color;\n"
|
||||||
"}"
|
"}"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user