summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/resource.cpp29
-rw-r--r--core/resource.h1
-rw-r--r--doc/classes/WindowDialog.xml2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp5
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp11
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp20
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h22
-rw-r--r--editor/translations/README.md7
-rw-r--r--scene/main/scene_tree.cpp4
-rw-r--r--scene/main/viewport.cpp10
-rw-r--r--scene/main/viewport.h2
-rw-r--r--scene/register_scene_types.cpp1
-rw-r--r--scene/resources/material.cpp6
-rw-r--r--scene/resources/material.h3
-rw-r--r--scene/resources/packed_scene.cpp6
-rw-r--r--scene/resources/texture.cpp69
-rw-r--r--scene/resources/texture.h27
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/visual_server_raster.h2
-rw-r--r--servers/visual/visual_server_wrap_mt.h2
-rw-r--r--servers/visual_server.h2
21 files changed, 215 insertions, 18 deletions
diff --git a/core/resource.cpp b/core/resource.cpp
index 78e20bada4..d339eb78ad 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -184,6 +184,35 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
return Ref<Resource>(r);
}
+void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache) {
+
+ print_line("configure for local: " + get_class());
+ List<PropertyInfo> plist;
+ get_property_list(&plist);
+
+ local_scene = p_for_scene;
+
+ for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
+
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+ Variant p = get(E->get().name);
+ if (p.get_type() == Variant::OBJECT) {
+
+ RES sr = p;
+ if (sr.is_valid()) {
+
+ if (sr->is_local_to_scene()) {
+ if (!remap_cache.has(sr)) {
+ sr->configure_for_local_scene(p_for_scene, remap_cache);
+ remap_cache[sr] = sr;
+ }
+ }
+ }
+ }
+ }
+}
+
Ref<Resource> Resource::duplicate(bool p_subresources) const {
List<PropertyInfo> plist;
diff --git a/core/resource.h b/core/resource.h
index 7dc3b67291..19714a68d1 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -108,6 +108,7 @@ public:
virtual Ref<Resource> duplicate(bool p_subresources = false) const;
Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache);
+ void configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache);
void set_local_to_scene(bool p_enable);
bool is_local_to_scene() const;
diff --git a/doc/classes/WindowDialog.xml b/doc/classes/WindowDialog.xml
index 41aa71b782..5bdcfe238d 100644
--- a/doc/classes/WindowDialog.xml
+++ b/doc/classes/WindowDialog.xml
@@ -21,8 +21,10 @@
</methods>
<members>
<member name="resizable" type="bool" setter="set_resizable" getter="get_resizable">
+ If [code]true[/code] the user can resize the window. Default value: [code]false[/code].
</member>
<member name="window_title" type="String" setter="set_title" getter="get_title">
+ The text displayed in the window's title bar. Default value: "Save a File".
</member>
</members>
<constants>
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 5b3e43fc43..0839f930c9 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -208,6 +208,8 @@ RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(con
} else {
+ texture = texture->get_ptr();
+
if (texture->render_target)
texture->render_target->used_in_frame = true;
@@ -243,6 +245,7 @@ RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(con
} else {
+ normal_map = normal_map->get_ptr();
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, normal_map->tex_id);
state.current_normal = p_normal_map;
@@ -1115,6 +1118,8 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
continue;
}
+ t = t->get_ptr();
+
if (storage->config.srgb_decode_supported && t->using_srgb) {
//no srgb in 2D
glTexParameteri(t->target, _TEXTURE_SRGB_DECODE_EXT, _SKIP_DECODE_EXT);
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 0f8f98b021..3031b70f70 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1235,6 +1235,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
} else {
+ t = t->get_ptr(); //resolve for proxies
#ifdef TOOLS_ENABLED
if (t->detect_3d) {
t->detect_3d(t->detect_3d_ud);
@@ -2164,7 +2165,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::USE_OPAQUE_PREPASS, false);
}
-void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass,bool p_shadow_pass) {
+void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass, bool p_shadow_pass) {
RasterizerStorageGLES3::Material *m = NULL;
RID m_src = p_instance->material_override.is_valid() ? p_instance->material_override : (p_material >= 0 ? p_instance->materials[p_material] : p_geometry->material);
@@ -2238,11 +2239,11 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::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 != RasterizerStorageGLES3::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) {
- p_material = storage->material_owner.getptr( !p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material_twosided : default_material_twosided);
+ p_material = storage->material_owner.getptr(!p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material_twosided : default_material_twosided);
no_cull = true;
mirror = false;
} else {
- p_material = storage->material_owner.getptr( !p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material : default_material);
+ p_material = storage->material_owner.getptr(!p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material : default_material);
}
}
@@ -2289,10 +2290,8 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
} else {
e->sort_key |= uint64_t(e->instance->depth_layer) << RenderList::SORT_KEY_OPAQUE_DEPTH_LAYER_SHIFT;
e->sort_key |= uint64_t(e->material->index) << RenderList::SORT_KEY_MATERIAL_INDEX_SHIFT;
-
}
-
/*
if (e->geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE)
e->sort_flags|=RenderList::SORT_FLAG_INSTANCING;
@@ -4090,7 +4089,6 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
_setup_lights(p_light_cull_result, p_light_cull_count, p_cam_transform.affine_inverse(), p_cam_projection, p_shadow_atlas);
_setup_reflections(p_reflection_probe_cull_result, p_reflection_probe_cull_count, p_cam_transform.affine_inverse(), p_cam_projection, p_reflection_atlas, env);
-
bool use_mrt = false;
render_list.clear();
@@ -4774,7 +4772,6 @@ void RasterizerSceneGLES3::initialize() {
default_worldcoord_material_twosided = storage->material_create();
storage->shader_set_code(default_worldcoord_shader_twosided, "shader_type spatial; render_mode cull_disabled,world_vertex_coords;\n");
storage->material_set_shader(default_worldcoord_material_twosided, default_worldcoord_shader_twosided);
-
}
{
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 7e3d21adbb..cba9f08537 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1232,6 +1232,25 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source, int p_
return texture_owner.make_rid(ctex);
}
+void RasterizerStorageGLES3::texture_set_proxy(RID p_texture, RID p_proxy) {
+
+ Texture *texture = texture_owner.get(p_texture);
+ ERR_FAIL_COND(!texture);
+
+ if (texture->proxy) {
+ texture->proxy->proxy_owners.erase(texture);
+ texture->proxy = NULL;
+ }
+
+ if (p_proxy.is_valid()) {
+ Texture *proxy = texture_owner.get(p_proxy);
+ ERR_FAIL_COND(!proxy);
+ ERR_FAIL_COND(proxy == texture);
+ proxy->proxy_owners.insert(texture);
+ texture->proxy = proxy;
+ }
+}
+
RID RasterizerStorageGLES3::sky_create() {
Sky *sky = memnew(Sky);
@@ -1617,7 +1636,6 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
shaders.actions_scene.render_mode_values["cull_back"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_BACK);
shaders.actions_scene.render_mode_values["cull_disabled"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_DISABLED);
-
shaders.actions_scene.render_mode_flags["unshaded"] = &p_shader->spatial.unshaded;
shaders.actions_scene.render_mode_flags["depth_test_disable"] = &p_shader->spatial.no_depth_test;
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 7c86862425..d5efd5307c 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -242,6 +242,9 @@ public:
struct Texture : public RID_Data {
+ Texture *proxy;
+ Set<Texture *> proxy_owners;
+
String path;
uint32_t flags;
int width, height;
@@ -301,6 +304,15 @@ public:
detect_srgb_ud = NULL;
detect_normal = NULL;
detect_normal_ud = NULL;
+ proxy = NULL;
+ }
+
+ _ALWAYS_INLINE_ Texture *get_ptr() {
+ if (proxy) {
+ return proxy; //->get_ptr(); only one level of indirection, else not inlining possible.
+ } else {
+ return this;
+ }
}
~Texture() {
@@ -309,6 +321,14 @@ public:
glDeleteTextures(1, &tex_id);
}
+
+ for (Set<Texture *>::Element *E = proxy_owners.front(); E; E = E->next()) {
+ E->get()->proxy = NULL;
+ }
+
+ if (proxy) {
+ proxy->proxy_owners.erase(this);
+ }
}
};
@@ -343,6 +363,8 @@ public:
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_proxy(RID p_texture, RID p_proxy);
+
/* SKY API */
struct Sky : public RID_Data {
diff --git a/editor/translations/README.md b/editor/translations/README.md
index 351bc9e2d1..f30f4e61fb 100644
--- a/editor/translations/README.md
+++ b/editor/translations/README.md
@@ -16,5 +16,8 @@ Link if you missed it: https://hosted.weblate.org/projects/godot-engine/godot
## Adding new languages
If you want to translate for a language which is not featured yet on Weblate,
-open an issue on this repo to ask that the language is added, or contact
-Akien/@akien-mga directly on IRC (#godotengine channel on Freenode).
+you can add it (when logged in) by clicking the "Start new translation"
+button at the bottom of the page.
+
+Alternatively, you can use this
+[direct link](https://hosted.weblate.org/new-lang/godot-engine/godot/).
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index f74bf161f0..5ee286c2d5 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -418,12 +418,12 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
if (!input_handled) {
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_vp_unhandled_input", ev); //special one for GUI, as controls use their own process check
- input_handled = true;
_flush_ugc();
+ // input_handled = true; - no reason to set this as handled
root_lock--;
//MessageQueue::get_singleton()->flush(); //flushing here causes UI and other places slowness
} else {
- input_handled = true;
+ // input_handled = true; - no reason to set this as handled
root_lock--;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 1fc2d4b16e..d864b0f763 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -69,6 +69,8 @@ void ViewportTexture::setup_local_to_scene() {
ERR_FAIL_COND(!vp);
vp->viewport_textures.insert(this);
+
+ VS::get_singleton()->texture_set_proxy(proxy, vp->texture_rid);
}
void ViewportTexture::set_viewport_path_in_scene(const NodePath &p_path) {
@@ -105,8 +107,8 @@ Size2 ViewportTexture::get_size() const {
}
RID ViewportTexture::get_rid() const {
- ERR_FAIL_COND_V(!vp, RID());
- return vp->texture_rid;
+ //ERR_FAIL_COND_V(!vp, RID());
+ return proxy;
}
bool ViewportTexture::has_alpha() const {
@@ -147,6 +149,7 @@ ViewportTexture::ViewportTexture() {
vp = NULL;
set_local_to_scene(true);
+ proxy = VS::get_singleton()->texture_create();
}
ViewportTexture::~ViewportTexture() {
@@ -154,6 +157,8 @@ ViewportTexture::~ViewportTexture() {
if (vp) {
vp->viewport_textures.erase(this);
}
+
+ VS::get_singleton()->free(proxy);
}
/////////////////////////////////////
@@ -2813,6 +2818,7 @@ Viewport::Viewport() {
default_texture.instance();
default_texture->vp = const_cast<Viewport *>(this);
viewport_textures.insert(default_texture.ptr());
+ VS::get_singleton()->texture_set_proxy(default_texture->proxy, texture_rid);
//internal_listener = SpatialSoundServer::get_singleton()->listener_create();
audio_listener = false;
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 6bbd4b26b5..0835e3f69a 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -59,6 +59,8 @@ class ViewportTexture : public Texture {
friend class Viewport;
Viewport *vp;
+ RID proxy;
+
protected:
static void _bind_methods();
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index c99bc3c9ef..d6557f508e 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -529,6 +529,7 @@ void register_scene_types() {
ClassDB::register_class<LargeTexture>();
ClassDB::register_class<CurveTexture>();
ClassDB::register_class<GradientTexture>();
+ ClassDB::register_class<ProxyTexture>();
ClassDB::register_class<CubeMap>();
ClassDB::register_class<Animation>();
ClassDB::register_virtual_class<Font>();
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 79f642a09b..15710f4c14 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -689,6 +689,10 @@ void SpatialMaterial::_update_shader() {
}
}
+ if (flags[FLAG_ALBEDO_TEXTURE_FORCE_SRGB]) {
+ code += "\talbedo_tex.rgb = mix(pow((albedo_tex.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)),vec3(2.4)),albedo_tex.rgb.rgb * (1.0 / 12.92),lessThan(albedo_tex.rgb,vec3(0.04045)));\n";
+ }
+
if (flags[FLAG_ALBEDO_FROM_VERTEX_COLOR]) {
code += "\talbedo_tex *= COLOR;\n";
}
@@ -1833,6 +1837,7 @@ void SpatialMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_use_point_size"), "set_flag", "get_flag", FLAG_USE_POINT_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_world_triplanar"), "set_flag", "get_flag", FLAG_TRIPLANAR_USE_WORLD);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_albedo_tex_force_srgb"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_FORCE_SRGB);
ADD_GROUP("Vertex Color", "vertex_color");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_use_as_albedo"), "set_flag", "get_flag", FLAG_ALBEDO_FROM_VERTEX_COLOR);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR);
@@ -2019,6 +2024,7 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(FLAG_AO_ON_UV2);
BIND_ENUM_CONSTANT(FLAG_USE_ALPHA_SCISSOR);
BIND_ENUM_CONSTANT(FLAG_TRIPLANAR_USE_WORLD);
+ BIND_ENUM_CONSTANT(FLAG_ALBEDO_TEXTURE_FORCE_SRGB);
BIND_ENUM_CONSTANT(FLAG_MAX);
BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 877d4dfd41..374ec853dc 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -181,6 +181,7 @@ public:
FLAG_TRIPLANAR_USE_WORLD,
FLAG_AO_ON_UV2,
FLAG_USE_ALPHA_SCISSOR,
+ FLAG_ALBEDO_TEXTURE_FORCE_SRGB,
FLAG_MAX
};
@@ -229,7 +230,7 @@ private:
uint64_t blend_mode : 2;
uint64_t depth_draw_mode : 2;
uint64_t cull_mode : 2;
- uint64_t flags : 12;
+ uint64_t flags : 13;
uint64_t detail_blend_mode : 2;
uint64_t diffuse_mode : 3;
uint64_t specular_mode : 2;
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 5d6f44dfef..06829089be 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -232,11 +232,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
Node *base = i == 0 ? node : ret_nodes[0];
if (p_edit_state == GEN_EDIT_STATE_MAIN) {
-
- res->local_scene = base;
- resources_local_to_scene[res] = res;
+ //for the main scene, use the resource as is
+ res->configure_for_local_scene(base, resources_local_to_scene);
} else {
+ //for instances, a copy must be made
Node *base = i == 0 ? node : ret_nodes[0];
Ref<Resource> local_dupe = res->duplicate_for_local_scene(base, resources_local_to_scene);
resources_local_to_scene[res] = local_dupe;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 162edd0d1c..987d6c5f6a 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1601,3 +1601,72 @@ int GradientTexture::get_width() const {
Ref<Image> GradientTexture::get_data() const {
return VisualServer::get_singleton()->texture_get_data(texture);
}
+
+//////////////////////////////////////
+
+void ProxyTexture::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_base", "base"), &ProxyTexture::set_base);
+ ClassDB::bind_method(D_METHOD("get_base"), &ProxyTexture::get_base);
+
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "base", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_base", "get_base");
+}
+
+void ProxyTexture::set_base(const Ref<Texture> &p_texture) {
+
+ base = p_texture;
+ if (base.is_valid()) {
+ VS::get_singleton()->texture_set_proxy(proxy, base->get_rid());
+ } else {
+ VS::get_singleton()->texture_set_proxy(proxy, RID());
+ }
+}
+
+Ref<Texture> ProxyTexture::get_base() const {
+
+ return base;
+}
+
+int ProxyTexture::get_width() const {
+
+ if (base.is_valid())
+ return base->get_width();
+ return 1;
+}
+int ProxyTexture::get_height() const {
+
+ if (base.is_valid())
+ return base->get_height();
+ return 1;
+}
+RID ProxyTexture::get_rid() const {
+
+ return proxy;
+}
+
+bool ProxyTexture::has_alpha() const {
+
+ if (base.is_valid())
+ return base->has_alpha();
+ return false;
+}
+
+void ProxyTexture::set_flags(uint32_t p_flags) {
+}
+
+uint32_t ProxyTexture::get_flags() const {
+
+ if (base.is_valid())
+ return base->get_flags();
+ return 0;
+}
+
+ProxyTexture::ProxyTexture() {
+
+ proxy = VS::get_singleton()->texture_create();
+}
+
+ProxyTexture::~ProxyTexture() {
+
+ VS::get_singleton()->free(proxy);
+}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index ee54156647..76c0195ef9 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -493,4 +493,31 @@ public:
virtual ~GradientTexture();
};
+class ProxyTexture : public Texture {
+ GDCLASS(ProxyTexture, Texture)
+
+private:
+ RID proxy;
+ Ref<Texture> base;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_base(const Ref<Texture> &p_texture);
+ Ref<Texture> get_base() const;
+
+ virtual int get_width() const;
+ virtual int get_height() const;
+ virtual RID get_rid() const;
+
+ virtual bool has_alpha() const;
+
+ virtual void set_flags(uint32_t p_flags);
+ virtual uint32_t get_flags() const;
+
+ ProxyTexture();
+ ~ProxyTexture();
+};
+
#endif
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 2499551607..4bb34af241 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -193,6 +193,8 @@ public:
virtual void textures_keep_original(bool p_enable) = 0;
+ virtual void texture_set_proxy(RID p_proxy, RID p_base) = 0;
+
/* SKY API */
virtual RID sky_create() = 0;
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index f34951f452..91542625e0 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -168,6 +168,8 @@ public:
BIND1(textures_keep_original, bool)
+ BIND2(texture_set_proxy, RID, RID)
+
/* SKY API */
BIND0R(RID, sky_create)
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index d1069a410c..1c3b34d16f 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -100,6 +100,8 @@ public:
FUNC1(textures_keep_original, bool)
+ FUNC2(texture_set_proxy, RID, RID)
+
/* SKY API */
FUNCRID(sky)
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 9df389999a..350097c1b5 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -141,6 +141,8 @@ public:
virtual void textures_keep_original(bool p_enable) = 0;
+ virtual void texture_set_proxy(RID p_proxy, RID p_base) = 0;
+
/* SKY API */
virtual RID sky_create() = 0;