summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-03-27 15:21:27 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-03-27 15:21:27 -0300
commita6f3bc7c696af03e3875f78e098d2476e409d15e (patch)
treefc1bb58e900436c48c03c52106eb57250442ae35 /drivers/gles2
parent307b1b3a5835ecdb477859785c673a07e248f904 (diff)
Renaming of servers for coherency.
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
Diffstat (limited to 'drivers/gles2')
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp216
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.h2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp4
-rw-r--r--drivers/gles2/rasterizer_gles2.h2
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp304
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h32
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp548
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h118
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp346
-rw-r--r--drivers/gles2/shader_compiler_gles2.h10
-rw-r--r--drivers/gles2/shader_gles2.h2
-rw-r--r--drivers/gles2/shaders/blend_shape.glsl2
12 files changed, 793 insertions, 793 deletions
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 5e8948e9c4..734b4463ff 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -33,7 +33,7 @@
#include "core/os/os.h"
#include "core/project_settings.h"
#include "rasterizer_scene_gles2.h"
-#include "servers/visual/visual_server_raster.h"
+#include "servers/rendering/rendering_server_raster.h"
#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
@@ -85,7 +85,7 @@ void RasterizerCanvasGLES2::_set_uniforms() {
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_COLOR, light->color * light->energy);
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_POS, light->light_shader_pos);
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_HEIGHT, light->height);
- state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_OUTSIDE_ALPHA, light->mode == VS::CANVAS_LIGHT_MODE_MASK ? 1.0 : 0.0);
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_OUTSIDE_ALPHA, light->mode == RS::CANVAS_LIGHT_MODE_MASK ? 1.0 : 0.0);
if (state.using_shadow) {
RasterizerStorageGLES2::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.getornull(light->shadow_buffer);
@@ -152,8 +152,8 @@ void RasterizerCanvasGLES2::canvas_begin() {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
// set up default uniforms
@@ -188,7 +188,7 @@ void RasterizerCanvasGLES2::canvas_end() {
glBindBuffer(GL_ARRAY_BUFFER, 0);
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
glDisableVertexAttribArray(i);
}
@@ -224,7 +224,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con
} else {
if (texture->redraw_if_visible) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
texture = texture->get_ptr();
@@ -266,7 +266,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con
} else {
if (normal_map->redraw_if_visible) { //check before proxy, because this is usually used with proxies
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
normal_map = normal_map->get_ptr();
@@ -299,47 +299,47 @@ void RasterizerCanvasGLES2::_draw_polygon(const int *p_indices, int p_index_coun
uint32_t buffer_ofs = 0;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
if (p_singlecolor) {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
Color m = *p_colors;
- glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
+ glVertexAttrib4f(RS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
} else if (!p_colors) {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} else {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
- glEnableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(Color) * p_vertex_count;
}
if (p_uvs) {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(Vector2) * p_vertex_count;
} else {
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
}
if (p_weights && p_bones) {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(float) * 4 * p_vertex_count, p_weights);
- glEnableVertexAttribArray(VS::ARRAY_WEIGHTS);
- glVertexAttribPointer(VS::ARRAY_WEIGHTS, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_WEIGHTS);
+ glVertexAttribPointer(RS::ARRAY_WEIGHTS, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(float) * 4 * p_vertex_count;
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(int) * 4 * p_vertex_count, p_bones);
- glEnableVertexAttribArray(VS::ARRAY_BONES);
- glVertexAttribPointer(VS::ARRAY_BONES, 4, GL_UNSIGNED_INT, GL_FALSE, sizeof(int) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_BONES);
+ glVertexAttribPointer(RS::ARRAY_BONES, 4, GL_UNSIGNED_INT, GL_FALSE, sizeof(int) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(int) * 4 * p_vertex_count;
} else {
- glDisableVertexAttribArray(VS::ARRAY_WEIGHTS);
- glDisableVertexAttribArray(VS::ARRAY_BONES);
+ glDisableVertexAttribArray(RS::ARRAY_WEIGHTS);
+ glDisableVertexAttribArray(RS::ARRAY_BONES);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
@@ -375,30 +375,30 @@ void RasterizerCanvasGLES2::_draw_generic(GLuint p_primitive, int p_vertex_count
uint32_t buffer_ofs = 0;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
if (p_singlecolor) {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
Color m = *p_colors;
- glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
+ glVertexAttrib4f(RS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
} else if (!p_colors) {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} else {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
- glEnableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(Color) * p_vertex_count;
}
if (p_uvs) {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
} else {
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
}
glDrawArrays(p_primitive, 0, p_vertex_count);
@@ -417,31 +417,31 @@ void RasterizerCanvasGLES2::_draw_generic_indices(GLuint p_primitive, const int
uint32_t buffer_ofs = 0;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
if (p_singlecolor) {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
Color m = *p_colors;
- glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
+ glVertexAttrib4f(RS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
} else if (!p_colors) {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} else {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
- glEnableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(Color) * p_vertex_count;
}
if (p_uvs) {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
buffer_ofs += sizeof(Vector2) * p_vertex_count;
} else {
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
@@ -514,16 +514,16 @@ void RasterizerCanvasGLES2::_draw_gui_primitive(int p_points, const Vector2 *p_v
#endif
glBufferSubData(GL_ARRAY_BUFFER, 0, p_points * stride * 4 * sizeof(float), buffer_data);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), NULL);
if (p_colors) {
- glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(color_offset * sizeof(float)));
- glEnableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(color_offset * sizeof(float)));
+ glEnableVertexAttribArray(RS::ARRAY_COLOR);
}
if (p_uvs) {
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(uv_offset * sizeof(float)));
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(uv_offset * sizeof(float)));
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
}
glDrawArrays(prim[p_points], 0, p_points);
@@ -564,8 +564,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
_bind_canvas_texture(RID(), RID());
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttrib4fv(VS::ARRAY_COLOR, line->color.components);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttrib4fv(RS::ARRAY_COLOR, line->color.components);
state.canvas_shader.set_uniform(CanvasShaderGLES2::MODELVIEW_MATRIX, state.uniforms.modelview_matrix);
@@ -616,8 +616,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
Item::CommandRect *r = static_cast<Item::CommandRect *>(command);
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttrib4fv(VS::ARRAY_COLOR, r->modulate.components);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttrib4fv(RS::ARRAY_COLOR, r->modulate.components);
bool can_tile = true;
if (r->texture.is_valid() && r->flags & CANVAS_RECT_TILE && !storage->config.support_npot_repeat_mipmap) {
@@ -696,7 +696,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
bool untile = false;
- if (can_tile && r->flags & CANVAS_RECT_TILE && !(texture->flags & VS::TEXTURE_FLAG_REPEAT)) {
+ if (can_tile && r->flags & CANVAS_RECT_TILE && !(texture->flags & RS::TEXTURE_FLAG_REPEAT)) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
untile = true;
@@ -753,7 +753,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
bool untile = false;
- if (can_tile && r->flags & CANVAS_RECT_TILE && !(tex->flags & VS::TEXTURE_FLAG_REPEAT)) {
+ if (can_tile && r->flags & CANVAS_RECT_TILE && !(tex->flags & RS::TEXTURE_FLAG_REPEAT)) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
untile = true;
@@ -816,8 +816,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
state.canvas_shader.use_material((void *)p_material);
}
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttrib4fv(VS::ARRAY_COLOR, np->color.components);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
+ glVertexAttrib4fv(RS::ARRAY_COLOR, np->color.components);
RasterizerStorageGLES2::Texture *tex = _bind_canvas_texture(np->texture, np->normal_map);
@@ -968,11 +968,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.ninepatch_elements);
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), NULL);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), CAST_INT_TO_UCHAR_PTR((sizeof(float) * 2)));
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), NULL);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), CAST_INT_TO_UCHAR_PTR((sizeof(float) * 2)));
glDrawElements(GL_TRIANGLES, 18 * 3 - (np->draw_center ? 0 : 6), GL_UNSIGNED_BYTE, NULL);
@@ -1072,18 +1072,18 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
- for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
+ for (int k = 0; k < RS::ARRAY_MAX - 1; k++) {
if (s->attribs[k].enabled) {
glEnableVertexAttribArray(k);
glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[k].offset));
} else {
glDisableVertexAttribArray(k);
switch (k) {
- case VS::ARRAY_NORMAL: {
- glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
+ case RS::ARRAY_NORMAL: {
+ glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
- case VS::ARRAY_COLOR: {
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ case RS::ARRAY_COLOR: {
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} break;
default: {
@@ -1099,7 +1099,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
}
- for (int j = 1; j < VS::ARRAY_MAX - 1; j++) {
+ for (int j = 1; j < RS::ARRAY_MAX - 1; j++) {
glDisableVertexAttribArray(j);
}
}
@@ -1118,7 +1118,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
if (!mesh_data)
break;
- state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != VS::MULTIMESH_CUSTOM_DATA_NONE);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != RS::MULTIMESH_CUSTOM_DATA_NONE);
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCING, true);
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
@@ -1162,18 +1162,18 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
- for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
+ for (int k = 0; k < RS::ARRAY_MAX - 1; k++) {
if (s->attribs[k].enabled) {
glEnableVertexAttribArray(k);
glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[k].offset));
} else {
glDisableVertexAttribArray(k);
switch (k) {
- case VS::ARRAY_NORMAL: {
- glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
+ case RS::ARRAY_NORMAL: {
+ glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
- case VS::ARRAY_COLOR: {
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ case RS::ARRAY_COLOR: {
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} break;
default: {
@@ -1189,7 +1189,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 0, &buffer[0]);
glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 1, &buffer[4]);
- if (multi_mesh->transform_format == VS::MULTIMESH_TRANSFORM_3D) {
+ if (multi_mesh->transform_format == RS::MULTIMESH_TRANSFORM_3D) {
glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 2, &buffer[8]);
} else {
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 2, 0.0, 0.0, 1.0, 0.0);
@@ -1197,7 +1197,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
if (multi_mesh->color_floats) {
- if (multi_mesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ if (multi_mesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
uint8_t *color_data = (uint8_t *)(buffer + color_ofs);
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 3, color_data[0] / 255.0, color_data[1] / 255.0, color_data[2] / 255.0, color_data[3] / 255.0);
} else {
@@ -1208,7 +1208,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
if (multi_mesh->custom_data_floats) {
- if (multi_mesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
+ if (multi_mesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
uint8_t *custom_data = (uint8_t *)(buffer + custom_data_ofs);
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 4, custom_data[0] / 255.0, custom_data[1] / 255.0, custom_data[2] / 255.0, custom_data[3] / 255.0);
} else {
@@ -1301,9 +1301,9 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
if (primitive->colors.size() == 1 && primitive->points.size() > 1) {
Color c = primitive->colors[0];
- glVertexAttrib4f(VS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
+ glVertexAttrib4f(RS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
} else if (primitive->colors.empty()) {
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
}
_draw_gui_primitive(primitive->points.size(), primitive->points.ptr(), primitive->colors.ptr(), primitive->uvs.ptr());
@@ -1518,7 +1518,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
if (material_ptr) {
shader_ptr = material_ptr->shader;
- if (shader_ptr && shader_ptr->mode != VS::SHADER_CANVAS_ITEM) {
+ if (shader_ptr && shader_ptr->mode != RS::SHADER_CANVAS_ITEM) {
shader_ptr = NULL; // not a canvas item shader, don't use.
}
}
@@ -1542,7 +1542,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
if (shader_ptr != shader_cache) {
if (shader_ptr->canvas_item.uses_time) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
state.canvas_shader.set_custom_shader(shader_ptr->custom_code_id);
@@ -1582,7 +1582,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
}
if (t->redraw_if_visible) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
t = t->get_ptr();
@@ -1682,7 +1682,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
Light *light = p_light;
bool light_used = false;
- VS::CanvasLightMode mode = VS::CANVAS_LIGHT_MODE_ADD;
+ RS::CanvasLightMode mode = RS::CANVAS_LIGHT_MODE_ADD;
state.uniforms.final_modulate = ci->final_modulate; // remove the canvas modulate
while (light) {
@@ -1697,17 +1697,17 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
switch (mode) {
- case VS::CANVAS_LIGHT_MODE_ADD: {
+ case RS::CANVAS_LIGHT_MODE_ADD: {
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
} break;
- case VS::CANVAS_LIGHT_MODE_SUB: {
+ case RS::CANVAS_LIGHT_MODE_SUB: {
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
} break;
- case VS::CANVAS_LIGHT_MODE_MIX:
- case VS::CANVAS_LIGHT_MODE_MASK: {
+ case RS::CANVAS_LIGHT_MODE_MIX:
+ case RS::CANVAS_LIGHT_MODE_MASK: {
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1726,12 +1726,12 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS, has_shadow);
if (has_shadow) {
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_USE_GRADIENT, light->shadow_gradient_length > 0);
- state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_NEAREST, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_NONE);
- state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF3, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF3);
- state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF5, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF5);
- state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF7, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF7);
- state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF9, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF9);
- state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF13, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF13);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_NEAREST, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_NONE);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF3, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF3);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF5, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF5);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF7, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF7);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF9, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF9);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF13, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF13);
}
state.canvas_shader.bind();
@@ -1846,7 +1846,7 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- VS::CanvasOccluderPolygonCullMode cull = VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
+ RS::CanvasOccluderPolygonCullMode cull = RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
for (int i = 0; i < 4; i++) {
@@ -1903,31 +1903,31 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES2::WORLD_MATRIX, instance->xform_cache);
- VS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
+ RS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
- if (transformed_cull_cache != VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
+ if (transformed_cull_cache != RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
(p_light_xform.basis_determinant() * instance->xform_cache.basis_determinant()) < 0) {
transformed_cull_cache =
- transformed_cull_cache == VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ?
- VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE :
- VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
+ transformed_cull_cache == RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ?
+ RS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE :
+ RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
}
if (cull != transformed_cull_cache) {
cull = transformed_cull_cache;
switch (cull) {
- case VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: {
+ case RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: {
glDisable(GL_CULL_FACE);
} break;
- case VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: {
+ case RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: {
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
} break;
- case VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: {
+ case RS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: {
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
@@ -1937,8 +1937,8 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
}
glBindBuffer(GL_ARRAY_BUFFER, cc->vertex_id);
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cc->index_id);
glDrawElements(GL_TRIANGLES, cc->len * 3, GL_UNSIGNED_SHORT, 0);
@@ -1979,8 +1979,8 @@ void RasterizerCanvasGLES2::reset_canvas() {
void RasterizerCanvasGLES2::_bind_quad_buffer() {
glBindBuffer(GL_ARRAY_BUFFER, data.canvas_quad_vertices);
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, NULL);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, NULL);
}
void RasterizerCanvasGLES2::draw_generic_textured_rect(const Rect2 &p_rect, const Rect2 &p_src) {
@@ -2022,7 +2022,7 @@ void RasterizerCanvasGLES2::draw_lens_distortion_rect(const Rect2 &p_rect, float
// and cleanup
glBindBuffer(GL_ARRAY_BUFFER, 0);
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
glDisableVertexAttribArray(i);
}
}
diff --git a/drivers/gles2/rasterizer_canvas_gles2.h b/drivers/gles2/rasterizer_canvas_gles2.h
index f6ae6a60c0..4e4db98c25 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.h
+++ b/drivers/gles2/rasterizer_canvas_gles2.h
@@ -32,7 +32,7 @@
#define RASTERIZERCANVASGLES2_H
#include "rasterizer_storage_gles2.h"
-#include "servers/visual/rasterizer.h"
+#include "servers/rendering/rasterizer.h"
#include "shaders/canvas.glsl.gen.h"
#include "shaders/lens_distorted.glsl.gen.h"
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index f14c5f9406..cc17af171e 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -263,7 +263,7 @@ void RasterizerGLES2::initialize() {
#endif // GLES_OVER_GL
#endif // CAN_DEBUG
- print_line("OpenGL ES 2.0 Renderer: " + VisualServer::get_singleton()->get_video_adapter_name());
+ print_line("OpenGL ES 2.0 Renderer: " + RenderingServer::get_singleton()->get_video_adapter_name());
storage->initialize();
canvas->initialize();
scene->initialize();
@@ -359,7 +359,7 @@ void RasterizerGLES2::set_boot_image(const Ref<Image> &p_image, const Color &p_c
canvas->canvas_begin();
RID texture = storage->texture_create();
- storage->texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), VS::TEXTURE_TYPE_2D, p_use_filter ? VS::TEXTURE_FLAG_FILTER : 0);
+ storage->texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), RS::TEXTURE_TYPE_2D, p_use_filter ? RS::TEXTURE_FLAG_FILTER : 0);
storage->texture_set_data(texture, p_image);
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index 9a5501f13d..027a634ae8 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -34,7 +34,7 @@
#include "rasterizer_canvas_gles2.h"
#include "rasterizer_scene_gles2.h"
#include "rasterizer_storage_gles2.h"
-#include "servers/visual/rasterizer.h"
+#include "servers/rendering/rasterizer.h"
class RasterizerGLES2 : public Rasterizer {
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 8872dde9fc..4bb8d5a16d 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -37,7 +37,7 @@
#include "core/vmap.h"
#include "rasterizer_canvas_gles2.h"
#include "servers/camera/camera_feed.h"
-#include "servers/visual/visual_server_raster.h"
+#include "servers/rendering/rendering_server_raster.h"
#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
@@ -456,10 +456,10 @@ int RasterizerSceneGLES2::get_directional_light_shadow_size(RID p_light_intance)
ERR_FAIL_COND_V(!light_instance, 0);
switch (light_instance->light_ptr->directional_shadow_mode) {
- case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
+ case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
break; //none
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS:
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS:
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS:
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS:
shadow_size /= 2;
break;
}
@@ -525,7 +525,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_needs_redraw(RID p_instance
const ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
ERR_FAIL_COND_V(!rpi, false);
- bool need_redraw = rpi->probe_ptr->resolution != rpi->current_resolution || rpi->dirty || rpi->probe_ptr->update_mode == VS::REFLECTION_PROBE_UPDATE_ALWAYS;
+ bool need_redraw = rpi->probe_ptr->resolution != rpi->current_resolution || rpi->dirty || rpi->probe_ptr->update_mode == RS::REFLECTION_PROBE_UPDATE_ALWAYS;
rpi->dirty = false;
return need_redraw;
}
@@ -610,7 +610,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_inst
glDisable(GL_BLEND);
glDepthMask(GL_FALSE);
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
glDisableVertexAttribArray(i);
}
}
@@ -690,7 +690,7 @@ RID RasterizerSceneGLES2::environment_create() {
return environment_owner.make_rid(env);
}
-void RasterizerSceneGLES2::environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {
+void RasterizerSceneGLES2::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -755,7 +755,7 @@ void RasterizerSceneGLES2::environment_set_camera_feed_id(RID p_env, int p_camer
env->camera_feed_id = p_camera_feed_id;
}
-void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
+void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -767,7 +767,7 @@ void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable
env->dof_blur_far_quality = p_quality;
}
-void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
+void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -779,7 +779,7 @@ void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enabl
env->dof_blur_near_quality = p_quality;
}
-void RasterizerSceneGLES2::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
+void RasterizerSceneGLES2::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -806,12 +806,12 @@ void RasterizerSceneGLES2::environment_set_ssr(RID p_env, bool p_enable, int p_m
ERR_FAIL_COND(!env);
}
-void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
+void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::EnvironmentSSAOQuality p_quality, RenderingServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
}
-void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
+void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
}
@@ -866,9 +866,9 @@ bool RasterizerSceneGLES2::is_environment(RID p_env) {
return environment_owner.owns(p_env);
}
-VS::EnvironmentBG RasterizerSceneGLES2::environment_get_background(RID p_env) {
+RS::EnvironmentBG RasterizerSceneGLES2::environment_get_background(RID p_env) {
const Environment *env = environment_owner.getornull(p_env);
- ERR_FAIL_COND_V(!env, VS::ENV_BG_MAX);
+ ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX);
return env->bg_mode;
}
@@ -914,7 +914,7 @@ void RasterizerSceneGLES2::light_instance_set_shadow_transform(RID p_light_insta
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
ERR_FAIL_COND(!light_instance);
- if (light_instance->light_ptr->type != VS::LIGHT_DIRECTIONAL) {
+ if (light_instance->light_ptr->type != RS::LIGHT_DIRECTIONAL) {
p_pass = 0;
}
@@ -1022,7 +1022,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
//shader does not use discard and does not write a vertex position, use generic material
- if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
+ if (p_instance->cast_shadows == RS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
p_material = storage->material_owner.getornull(!p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material_twosided : default_material_twosided);
mirror = false;
} else {
@@ -1048,7 +1048,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
e->use_accum = false;
e->light_index = RenderList::MAX_LIGHTS;
e->use_accum_ptr = &e->use_accum;
- e->instancing = (e->instance->base_type == VS::INSTANCE_MULTIMESH) ? 1 : 0;
+ e->instancing = (e->instance->base_type == RS::INSTANCE_MULTIMESH) ? 1 : 0;
e->front_facing = false;
if (e->geometry->last_pass != render_pass) {
@@ -1162,7 +1162,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
//directional sort key
e->light_type1 = 1;
- e->light_type2 = li->light_ptr->type == VisualServer::LIGHT_OMNI ? 0 : 1;
+ e->light_type2 = li->light_ptr->type == RenderingServer::LIGHT_OMNI ? 0 : 1;
e->light_index = li->light_index;
copy = true;
@@ -1181,7 +1181,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
// do not add anything here, as lights are duplicated elements..
if (p_material->shader->spatial.uses_time) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
}
@@ -1224,7 +1224,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
switch (instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
RasterizerStorageGLES2::Mesh *mesh = storage->mesh_owner.getornull(instance->base);
ERR_CONTINUE(!mesh);
@@ -1241,7 +1241,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
RasterizerStorageGLES2::MultiMesh *multi_mesh = storage->multimesh_owner.getornull(instance->base);
ERR_CONTINUE(!multi_mesh);
@@ -1260,7 +1260,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
}
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
RasterizerStorageGLES2::Immediate *im = storage->immediate_owner.getornull(instance->base);
ERR_CONTINUE(!im);
@@ -1426,7 +1426,7 @@ bool RasterizerSceneGLES2::_setup_material(RasterizerStorageGLES2::Material *p_m
}
if (t->redraw_if_visible) { //must check before proxy because this is often used with proxies
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
t = t->get_ptr();
@@ -1459,7 +1459,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
switch (p_element->instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
glBindBuffer(GL_ARRAY_BUFFER, s->vertex_id);
@@ -1468,18 +1468,18 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
if (s->attribs[i].enabled) {
glEnableVertexAttribArray(i);
glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[i].offset));
} else {
glDisableVertexAttribArray(i);
switch (i) {
- case VS::ARRAY_NORMAL: {
- glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
+ case RS::ARRAY_NORMAL: {
+ glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
- case VS::ARRAY_COLOR: {
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ case RS::ARRAY_COLOR: {
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} break;
default: {
@@ -1502,7 +1502,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
Vector<float> &transform_buffer = storage->resources.skeleton_transform_cpu_buffer;
- if (!s->attribs[VS::ARRAY_BONES].enabled || !s->attribs[VS::ARRAY_WEIGHTS].enabled) {
+ if (!s->attribs[RS::ARRAY_BONES].enabled || !s->attribs[RS::ARRAY_WEIGHTS].enabled) {
break; // the whole instance has a skeleton, but this surface is not affected by it.
}
@@ -1511,10 +1511,10 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
transform_buffer.resize(s->array_len * 12);
}
- const size_t bones_offset = s->attribs[VS::ARRAY_BONES].offset;
- const size_t bones_stride = s->attribs[VS::ARRAY_BONES].stride;
- const size_t bone_weight_offset = s->attribs[VS::ARRAY_WEIGHTS].offset;
- const size_t bone_weight_stride = s->attribs[VS::ARRAY_WEIGHTS].stride;
+ const size_t bones_offset = s->attribs[RS::ARRAY_BONES].offset;
+ const size_t bones_stride = s->attribs[RS::ARRAY_BONES].stride;
+ const size_t bone_weight_offset = s->attribs[RS::ARRAY_WEIGHTS].offset;
+ const size_t bone_weight_stride = s->attribs[RS::ARRAY_WEIGHTS].stride;
{
float *write = transform_buffer.ptrw();
@@ -1530,7 +1530,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
size_t bones[4];
float bone_weight[4];
- if (s->attribs[VS::ARRAY_BONES].type == GL_UNSIGNED_BYTE) {
+ if (s->attribs[RS::ARRAY_BONES].type == GL_UNSIGNED_BYTE) {
// read as byte
const uint8_t *bones_ptr = vertex_data + bones_offset + (i * bones_stride);
bones[0] = bones_ptr[0];
@@ -1546,7 +1546,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
bones[3] = bones_ptr[3];
}
- if (s->attribs[VS::ARRAY_WEIGHTS].type == GL_FLOAT) {
+ if (s->attribs[RS::ARRAY_WEIGHTS].type == GL_FLOAT) {
// read as float
const float *weight_ptr = (const float *)(vertex_data + bone_weight_offset + (i * bone_weight_stride));
bone_weight[0] = weight_ptr[0];
@@ -1621,7 +1621,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
glBindBuffer(GL_ARRAY_BUFFER, s->vertex_id);
@@ -1630,18 +1630,18 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
if (s->attribs[i].enabled) {
glEnableVertexAttribArray(i);
glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[i].offset));
} else {
glDisableVertexAttribArray(i);
switch (i) {
- case VS::ARRAY_NORMAL: {
- glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
+ case RS::ARRAY_NORMAL: {
+ glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
- case VS::ARRAY_COLOR: {
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ case RS::ARRAY_COLOR: {
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
} break;
default: {
@@ -1662,7 +1662,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
} break;
default: {
@@ -1674,7 +1674,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
switch (p_element->instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
@@ -1688,22 +1688,22 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
storage->info.render.vertices_count += s->array_len;
}
/*
- if (p_element->instance->skeleton.is_valid() && s->attribs[VS::ARRAY_BONES].enabled && s->attribs[VS::ARRAY_WEIGHTS].enabled) {
+ if (p_element->instance->skeleton.is_valid() && s->attribs[RS::ARRAY_BONES].enabled && s->attribs[RS::ARRAY_WEIGHTS].enabled) {
//clean up after skeleton
glBindBuffer(GL_ARRAY_BUFFER, storage->resources.skeleton_transform_buffer);
- glDisableVertexAttribArray(VS::ARRAY_MAX + 0);
- glDisableVertexAttribArray(VS::ARRAY_MAX + 1);
- glDisableVertexAttribArray(VS::ARRAY_MAX + 2);
+ glDisableVertexAttribArray(RS::ARRAY_MAX + 0);
+ glDisableVertexAttribArray(RS::ARRAY_MAX + 1);
+ glDisableVertexAttribArray(RS::ARRAY_MAX + 2);
- glVertexAttrib4f(VS::ARRAY_MAX + 0, 1, 0, 0, 0);
- glVertexAttrib4f(VS::ARRAY_MAX + 1, 0, 1, 0, 0);
- glVertexAttrib4f(VS::ARRAY_MAX + 2, 0, 0, 1, 0);
+ glVertexAttrib4f(RS::ARRAY_MAX + 0, 1, 0, 0, 0);
+ glVertexAttrib4f(RS::ARRAY_MAX + 1, 0, 1, 0, 0);
+ glVertexAttrib4f(RS::ARRAY_MAX + 2, 0, 0, 1, 0);
}
*/
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
RasterizerStorageGLES2::MultiMesh *multi_mesh = static_cast<RasterizerStorageGLES2::MultiMesh *>(p_element->owner);
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
@@ -1734,7 +1734,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
}
if (multi_mesh->color_floats) {
- if (multi_mesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ if (multi_mesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
uint8_t *color_data = (uint8_t *)(buffer + color_ofs);
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 3, color_data[0] / 255.0, color_data[1] / 255.0, color_data[2] / 255.0, color_data[3] / 255.0);
} else {
@@ -1745,7 +1745,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
}
if (multi_mesh->custom_data_floats) {
- if (multi_mesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
+ if (multi_mesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
uint8_t *custom_data = (uint8_t *)(buffer + custom_data_ofs);
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 4, custom_data[0] / 255.0, custom_data[1] / 255.0, custom_data[2] / 255.0, custom_data[3] / 255.0);
} else {
@@ -1764,7 +1764,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
const RasterizerStorageGLES2::Immediate *im = static_cast<const RasterizerStorageGLES2::Immediate *>(p_element->geometry);
if (im->building) {
@@ -1792,7 +1792,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(c.texture);
if (t->redraw_if_visible) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
t = t->get_ptr();
@@ -1816,53 +1816,53 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
}
if (!c.normals.empty()) {
- glEnableVertexAttribArray(VS::ARRAY_NORMAL);
+ glEnableVertexAttribArray(RS::ARRAY_NORMAL);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.normals.ptr());
- glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
+ glVertexAttribPointer(RS::ARRAY_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
buf_ofs += sizeof(Vector3) * vertices;
} else {
- glDisableVertexAttribArray(VS::ARRAY_NORMAL);
+ glDisableVertexAttribArray(RS::ARRAY_NORMAL);
}
if (!c.tangents.empty()) {
- glEnableVertexAttribArray(VS::ARRAY_TANGENT);
+ glEnableVertexAttribArray(RS::ARRAY_TANGENT);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Plane) * vertices, c.tangents.ptr());
- glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, GL_FALSE, sizeof(Plane), CAST_INT_TO_UCHAR_PTR(buf_ofs));
+ glVertexAttribPointer(RS::ARRAY_TANGENT, 4, GL_FLOAT, GL_FALSE, sizeof(Plane), CAST_INT_TO_UCHAR_PTR(buf_ofs));
buf_ofs += sizeof(Plane) * vertices;
} else {
- glDisableVertexAttribArray(VS::ARRAY_TANGENT);
+ glDisableVertexAttribArray(RS::ARRAY_TANGENT);
}
if (!c.colors.empty()) {
- glEnableVertexAttribArray(VS::ARRAY_COLOR);
+ glEnableVertexAttribArray(RS::ARRAY_COLOR);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Color) * vertices, c.colors.ptr());
- glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buf_ofs));
+ glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buf_ofs));
buf_ofs += sizeof(Color) * vertices;
} else {
- glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glDisableVertexAttribArray(RS::ARRAY_COLOR);
}
if (!c.uvs.empty()) {
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uvs.ptr());
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
buf_ofs += sizeof(Vector2) * vertices;
} else {
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
}
if (!c.uv2s.empty()) {
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV2);
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV2);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uv2s.ptr());
- glVertexAttribPointer(VS::ARRAY_TEX_UV2, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
+ glVertexAttribPointer(RS::ARRAY_TEX_UV2, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
buf_ofs += sizeof(Vector2) * vertices;
} else {
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV2);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV2);
}
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.vertices.ptr());
- glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
glDrawArrays(gl_primitive[c.primitive], 0, c.vertices.size());
}
@@ -1901,18 +1901,18 @@ void RasterizerSceneGLES2::_setup_light_type(LightInstance *p_light, ShadowAtlas
state.scene_shader.set_conditional(SceneShaderGLES2::USE_LIGHTING, true);
switch (p_light->light_ptr->type) {
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_MODE_DIRECTIONAL, true);
switch (p_light->light_ptr->directional_shadow_mode) {
- case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
//no need
} break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_USE_PSSM2, true);
} break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_USE_PSSM4, true);
} break;
}
@@ -1931,7 +1931,7 @@ void RasterizerSceneGLES2::_setup_light_type(LightInstance *p_light, ShadowAtlas
}
} break;
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_OMNI: {
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_MODE_OMNI, true);
if (!state.render_no_shadows && shadow_atlas && p_light->light_ptr->shadow) {
@@ -1946,7 +1946,7 @@ void RasterizerSceneGLES2::_setup_light_type(LightInstance *p_light, ShadowAtlas
state.scene_shader.set_conditional(SceneShaderGLES2::SHADOW_MODE_PCF_13, shadow_filter_mode == SHADOW_FILTER_PCF13);
}
} break;
- case VS::LIGHT_SPOT: {
+ case RS::LIGHT_SPOT: {
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_MODE_SPOT, true);
if (!state.render_no_shadows && shadow_atlas && p_light->light_ptr->shadow) {
@@ -1969,8 +1969,8 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
RasterizerStorageGLES2::Light *light_ptr = light->light_ptr;
//common parameters
- float energy = light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- float specular = light_ptr->param[VS::LIGHT_PARAM_SPECULAR];
+ float energy = light_ptr->param[RS::LIGHT_PARAM_ENERGY];
+ float specular = light_ptr->param[RS::LIGHT_PARAM_SPECULAR];
float sign = (light_ptr->negative && !accum_pass) ? -1 : 1; //inverse color for base pass lights only
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_SPECULAR, specular);
@@ -1982,7 +1982,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
//specific parameters
switch (light_ptr->type) {
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
//not using inverse for performance, view should be normalized anyway
Vector3 direction = p_view_transform.basis.xform_inv(light->transform.basis.xform(Vector3(0, 0, -1))).normalized();
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_DIRECTION, direction);
@@ -1995,15 +1995,15 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
Color split_offsets;
switch (light_ptr->directional_shadow_mode) {
- case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
shadow_count = 1;
} break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
shadow_count = 2;
} break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
shadow_count = 4;
} break;
}
@@ -2015,7 +2015,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
uint32_t width = light->directional_rect.size.x;
uint32_t height = light->directional_rect.size.y;
- if (light_ptr->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
+ if (light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
width /= 2;
height /= 2;
@@ -2029,7 +2029,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
y += height;
}
- } else if (light_ptr->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
+ } else if (light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
height /= 2;
@@ -2067,16 +2067,16 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_SHADOW_MATRIX4, matrices[3]);
}
} break;
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_OMNI: {
Vector3 position = p_view_transform.xform_inv(light->transform.origin);
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_POSITION, position);
- float range = light_ptr->param[VS::LIGHT_PARAM_RANGE];
+ float range = light_ptr->param[RS::LIGHT_PARAM_RANGE];
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_RANGE, range);
- float attenuation = light_ptr->param[VS::LIGHT_PARAM_ATTENUATION];
+ float attenuation = light_ptr->param[RS::LIGHT_PARAM_ATTENUATION];
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_ATTENUATION, attenuation);
if (!state.render_no_shadows && light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(light->self)) {
@@ -2101,7 +2101,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
uint32_t width = shadow_size;
uint32_t height = shadow_size;
- if (light->light_ptr->omni_shadow_detail == VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
+ if (light->light_ptr->omni_shadow_detail == RS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
height /= 2;
} else {
width /= 2;
@@ -2121,7 +2121,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
}
} break;
- case VS::LIGHT_SPOT: {
+ case RS::LIGHT_SPOT: {
Vector3 position = p_view_transform.xform_inv(light->transform.origin);
@@ -2129,10 +2129,10 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
Vector3 direction = p_view_transform.inverse().basis.xform(light->transform.basis.xform(Vector3(0, 0, -1))).normalized();
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_DIRECTION, direction);
- float attenuation = light_ptr->param[VS::LIGHT_PARAM_ATTENUATION];
- float range = light_ptr->param[VS::LIGHT_PARAM_RANGE];
- float spot_attenuation = light_ptr->param[VS::LIGHT_PARAM_SPOT_ATTENUATION];
- float angle = light_ptr->param[VS::LIGHT_PARAM_SPOT_ANGLE];
+ float attenuation = light_ptr->param[RS::LIGHT_PARAM_ATTENUATION];
+ float range = light_ptr->param[RS::LIGHT_PARAM_RANGE];
+ float spot_attenuation = light_ptr->param[RS::LIGHT_PARAM_SPOT_ATTENUATION];
+ float angle = light_ptr->param[RS::LIGHT_PARAM_SPOT_ANGLE];
angle = Math::cos(Math::deg2rad(angle));
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_ATTENUATION, attenuation);
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_SPOT_ATTENUATION, spot_attenuation);
@@ -2490,7 +2490,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
rebind = true;
}
- bool instancing = e->instance->base_type == VS::INSTANCE_MULTIMESH;
+ bool instancing = e->instance->base_type == RS::INSTANCE_MULTIMESH;
if (instancing != prev_instancing) {
@@ -2726,10 +2726,10 @@ void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const C
glBufferData(GL_ARRAY_BUFFER, sizeof(Vector3) * 8, vertices, GL_DYNAMIC_DRAW);
// bind sky vertex array....
- glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, 0);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, CAST_INT_TO_UCHAR_PTR(sizeof(Vector3)));
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, 0);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, CAST_INT_TO_UCHAR_PTR(sizeof(Vector3)));
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_ASYM_PANO, asymmetrical);
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_PANORAMA, !asymmetrical);
@@ -2752,8 +2752,8 @@ void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const C
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisableVertexAttribArray(VS::ARRAY_VERTEX);
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glDisableVertexAttribArray(RS::ARRAY_VERTEX);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
glBindBuffer(GL_ARRAY_BUFFER, 0);
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_ASYM_PANO, false);
@@ -2845,9 +2845,9 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_ORTHOGONAL_PROJECTION, p_cam_projection.is_orthogonal());
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_FAR_BLUR, true);
- state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_far_quality == VS::ENV_DOF_BLUR_QUALITY_LOW);
- state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_far_quality == VS::ENV_DOF_BLUR_QUALITY_MEDIUM);
- state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_far_quality == VS::ENV_DOF_BLUR_QUALITY_HIGH);
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_LOW);
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_MEDIUM);
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_HIGH);
state.effect_blur_shader.bind();
int qsteps[3] = { 4, 10, 20 };
@@ -2911,9 +2911,9 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_BLUR, true);
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_FIRST_TAP, true);
- state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_near_quality == VS::ENV_DOF_BLUR_QUALITY_LOW);
- state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_near_quality == VS::ENV_DOF_BLUR_QUALITY_MEDIUM);
- state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_near_quality == VS::ENV_DOF_BLUR_QUALITY_HIGH);
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_LOW);
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_MEDIUM);
+ state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_HIGH);
state.effect_blur_shader.bind();
int qsteps[3] = { 4, 10, 20 };
@@ -3003,7 +3003,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
if (env->glow_enabled) {
- for (int i = 0; i < VS::MAX_GLOW_LEVELS; i++) {
+ for (int i = 0; i < RS::MAX_GLOW_LEVELS; i++) {
if (env->glow_levels & (1 << i)) {
if (i >= storage->frame.current_rt->mip_maps[1].sizes.size()) {
@@ -3156,9 +3156,9 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
}
}
- state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SCREEN, env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_SCREEN);
- state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SOFTLIGHT, env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_SOFTLIGHT);
- state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_REPLACE, env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_REPLACE);
+ state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SCREEN, env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_SCREEN);
+ state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SOFTLIGHT, env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT);
+ state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_REPLACE, env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_REPLACE);
}
//Adjustments
@@ -3288,7 +3288,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
LightInstance *light = light_instance_owner.getornull(light_rid);
- if (light->light_ptr->type == VS::LIGHT_DIRECTIONAL) {
+ if (light->light_ptr->type == RS::LIGHT_DIRECTIONAL) {
render_directional_lights++;
//as going in reverse, directional lights are always first anyway
}
@@ -3322,7 +3322,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
reflection_probe_count = 0;
}
- if (env && env->bg_mode == VS::ENV_BG_CANVAS) {
+ if (env && env->bg_mode == RS::ENV_BG_CANVAS) {
// If using canvas background, copy 2d to screen copy texture
// TODO: When GLES2 renders to current_rt->mip_maps[], this copy will no longer be needed
_copy_texture_to_buffer(storage->frame.current_rt->color, storage->frame.current_rt->copy_screen_effect.fbo);
@@ -3358,22 +3358,22 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
clear_color = Color(0, 0, 0, 0);
storage->frame.clear_request = false;
- } else if (!env || env->bg_mode == VS::ENV_BG_CLEAR_COLOR || env->bg_mode == VS::ENV_BG_SKY) {
+ } else if (!env || env->bg_mode == RS::ENV_BG_CLEAR_COLOR || env->bg_mode == RS::ENV_BG_SKY) {
if (storage->frame.clear_request) {
clear_color = storage->frame.clear_request_color;
storage->frame.clear_request = false;
}
- } else if (env->bg_mode == VS::ENV_BG_CANVAS || env->bg_mode == VS::ENV_BG_COLOR || env->bg_mode == VS::ENV_BG_COLOR_SKY) {
+ } else if (env->bg_mode == RS::ENV_BG_CANVAS || env->bg_mode == RS::ENV_BG_COLOR || env->bg_mode == RS::ENV_BG_COLOR_SKY) {
clear_color = env->bg_color;
storage->frame.clear_request = false;
- } else if (env->bg_mode == VS::ENV_BG_CAMERA_FEED) {
+ } else if (env->bg_mode == RS::ENV_BG_CAMERA_FEED) {
feed = CameraServer::get_singleton()->get_feed_by_id(env->camera_feed_id);
storage->frame.clear_request = false;
} else {
storage->frame.clear_request = false;
}
- if (!env || env->bg_mode != VS::ENV_BG_KEEP) {
+ if (!env || env->bg_mode != RS::ENV_BG_KEEP) {
glClearColor(clear_color.r, clear_color.g, clear_color.b, clear_color.a);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -3385,7 +3385,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
glDisable(GL_SCISSOR_TEST);
}
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -3396,15 +3396,15 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
if (env) {
switch (env->bg_mode) {
- case VS::ENV_BG_COLOR_SKY:
- case VS::ENV_BG_SKY: {
+ case RS::ENV_BG_COLOR_SKY:
+ case RS::ENV_BG_SKY: {
sky = storage->sky_owner.getornull(env->sky);
if (sky) {
env_radiance_tex = sky->radiance;
}
} break;
- case VS::ENV_BG_CAMERA_FEED: {
+ case RS::ENV_BG_CAMERA_FEED: {
if (feed.is_valid() && (feed->get_base_width() > 0) && (feed->get_base_height() > 0)) {
// copy our camera feed to our background
@@ -3419,12 +3419,12 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
if (feed->get_datatype() == CameraFeed::FEED_RGB) {
RID camera_RGBA = feed->get_texture(CameraServer::FEED_RGBA_IMAGE);
- VS::get_singleton()->texture_bind(camera_RGBA, 0);
+ RS::get_singleton()->texture_bind(camera_RGBA, 0);
} else if (feed->get_datatype() == CameraFeed::FEED_YCBCR) {
RID camera_YCbCr = feed->get_texture(CameraServer::FEED_YCBCR_IMAGE);
- VS::get_singleton()->texture_bind(camera_YCbCr, 0);
+ RS::get_singleton()->texture_bind(camera_YCbCr, 0);
storage->shaders.copy.set_conditional(CopyShaderGLES2::YCBCR_TO_RGB, true);
@@ -3432,8 +3432,8 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
RID camera_Y = feed->get_texture(CameraServer::FEED_Y_IMAGE);
RID camera_CbCr = feed->get_texture(CameraServer::FEED_CBCR_IMAGE);
- VS::get_singleton()->texture_bind(camera_Y, 0);
- VS::get_singleton()->texture_bind(camera_CbCr, 1);
+ RS::get_singleton()->texture_bind(camera_Y, 0);
+ RS::get_singleton()->texture_bind(camera_CbCr, 1);
storage->shaders.copy.set_conditional(CopyShaderGLES2::SEP_CBCR_TEXTURE, true);
storage->shaders.copy.set_conditional(CopyShaderGLES2::YCBCR_TO_RGB, true);
@@ -3444,8 +3444,8 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
storage->bind_quad_array();
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisableVertexAttribArray(VS::ARRAY_VERTEX);
- glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glDisableVertexAttribArray(RS::ARRAY_VERTEX);
+ glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
glBindBuffer(GL_ARRAY_BUFFER, 0);
// turn off everything used
@@ -3464,7 +3464,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
clear_color = Color(0.0, 1.0, 0.0, 1.0);
}
} break;
- case VS::ENV_BG_CANVAS: {
+ case RS::ENV_BG_CANVAS: {
// use screen copy as background
_copy_texture_to_buffer(storage->frame.current_rt->copy_screen_effect.color, current_fb);
} break;
@@ -3484,7 +3484,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false);
// then draw the sky after
- if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
+ if (env && env->bg_mode == RS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
if (sky && sky->panorama.is_valid()) {
_draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
@@ -3616,7 +3616,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
// TODO directional light
- if (light->type == VS::LIGHT_DIRECTIONAL) {
+ if (light->type == RS::LIGHT_DIRECTIONAL) {
// set pssm stuff
// TODO set this only when changed
@@ -3651,7 +3651,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
width = light_instance->directional_rect.size.width;
height = light_instance->directional_rect.size.height;
- if (light->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
+ if (light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
width /= 2;
height /= 2;
@@ -3665,7 +3665,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
y += height;
}
- } else if (light->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
+ } else if (light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
height /= 2;
@@ -3676,10 +3676,10 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
}
}
- float bias_mult = Math::lerp(1.0f, light_instance->shadow_transform[p_pass].bias_scale, light->param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE]);
- zfar = light->param[VS::LIGHT_PARAM_RANGE];
- bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS] * bias_mult;
- normal_bias = light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] * bias_mult;
+ float bias_mult = Math::lerp(1.0f, light_instance->shadow_transform[p_pass].bias_scale, light->param[RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE]);
+ zfar = light->param[RS::LIGHT_PARAM_RANGE];
+ bias = light->param[RS::LIGHT_PARAM_SHADOW_BIAS] * bias_mult;
+ normal_bias = light->param[RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] * bias_mult;
fbo = directional_shadow.fbo;
} else {
@@ -3708,9 +3708,9 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
width = shadow_size;
height = shadow_size;
- if (light->type == VS::LIGHT_OMNI) {
+ if (light->type == RS::LIGHT_OMNI) {
// cubemap only
- if (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) {
+ if (light->omni_shadow_mode == RS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) {
int cubemap_index = shadow_cubemaps.size() - 1;
// find an appropriate cubemap to render to
@@ -3727,7 +3727,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
light_transform = light_instance->shadow_transform[0].transform;
custom_vp_size = shadow_cubemaps[cubemap_index].size;
- zfar = light->param[VS::LIGHT_PARAM_RANGE];
+ zfar = light->param[RS::LIGHT_PARAM_RANGE];
current_cubemap = cubemap_index;
} else {
@@ -3736,7 +3736,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
light_projection = light_instance->shadow_transform[0].camera;
light_transform = light_instance->shadow_transform[0].transform;
- if (light->omni_shadow_detail == VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
+ if (light->omni_shadow_detail == RS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
height /= 2;
y += p_pass * height;
@@ -3747,22 +3747,22 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.dual_parbolloid_direction = p_pass == 0 ? 1.0 : -1.0;
flip_facing = (p_pass == 1);
- zfar = light->param[VS::LIGHT_PARAM_RANGE];
- bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS];
+ zfar = light->param[RS::LIGHT_PARAM_RANGE];
+ bias = light->param[RS::LIGHT_PARAM_SHADOW_BIAS];
state.dual_parbolloid_zfar = zfar;
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, true);
}
- } else if (light->type == VS::LIGHT_SPOT) {
+ } else if (light->type == RS::LIGHT_SPOT) {
light_projection = light_instance->shadow_transform[0].camera;
light_transform = light_instance->shadow_transform[0].transform;
flip_facing = false;
- zfar = light->param[VS::LIGHT_PARAM_RANGE];
- bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS];
- normal_bias = light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS];
+ zfar = light->param[RS::LIGHT_PARAM_RANGE];
+ bias = light->param[RS::LIGHT_PARAM_SHADOW_BIAS];
+ normal_bias = light->param[RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS];
}
}
@@ -3812,7 +3812,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, false);
// convert cubemap to dual paraboloid if needed
- if (light->type == VS::LIGHT_OMNI && (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) && p_pass == 5) {
+ if (light->type == RS::LIGHT_OMNI && (light->omni_shadow_mode == RS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) && p_pass == 5) {
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas);
glBindFramebuffer(GL_FRAMEBUFFER, shadow_atlas->fbo);
@@ -3827,14 +3827,14 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::Z_FLIP, i == 1);
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::Z_NEAR, light_projection.get_z_near());
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::Z_FAR, light_projection.get_z_far());
- state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::BIAS, light->param[VS::LIGHT_PARAM_SHADOW_BIAS]);
+ state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::BIAS, light->param[RS::LIGHT_PARAM_SHADOW_BIAS]);
uint32_t local_width = width;
uint32_t local_height = height;
uint32_t local_x = x;
uint32_t local_y = y;
- if (light->omni_shadow_detail == VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
+ if (light->omni_shadow_detail == RS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
local_height /= 2;
local_y += i * local_height;
} else {
@@ -3922,7 +3922,7 @@ bool RasterizerSceneGLES2::free(RID p_rid) {
return true;
}
-void RasterizerSceneGLES2::set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {
+void RasterizerSceneGLES2::set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) {
}
void RasterizerSceneGLES2::initialize() {
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index 174cdd8e2e..6d0a5a45ca 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -236,7 +236,7 @@ public:
/* ENVIRONMENT API */
struct Environment {
- VS::EnvironmentBG bg_mode;
+ RS::EnvironmentBG bg_mode;
RID sky;
float sky_custom_fov;
@@ -259,7 +259,7 @@ public:
float glow_intensity;
float glow_strength;
float glow_bloom;
- VS::EnvironmentGlowBlendMode glow_blend_mode;
+ RS::EnvironmentGlowBlendMode glow_blend_mode;
float glow_hdr_bleed_threshold;
float glow_hdr_bleed_scale;
float glow_hdr_luminance_cap;
@@ -269,13 +269,13 @@ public:
float dof_blur_far_distance;
float dof_blur_far_transition;
float dof_blur_far_amount;
- VS::EnvironmentDOFBlurQuality dof_blur_far_quality;
+ RS::EnvironmentDOFBlurQuality dof_blur_far_quality;
bool dof_blur_near_enabled;
float dof_blur_near_distance;
float dof_blur_near_transition;
float dof_blur_near_amount;
- VS::EnvironmentDOFBlurQuality dof_blur_near_quality;
+ RS::EnvironmentDOFBlurQuality dof_blur_near_quality;
bool adjustments_enabled;
float adjustments_brightness;
@@ -300,7 +300,7 @@ public:
float fog_height_curve;
Environment() :
- bg_mode(VS::ENV_BG_CLEAR_COLOR),
+ bg_mode(RS::ENV_BG_CLEAR_COLOR),
sky_custom_fov(0.0),
bg_energy(1.0),
sky_ambient(0),
@@ -313,7 +313,7 @@ public:
glow_intensity(0.8),
glow_strength(1.0),
glow_bloom(0.0),
- glow_blend_mode(VS::ENV_GLOW_BLEND_MODE_SOFTLIGHT),
+ glow_blend_mode(RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT),
glow_hdr_bleed_threshold(1.0),
glow_hdr_bleed_scale(2.0),
glow_hdr_luminance_cap(12.0),
@@ -322,12 +322,12 @@ public:
dof_blur_far_distance(10),
dof_blur_far_transition(5),
dof_blur_far_amount(0.1),
- dof_blur_far_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
+ dof_blur_far_quality(RS::ENV_DOF_BLUR_QUALITY_MEDIUM),
dof_blur_near_enabled(false),
dof_blur_near_distance(2),
dof_blur_near_transition(1),
dof_blur_near_amount(0.1),
- dof_blur_near_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
+ dof_blur_near_quality(RS::ENV_DOF_BLUR_QUALITY_MEDIUM),
adjustments_enabled(false),
adjustments_brightness(1.0),
adjustments_contrast(1.0),
@@ -353,7 +353,7 @@ public:
virtual RID environment_create();
- virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
+ virtual void environment_set_background(RID p_env, RS::EnvironmentBG p_bg);
virtual void environment_set_sky(RID p_env, RID p_sky);
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
@@ -363,15 +363,15 @@ public:
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id);
- virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
- virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
- virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
+ virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality);
+ virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality);
+ virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
- virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
+ virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::EnvironmentSSAOQuality p_quality, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
- virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
+ virtual void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp);
@@ -381,7 +381,7 @@ public:
virtual bool is_environment(RID p_env);
- virtual VS::EnvironmentBG environment_get_background(RID p_env);
+ virtual RS::EnvironmentBG environment_get_background(RID p_env);
virtual int environment_get_canvas_max_layer(RID p_env);
/* LIGHT INSTANCE */
@@ -650,7 +650,7 @@ public:
virtual bool free(RID p_rid);
virtual void set_scene_pass(uint64_t p_pass);
- virtual void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw);
+ virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw);
void iteration();
void initialize();
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index f76c7da8e1..4337d2a833 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -34,7 +34,7 @@
#include "core/project_settings.h"
#include "rasterizer_canvas_gles2.h"
#include "rasterizer_scene_gles2.h"
-#include "servers/visual/shader_language.h"
+#include "servers/rendering/shader_language.h"
GLuint RasterizerStorageGLES2::system_fbo = 0;
@@ -127,11 +127,11 @@ PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC glCompressedTexSubImage3DOES;
void RasterizerStorageGLES2::bind_quad_array() const {
glBindBuffer(GL_ARRAY_BUFFER, resources.quadie);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(8));
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0);
+ glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(8));
- glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glEnableVertexAttribArray(RS::ARRAY_VERTEX);
+ glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
}
Ref<Image> RasterizerStorageGLES2::_get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, Image::Format &r_real_format, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool p_force_decompress) const {
@@ -549,15 +549,15 @@ RID RasterizerStorageGLES2::texture_create() {
return texture_owner.make_rid(texture);
}
-void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, VisualServer::TextureType p_type, uint32_t p_flags) {
+void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, RenderingServer::TextureType p_type, uint32_t p_flags) {
GLenum format;
GLenum internal_format;
GLenum type;
bool compressed = false;
- if (p_flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
- p_flags &= ~VS::TEXTURE_FLAG_MIPMAPS; // no mipies for video
+ if (p_flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ p_flags &= ~RS::TEXTURE_FLAG_MIPMAPS; // no mipies for video
}
Texture *texture = texture_owner.getornull(p_texture);
@@ -570,15 +570,15 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
texture->type = p_type;
switch (p_type) {
- case VS::TEXTURE_TYPE_2D: {
+ case RS::TEXTURE_TYPE_2D: {
texture->target = GL_TEXTURE_2D;
texture->images.resize(1);
} break;
- case VS::TEXTURE_TYPE_CUBEMAP: {
+ case RS::TEXTURE_TYPE_CUBEMAP: {
texture->target = GL_TEXTURE_CUBE_MAP;
texture->images.resize(6);
} break;
- case VS::TEXTURE_TYPE_2D_ARRAY: {
+ case RS::TEXTURE_TYPE_2D_ARRAY: {
if (config.texture_array_supported) {
texture->target = GL_TEXTURE_2D_ARRAY;
texture->images.resize(p_depth_3d);
@@ -587,7 +587,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
return;
}
} break;
- case VS::TEXTURE_TYPE_3D: {
+ case RS::TEXTURE_TYPE_3D: {
if (config.texture_3d_supported) {
texture->target = GL_TEXTURE_3D;
texture->images.resize(p_depth_3d);
@@ -611,12 +611,12 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
bool is_po2 = p_width == po2_width && p_height == po2_height;
- if (!is_po2 && (p_flags & VS::TEXTURE_FLAG_REPEAT || p_flags & VS::TEXTURE_FLAG_MIPMAPS)) {
+ if (!is_po2 && (p_flags & RS::TEXTURE_FLAG_REPEAT || p_flags & RS::TEXTURE_FLAG_MIPMAPS)) {
- if (p_flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ if (p_flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING) {
//not supported
ERR_PRINT("Streaming texture for non power of 2 or has mipmaps on this hardware: " + texture->path + "'. Mipmaps and repeat disabled.");
- texture->flags &= ~(VS::TEXTURE_FLAG_REPEAT | VS::TEXTURE_FLAG_MIPMAPS);
+ texture->flags &= ~(RS::TEXTURE_FLAG_REPEAT | RS::TEXTURE_FLAG_MIPMAPS);
} else {
texture->alloc_height = po2_height;
texture->alloc_width = po2_width;
@@ -640,7 +640,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
glBindTexture(texture->target, texture->tex_id);
#if defined(GLES_OVER_GL) || defined(ANDROID_ENABLED)
- if ((p_type == VS::TEXTURE_TYPE_3D && config.texture_3d_supported) || (p_type == VS::TEXTURE_TYPE_2D_ARRAY && config.texture_array_supported)) {
+ if ((p_type == RS::TEXTURE_TYPE_3D && config.texture_3d_supported) || (p_type == RS::TEXTURE_TYPE_2D_ARRAY && config.texture_array_supported)) {
int width = p_width;
int height = p_height;
@@ -648,7 +648,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
int mipmaps = 0;
- while (width > 0 || height > 0 || (p_type == VS::TEXTURE_TYPE_3D && depth > 0)) {
+ while (width > 0 || height > 0 || (p_type == RS::TEXTURE_TYPE_3D && depth > 0)) {
width = MAX(1, width);
height = MAX(1, height);
depth = MAX(1, depth);
@@ -658,13 +658,13 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
width /= 2;
height /= 2;
- if (p_type == VS::TEXTURE_TYPE_3D) {
+ if (p_type == RS::TEXTURE_TYPE_3D) {
depth /= 2;
}
mipmaps++;
- if (!(p_flags & VS::TEXTURE_FLAG_MIPMAPS))
+ if (!(p_flags & RS::TEXTURE_FLAG_MIPMAPS))
break;
}
#ifdef GLES_OVER_GL
@@ -674,7 +674,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
} else
#endif
- if (p_flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ if (p_flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING) {
//prealloc if video
glTexImage2D(texture->target, 0, internal_format, texture->alloc_width, texture->alloc_height, 0, format, type, NULL);
}
@@ -686,7 +686,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
Texture *texture = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!texture);
- if ((texture->type == VS::TEXTURE_TYPE_2D_ARRAY && !config.texture_array_supported) || (texture->type == VS::TEXTURE_TYPE_3D && !config.texture_3d_supported)) {
+ if ((texture->type == RS::TEXTURE_TYPE_2D_ARRAY && !config.texture_array_supported) || (texture->type == RS::TEXTURE_TYPE_3D && !config.texture_3d_supported)) {
return;
}
ERR_FAIL_COND(!texture->active);
@@ -699,7 +699,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
GLenum internal_format;
bool compressed = false;
- if (config.keep_original_textures && !(texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
+ if (config.keep_original_textures && !(texture->flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
texture->images.write[p_layer] = p_image;
}
@@ -717,7 +717,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
img->resize_to_po2(false);
}
- if (config.shrink_textures_x2 && (p_image->has_mipmaps() || !p_image->is_compressed()) && !(texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
+ if (config.shrink_textures_x2 && (p_image->has_mipmaps() || !p_image->is_compressed()) && !(texture->flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
texture->alloc_height = MAX(1, texture->alloc_height / 2);
texture->alloc_width = MAX(1, texture->alloc_width / 2);
@@ -734,17 +734,17 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
GLenum blit_target = GL_TEXTURE_2D;
switch (texture->type) {
- case VS::TEXTURE_TYPE_2D: {
+ case RS::TEXTURE_TYPE_2D: {
blit_target = GL_TEXTURE_2D;
} break;
- case VS::TEXTURE_TYPE_CUBEMAP: {
+ case RS::TEXTURE_TYPE_CUBEMAP: {
ERR_FAIL_INDEX(p_layer, 6);
blit_target = _cube_side_enum[p_layer];
} break;
- case VS::TEXTURE_TYPE_2D_ARRAY: {
+ case RS::TEXTURE_TYPE_2D_ARRAY: {
blit_target = GL_TEXTURE_2D_ARRAY;
} break;
- case VS::TEXTURE_TYPE_3D: {
+ case RS::TEXTURE_TYPE_3D: {
blit_target = GL_TEXTURE_3D;
} break;
}
@@ -758,17 +758,17 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
texture->ignore_mipmaps = compressed && !img->has_mipmaps();
- if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps)
+ if ((texture->flags & RS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps)
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, config.use_fast_texture_filter ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR);
else {
- if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ if (texture->flags & RS::TEXTURE_FLAG_FILTER) {
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
}
- if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ if (texture->flags & RS::TEXTURE_FLAG_FILTER) {
glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Filtering
@@ -777,9 +777,9 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // raw Filtering
}
- if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
+ if (((texture->flags & RS::TEXTURE_FLAG_REPEAT) || (texture->flags & RS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
- if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) {
+ if (texture->flags & RS::TEXTURE_FLAG_MIRRORED_REPEAT) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
} else {
@@ -793,7 +793,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
glTexParameterf(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
- int mipmaps = ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1;
+ int mipmaps = ((texture->flags & RS::TEXTURE_FLAG_MIPMAPS) && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1;
int w = img->get_width();
int h = img->get_height();
@@ -804,7 +804,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
int size, ofs;
img->get_mipmap_offset_and_size(i, ofs, size);
- if (texture->type == VS::TEXTURE_TYPE_2D || texture->type == VS::TEXTURE_TYPE_CUBEMAP) {
+ if (texture->type == RS::TEXTURE_TYPE_2D || texture->type == RS::TEXTURE_TYPE_CUBEMAP) {
if (compressed) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
@@ -816,7 +816,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
} else {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ if (texture->flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING) {
glTexSubImage2D(blit_target, i, 0, 0, w, h, format, type, &read[ofs]);
} else {
glTexImage2D(blit_target, i, internal_format, w, h, 0, format, type, &read[ofs]);
@@ -854,7 +854,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
texture->stored_cube_sides |= (1 << p_layer);
- if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && mipmaps == 1 && !texture->ignore_mipmaps && (texture->type != VS::TEXTURE_TYPE_CUBEMAP || texture->stored_cube_sides == (1 << 6) - 1)) {
+ if ((texture->flags & RS::TEXTURE_FLAG_MIPMAPS) && mipmaps == 1 && !texture->ignore_mipmaps && (texture->type != RS::TEXTURE_TYPE_CUBEMAP || texture->stored_cube_sides == (1 << 6) - 1)) {
//generate mipmaps if they were requested and the image does not contain them
glGenerateMipmap(texture->target);
}
@@ -875,7 +875,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
ERR_FAIL_COND_V(!texture->active, Ref<Image>());
ERR_FAIL_COND_V(texture->data_size == 0 && !texture->render_target, Ref<Image>());
- if (texture->type == VS::TEXTURE_TYPE_CUBEMAP && p_layer < 6 && p_layer >= 0 && !texture->images[p_layer].is_null()) {
+ if (texture->type == RS::TEXTURE_TYPE_CUBEMAP && p_layer < 6 && p_layer >= 0 && !texture->images[p_layer].is_null()) {
return texture->images[p_layer];
}
@@ -997,16 +997,16 @@ void RasterizerStorageGLES2::texture_set_flags(RID p_texture, uint32_t p_flags)
Texture *texture = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!texture);
- bool had_mipmaps = texture->flags & VS::TEXTURE_FLAG_MIPMAPS;
+ bool had_mipmaps = texture->flags & RS::TEXTURE_FLAG_MIPMAPS;
texture->flags = p_flags;
glActiveTexture(GL_TEXTURE0);
glBindTexture(texture->target, texture->tex_id);
- if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
+ if (((texture->flags & RS::TEXTURE_FLAG_REPEAT) || (texture->flags & RS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
- if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) {
+ if (texture->flags & RS::TEXTURE_FLAG_MIRRORED_REPEAT) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
} else {
@@ -1019,21 +1019,21 @@ void RasterizerStorageGLES2::texture_set_flags(RID p_texture, uint32_t p_flags)
glTexParameterf(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
- if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) {
+ if ((texture->flags & RS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) {
if (!had_mipmaps && texture->mipmaps == 1) {
glGenerateMipmap(texture->target);
}
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, config.use_fast_texture_filter ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR);
} else {
- if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ if (texture->flags & RS::TEXTURE_FLAG_FILTER) {
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
}
- if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ if (texture->flags & RS::TEXTURE_FLAG_FILTER) {
glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Filtering
@@ -1059,10 +1059,10 @@ Image::Format RasterizerStorageGLES2::texture_get_format(RID p_texture) const {
return texture->format;
}
-VisualServer::TextureType RasterizerStorageGLES2::texture_get_type(RID p_texture) const {
+RenderingServer::TextureType RasterizerStorageGLES2::texture_get_type(RID p_texture) const {
Texture *texture = texture_owner.getornull(p_texture);
- ERR_FAIL_COND_V(!texture, VS::TEXTURE_TYPE_2D);
+ ERR_FAIL_COND_V(!texture, RS::TEXTURE_TYPE_2D);
return texture->type;
}
@@ -1135,7 +1135,7 @@ String RasterizerStorageGLES2::texture_get_path(RID p_texture) const {
return texture->path;
}
-void RasterizerStorageGLES2::texture_debug_usage(List<VS::TextureInfo> *r_info) {
+void RasterizerStorageGLES2::texture_debug_usage(List<RS::TextureInfo> *r_info) {
List<RID> textures;
texture_owner.get_owned_list(&textures);
@@ -1144,7 +1144,7 @@ void RasterizerStorageGLES2::texture_debug_usage(List<VS::TextureInfo> *r_info)
Texture *t = texture_owner.getornull(E->get());
if (!t)
continue;
- VS::TextureInfo tinfo;
+ RS::TextureInfo tinfo;
tinfo.path = t->path;
tinfo.format = t->format;
tinfo.width = t->alloc_width;
@@ -1200,7 +1200,7 @@ void RasterizerStorageGLES2::texture_set_force_redraw_if_visible(RID p_texture,
texture->redraw_if_visible = p_enable;
}
-void RasterizerStorageGLES2::texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+void RasterizerStorageGLES2::texture_set_detect_3d_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata) {
Texture *texture = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!texture);
@@ -1208,7 +1208,7 @@ void RasterizerStorageGLES2::texture_set_detect_3d_callback(RID p_texture, Visua
texture->detect_3d_ud = p_userdata;
}
-void RasterizerStorageGLES2::texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+void RasterizerStorageGLES2::texture_set_detect_srgb_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata) {
Texture *texture = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!texture);
@@ -1216,7 +1216,7 @@ void RasterizerStorageGLES2::texture_set_detect_srgb_callback(RID p_texture, Vis
texture->detect_srgb_ud = p_userdata;
}
-void RasterizerStorageGLES2::texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+void RasterizerStorageGLES2::texture_set_detect_normal_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata) {
Texture *texture = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!texture);
@@ -1265,7 +1265,7 @@ void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
glDisableVertexAttribArray(i);
}
}
@@ -1397,7 +1397,7 @@ void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
RID RasterizerStorageGLES2::shader_create() {
Shader *shader = memnew(Shader);
- shader->mode = VS::SHADER_SPATIAL;
+ shader->mode = RS::SHADER_SPATIAL;
shader->shader = &scene->state.scene_shader;
RID rid = shader_owner.make_rid(shader);
_shader_make_dirty(shader);
@@ -1421,16 +1421,16 @@ void RasterizerStorageGLES2::shader_set_code(RID p_shader, const String &p_code)
shader->code = p_code;
String mode_string = ShaderLanguage::get_shader_type(p_code);
- VS::ShaderMode mode;
+ RS::ShaderMode mode;
if (mode_string == "canvas_item")
- mode = VS::SHADER_CANVAS_ITEM;
+ mode = RS::SHADER_CANVAS_ITEM;
else if (mode_string == "particles")
- mode = VS::SHADER_PARTICLES;
+ mode = RS::SHADER_PARTICLES;
else if (mode_string == "sky")
- mode = VS::SHADER_SKY;
+ mode = RS::SHADER_SKY;
else
- mode = VS::SHADER_SPATIAL;
+ mode = RS::SHADER_SPATIAL;
if (shader->custom_code_id && mode != shader->mode) {
shader->shader->free_custom_shader(shader->custom_code_id);
@@ -1440,10 +1440,10 @@ void RasterizerStorageGLES2::shader_set_code(RID p_shader, const String &p_code)
shader->mode = mode;
// TODO handle all shader types
- if (mode == VS::SHADER_CANVAS_ITEM) {
+ if (mode == RS::SHADER_CANVAS_ITEM) {
shader->shader = &canvas->state.canvas_shader;
- } else if (mode == VS::SHADER_SPATIAL) {
+ } else if (mode == RS::SHADER_SPATIAL) {
shader->shader = &scene->state.scene_shader;
} else {
return;
@@ -1481,7 +1481,7 @@ void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
switch (p_shader->mode) {
- case VS::SHADER_CANVAS_ITEM: {
+ case RS::SHADER_CANVAS_ITEM: {
p_shader->canvas_item.light_mode = Shader::CanvasItem::LIGHT_MODE_NORMAL;
p_shader->canvas_item.blend_mode = Shader::CanvasItem::BLEND_MODE_MIX;
@@ -1508,7 +1508,7 @@ void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
actions->uniforms = &p_shader->uniforms;
} break;
- case VS::SHADER_SPATIAL: {
+ case RS::SHADER_SPATIAL: {
p_shader->spatial.blend_mode = Shader::Spatial::BLEND_MODE_MIX;
p_shader->spatial.depth_draw_mode = Shader::Spatial::DEPTH_DRAW_OPAQUE;
p_shader->spatial.cull_mode = Shader::Spatial::CULL_MODE_BACK;
@@ -1949,8 +1949,8 @@ void RasterizerStorageGLES2::material_remove_instance_owner(RID p_material, Rast
}
void RasterizerStorageGLES2::material_set_render_priority(RID p_material, int priority) {
- ERR_FAIL_COND(priority < VS::MATERIAL_RENDER_PRIORITY_MIN);
- ERR_FAIL_COND(priority > VS::MATERIAL_RENDER_PRIORITY_MAX);
+ ERR_FAIL_COND(priority < RS::MATERIAL_RENDER_PRIORITY_MIN);
+ ERR_FAIL_COND(priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
Material *material = material_owner.getornull(p_material);
ERR_FAIL_COND(!material);
@@ -1975,7 +1975,7 @@ void RasterizerStorageGLES2::_update_material(Material *p_material) {
bool can_cast_shadow = false;
bool is_animated = false;
- if (p_material->shader && p_material->shader->mode == VS::SHADER_SPATIAL) {
+ if (p_material->shader && p_material->shader->mode == RS::SHADER_SPATIAL) {
if (p_material->shader->spatial.blend_mode == Shader::Spatial::BLEND_MODE_MIX &&
(!p_material->shader->spatial.uses_alpha || p_material->shader->spatial.depth_draw_mode == Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) {
@@ -2087,14 +2087,14 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
uint32_t p_format = format;
- static int src_size[VS::ARRAY_MAX];
- static int dst_size[VS::ARRAY_MAX];
- static int to_convert[VS::ARRAY_MAX];
+ static int src_size[RS::ARRAY_MAX];
+ static int dst_size[RS::ARRAY_MAX];
+ static int to_convert[RS::ARRAY_MAX];
int src_stride = 0;
int dst_stride = 0;
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
to_convert[i] = 0;
if (!(p_format & (1 << i))) {
@@ -2105,11 +2105,11 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
- if (p_format & VS::ARRAY_COMPRESS_VERTEX) {
+ if (p_format & RS::ARRAY_COMPRESS_VERTEX) {
- if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (p_format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
src_size[i] = 4;
dst_size[i] = 8;
to_convert[i] = 2;
@@ -2119,10 +2119,10 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
to_convert[i] = 3;
}
- format &= ~VS::ARRAY_COMPRESS_VERTEX;
+ format &= ~RS::ARRAY_COMPRESS_VERTEX;
} else {
- if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (p_format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
src_size[i] = 8;
dst_size[i] = 8;
} else {
@@ -2132,9 +2132,9 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
- if (p_format & VS::ARRAY_COMPRESS_NORMAL) {
+ if (p_format & RS::ARRAY_COMPRESS_NORMAL) {
src_size[i] = 4;
dst_size[i] = 4;
} else {
@@ -2143,9 +2143,9 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
}
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
- if (p_format & VS::ARRAY_COMPRESS_TANGENT) {
+ if (p_format & RS::ARRAY_COMPRESS_TANGENT) {
src_size[i] = 4;
dst_size[i] = 4;
} else {
@@ -2154,9 +2154,9 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
- if (p_format & VS::ARRAY_COMPRESS_COLOR) {
+ if (p_format & RS::ARRAY_COMPRESS_COLOR) {
src_size[i] = 4;
dst_size[i] = 4;
} else {
@@ -2165,12 +2165,12 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
- if (p_format & VS::ARRAY_COMPRESS_TEX_UV) {
+ if (p_format & RS::ARRAY_COMPRESS_TEX_UV) {
src_size[i] = 4;
to_convert[i] = 2;
- format &= ~VS::ARRAY_COMPRESS_TEX_UV;
+ format &= ~RS::ARRAY_COMPRESS_TEX_UV;
} else {
src_size[i] = 8;
}
@@ -2178,12 +2178,12 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
dst_size[i] = 8;
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
- if (p_format & VS::ARRAY_COMPRESS_TEX_UV2) {
+ if (p_format & RS::ARRAY_COMPRESS_TEX_UV2) {
src_size[i] = 4;
to_convert[i] = 2;
- format &= ~VS::ARRAY_COMPRESS_TEX_UV2;
+ format &= ~RS::ARRAY_COMPRESS_TEX_UV2;
} else {
src_size[i] = 8;
}
@@ -2191,9 +2191,9 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
dst_size[i] = 8;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
- if (p_format & VS::ARRAY_FLAG_USE_16_BIT_BONES) {
+ if (p_format & RS::ARRAY_FLAG_USE_16_BIT_BONES) {
src_size[i] = 8;
dst_size[i] = 8;
} else {
@@ -2202,9 +2202,9 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
}
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
- if (p_format & VS::ARRAY_COMPRESS_WEIGHTS) {
+ if (p_format & RS::ARRAY_COMPRESS_WEIGHTS) {
src_size[i] = 8;
dst_size[i] = 8;
} else {
@@ -2213,7 +2213,7 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
}
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
src_size[i] = 0;
dst_size[i] = 0;
@@ -2234,7 +2234,7 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
int src_offset = 0;
int dst_offset = 0;
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
if (src_size[i] == 0) {
continue; //no go
@@ -2272,27 +2272,27 @@ static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_
return ret;
}
-void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) {
+void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, RS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
- ERR_FAIL_COND(!(p_format & VS::ARRAY_FORMAT_VERTEX));
+ ERR_FAIL_COND(!(p_format & RS::ARRAY_FORMAT_VERTEX));
//must have index and bones, both.
{
- uint32_t bones_weight = VS::ARRAY_FORMAT_BONES | VS::ARRAY_FORMAT_WEIGHTS;
+ uint32_t bones_weight = RS::ARRAY_FORMAT_BONES | RS::ARRAY_FORMAT_WEIGHTS;
ERR_FAIL_COND_MSG((p_format & bones_weight) && (p_format & bones_weight) != bones_weight, "Array must have both bones and weights in format or none.");
}
//bool has_morph = p_blend_shapes.size();
- Surface::Attrib attribs[VS::ARRAY_MAX];
+ Surface::Attrib attribs[RS::ARRAY_MAX];
int stride = 0;
bool uses_half_float = false;
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
attribs[i].index = i;
@@ -2308,15 +2308,15 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
- if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (p_format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
attribs[i].size = 2;
} else {
- attribs[i].size = (p_format & VS::ARRAY_COMPRESS_VERTEX) ? 4 : 3;
+ attribs[i].size = (p_format & RS::ARRAY_COMPRESS_VERTEX) ? 4 : 3;
}
- if (p_format & VS::ARRAY_COMPRESS_VERTEX) {
+ if (p_format & RS::ARRAY_COMPRESS_VERTEX) {
attribs[i].type = _GL_HALF_FLOAT_OES;
stride += attribs[i].size * 2;
uses_half_float = true;
@@ -2328,11 +2328,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
attribs[i].normalized = GL_FALSE;
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
attribs[i].size = 3;
- if (p_format & VS::ARRAY_COMPRESS_NORMAL) {
+ if (p_format & RS::ARRAY_COMPRESS_NORMAL) {
attribs[i].type = GL_BYTE;
stride += 4; //pad extra byte
attribs[i].normalized = GL_TRUE;
@@ -2343,11 +2343,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
attribs[i].size = 4;
- if (p_format & VS::ARRAY_COMPRESS_TANGENT) {
+ if (p_format & RS::ARRAY_COMPRESS_TANGENT) {
attribs[i].type = GL_BYTE;
stride += 4;
attribs[i].normalized = GL_TRUE;
@@ -2358,11 +2358,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
attribs[i].size = 4;
- if (p_format & VS::ARRAY_COMPRESS_COLOR) {
+ if (p_format & RS::ARRAY_COMPRESS_COLOR) {
attribs[i].type = GL_UNSIGNED_BYTE;
stride += 4;
attribs[i].normalized = GL_TRUE;
@@ -2373,11 +2373,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
attribs[i].size = 2;
- if (p_format & VS::ARRAY_COMPRESS_TEX_UV) {
+ if (p_format & RS::ARRAY_COMPRESS_TEX_UV) {
attribs[i].type = _GL_HALF_FLOAT_OES;
stride += 4;
uses_half_float = true;
@@ -2389,11 +2389,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
attribs[i].normalized = GL_FALSE;
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
attribs[i].size = 2;
- if (p_format & VS::ARRAY_COMPRESS_TEX_UV2) {
+ if (p_format & RS::ARRAY_COMPRESS_TEX_UV2) {
attribs[i].type = _GL_HALF_FLOAT_OES;
stride += 4;
uses_half_float = true;
@@ -2404,11 +2404,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
attribs[i].normalized = GL_FALSE;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
attribs[i].size = 4;
- if (p_format & VS::ARRAY_FLAG_USE_16_BIT_BONES) {
+ if (p_format & RS::ARRAY_FLAG_USE_16_BIT_BONES) {
attribs[i].type = GL_UNSIGNED_SHORT;
stride += 8;
} else {
@@ -2420,11 +2420,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
attribs[i].integer = true;
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
attribs[i].size = 4;
- if (p_format & VS::ARRAY_COMPRESS_WEIGHTS) {
+ if (p_format & RS::ARRAY_COMPRESS_WEIGHTS) {
attribs[i].type = GL_UNSIGNED_SHORT;
stride += 8;
@@ -2436,7 +2436,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
attribs[i].size = 1;
@@ -2454,7 +2454,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
}
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
attribs[i].stride = stride;
}
@@ -2500,9 +2500,9 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
return; //do not go any further, above function used unpacked stuff will be used instead.
}
- if (p_format & VS::ARRAY_FORMAT_INDEX) {
+ if (p_format & RS::ARRAY_FORMAT_INDEX) {
- index_array_size = attribs[VS::ARRAY_INDEX].stride * p_index_count;
+ index_array_size = attribs[RS::ARRAY_INDEX].stride * p_index_count;
}
ERR_FAIL_COND(p_index_array.size() != index_array_size);
@@ -2545,7 +2545,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
surface->skeleton_bone_used.write[i] = !(surface->skeleton_bone_aabb[i].size.x < 0 || surface->skeleton_bone_aabb[i].size.y < 0 || surface->skeleton_bone_aabb[i].size.z < 0);
}
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
surface->attribs[i] = attribs[i];
}
@@ -2555,11 +2555,11 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
glGenBuffers(1, &surface->vertex_id);
glBindBuffer(GL_ARRAY_BUFFER, surface->vertex_id);
- glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), (p_format & VS::ARRAY_FLAG_USE_DYNAMIC_UPDATE) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), (p_format & RS::ARRAY_FLAG_USE_DYNAMIC_UPDATE) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
- if (p_format & VS::ARRAY_FORMAT_INDEX) {
+ if (p_format & RS::ARRAY_FORMAT_INDEX) {
const uint8_t *ir = p_index_array.ptr();
glGenBuffers(1, &surface->index_id);
@@ -2616,16 +2616,16 @@ int RasterizerStorageGLES2::mesh_get_blend_shape_count(RID p_mesh) const {
return mesh->blend_shape_count;
}
-void RasterizerStorageGLES2::mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) {
+void RasterizerStorageGLES2::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
mesh->blend_shape_mode = p_mode;
}
-VS::BlendShapeMode RasterizerStorageGLES2::mesh_get_blend_shape_mode(RID p_mesh) const {
+RS::BlendShapeMode RasterizerStorageGLES2::mesh_get_blend_shape_mode(RID p_mesh) const {
const Mesh *mesh = mesh_owner.getornull(p_mesh);
- ERR_FAIL_COND_V(!mesh, VS::BLEND_SHAPE_MODE_NORMALIZED);
+ ERR_FAIL_COND_V(!mesh, RS::BLEND_SHAPE_MODE_NORMALIZED);
return mesh->blend_shape_mode;
}
@@ -2723,10 +2723,10 @@ uint32_t RasterizerStorageGLES2::mesh_surface_get_format(RID p_mesh, int p_surfa
return mesh->surfaces[p_surface]->format;
}
-VS::PrimitiveType RasterizerStorageGLES2::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const {
+RS::PrimitiveType RasterizerStorageGLES2::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const {
const Mesh *mesh = mesh_owner.getornull(p_mesh);
- ERR_FAIL_COND_V(!mesh, VS::PRIMITIVE_MAX);
- ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), VS::PRIMITIVE_MAX);
+ ERR_FAIL_COND_V(!mesh, RS::PRIMITIVE_MAX);
+ ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), RS::PRIMITIVE_MAX);
return mesh->surfaces[p_surface]->primitive;
}
@@ -2827,7 +2827,7 @@ AABB RasterizerStorageGLES2::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
for (int i = 0; i < mesh->surfaces.size(); i++) {
AABB laabb;
- if ((mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->skeleton_bone_aabb.size()) {
+ if ((mesh->surfaces[i]->format & RS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->skeleton_bone_aabb.size()) {
int bs = mesh->surfaces[i]->skeleton_bone_aabb.size();
const AABB *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr();
@@ -2939,7 +2939,7 @@ RID RasterizerStorageGLES2::multimesh_create() {
return multimesh_owner.make_rid(multimesh);
}
-void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format, VS::MultimeshCustomDataFormat p_data) {
+void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, RS::MultimeshColorFormat p_color_format, RS::MultimeshCustomDataFormat p_data) {
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
@@ -2957,23 +2957,23 @@ void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances
multimesh->data.resize(0);
}
- if (multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D) {
+ if (multimesh->transform_format == RS::MULTIMESH_TRANSFORM_2D) {
multimesh->xform_floats = 8;
} else {
multimesh->xform_floats = 12;
}
- if (multimesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ if (multimesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
multimesh->color_floats = 1;
- } else if (multimesh->color_format == VS::MULTIMESH_COLOR_FLOAT) {
+ } else if (multimesh->color_format == RS::MULTIMESH_COLOR_FLOAT) {
multimesh->color_floats = 4;
} else {
multimesh->color_floats = 0;
}
- if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
+ if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
multimesh->custom_data_floats = 1;
- } else if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_FLOAT) {
+ } else if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_FLOAT) {
multimesh->custom_data_floats = 4;
} else {
multimesh->custom_data_floats = 0;
@@ -2987,7 +2987,7 @@ void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances
int color_from = 0;
int custom_data_from = 0;
- if (multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D) {
+ if (multimesh->transform_format == RS::MULTIMESH_TRANSFORM_2D) {
multimesh->data.write[i + 0] = 1.0;
multimesh->data.write[i + 1] = 0.0;
multimesh->data.write[i + 2] = 0.0;
@@ -3015,7 +3015,7 @@ void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances
custom_data_from = 12;
}
- if (multimesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ if (multimesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
union {
uint32_t colu;
float colf;
@@ -3024,7 +3024,7 @@ void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances
cu.colu = 0xFFFFFFFF;
multimesh->data.write[i + color_from + 0] = cu.colf;
custom_data_from = color_from + 1;
- } else if (multimesh->color_format == VS::MULTIMESH_COLOR_FLOAT) {
+ } else if (multimesh->color_format == RS::MULTIMESH_COLOR_FLOAT) {
multimesh->data.write[i + color_from + 0] = 1.0;
multimesh->data.write[i + color_from + 1] = 1.0;
multimesh->data.write[i + color_from + 2] = 1.0;
@@ -3032,7 +3032,7 @@ void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances
custom_data_from = color_from + 4;
}
- if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
+ if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
union {
uint32_t colu;
float colf;
@@ -3040,7 +3040,7 @@ void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances
cu.colu = 0;
multimesh->data.write[i + custom_data_from + 0] = cu.colf;
- } else if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_FLOAT) {
+ } else if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_FLOAT) {
multimesh->data.write[i + custom_data_from + 0] = 0.0;
multimesh->data.write[i + custom_data_from + 1] = 0.0;
multimesh->data.write[i + custom_data_from + 2] = 0.0;
@@ -3094,7 +3094,7 @@ void RasterizerStorageGLES2::multimesh_instance_set_transform(RID p_multimesh, i
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
ERR_FAIL_INDEX(p_index, multimesh->size);
- ERR_FAIL_COND(multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D);
+ ERR_FAIL_COND(multimesh->transform_format == RS::MULTIMESH_TRANSFORM_2D);
int stride = multimesh->color_floats + multimesh->custom_data_floats + multimesh->xform_floats;
@@ -3125,7 +3125,7 @@ void RasterizerStorageGLES2::multimesh_instance_set_transform_2d(RID p_multimesh
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
ERR_FAIL_INDEX(p_index, multimesh->size);
- ERR_FAIL_COND(multimesh->transform_format == VS::MULTIMESH_TRANSFORM_3D);
+ ERR_FAIL_COND(multimesh->transform_format == RS::MULTIMESH_TRANSFORM_3D);
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index];
@@ -3151,13 +3151,13 @@ void RasterizerStorageGLES2::multimesh_instance_set_color(RID p_multimesh, int p
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
ERR_FAIL_INDEX(p_index, multimesh->size);
- ERR_FAIL_COND(multimesh->color_format == VS::MULTIMESH_COLOR_NONE);
- ERR_FAIL_INDEX(multimesh->color_format, VS::MULTIMESH_COLOR_MAX);
+ ERR_FAIL_COND(multimesh->color_format == RS::MULTIMESH_COLOR_NONE);
+ ERR_FAIL_INDEX(multimesh->color_format, RS::MULTIMESH_COLOR_MAX);
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index + multimesh->xform_floats];
- if (multimesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ if (multimesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
uint8_t *data8 = (uint8_t *)dataptr;
data8[0] = CLAMP(p_color.r * 255.0, 0, 255);
@@ -3165,7 +3165,7 @@ void RasterizerStorageGLES2::multimesh_instance_set_color(RID p_multimesh, int p
data8[2] = CLAMP(p_color.b * 255.0, 0, 255);
data8[3] = CLAMP(p_color.a * 255.0, 0, 255);
- } else if (multimesh->color_format == VS::MULTIMESH_COLOR_FLOAT) {
+ } else if (multimesh->color_format == RS::MULTIMESH_COLOR_FLOAT) {
dataptr[0] = p_color.r;
dataptr[1] = p_color.g;
dataptr[2] = p_color.b;
@@ -3184,13 +3184,13 @@ void RasterizerStorageGLES2::multimesh_instance_set_custom_data(RID p_multimesh,
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
ERR_FAIL_INDEX(p_index, multimesh->size);
- ERR_FAIL_COND(multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_NONE);
- ERR_FAIL_INDEX(multimesh->custom_data_format, VS::MULTIMESH_CUSTOM_DATA_MAX);
+ ERR_FAIL_COND(multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_NONE);
+ ERR_FAIL_INDEX(multimesh->custom_data_format, RS::MULTIMESH_CUSTOM_DATA_MAX);
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index + multimesh->xform_floats + multimesh->color_floats];
- if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
+ if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
uint8_t *data8 = (uint8_t *)dataptr;
data8[0] = CLAMP(p_custom_data.r * 255.0, 0, 255);
@@ -3198,7 +3198,7 @@ void RasterizerStorageGLES2::multimesh_instance_set_custom_data(RID p_multimesh,
data8[2] = CLAMP(p_custom_data.b * 255.0, 0, 255);
data8[3] = CLAMP(p_custom_data.a * 255.0, 0, 255);
- } else if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_FLOAT) {
+ } else if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_FLOAT) {
dataptr[0] = p_custom_data.r;
dataptr[1] = p_custom_data.g;
dataptr[2] = p_custom_data.b;
@@ -3224,7 +3224,7 @@ Transform RasterizerStorageGLES2::multimesh_instance_get_transform(RID p_multime
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND_V(!multimesh, Transform());
ERR_FAIL_INDEX_V(p_index, multimesh->size, Transform());
- ERR_FAIL_COND_V(multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D, Transform());
+ ERR_FAIL_COND_V(multimesh->transform_format == RS::MULTIMESH_TRANSFORM_2D, Transform());
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index];
@@ -3251,7 +3251,7 @@ Transform2D RasterizerStorageGLES2::multimesh_instance_get_transform_2d(RID p_mu
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND_V(!multimesh, Transform2D());
ERR_FAIL_INDEX_V(p_index, multimesh->size, Transform2D());
- ERR_FAIL_COND_V(multimesh->transform_format == VS::MULTIMESH_TRANSFORM_3D, Transform2D());
+ ERR_FAIL_COND_V(multimesh->transform_format == RS::MULTIMESH_TRANSFORM_3D, Transform2D());
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index];
@@ -3272,13 +3272,13 @@ Color RasterizerStorageGLES2::multimesh_instance_get_color(RID p_multimesh, int
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND_V(!multimesh, Color());
ERR_FAIL_INDEX_V(p_index, multimesh->size, Color());
- ERR_FAIL_COND_V(multimesh->color_format == VS::MULTIMESH_COLOR_NONE, Color());
- ERR_FAIL_INDEX_V(multimesh->color_format, VS::MULTIMESH_COLOR_MAX, Color());
+ ERR_FAIL_COND_V(multimesh->color_format == RS::MULTIMESH_COLOR_NONE, Color());
+ ERR_FAIL_INDEX_V(multimesh->color_format, RS::MULTIMESH_COLOR_MAX, Color());
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index + multimesh->xform_floats];
- if (multimesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
+ if (multimesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
union {
uint32_t colu;
float colf;
@@ -3288,7 +3288,7 @@ Color RasterizerStorageGLES2::multimesh_instance_get_color(RID p_multimesh, int
return Color::hex(BSWAP32(cu.colu));
- } else if (multimesh->color_format == VS::MULTIMESH_COLOR_FLOAT) {
+ } else if (multimesh->color_format == RS::MULTIMESH_COLOR_FLOAT) {
Color c;
c.r = dataptr[0];
c.g = dataptr[1];
@@ -3305,13 +3305,13 @@ Color RasterizerStorageGLES2::multimesh_instance_get_custom_data(RID p_multimesh
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND_V(!multimesh, Color());
ERR_FAIL_INDEX_V(p_index, multimesh->size, Color());
- ERR_FAIL_COND_V(multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_NONE, Color());
- ERR_FAIL_INDEX_V(multimesh->custom_data_format, VS::MULTIMESH_CUSTOM_DATA_MAX, Color());
+ ERR_FAIL_COND_V(multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_NONE, Color());
+ ERR_FAIL_INDEX_V(multimesh->custom_data_format, RS::MULTIMESH_CUSTOM_DATA_MAX, Color());
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index + multimesh->xform_floats + multimesh->color_floats];
- if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
+ if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
union {
uint32_t colu;
float colf;
@@ -3321,7 +3321,7 @@ Color RasterizerStorageGLES2::multimesh_instance_get_custom_data(RID p_multimesh
return Color::hex(BSWAP32(cu.colu));
- } else if (multimesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_FLOAT) {
+ } else if (multimesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_FLOAT) {
Color c;
c.r = dataptr[0];
c.g = dataptr[1];
@@ -3400,7 +3400,7 @@ void RasterizerStorageGLES2::update_dirty_multimeshes() {
AABB aabb;
- if (multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D) {
+ if (multimesh->transform_format == RS::MULTIMESH_TRANSFORM_2D) {
for (int i = 0; i < count; i += stride) {
@@ -3472,7 +3472,7 @@ RID RasterizerStorageGLES2::immediate_create() {
return immediate_owner.make_rid(im);
}
-void RasterizerStorageGLES2::immediate_begin(RID p_immediate, VS::PrimitiveType p_primitive, RID p_texture) {
+void RasterizerStorageGLES2::immediate_begin(RID p_immediate, RS::PrimitiveType p_primitive, RID p_texture) {
Immediate *im = immediate_owner.getornull(p_immediate);
ERR_FAIL_COND(!im);
ERR_FAIL_COND(im->building);
@@ -3499,17 +3499,17 @@ void RasterizerStorageGLES2::immediate_vertex(RID p_immediate, const Vector3 &p_
im->aabb.expand_to(p_vertex);
}
- if (im->mask & VS::ARRAY_FORMAT_NORMAL)
+ if (im->mask & RS::ARRAY_FORMAT_NORMAL)
c->normals.push_back(chunk_normal);
- if (im->mask & VS::ARRAY_FORMAT_TANGENT)
+ if (im->mask & RS::ARRAY_FORMAT_TANGENT)
c->tangents.push_back(chunk_tangent);
- if (im->mask & VS::ARRAY_FORMAT_COLOR)
+ if (im->mask & RS::ARRAY_FORMAT_COLOR)
c->colors.push_back(chunk_color);
- if (im->mask & VS::ARRAY_FORMAT_TEX_UV)
+ if (im->mask & RS::ARRAY_FORMAT_TEX_UV)
c->uvs.push_back(chunk_uv);
- if (im->mask & VS::ARRAY_FORMAT_TEX_UV2)
+ if (im->mask & RS::ARRAY_FORMAT_TEX_UV2)
c->uv2s.push_back(chunk_uv2);
- im->mask |= VS::ARRAY_FORMAT_VERTEX;
+ im->mask |= RS::ARRAY_FORMAT_VERTEX;
c->vertices.push_back(p_vertex);
}
@@ -3518,7 +3518,7 @@ void RasterizerStorageGLES2::immediate_normal(RID p_immediate, const Vector3 &p_
ERR_FAIL_COND(!im);
ERR_FAIL_COND(!im->building);
- im->mask |= VS::ARRAY_FORMAT_NORMAL;
+ im->mask |= RS::ARRAY_FORMAT_NORMAL;
chunk_normal = p_normal;
}
@@ -3527,7 +3527,7 @@ void RasterizerStorageGLES2::immediate_tangent(RID p_immediate, const Plane &p_t
ERR_FAIL_COND(!im);
ERR_FAIL_COND(!im->building);
- im->mask |= VS::ARRAY_FORMAT_TANGENT;
+ im->mask |= RS::ARRAY_FORMAT_TANGENT;
chunk_tangent = p_tangent;
}
@@ -3536,7 +3536,7 @@ void RasterizerStorageGLES2::immediate_color(RID p_immediate, const Color &p_col
ERR_FAIL_COND(!im);
ERR_FAIL_COND(!im->building);
- im->mask |= VS::ARRAY_FORMAT_COLOR;
+ im->mask |= RS::ARRAY_FORMAT_COLOR;
chunk_color = p_color;
}
@@ -3545,7 +3545,7 @@ void RasterizerStorageGLES2::immediate_uv(RID p_immediate, const Vector2 &tex_uv
ERR_FAIL_COND(!im);
ERR_FAIL_COND(!im->building);
- im->mask |= VS::ARRAY_FORMAT_TEX_UV;
+ im->mask |= RS::ARRAY_FORMAT_TEX_UV;
chunk_uv = tex_uv;
}
@@ -3554,7 +3554,7 @@ void RasterizerStorageGLES2::immediate_uv2(RID p_immediate, const Vector2 &tex_u
ERR_FAIL_COND(!im);
ERR_FAIL_COND(!im->building);
- im->mask |= VS::ARRAY_FORMAT_TEX_UV2;
+ im->mask |= RS::ARRAY_FORMAT_TEX_UV2;
chunk_uv2 = tex_uv;
}
@@ -3812,34 +3812,34 @@ void RasterizerStorageGLES2::update_dirty_skeletons() {
/* Light API */
-RID RasterizerStorageGLES2::light_create(VS::LightType p_type) {
+RID RasterizerStorageGLES2::light_create(RS::LightType p_type) {
Light *light = memnew(Light);
light->type = p_type;
- light->param[VS::LIGHT_PARAM_ENERGY] = 1.0;
- light->param[VS::LIGHT_PARAM_INDIRECT_ENERGY] = 1.0;
- light->param[VS::LIGHT_PARAM_SPECULAR] = 0.5;
- light->param[VS::LIGHT_PARAM_RANGE] = 1.0;
- light->param[VS::LIGHT_PARAM_SPOT_ANGLE] = 45;
- light->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] = 45;
- light->param[VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE] = 0;
- light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET] = 0.1;
- light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET] = 0.3;
- light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET] = 0.6;
- light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] = 0.1;
- light->param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE] = 0.1;
+ light->param[RS::LIGHT_PARAM_ENERGY] = 1.0;
+ light->param[RS::LIGHT_PARAM_INDIRECT_ENERGY] = 1.0;
+ light->param[RS::LIGHT_PARAM_SPECULAR] = 0.5;
+ light->param[RS::LIGHT_PARAM_RANGE] = 1.0;
+ light->param[RS::LIGHT_PARAM_SPOT_ANGLE] = 45;
+ light->param[RS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] = 45;
+ light->param[RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE] = 0;
+ light->param[RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET] = 0.1;
+ light->param[RS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET] = 0.3;
+ light->param[RS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET] = 0.6;
+ light->param[RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] = 0.1;
+ light->param[RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE] = 0.1;
light->color = Color(1, 1, 1, 1);
light->shadow = false;
light->negative = false;
light->cull_mask = 0xFFFFFFFF;
- light->directional_shadow_mode = VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
- light->omni_shadow_mode = VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
- light->omni_shadow_detail = VS::LIGHT_OMNI_SHADOW_DETAIL_VERTICAL;
+ light->directional_shadow_mode = RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
+ light->omni_shadow_mode = RS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
+ light->omni_shadow_detail = RS::LIGHT_OMNI_SHADOW_DETAIL_VERTICAL;
light->directional_blend_splits = false;
- light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
+ light->directional_range_mode = RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
light->reverse_cull = false;
light->use_gi = true;
light->version = 0;
@@ -3854,20 +3854,20 @@ void RasterizerStorageGLES2::light_set_color(RID p_light, const Color &p_color)
light->color = p_color;
}
-void RasterizerStorageGLES2::light_set_param(RID p_light, VS::LightParam p_param, float p_value) {
+void RasterizerStorageGLES2::light_set_param(RID p_light, RS::LightParam p_param, float p_value) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
- ERR_FAIL_INDEX(p_param, VS::LIGHT_PARAM_MAX);
+ ERR_FAIL_INDEX(p_param, RS::LIGHT_PARAM_MAX);
switch (p_param) {
- case VS::LIGHT_PARAM_RANGE:
- case VS::LIGHT_PARAM_SPOT_ANGLE:
- case VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE:
- case VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET:
- case VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET:
- case VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET:
- case VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS:
- case VS::LIGHT_PARAM_SHADOW_BIAS: {
+ case RS::LIGHT_PARAM_RANGE:
+ case RS::LIGHT_PARAM_SPOT_ANGLE:
+ case RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE:
+ case RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET:
+ case RS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET:
+ case RS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET:
+ case RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS:
+ case RS::LIGHT_PARAM_SHADOW_BIAS: {
light->version++;
light->instance_change_notify(true, false);
} break;
@@ -3939,7 +3939,7 @@ void RasterizerStorageGLES2::light_set_use_gi(RID p_light, bool p_enabled) {
light->instance_change_notify(true, false);
}
-void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
+void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3949,14 +3949,14 @@ void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOm
light->instance_change_notify(true, false);
}
-VS::LightOmniShadowMode RasterizerStorageGLES2::light_omni_get_shadow_mode(RID p_light) {
+RS::LightOmniShadowMode RasterizerStorageGLES2::light_omni_get_shadow_mode(RID p_light) {
Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_OMNI_SHADOW_CUBE);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_OMNI_SHADOW_CUBE);
return light->omni_shadow_mode;
}
-void RasterizerStorageGLES2::light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {
+void RasterizerStorageGLES2::light_omni_set_shadow_detail(RID p_light, RS::LightOmniShadowDetail p_detail) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3966,7 +3966,7 @@ void RasterizerStorageGLES2::light_omni_set_shadow_detail(RID p_light, VS::Light
light->instance_change_notify(true, false);
}
-void RasterizerStorageGLES2::light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) {
+void RasterizerStorageGLES2::light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3992,37 +3992,37 @@ bool RasterizerStorageGLES2::light_directional_get_blend_splits(RID p_light) con
return light->directional_blend_splits;
}
-VS::LightDirectionalShadowMode RasterizerStorageGLES2::light_directional_get_shadow_mode(RID p_light) {
+RS::LightDirectionalShadowMode RasterizerStorageGLES2::light_directional_get_shadow_mode(RID p_light) {
Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL);
return light->directional_shadow_mode;
}
-void RasterizerStorageGLES2::light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) {
+void RasterizerStorageGLES2::light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
light->directional_range_mode = p_range_mode;
}
-VS::LightDirectionalShadowDepthRangeMode RasterizerStorageGLES2::light_directional_get_shadow_depth_range_mode(RID p_light) const {
+RS::LightDirectionalShadowDepthRangeMode RasterizerStorageGLES2::light_directional_get_shadow_depth_range_mode(RID p_light) const {
Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE);
return light->directional_range_mode;
}
-VS::LightType RasterizerStorageGLES2::light_get_type(RID p_light) const {
+RS::LightType RasterizerStorageGLES2::light_get_type(RID p_light) const {
Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
return light->type;
}
-float RasterizerStorageGLES2::light_get_param(RID p_light, VS::LightParam p_param) {
+float RasterizerStorageGLES2::light_get_param(RID p_light, RS::LightParam p_param) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND_V(!light, 0.0);
- ERR_FAIL_INDEX_V(p_param, VS::LIGHT_PARAM_MAX, 0.0);
+ ERR_FAIL_INDEX_V(p_param, RS::LIGHT_PARAM_MAX, 0.0);
return light->param[p_param];
}
@@ -4061,18 +4061,18 @@ AABB RasterizerStorageGLES2::light_get_aabb(RID p_light) const {
switch (light->type) {
- case VS::LIGHT_SPOT: {
- float len = light->param[VS::LIGHT_PARAM_RANGE];
- float size = Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE])) * len;
+ case RS::LIGHT_SPOT: {
+ float len = light->param[RS::LIGHT_PARAM_RANGE];
+ float size = Math::tan(Math::deg2rad(light->param[RS::LIGHT_PARAM_SPOT_ANGLE])) * len;
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
};
- case VS::LIGHT_OMNI: {
- float r = light->param[VS::LIGHT_PARAM_RANGE];
+ case RS::LIGHT_OMNI: {
+ float r = light->param[RS::LIGHT_PARAM_RANGE];
return AABB(-Vector3(r, r, r), Vector3(r, r, r) * 2);
};
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
return AABB();
};
}
@@ -4097,13 +4097,13 @@ RID RasterizerStorageGLES2::reflection_probe_create() {
reflection_probe->box_projection = false;
reflection_probe->enable_shadows = false;
reflection_probe->cull_mask = (1 << 20) - 1;
- reflection_probe->update_mode = VS::REFLECTION_PROBE_UPDATE_ONCE;
+ reflection_probe->update_mode = RS::REFLECTION_PROBE_UPDATE_ONCE;
reflection_probe->resolution = 128;
return reflection_probe_owner.make_rid(reflection_probe);
}
-void RasterizerStorageGLES2::reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) {
+void RasterizerStorageGLES2::reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) {
ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe);
ERR_FAIL_COND(!reflection_probe);
@@ -4220,10 +4220,10 @@ AABB RasterizerStorageGLES2::reflection_probe_get_aabb(RID p_probe) const {
return aabb;
}
-VS::ReflectionProbeUpdateMode RasterizerStorageGLES2::reflection_probe_get_update_mode(RID p_probe) const {
+RS::ReflectionProbeUpdateMode RasterizerStorageGLES2::reflection_probe_get_update_mode(RID p_probe) const {
const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe);
- ERR_FAIL_COND_V(!reflection_probe, VS::REFLECTION_PROBE_UPDATE_ALWAYS);
+ ERR_FAIL_COND_V(!reflection_probe, RS::REFLECTION_PROBE_UPDATE_ALWAYS);
return reflection_probe->update_mode;
}
@@ -4518,7 +4518,7 @@ void RasterizerStorageGLES2::particles_set_fractional_delta(RID p_particles, boo
void RasterizerStorageGLES2::particles_set_process_material(RID p_particles, RID p_material) {
}
-void RasterizerStorageGLES2::particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) {
+void RasterizerStorageGLES2::particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order) {
}
void RasterizerStorageGLES2::particles_set_draw_passes(RID p_particles, int p_passes) {
@@ -4581,35 +4581,35 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
Instantiable *inst = NULL;
switch (p_instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
inst = mesh_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
inst = multimesh_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
inst = immediate_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- /*case VS::INSTANCE_PARTICLES: {
+ /*case RS::INSTANCE_PARTICLES: {
inst = particles_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;*/
- case VS::INSTANCE_REFLECTION_PROBE: {
+ case RS::INSTANCE_REFLECTION_PROBE: {
inst = reflection_probe_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- case VS::INSTANCE_LIGHT: {
+ case RS::INSTANCE_LIGHT: {
inst = light_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- /*case VS::INSTANCE_GI_PROBE: {
+ /*case RS::INSTANCE_GI_PROBE: {
inst = gi_probe_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;*/
- case VS::INSTANCE_LIGHTMAP_CAPTURE: {
+ case RS::INSTANCE_LIGHTMAP_CAPTURE: {
inst = lightmap_capture_data_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
@@ -4626,35 +4626,35 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
Instantiable *inst = NULL;
switch (p_instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
inst = mesh_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
inst = multimesh_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
inst = immediate_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- /*case VS::INSTANCE_PARTICLES: {
+ /*case RS::INSTANCE_PARTICLES: {
inst = particles_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;*/
- case VS::INSTANCE_REFLECTION_PROBE: {
+ case RS::INSTANCE_REFLECTION_PROBE: {
inst = reflection_probe_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- case VS::INSTANCE_LIGHT: {
+ case RS::INSTANCE_LIGHT: {
inst = light_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
- /*case VS::INSTANCE_GI_PROBE: {
+ /*case RS::INSTANCE_GI_PROBE: {
inst = gi_probe_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break; */
- case VS::INSTANCE_LIGHTMAP_CAPTURE: {
+ case RS::INSTANCE_LIGHTMAP_CAPTURE: {
inst = lightmap_capture_data_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
@@ -4723,7 +4723,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
- if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ if (texture->flags & RS::TEXTURE_FLAG_FILTER) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -4805,7 +4805,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
/* For MSAA */
#ifndef JAVASCRIPT_ENABLED
- if (rt->msaa >= VS::VIEWPORT_MSAA_2X && rt->msaa <= VS::VIEWPORT_MSAA_16X && config.multisample_supported) {
+ if (rt->msaa >= RS::VIEWPORT_MSAA_2X && rt->msaa <= RS::VIEWPORT_MSAA_16X && config.multisample_supported) {
rt->multisample_active = true;
@@ -5134,7 +5134,7 @@ RID RasterizerStorageGLES2::render_target_create() {
Texture *t = memnew(Texture);
- t->type = VS::TEXTURE_TYPE_2D;
+ t->type = RS::TEXTURE_TYPE_2D;
t->flags = 0;
t->width = 0;
t->height = 0;
@@ -5235,7 +5235,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
// allocate a texture
t = memnew(Texture);
- t->type = VS::TEXTURE_TYPE_2D;
+ t->type = RS::TEXTURE_TYPE_2D;
t->flags = 0;
t->width = 0;
t->height = 0;
@@ -5278,7 +5278,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
// Switch our texture on our frame buffer
#if ANDROID_ENABLED
- if (rt->msaa >= VS::VIEWPORT_MSAA_EXT_2X && rt->msaa <= VS::VIEWPORT_MSAA_EXT_4X) {
+ if (rt->msaa >= RS::VIEWPORT_MSAA_EXT_2X && rt->msaa <= RS::VIEWPORT_MSAA_EXT_4X) {
// This code only applies to the Oculus Go and Oculus Quest. Due to the the tiled nature
// of the GPU we can do a single render pass by rendering directly into our texture chains
// texture and apply MSAA as we render.
@@ -5287,7 +5287,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
// the normal MSAA modes need to be used to enable our two pass approach
static const int msaa_value[] = { 2, 4 };
- int msaa = msaa_value[rt->msaa - VS::VIEWPORT_MSAA_EXT_2X];
+ int msaa = msaa_value[rt->msaa - RS::VIEWPORT_MSAA_EXT_2X];
if (rt->external.depth == 0) {
// create a multisample depth buffer, we're not reusing Godots because Godot's didn't get created..
@@ -5370,7 +5370,7 @@ void RasterizerStorageGLES2::render_target_set_as_unused(RID p_render_target) {
rt->used_in_frame = false;
}
-void RasterizerStorageGLES2::render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa) {
+void RasterizerStorageGLES2::render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa) {
RenderTarget *rt = render_target_owner.getornull(p_render_target);
ERR_FAIL_COND(!rt);
@@ -5544,22 +5544,22 @@ void RasterizerStorageGLES2::canvas_light_occluder_set_polylines(RID p_occluder,
}
}
-VS::InstanceType RasterizerStorageGLES2::get_base_type(RID p_rid) const {
+RS::InstanceType RasterizerStorageGLES2::get_base_type(RID p_rid) const {
if (mesh_owner.owns(p_rid)) {
- return VS::INSTANCE_MESH;
+ return RS::INSTANCE_MESH;
} else if (light_owner.owns(p_rid)) {
- return VS::INSTANCE_LIGHT;
+ return RS::INSTANCE_LIGHT;
} else if (multimesh_owner.owns(p_rid)) {
- return VS::INSTANCE_MULTIMESH;
+ return RS::INSTANCE_MULTIMESH;
} else if (immediate_owner.owns(p_rid)) {
- return VS::INSTANCE_IMMEDIATE;
+ return RS::INSTANCE_IMMEDIATE;
} else if (reflection_probe_owner.owns(p_rid)) {
- return VS::INSTANCE_REFLECTION_PROBE;
+ return RS::INSTANCE_REFLECTION_PROBE;
} else if (lightmap_capture_data_owner.owns(p_rid)) {
- return VS::INSTANCE_LIGHTMAP_CAPTURE;
+ return RS::INSTANCE_LIGHTMAP_CAPTURE;
} else {
- return VS::INSTANCE_NONE;
+ return RS::INSTANCE_NONE;
}
}
@@ -5710,7 +5710,7 @@ bool RasterizerStorageGLES2::free(RID p_rid) {
}
}
- multimesh_allocate(p_rid, 0, VS::MULTIMESH_TRANSFORM_3D, VS::MULTIMESH_COLOR_NONE);
+ multimesh_allocate(p_rid, 0, RS::MULTIMESH_TRANSFORM_3D, RS::MULTIMESH_COLOR_NONE);
update_dirty_multimeshes();
@@ -5817,25 +5817,25 @@ void RasterizerStorageGLES2::render_info_end_capture() {
info.snap.vertices_count = info.render.vertices_count - info.snap.vertices_count;
}
-int RasterizerStorageGLES2::get_captured_render_info(VS::RenderInfo p_info) {
+int RasterizerStorageGLES2::get_captured_render_info(RS::RenderInfo p_info) {
switch (p_info) {
- case VS::INFO_OBJECTS_IN_FRAME: {
+ case RS::INFO_OBJECTS_IN_FRAME: {
return info.snap.object_count;
} break;
- case VS::INFO_VERTICES_IN_FRAME: {
+ case RS::INFO_VERTICES_IN_FRAME: {
return info.snap.vertices_count;
} break;
- case VS::INFO_MATERIAL_CHANGES_IN_FRAME: {
+ case RS::INFO_MATERIAL_CHANGES_IN_FRAME: {
return info.snap.material_switch_count;
} break;
- case VS::INFO_SHADER_CHANGES_IN_FRAME: {
+ case RS::INFO_SHADER_CHANGES_IN_FRAME: {
return info.snap.shader_rebind_count;
} break;
- case VS::INFO_SURFACE_CHANGES_IN_FRAME: {
+ case RS::INFO_SURFACE_CHANGES_IN_FRAME: {
return info.snap.surface_switch_count;
} break;
- case VS::INFO_DRAW_CALLS_IN_FRAME: {
+ case RS::INFO_DRAW_CALLS_IN_FRAME: {
return info.snap.draw_call_count;
} break;
default: {
@@ -5844,27 +5844,27 @@ int RasterizerStorageGLES2::get_captured_render_info(VS::RenderInfo p_info) {
}
}
-int RasterizerStorageGLES2::get_render_info(VS::RenderInfo p_info) {
+int RasterizerStorageGLES2::get_render_info(RS::RenderInfo p_info) {
switch (p_info) {
- case VS::INFO_OBJECTS_IN_FRAME:
+ case RS::INFO_OBJECTS_IN_FRAME:
return info.render_final.object_count;
- case VS::INFO_VERTICES_IN_FRAME:
+ case RS::INFO_VERTICES_IN_FRAME:
return info.render_final.vertices_count;
- case VS::INFO_MATERIAL_CHANGES_IN_FRAME:
+ case RS::INFO_MATERIAL_CHANGES_IN_FRAME:
return info.render_final.material_switch_count;
- case VS::INFO_SHADER_CHANGES_IN_FRAME:
+ case RS::INFO_SHADER_CHANGES_IN_FRAME:
return info.render_final.shader_rebind_count;
- case VS::INFO_SURFACE_CHANGES_IN_FRAME:
+ case RS::INFO_SURFACE_CHANGES_IN_FRAME:
return info.render_final.surface_switch_count;
- case VS::INFO_DRAW_CALLS_IN_FRAME:
+ case RS::INFO_DRAW_CALLS_IN_FRAME:
return info.render_final.draw_call_count;
- case VS::INFO_USAGE_VIDEO_MEM_TOTAL:
+ case RS::INFO_USAGE_VIDEO_MEM_TOTAL:
return 0; //no idea
- case VS::INFO_VIDEO_MEM_USED:
+ case RS::INFO_VIDEO_MEM_USED:
return info.vertex_mem + info.texture_mem;
- case VS::INFO_TEXTURE_MEM_USED:
+ case RS::INFO_TEXTURE_MEM_USED:
return info.texture_mem;
- case VS::INFO_VERTEX_MEM_USED:
+ case RS::INFO_VERTEX_MEM_USED:
return info.vertex_mem;
default:
return 0; //no idea either
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 86965730e0..f8b8b824bd 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -32,8 +32,8 @@
#define RASTERIZERSTORAGEGLES2_H
#include "core/self_list.h"
-#include "servers/visual/rasterizer.h"
-#include "servers/visual/shader_language.h"
+#include "servers/rendering/rasterizer.h"
+#include "servers/rendering/shader_language.h"
#include "shader_compiler_gles2.h"
#include "shader_gles2.h"
@@ -249,7 +249,7 @@ public:
int width, height, depth;
int alloc_width, alloc_height;
Image::Format format;
- VS::TextureType type;
+ RS::TextureType type;
GLenum target;
GLenum gl_format_cache;
@@ -279,13 +279,13 @@ public:
bool redraw_if_visible;
- VisualServer::TextureDetectCallback detect_3d;
+ RenderingServer::TextureDetectCallback detect_3d;
void *detect_3d_ud;
- VisualServer::TextureDetectCallback detect_srgb;
+ RenderingServer::TextureDetectCallback detect_srgb;
void *detect_srgb_ud;
- VisualServer::TextureDetectCallback detect_normal;
+ RenderingServer::TextureDetectCallback detect_normal;
void *detect_normal_ud;
Texture() :
@@ -296,7 +296,7 @@ public:
alloc_width(0),
alloc_height(0),
format(Image::FORMAT_L8),
- type(VS::TEXTURE_TYPE_2D),
+ type(RS::TEXTURE_TYPE_2D),
target(0),
data_size(0),
total_data_size(0),
@@ -345,14 +345,14 @@ public:
Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, Image::Format &r_real_format, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool p_force_decompress) const;
virtual RID texture_create();
- virtual void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, VS::TextureType p_type, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT);
+ virtual void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, RS::TextureType p_type, uint32_t p_flags = RS::TEXTURE_FLAGS_DEFAULT);
virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, int p_layer = 0);
virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_layer = 0);
virtual Ref<Image> texture_get_data(RID p_texture, int p_layer = 0) const;
virtual void texture_set_flags(RID p_texture, uint32_t p_flags);
virtual uint32_t texture_get_flags(RID p_texture) const;
virtual Image::Format texture_get_format(RID p_texture) const;
- virtual VS::TextureType texture_get_type(RID p_texture) const;
+ virtual RS::TextureType texture_get_type(RID p_texture) const;
virtual uint32_t texture_get_texid(RID p_texture) const;
virtual uint32_t texture_get_width(RID p_texture) const;
virtual uint32_t texture_get_height(RID p_texture) const;
@@ -365,7 +365,7 @@ public:
virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable);
- virtual void texture_debug_usage(List<VS::TextureInfo> *r_info);
+ virtual void texture_debug_usage(List<RS::TextureInfo> *r_info);
virtual RID texture_create_radiance_cubemap(RID p_source, int p_resolution = -1) const;
@@ -374,9 +374,9 @@ public:
virtual void texture_set_proxy(RID p_texture, RID p_proxy);
virtual Size2 texture_size_with_proxy(RID p_texture) const;
- virtual void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
- virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
- virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_3d_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_srgb_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_normal_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata);
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable);
@@ -402,7 +402,7 @@ public:
RID self;
- VS::ShaderMode mode;
+ RS::ShaderMode mode;
ShaderGLES2 *shader;
String code;
SelfList<Material>::List materials;
@@ -617,7 +617,7 @@ public:
uint32_t offset;
};
- Attrib attribs[VS::ARRAY_MAX];
+ Attrib attribs[RS::ARRAY_MAX];
Mesh *mesh;
uint32_t format;
@@ -641,7 +641,7 @@ public:
int array_byte_size;
int index_array_byte_size;
- VS::PrimitiveType primitive;
+ RS::PrimitiveType primitive;
Vector<AABB> skeleton_bone_aabb;
Vector<bool> skeleton_bone_used;
@@ -660,7 +660,7 @@ public:
index_array_len(0),
array_byte_size(0),
index_array_byte_size(0),
- primitive(VS::PRIMITIVE_POINTS),
+ primitive(RS::PRIMITIVE_POINTS),
active(false),
total_data_size(0) {
}
@@ -675,7 +675,7 @@ public:
Vector<Surface *> surfaces;
int blend_shape_count;
- VS::BlendShapeMode blend_shape_mode;
+ RS::BlendShapeMode blend_shape_mode;
AABB custom_aabb;
@@ -694,7 +694,7 @@ public:
Mesh() :
blend_shape_count(0),
- blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED) {
+ blend_shape_mode(RS::BLEND_SHAPE_MODE_NORMALIZED) {
}
};
@@ -702,13 +702,13 @@ public:
virtual RID mesh_create();
- virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes = Vector<Vector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>());
+ virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, RS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes = Vector<Vector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>());
virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount);
virtual int mesh_get_blend_shape_count(RID p_mesh) const;
- virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode);
- virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
+ virtual void mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode);
+ virtual RS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data);
@@ -722,7 +722,7 @@ public:
virtual Vector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const;
virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const;
- virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
+ virtual RS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const;
virtual Vector<Vector<uint8_t>> mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const;
@@ -744,9 +744,9 @@ public:
RID mesh;
int size;
- VS::MultimeshTransformFormat transform_format;
- VS::MultimeshColorFormat color_format;
- VS::MultimeshCustomDataFormat custom_data_format;
+ RS::MultimeshTransformFormat transform_format;
+ RS::MultimeshColorFormat color_format;
+ RS::MultimeshCustomDataFormat custom_data_format;
Vector<float> data;
@@ -766,9 +766,9 @@ public:
MultiMesh() :
size(0),
- transform_format(VS::MULTIMESH_TRANSFORM_2D),
- color_format(VS::MULTIMESH_COLOR_NONE),
- custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE),
+ transform_format(RS::MULTIMESH_TRANSFORM_2D),
+ color_format(RS::MULTIMESH_COLOR_NONE),
+ custom_data_format(RS::MULTIMESH_CUSTOM_DATA_NONE),
update_list(this),
mesh_list(this),
visible_instances(-1),
@@ -786,7 +786,7 @@ public:
virtual RID multimesh_create();
- virtual void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format, VS::MultimeshCustomDataFormat p_data = VS::MULTIMESH_CUSTOM_DATA_NONE);
+ virtual void multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, RS::MultimeshColorFormat p_color_format, RS::MultimeshCustomDataFormat p_data = RS::MULTIMESH_CUSTOM_DATA_NONE);
virtual int multimesh_get_instance_count(RID p_multimesh) const;
virtual void multimesh_set_mesh(RID p_multimesh, RID p_mesh);
@@ -817,7 +817,7 @@ public:
struct Chunk {
RID texture;
- VS::PrimitiveType primitive;
+ RS::PrimitiveType primitive;
Vector<Vector3> vertices;
Vector<Vector3> normals;
Vector<Plane> tangents;
@@ -846,7 +846,7 @@ public:
mutable RID_PtrOwner<Immediate> immediate_owner;
virtual RID immediate_create();
- virtual void immediate_begin(RID p_immediate, VS::PrimitiveType p_primitive, RID p_texture = RID());
+ virtual void immediate_begin(RID p_immediate, RS::PrimitiveType p_primitive, RID p_texture = RID());
virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex);
virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal);
virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent);
@@ -906,8 +906,8 @@ public:
/* Light API */
struct Light : Instantiable {
- VS::LightType type;
- float param[VS::LIGHT_PARAM_MAX];
+ RS::LightType type;
+ float param[RS::LIGHT_PARAM_MAX];
Color color;
Color shadow_color;
@@ -921,11 +921,11 @@ public:
uint32_t cull_mask;
- VS::LightOmniShadowMode omni_shadow_mode;
- VS::LightOmniShadowDetail omni_shadow_detail;
+ RS::LightOmniShadowMode omni_shadow_mode;
+ RS::LightOmniShadowDetail omni_shadow_detail;
- VS::LightDirectionalShadowMode directional_shadow_mode;
- VS::LightDirectionalShadowDepthRangeMode directional_range_mode;
+ RS::LightDirectionalShadowMode directional_shadow_mode;
+ RS::LightDirectionalShadowDepthRangeMode directional_range_mode;
bool directional_blend_splits;
@@ -934,10 +934,10 @@ public:
mutable RID_PtrOwner<Light> light_owner;
- virtual RID light_create(VS::LightType p_type);
+ virtual RID light_create(RS::LightType p_type);
virtual void light_set_color(RID p_light, const Color &p_color);
- virtual void light_set_param(RID p_light, VS::LightParam p_param, float p_value);
+ virtual void light_set_param(RID p_light, RS::LightParam p_param, float p_value);
virtual void light_set_shadow(RID p_light, bool p_enabled);
virtual void light_set_shadow_color(RID p_light, const Color &p_color);
virtual void light_set_projector(RID p_light, RID p_texture);
@@ -946,23 +946,23 @@ public:
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
virtual void light_set_use_gi(RID p_light, bool p_enabled);
- virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
- virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
+ virtual void light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode);
+ virtual void light_omni_set_shadow_detail(RID p_light, RS::LightOmniShadowDetail p_detail);
- virtual void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode);
+ virtual void light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode);
virtual void light_directional_set_blend_splits(RID p_light, bool p_enable);
virtual bool light_directional_get_blend_splits(RID p_light) const;
- virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
- virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
+ virtual RS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
+ virtual RS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
- virtual void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode);
- virtual VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
+ virtual void light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode);
+ virtual RS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
virtual bool light_has_shadow(RID p_light) const;
- virtual VS::LightType light_get_type(RID p_light) const;
- virtual float light_get_param(RID p_light, VS::LightParam p_param);
+ virtual RS::LightType light_get_type(RID p_light) const;
+ virtual float light_get_param(RID p_light, RS::LightParam p_param);
virtual Color light_get_color(RID p_light);
virtual bool light_get_use_gi(RID p_light);
@@ -973,7 +973,7 @@ public:
struct ReflectionProbe : Instantiable {
- VS::ReflectionProbeUpdateMode update_mode;
+ RS::ReflectionProbeUpdateMode update_mode;
float intensity;
Color interior_ambient;
float interior_ambient_energy;
@@ -992,7 +992,7 @@ public:
virtual RID reflection_probe_create();
- virtual void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode);
+ virtual void reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode);
virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity);
virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient);
virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy);
@@ -1007,7 +1007,7 @@ public:
virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution);
virtual AABB reflection_probe_get_aabb(RID p_probe) const;
- virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
+ virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const;
virtual int reflection_probe_get_resolution(RID p_probe) const;
@@ -1111,7 +1111,7 @@ public:
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable);
virtual void particles_restart(RID p_particles);
- virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order);
+ virtual void particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order);
virtual void particles_set_draw_passes(RID p_particles, int p_passes);
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh);
@@ -1203,7 +1203,7 @@ public:
bool flags[RENDER_TARGET_FLAG_MAX];
bool used_in_frame;
- VS::ViewportMSAA msaa;
+ RS::ViewportMSAA msaa;
RID texture;
@@ -1223,7 +1223,7 @@ public:
width(0),
height(0),
used_in_frame(false),
- msaa(VS::VIEWPORT_MSAA_DISABLED),
+ msaa(RS::VIEWPORT_MSAA_DISABLED),
used_dof_blur_near(false),
mip_maps_allocated(false) {
for (int i = 0; i < RENDER_TARGET_FLAG_MAX; ++i) {
@@ -1247,7 +1247,7 @@ public:
virtual void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value);
virtual bool render_target_was_used(RID p_render_target);
virtual void render_target_set_as_unused(RID p_render_target);
- virtual void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa);
+ virtual void render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa);
/* CANVAS SHADOW */
@@ -1279,7 +1279,7 @@ public:
virtual RID canvas_light_occluder_create();
virtual void canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines);
- virtual VS::InstanceType get_base_type(RID p_rid) const;
+ virtual RS::InstanceType get_base_type(RID p_rid) const;
virtual bool free(RID p_rid);
@@ -1309,9 +1309,9 @@ public:
virtual void render_info_begin_capture();
virtual void render_info_end_capture();
- virtual int get_captured_render_info(VS::RenderInfo p_info);
+ virtual int get_captured_render_info(RS::RenderInfo p_info);
- virtual int get_render_info(VS::RenderInfo p_info);
+ virtual int get_render_info(RS::RenderInfo p_info);
virtual String get_video_adapter_name() const;
virtual String get_video_adapter_vendor() const;
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 620fcdbdca..d626263431 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -934,7 +934,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
return code.as_string();
}
-Error ShaderCompilerGLES2::compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
+Error ShaderCompilerGLES2::compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
Error err = parser.compile(p_code, ShaderTypes::get_singleton()->get_functions(p_mode), ShaderTypes::get_singleton()->get_modes(p_mode), ShaderTypes::get_singleton()->get_types());
@@ -975,210 +975,210 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
/** CANVAS ITEM SHADER **/
- actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
- actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
- actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
-
- actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
- actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
- actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] = "extra_matrix_instance";
- actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
- actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
- actions[VS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom";
-
- actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
- actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
- actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP"] = "normal_map";
- actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP_DEPTH"] = "normal_depth";
- actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture";
- actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size";
- actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture";
- actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv";
- actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture";
- actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size";
- actions[VS::SHADER_CANVAS_ITEM].renames["FRAGCOORD"] = "gl_FragCoord";
- actions[VS::SHADER_CANVAS_ITEM].renames["POINT_COORD"] = "gl_PointCoord";
-
- actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"] = "light_vec";
- actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"] = "light_height";
- actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"] = "light_color";
- actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"] = "light_uv";
- actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT"] = "light";
- actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"] = "shadow_color";
- actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_VEC"] = "shadow_vec";
-
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["COLOR"] = "#define COLOR_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
- actions[VS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_VEC"] = "#define SHADOW_VEC_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
+ actions[RS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
+ actions[RS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
+
+ actions[RS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
+ actions[RS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
+ actions[RS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] = "extra_matrix_instance";
+ actions[RS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
+ actions[RS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
+ actions[RS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom";
+
+ actions[RS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
+ actions[RS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
+ actions[RS::SHADER_CANVAS_ITEM].renames["NORMALMAP"] = "normal_map";
+ actions[RS::SHADER_CANVAS_ITEM].renames["NORMALMAP_DEPTH"] = "normal_depth";
+ actions[RS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture";
+ actions[RS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size";
+ actions[RS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture";
+ actions[RS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv";
+ actions[RS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture";
+ actions[RS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size";
+ actions[RS::SHADER_CANVAS_ITEM].renames["FRAGCOORD"] = "gl_FragCoord";
+ actions[RS::SHADER_CANVAS_ITEM].renames["POINT_COORD"] = "gl_PointCoord";
+
+ actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"] = "light_vec";
+ actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"] = "light_height";
+ actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"] = "light_color";
+ actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"] = "light_uv";
+ actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT"] = "light";
+ actions[RS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"] = "shadow_color";
+ actions[RS::SHADER_CANVAS_ITEM].renames["SHADOW_VEC"] = "shadow_vec";
+
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["COLOR"] = "#define COLOR_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+ actions[RS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_VEC"] = "#define SHADOW_VEC_USED\n";
// Ported from GLES3
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["sinh"] = "#define SINH_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["cosh"] = "#define COSH_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["tanh"] = "#define TANH_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["asinh"] = "#define ASINH_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["acosh"] = "#define ACOSH_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["atanh"] = "#define ATANH_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["round"] = "#define ROUND_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["inverse"] = "#define INVERSE_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["isinf"] = "#define IS_INF_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["isnan"] = "#define IS_NAN_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["trunc"] = "#define TRUNC_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["sinh"] = "#define SINH_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["cosh"] = "#define COSH_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["tanh"] = "#define TANH_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["asinh"] = "#define ASINH_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["acosh"] = "#define ACOSH_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["atanh"] = "#define ATANH_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["round"] = "#define ROUND_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["inverse"] = "#define INVERSE_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["isinf"] = "#define IS_INF_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["isnan"] = "#define IS_NAN_USED\n";
+ actions[RS::SHADER_CANVAS_ITEM].usage_defines["trunc"] = "#define TRUNC_USED\n";
/** SPATIAL SHADER **/
- actions[VS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
- actions[VS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
- actions[VS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
- actions[VS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
- actions[VS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "projection_inverse_matrix";
- actions[VS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
-
- actions[VS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
- actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
- actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
- actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
- actions[VS::SHADER_SPATIAL].renames["POSITION"] = "position";
- actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
- actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
- actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
- actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
+ actions[RS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
+ actions[RS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
+ actions[RS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
+ actions[RS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
+ actions[RS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "projection_inverse_matrix";
+ actions[RS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
+
+ actions[RS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
+ actions[RS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
+ actions[RS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
+ actions[RS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
+ actions[RS::SHADER_SPATIAL].renames["POSITION"] = "position";
+ actions[RS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
+ actions[RS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
+ actions[RS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
+ actions[RS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
// gl_InstanceID is not available in OpenGL ES 2.0
- actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";
+ actions[RS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";
//builtins
- actions[VS::SHADER_SPATIAL].renames["TIME"] = "time";
- actions[VS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
-
- actions[VS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
- actions[VS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
- actions[VS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
- actions[VS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
- actions[VS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
- actions[VS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
- actions[VS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
- actions[VS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
- actions[VS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
- actions[VS::SHADER_SPATIAL].renames["RIM"] = "rim";
- actions[VS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
- actions[VS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
- actions[VS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
- actions[VS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
- actions[VS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
- actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
- actions[VS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
- actions[VS::SHADER_SPATIAL].renames["AO"] = "ao";
- actions[VS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
- actions[VS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
- actions[VS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
- actions[VS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
- actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
- actions[VS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
- actions[VS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_texture";
+ actions[RS::SHADER_SPATIAL].renames["TIME"] = "time";
+ actions[RS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
+
+ actions[RS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
+ actions[RS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
+ actions[RS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
+ actions[RS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
+ actions[RS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
+ actions[RS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
+ actions[RS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
+ actions[RS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
+ actions[RS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
+ actions[RS::SHADER_SPATIAL].renames["RIM"] = "rim";
+ actions[RS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
+ actions[RS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
+ actions[RS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
+ actions[RS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
+ actions[RS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
+ actions[RS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
+ actions[RS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
+ actions[RS::SHADER_SPATIAL].renames["AO"] = "ao";
+ actions[RS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
+ actions[RS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
+ actions[RS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
+ actions[RS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
+ actions[RS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
+ actions[RS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
+ actions[RS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_texture";
// Defined in GLES3, but not available in GLES2
- //actions[VS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
- actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
- actions[VS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
+ //actions[RS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
+ actions[RS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
+ actions[RS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
//for light
- actions[VS::SHADER_SPATIAL].renames["VIEW"] = "view";
- actions[VS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
- actions[VS::SHADER_SPATIAL].renames["LIGHT"] = "light";
- actions[VS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
- actions[VS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
- actions[VS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
-
- actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
- actions[VS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
- actions[VS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
- actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
- actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
- actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
- actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
- actions[VS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
- actions[VS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
- actions[VS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
- actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
- actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
-
- actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
- actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["DEPTH_TEXTURE"] = "#define DEPTH_TEXTURE_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
-
- actions[VS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
- actions[VS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+ actions[RS::SHADER_SPATIAL].renames["VIEW"] = "view";
+ actions[RS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
+ actions[RS::SHADER_SPATIAL].renames["LIGHT"] = "light";
+ actions[RS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
+ actions[RS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
+ actions[RS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
+
+ actions[RS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
+ actions[RS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
+ actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
+ actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
+ actions[RS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
+ actions[RS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
+
+ actions[RS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["DEPTH_TEXTURE"] = "#define DEPTH_TEXTURE_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
+
+ actions[RS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
// Ported from GLES3
- actions[VS::SHADER_SPATIAL].usage_defines["sinh"] = "#define SINH_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["cosh"] = "#define COSH_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["tanh"] = "#define TANH_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["asinh"] = "#define ASINH_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["acosh"] = "#define ACOSH_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["atanh"] = "#define ATANH_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["round"] = "#define ROUND_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["inverse"] = "#define INVERSE_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["isinf"] = "#define IS_INF_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["isnan"] = "#define IS_NAN_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["trunc"] = "#define TRUNC_USED\n";
-
- actions[VS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["sinh"] = "#define SINH_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["cosh"] = "#define COSH_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["tanh"] = "#define TANH_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["asinh"] = "#define ASINH_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["acosh"] = "#define ACOSH_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["atanh"] = "#define ATANH_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["round"] = "#define ROUND_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["inverse"] = "#define INVERSE_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["isinf"] = "#define IS_INF_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["isnan"] = "#define IS_NAN_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["trunc"] = "#define TRUNC_USED\n";
+
+ actions[RS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
// Defined in GLES3, could be implemented in GLES2 too if there's a need for it
- //actions[VS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
+ //actions[RS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
// Defined in GLES3, might not be possible in GLES2 as gl_FrontFacing is not available
- //actions[VS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
- //actions[VS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
+ //actions[RS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
+ //actions[RS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
bool force_lambert = GLOBAL_GET("rendering/quality/shading/force_lambert_over_burley");
if (!force_lambert) {
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
}
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
bool force_blinn = GLOBAL_GET("rendering/quality/shading/force_blinn_over_ggx");
if (!force_blinn) {
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
} else {
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
}
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
// No defines for particle shaders in GLES2, there are no GPU particles
diff --git a/drivers/gles2/shader_compiler_gles2.h b/drivers/gles2/shader_compiler_gles2.h
index dd10a27c0d..757dcdd4f2 100644
--- a/drivers/gles2/shader_compiler_gles2.h
+++ b/drivers/gles2/shader_compiler_gles2.h
@@ -33,9 +33,9 @@
#include "core/pair.h"
#include "core/string_builder.h"
-#include "servers/visual/shader_language.h"
-#include "servers/visual/shader_types.h"
-#include "servers/visual_server.h"
+#include "servers/rendering/shader_language.h"
+#include "servers/rendering/shader_types.h"
+#include "servers/rendering_server.h"
class ShaderCompilerGLES2 {
public:
@@ -91,10 +91,10 @@ private:
Set<StringName> used_rmode_defines;
Set<StringName> internal_functions;
- DefaultIdentifierActions actions[VS::SHADER_MAX];
+ DefaultIdentifierActions actions[RS::SHADER_MAX];
public:
- Error compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
+ Error compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
ShaderCompilerGLES2();
};
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
index d5e8159479..54858becb6 100644
--- a/drivers/gles2/shader_gles2.h
+++ b/drivers/gles2/shader_gles2.h
@@ -44,7 +44,7 @@
#include "core/math/camera_matrix.h"
#include "core/pair.h"
#include "core/variant.h"
-#include "servers/visual/shader_language.h"
+#include "servers/rendering/shader_language.h"
#include <stdio.h>
diff --git a/drivers/gles2/shaders/blend_shape.glsl b/drivers/gles2/shaders/blend_shape.glsl
index a1e954e33d..0d0b3e24e4 100644
--- a/drivers/gles2/shaders/blend_shape.glsl
+++ b/drivers/gles2/shaders/blend_shape.glsl
@@ -2,7 +2,7 @@
[vertex]
/*
-from VisualServer:
+from RenderingServer:
ARRAY_VERTEX=0,
ARRAY_NORMAL=1,