summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-09-03 07:36:58 +0200
committerGitHub <noreply@github.com>2020-09-03 07:36:58 +0200
commit1956c7ad3367cba3ced34a6b933724cdb2adcaa7 (patch)
tree2d88d66f299437749b7afcfb73758c708a7d96c5
parent4a5138bb99f5a063035c1d34de26af050bef5dc3 (diff)
parent4e2d6997455cf9741108fbf32e59b012793e7aff (diff)
Merge pull request #41533 from Chaosus/vs_fix_specular
Fix specular render_mode for visual shaders
-rw-r--r--scene/resources/visual_shader.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index e4851ad9f7..6841ecb61f 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1367,10 +1367,19 @@ void VisualShader::_update_shader() const {
{
//fill render mode enums
int idx = 0;
+ bool specular = false;
while (render_mode_enums[idx].string) {
if (shader_mode == render_mode_enums[idx].mode) {
- if (modes.has(render_mode_enums[idx].string)) {
- int which = modes[render_mode_enums[idx].string];
+ if (shader_mode == Shader::MODE_SPATIAL) {
+ if (String(render_mode_enums[idx].string) == "specular") {
+ specular = true;
+ }
+ }
+ if (modes.has(render_mode_enums[idx].string) || specular) {
+ int which = 0;
+ if (modes.has(render_mode_enums[idx].string)) {
+ which = modes[render_mode_enums[idx].string];
+ }
int count = 0;
for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)).size(); i++) {
String mode = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode))[i];