summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/shader_language.cpp25
-rw-r--r--servers/visual/shader_language.h4
-rw-r--r--servers/visual/shader_types.cpp7
3 files changed, 36 insertions, 0 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 357546e595..f6220250d9 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -183,7 +183,9 @@ const char * ShaderLanguage::token_names[TK_MAX]={
"HINT_WHITE_TEXTURE",
"HINT_BLACK_TEXTURE",
"HINT_NORMAL_TEXTURE",
+ "HINT_ANISO_TEXTURE",
"HINT_ALBEDO_TEXTURE",
+ "HINT_BLACK_ALBEDO_TEXTURE",
"HINT_COLOR",
"HINT_RANGE",
"CURSOR",
@@ -263,7 +265,9 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[]={
{TK_HINT_WHITE_TEXTURE,"hint_white"},
{TK_HINT_BLACK_TEXTURE,"hint_black"},
{TK_HINT_NORMAL_TEXTURE,"hint_normal"},
+ {TK_HINT_ANISO_TEXTURE,"hint_aniso"},
{TK_HINT_ALBEDO_TEXTURE,"hint_albedo"},
+ {TK_HINT_BLACK_ALBEDO_TEXTURE,"hint_black_albedo"},
{TK_HINT_COLOR,"hint_color"},
{TK_HINT_RANGE,"hint_range"},
@@ -3303,8 +3307,12 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map<StringName,DataTy
uniform.hint=ShaderNode::Uniform::HINT_BLACK;
} else if (tk.type==TK_HINT_NORMAL_TEXTURE) {
uniform.hint=ShaderNode::Uniform::HINT_NORMAL;
+ } else if (tk.type==TK_HINT_ANISO_TEXTURE) {
+ uniform.hint=ShaderNode::Uniform::HINT_ANISO;
} else if (tk.type==TK_HINT_ALBEDO_TEXTURE) {
uniform.hint=ShaderNode::Uniform::HINT_ALBEDO;
+ } else if (tk.type==TK_HINT_BLACK_ALBEDO_TEXTURE) {
+ uniform.hint=ShaderNode::Uniform::HINT_BLACK_ALBEDO;
} else if (tk.type==TK_HINT_COLOR) {
if (type!=TYPE_VEC4) {
_set_error("Color hint is for vec4 only");
@@ -3327,12 +3335,20 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map<StringName,DataTy
tk = _get_token();
+ float sign=1.0;
+
+ if (tk.type==TK_OP_SUB) {
+ sign=-1.0;
+ tk = _get_token();
+ }
+
if (tk.type!=TK_REAL_CONSTANT && tk.type!=TK_INT_CONSTANT) {
_set_error("Expected integer constant");
return ERR_PARSE_ERROR;
}
uniform.hint_range[0]=tk.constant;
+ uniform.hint_range[0]*=sign;
tk = _get_token();
@@ -3343,12 +3359,21 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map<StringName,DataTy
tk = _get_token();
+ sign=1.0;
+
+ if (tk.type==TK_OP_SUB) {
+ sign=-1.0;
+ tk = _get_token();
+ }
+
+
if (tk.type!=TK_REAL_CONSTANT && tk.type!=TK_INT_CONSTANT) {
_set_error("Expected integer constant after ','");
return ERR_PARSE_ERROR;
}
uniform.hint_range[1]=tk.constant;
+ uniform.hint_range[1]*=sign;
tk = _get_token();
diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h
index dc1279efd3..e6b515167e 100644
--- a/servers/visual/shader_language.h
+++ b/servers/visual/shader_language.h
@@ -138,7 +138,9 @@ public:
TK_HINT_WHITE_TEXTURE,
TK_HINT_BLACK_TEXTURE,
TK_HINT_NORMAL_TEXTURE,
+ TK_HINT_ANISO_TEXTURE,
TK_HINT_ALBEDO_TEXTURE,
+ TK_HINT_BLACK_ALBEDO_TEXTURE,
TK_HINT_COLOR,
TK_HINT_RANGE,
TK_CURSOR,
@@ -385,9 +387,11 @@ public:
HINT_COLOR,
HINT_RANGE,
HINT_ALBEDO,
+ HINT_BLACK_ALBEDO,
HINT_NORMAL,
HINT_BLACK,
HINT_WHITE,
+ HINT_ANISO,
HINT_MAX
};
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 8a0818c299..f799329026 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -60,6 +60,13 @@ ShaderTypes::ShaderTypes()
shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ALPHA"]=ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SPECULAR"]=ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ROUGHNESS"]=ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["RIM"]=ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["RIM_TINT"]=ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["CLEARCOAT"]=ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["CLEARCOAT_GLOSS"]=ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ANISOTROPY"]=ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ANISOTROPY_FLOW"]=ShaderLanguage::TYPE_VEC2;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["AO"]=ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["EMISSION"]=ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SPECIAL"]=ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["DISCARD"]=ShaderLanguage::TYPE_BOOL;