summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h6
3 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index f7253c6b5b..5447a17dcc 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1207,6 +1207,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
} break;
case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: {
tex = storage->resources.normal_tex;
+
} break;
default: {
tex = storage->resources.white_tex;
@@ -1220,6 +1221,13 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
t->detect_3d(t->detect_3d_ud);
}
#endif
+
+#ifdef TOOLS_ENABLED
+ if (t->detect_normal && texture_hints[i] == ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL) {
+ t->detect_normal(t->detect_normal_ud);
+ }
+#endif
+
if (storage->config.srgb_decode_supported) {
//if SRGB decode extension is present, simply switch the texture to whathever is needed
bool must_srgb = false;
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index ac2cbcbd54..0da9e38769 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1072,6 +1072,14 @@ void RasterizerStorageGLES3::texture_set_detect_srgb_callback(RID p_texture, Vis
texture->detect_srgb_ud = p_userdata;
}
+void RasterizerStorageGLES3::texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+ Texture *texture = texture_owner.get(p_texture);
+ ERR_FAIL_COND(!texture);
+
+ texture->detect_normal = p_callback;
+ texture->detect_normal_ud = p_userdata;
+}
+
RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source, int p_resolution) const {
Texture *texture = texture_owner.get(p_source);
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index e4bde96443..643554e55d 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -270,6 +270,9 @@ public:
VisualServer::TextureDetectCallback detect_srgb;
void *detect_srgb_ud;
+ VisualServer::TextureDetectCallback detect_normal;
+ void *detect_normal_ud;
+
Texture() {
using_srgb = false;
@@ -289,6 +292,8 @@ public:
detect_3d_ud = NULL;
detect_srgb = NULL;
detect_srgb_ud = NULL;
+ detect_normal = NULL;
+ detect_normal_ud = NULL;
}
~Texture() {
@@ -329,6 +334,7 @@ public:
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);
/* SKY API */