diff options
author | clayjohn <claynjohn@gmail.com> | 2019-06-02 15:09:02 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2019-06-03 12:11:54 -0700 |
commit | 2b8b1d7c4632e5a8b11b5dd6d974ec94ce211289 (patch) | |
tree | b63ed486c4c017c0be7c8f975daea62cfcf8aa8f /drivers/gles2 | |
parent | 85a338295859bd14817df675f9ce045f39658920 (diff) |
added MultiMeshInstance2D node for using MultiMesh in 2D
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/rasterizer_canvas_gles2.cpp | 2 | ||||
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index ee722e9d6c..b82186162d 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -1081,6 +1081,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur } else { glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 3, buffer + color_ofs); } + } else { + glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 3, 1.0, 1.0, 1.0, 1.0); } if (multi_mesh->custom_data_floats) { diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 7dce784f52..0818942b0a 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -112,7 +112,12 @@ void main() { #ifdef USE_INSTANCING mat4 extra_matrix_instance = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0))); color *= instance_color; + +#ifdef USE_INSTANCE_CUSTOM vec4 instance_custom = instance_custom_data; +#else + vec4 instance_custom = vec4(0.0); +#endif #else mat4 extra_matrix_instance = extra_matrix; |