mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 14:12:51 +00:00
Added missed limiters for Visual Shader node enums
This commit is contained in:
parent
966559c3bd
commit
e537a1f10e
@ -36,5 +36,8 @@
|
||||
return vec3(r, g, b);
|
||||
[/codeblock]
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="2" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -94,5 +94,8 @@
|
||||
}
|
||||
[/codeblock]
|
||||
</constant>
|
||||
<constant name="OP_MAX" value="9" enum="Operator">
|
||||
Represents the size of the [enum Operator] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -37,6 +37,9 @@
|
||||
<constant name="CTYPE_TRANSFORM" value="4" enum="ComparisonType">
|
||||
A transform ([code]mat4[/code]) type.
|
||||
</constant>
|
||||
<constant name="CTYPE_MAX" value="5" enum="ComparisonType">
|
||||
Represents the size of the [enum ComparisonType] enum.
|
||||
</constant>
|
||||
<constant name="FUNC_EQUAL" value="0" enum="Function">
|
||||
Comparison for equality ([code]a == b[/code]).
|
||||
</constant>
|
||||
@ -55,11 +58,17 @@
|
||||
<constant name="FUNC_LESS_THAN_EQUAL" value="5" enum="Function">
|
||||
Comparison for less than or equal ([code]a <= b[/code]). Cannot be used if [member type] set to [constant CTYPE_BOOLEAN] or [constant CTYPE_TRANSFORM].
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="6" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
<constant name="COND_ALL" value="0" enum="Condition">
|
||||
The result will be true if all of component in vector satisfy the comparison condition.
|
||||
</constant>
|
||||
<constant name="COND_ANY" value="1" enum="Condition">
|
||||
The result will be true if any of component in vector satisfy the comparison condition.
|
||||
</constant>
|
||||
<constant name="COND_MAX" value="2" enum="Condition">
|
||||
Represents the size of the [enum Condition] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -28,6 +28,9 @@
|
||||
<constant name="SOURCE_PORT" value="1" enum="Source">
|
||||
Use the [Cubemap] sampler reference passed via the [code]samplerCube[/code] port. If this is set to [member source], the [member cube_map] texture is ignored.
|
||||
</constant>
|
||||
<constant name="SOURCE_MAX" value="2" enum="Source">
|
||||
Represents the size of the [enum Source] enum.
|
||||
</constant>
|
||||
<constant name="TYPE_DATA" value="0" enum="TextureType">
|
||||
No hints are added to the uniform declaration.
|
||||
</constant>
|
||||
@ -37,5 +40,8 @@
|
||||
<constant name="TYPE_NORMAL_MAP" value="2" enum="TextureType">
|
||||
Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
|
||||
</constant>
|
||||
<constant name="TYPE_MAX" value="3" enum="TextureType">
|
||||
Represents the size of the [enum TextureType] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -112,5 +112,8 @@
|
||||
<constant name="FUNC_ONEMINUS" value="31" enum="Function">
|
||||
Subtracts scalar [code]x[/code] from 1 (i.e. [code]1 - x[/code]).
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="32" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -46,5 +46,8 @@
|
||||
<constant name="OP_STEP" value="9" enum="Operator">
|
||||
Generates a step function by comparing [code]b[/code](x) to [code]a[/code](edge). Returns 0.0 if [code]x[/code] is smaller than [code]edge[/code] and otherwise 1.0. Translates to [code]step(a, b)[/code] in the Godot Shader Language.
|
||||
</constant>
|
||||
<constant name="OP_ENUM_SIZE" value="10" enum="Operator">
|
||||
Represents the size of the [enum Operator] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -40,5 +40,8 @@
|
||||
<constant name="HINT_RANGE_STEP" value="2" enum="Hint">
|
||||
A range hint for scalar value with step, which limits possible input values between [member min] and [member max], with a step (increment) of [member step]). Translated to [code]hint_range(min, max, step)[/code] in shader code.
|
||||
</constant>
|
||||
<constant name="HINT_MAX" value="3" enum="Hint">
|
||||
Represents the size of the [enum Hint] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -25,5 +25,8 @@
|
||||
<constant name="FUNC_SIGN" value="2" enum="Function">
|
||||
Extracts the sign of the parameter. Translates to [code]sign(x)[/code] in the Godot Shader Language.
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="3" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -37,5 +37,8 @@
|
||||
<constant name="OP_MIN" value="6" enum="Operator">
|
||||
Returns the lesser of two numbers. Translates to [code]max(a, b)[/code] in the Godot Shader Language.
|
||||
</constant>
|
||||
<constant name="OP_ENUM_SIZE" value="7" enum="Operator">
|
||||
Represents the size of the [enum Operator] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -40,5 +40,8 @@
|
||||
<constant name="HINT_RANGE_STEP" value="2" enum="Hint">
|
||||
A range hint for scalar value with step, which limits possible input values between [member min] and [member max], with a step (increment) of [member step]). Translated to [code]hint_range(min, max, step)[/code] in shader code.
|
||||
</constant>
|
||||
<constant name="HINT_MAX" value="3" enum="Hint">
|
||||
Represents the size of the [enum Hint] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -22,5 +22,8 @@
|
||||
<constant name="FUNC_IS_NAN" value="1" enum="Function">
|
||||
Comparison with [code]NaN[/code] (Not a Number; denotes invalid numeric results, e.g. division by zero).
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="2" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -20,6 +20,7 @@
|
||||
<constant name="MODE_TANGENTIAL" value="2" enum="Mode">
|
||||
</constant>
|
||||
<constant name="MODE_MAX" value="3" enum="Mode">
|
||||
Represents the size of the [enum Mode] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<constant name="OP_TYPE_VECTOR" value="1" enum="OpType">
|
||||
</constant>
|
||||
<constant name="OP_TYPE_MAX" value="2" enum="OpType">
|
||||
Represents the size of the [enum OpType] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -22,5 +22,8 @@
|
||||
<constant name="SOURCE_PORT" value="1" enum="Source">
|
||||
Use the uniform texture from sampler port.
|
||||
</constant>
|
||||
<constant name="SOURCE_MAX" value="2" enum="Source">
|
||||
Represents the size of the [enum Source] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -25,5 +25,8 @@
|
||||
<constant name="FUNC_Y" value="2" enum="Function">
|
||||
Derivative in [code]y[/code] using local differencing.
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="3" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -40,6 +40,9 @@
|
||||
<constant name="SOURCE_PORT" value="5" enum="Source">
|
||||
Use the texture provided in the input port for this function.
|
||||
</constant>
|
||||
<constant name="SOURCE_MAX" value="6" enum="Source">
|
||||
Represents the size of the [enum Source] enum.
|
||||
</constant>
|
||||
<constant name="TYPE_DATA" value="0" enum="TextureType">
|
||||
No hints are added to the uniform declaration.
|
||||
</constant>
|
||||
@ -49,5 +52,8 @@
|
||||
<constant name="TYPE_NORMAL_MAP" value="2" enum="TextureType">
|
||||
Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
|
||||
</constant>
|
||||
<constant name="TYPE_MAX" value="3" enum="TextureType">
|
||||
Represents the size of the [enum TextureType] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -31,11 +31,17 @@
|
||||
<constant name="TYPE_ANISO" value="3" enum="TextureType">
|
||||
Adds [code]hint_aniso[/code] as hint to the uniform declaration to use for a flowmap.
|
||||
</constant>
|
||||
<constant name="TYPE_MAX" value="4" enum="TextureType">
|
||||
Represents the size of the [enum TextureType] enum.
|
||||
</constant>
|
||||
<constant name="COLOR_DEFAULT_WHITE" value="0" enum="ColorDefault">
|
||||
Defaults to white color.
|
||||
</constant>
|
||||
<constant name="COLOR_DEFAULT_BLACK" value="1" enum="ColorDefault">
|
||||
Defaults to black color.
|
||||
</constant>
|
||||
<constant name="COLOR_DEFAULT_MAX" value="2" enum="ColorDefault">
|
||||
Represents the size of the [enum ColorDefault] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -22,5 +22,8 @@
|
||||
<constant name="FUNC_TRANSPOSE" value="1" enum="Function">
|
||||
Perform the transpose operation on the [Transform3D] matrix.
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="2" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -43,7 +43,7 @@
|
||||
<constant name="OP_B_DIV_A" value="8" enum="Operator">
|
||||
Divides the transform [code]b[/code] by the transform [code]a[/code].
|
||||
</constant>
|
||||
<constant name="OP_LIMITER" value="9" enum="Operator">
|
||||
<constant name="OP_MAX" value="9" enum="Operator">
|
||||
Represents the size of the [enum Operator] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
|
@ -28,5 +28,8 @@
|
||||
<constant name="OP_3x3_BxA" value="3" enum="Operator">
|
||||
Multiplies vector [code]b[/code] by the transform [code]a[/code], skipping the last row and column of the transform.
|
||||
</constant>
|
||||
<constant name="OP_MAX" value="4" enum="Operator">
|
||||
Represents the size of the [enum Operator] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -24,5 +24,8 @@
|
||||
</constant>
|
||||
<constant name="QUAL_INSTANCE" value="2" enum="Qualifier">
|
||||
</constant>
|
||||
<constant name="QUAL_MAX" value="3" enum="Qualifier">
|
||||
Represents the size of the [enum Qualifier] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -25,5 +25,8 @@
|
||||
<constant name="FUNC_Y" value="2" enum="Function">
|
||||
Derivative in [code]y[/code] using local differencing.
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="3" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -121,5 +121,8 @@
|
||||
<constant name="FUNC_ONEMINUS" value="34" enum="Function">
|
||||
Returns [code]1.0 - vector[/code].
|
||||
</constant>
|
||||
<constant name="FUNC_MAX" value="35" enum="Function">
|
||||
Represents the size of the [enum Function] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -52,5 +52,8 @@
|
||||
<constant name="OP_STEP" value="11" enum="Operator">
|
||||
Vector step operator. Returns [code]0.0[/code] if [code]a[/code] is smaller than [code]b[/code] and [code]1.0[/code] otherwise.
|
||||
</constant>
|
||||
<constant name="OP_ENUM_SIZE" value="12" enum="Operator">
|
||||
Represents the size of the [enum Operator] enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -3032,6 +3032,10 @@ String VisualShaderNodeUniform::get_uniform_name() const {
|
||||
}
|
||||
|
||||
void VisualShaderNodeUniform::set_qualifier(VisualShaderNodeUniform::Qualifier p_qual) {
|
||||
ERR_FAIL_INDEX(int(p_qual), int(QUAL_MAX));
|
||||
if (qualifier == p_qual) {
|
||||
return;
|
||||
}
|
||||
qualifier = p_qual;
|
||||
emit_changed();
|
||||
}
|
||||
@ -3061,6 +3065,7 @@ void VisualShaderNodeUniform::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(QUAL_NONE);
|
||||
BIND_ENUM_CONSTANT(QUAL_GLOBAL);
|
||||
BIND_ENUM_CONSTANT(QUAL_INSTANCE);
|
||||
BIND_ENUM_CONSTANT(QUAL_MAX);
|
||||
}
|
||||
|
||||
String VisualShaderNodeUniform::_get_qual_str() const {
|
||||
@ -3072,6 +3077,8 @@ String VisualShaderNodeUniform::_get_qual_str() const {
|
||||
return "global ";
|
||||
case QUAL_INSTANCE:
|
||||
return "instance ";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return String();
|
||||
@ -3094,6 +3101,8 @@ String VisualShaderNodeUniform::get_warning(Shader::Mode p_mode, VisualShader::T
|
||||
case QUAL_INSTANCE:
|
||||
qualifier_str = "instance";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return vformat(TTR("This uniform type does not support the '%s' qualifier."), qualifier_str);
|
||||
} else if (qualifier == Qualifier::QUAL_GLOBAL) {
|
||||
@ -3350,6 +3359,10 @@ bool VisualShaderNodeGroupBase::is_valid_port_name(const String &p_name) const {
|
||||
}
|
||||
|
||||
void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const String &p_name) {
|
||||
ERR_FAIL_COND(has_input_port(p_id));
|
||||
ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
|
||||
ERR_FAIL_COND(!is_valid_port_name(p_name));
|
||||
|
||||
String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
|
||||
Vector<String> inputs_strings = inputs.split(";", false);
|
||||
int index = 0;
|
||||
@ -3422,6 +3435,10 @@ bool VisualShaderNodeGroupBase::has_input_port(int p_id) const {
|
||||
}
|
||||
|
||||
void VisualShaderNodeGroupBase::add_output_port(int p_id, int p_type, const String &p_name) {
|
||||
ERR_FAIL_COND(has_output_port(p_id));
|
||||
ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
|
||||
ERR_FAIL_COND(!is_valid_port_name(p_name));
|
||||
|
||||
String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
|
||||
Vector<String> outputs_strings = outputs.split(";", false);
|
||||
int index = 0;
|
||||
@ -3503,7 +3520,7 @@ void VisualShaderNodeGroupBase::clear_output_ports() {
|
||||
|
||||
void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
|
||||
ERR_FAIL_COND(!has_input_port(p_id));
|
||||
ERR_FAIL_COND(p_type < 0 || p_type >= PORT_TYPE_MAX);
|
||||
ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
|
||||
|
||||
if (input_ports[p_id].type == p_type) {
|
||||
return;
|
||||
@ -3575,7 +3592,7 @@ String VisualShaderNodeGroupBase::get_input_port_name(int p_id) const {
|
||||
|
||||
void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
|
||||
ERR_FAIL_COND(!has_output_port(p_id));
|
||||
ERR_FAIL_COND(p_type < 0 || p_type >= PORT_TYPE_MAX);
|
||||
ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
|
||||
|
||||
if (output_ports[p_id].type == p_type) {
|
||||
return;
|
||||
|
@ -435,6 +435,7 @@ public:
|
||||
QUAL_NONE,
|
||||
QUAL_GLOBAL,
|
||||
QUAL_INSTANCE,
|
||||
QUAL_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -76,7 +76,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_constant(float p_value);
|
||||
void set_constant(float p_constant);
|
||||
float get_constant() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -106,7 +106,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_constant(int p_value);
|
||||
void set_constant(int p_constant);
|
||||
int get_constant() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -136,7 +136,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_constant(bool p_value);
|
||||
void set_constant(bool p_constant);
|
||||
bool get_constant() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -167,7 +167,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_constant(Color p_value);
|
||||
void set_constant(const Color &p_constant);
|
||||
Color get_constant() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -197,7 +197,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_constant(Vector3 p_value);
|
||||
void set_constant(const Vector3 &p_constant);
|
||||
Vector3 get_constant() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -227,7 +227,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_constant(Transform3D p_value);
|
||||
void set_constant(const Transform3D &p_constant);
|
||||
Transform3D get_constant() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -251,12 +251,14 @@ public:
|
||||
SOURCE_2D_NORMAL,
|
||||
SOURCE_DEPTH,
|
||||
SOURCE_PORT,
|
||||
SOURCE_MAX,
|
||||
};
|
||||
|
||||
enum TextureType {
|
||||
TYPE_DATA,
|
||||
TYPE_COLOR,
|
||||
TYPE_NORMAL_MAP,
|
||||
TYPE_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -287,10 +289,10 @@ public:
|
||||
void set_source(Source p_source);
|
||||
Source get_source() const;
|
||||
|
||||
void set_texture(Ref<Texture2D> p_value);
|
||||
void set_texture(Ref<Texture2D> p_texture);
|
||||
Ref<Texture2D> get_texture() const;
|
||||
|
||||
void set_texture_type(TextureType p_type);
|
||||
void set_texture_type(TextureType p_texture_type);
|
||||
TextureType get_texture_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -327,7 +329,7 @@ public:
|
||||
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_texture(Ref<CurveTexture> p_value);
|
||||
void set_texture(Ref<CurveTexture> p_texture);
|
||||
Ref<CurveTexture> get_texture() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -360,7 +362,7 @@ public:
|
||||
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_texture(Ref<CurveXYZTexture> p_value);
|
||||
void set_texture(Ref<CurveXYZTexture> p_texture);
|
||||
Ref<CurveXYZTexture> get_texture() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -378,6 +380,7 @@ public:
|
||||
enum Source {
|
||||
SOURCE_TEXTURE,
|
||||
SOURCE_PORT,
|
||||
SOURCE_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -410,7 +413,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeSample3D::Source)
|
||||
|
||||
class VisualShaderNodeTexture2DArray : public VisualShaderNodeSample3D {
|
||||
GDCLASS(VisualShaderNodeTexture2DArray, VisualShaderNodeSample3D);
|
||||
Ref<Texture2DArray> texture;
|
||||
Ref<Texture2DArray> texture_array;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
@ -423,7 +426,7 @@ public:
|
||||
virtual Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override;
|
||||
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
|
||||
|
||||
void set_texture_array(Ref<Texture2DArray> p_value);
|
||||
void set_texture_array(Ref<Texture2DArray> p_texture_array);
|
||||
Ref<Texture2DArray> get_texture_array() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -446,7 +449,7 @@ public:
|
||||
virtual Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override;
|
||||
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
|
||||
|
||||
void set_texture(Ref<Texture3D> p_value);
|
||||
void set_texture(Ref<Texture3D> p_texture);
|
||||
Ref<Texture3D> get_texture() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -461,13 +464,15 @@ class VisualShaderNodeCubemap : public VisualShaderNode {
|
||||
public:
|
||||
enum Source {
|
||||
SOURCE_TEXTURE,
|
||||
SOURCE_PORT
|
||||
SOURCE_PORT,
|
||||
SOURCE_MAX,
|
||||
};
|
||||
|
||||
enum TextureType {
|
||||
TYPE_DATA,
|
||||
TYPE_COLOR,
|
||||
TYPE_NORMAL_MAP
|
||||
TYPE_NORMAL_MAP,
|
||||
TYPE_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -497,10 +502,10 @@ public:
|
||||
void set_source(Source p_source);
|
||||
Source get_source() const;
|
||||
|
||||
void set_cube_map(Ref<Cubemap> p_value);
|
||||
void set_cube_map(Ref<Cubemap> p_cube_map);
|
||||
Ref<Cubemap> get_cube_map() const;
|
||||
|
||||
void set_texture_type(TextureType p_type);
|
||||
void set_texture_type(TextureType p_texture_type);
|
||||
TextureType get_texture_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -530,7 +535,8 @@ public:
|
||||
OP_MAX,
|
||||
OP_MIN,
|
||||
OP_ATAN2,
|
||||
OP_STEP
|
||||
OP_STEP,
|
||||
OP_ENUM_SIZE,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -573,6 +579,7 @@ public:
|
||||
OP_MOD,
|
||||
OP_MAX,
|
||||
OP_MIN,
|
||||
OP_ENUM_SIZE,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -619,7 +626,8 @@ public:
|
||||
OP_CROSS,
|
||||
OP_ATAN2,
|
||||
OP_REFLECT,
|
||||
OP_STEP
|
||||
OP_STEP,
|
||||
OP_ENUM_SIZE,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -665,7 +673,8 @@ public:
|
||||
OP_DODGE,
|
||||
OP_BURN,
|
||||
OP_SOFT_LIGHT,
|
||||
OP_HARD_LIGHT
|
||||
OP_HARD_LIGHT,
|
||||
OP_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -714,7 +723,7 @@ public:
|
||||
OP_B_MINUS_A,
|
||||
OP_A_DIV_B,
|
||||
OP_B_DIV_A,
|
||||
OP_LIMITER,
|
||||
OP_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -758,6 +767,7 @@ public:
|
||||
OP_BxA,
|
||||
OP_3x3_AxB,
|
||||
OP_3x3_BxA,
|
||||
OP_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -828,7 +838,8 @@ public:
|
||||
FUNC_RECIPROCAL,
|
||||
FUNC_ROUNDEVEN,
|
||||
FUNC_TRUNC,
|
||||
FUNC_ONEMINUS
|
||||
FUNC_ONEMINUS,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -871,6 +882,7 @@ public:
|
||||
FUNC_ABS,
|
||||
FUNC_NEGATE,
|
||||
FUNC_SIGN,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -944,7 +956,8 @@ public:
|
||||
FUNC_TAN,
|
||||
FUNC_TANH,
|
||||
FUNC_TRUNC,
|
||||
FUNC_ONEMINUS
|
||||
FUNC_ONEMINUS,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -985,7 +998,8 @@ class VisualShaderNodeColorFunc : public VisualShaderNode {
|
||||
public:
|
||||
enum Function {
|
||||
FUNC_GRAYSCALE,
|
||||
FUNC_SEPIA
|
||||
FUNC_SEPIA,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -1026,7 +1040,8 @@ class VisualShaderNodeTransformFunc : public VisualShaderNode {
|
||||
public:
|
||||
enum Function {
|
||||
FUNC_INVERSE,
|
||||
FUNC_TRANSPOSE
|
||||
FUNC_TRANSPOSE,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -1092,7 +1107,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_function(Function p_op);
|
||||
void set_function(Function p_func);
|
||||
Function get_function() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -1201,7 +1216,7 @@ public:
|
||||
virtual PortType get_output_port_type(int p_port) const override;
|
||||
virtual String get_output_port_name(int p_port) const override;
|
||||
|
||||
void set_op_type(OpType p_type);
|
||||
void set_op_type(OpType p_op_type);
|
||||
OpType get_op_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -1224,7 +1239,8 @@ public:
|
||||
enum Function {
|
||||
FUNC_SUM,
|
||||
FUNC_X,
|
||||
FUNC_Y
|
||||
FUNC_Y,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -1264,7 +1280,8 @@ public:
|
||||
enum Function {
|
||||
FUNC_SUM,
|
||||
FUNC_X,
|
||||
FUNC_Y
|
||||
FUNC_Y,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -1371,7 +1388,7 @@ public:
|
||||
virtual PortType get_output_port_type(int p_port) const override;
|
||||
virtual String get_output_port_name(int p_port) const override;
|
||||
|
||||
void set_op_type(OpType p_type);
|
||||
void set_op_type(OpType p_op_type);
|
||||
OpType get_op_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -1413,7 +1430,7 @@ public:
|
||||
virtual PortType get_output_port_type(int p_port) const override;
|
||||
virtual String get_output_port_name(int p_port) const override;
|
||||
|
||||
void set_op_type(OpType p_type);
|
||||
void set_op_type(OpType p_op_type);
|
||||
OpType get_op_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -1501,7 +1518,7 @@ public:
|
||||
virtual PortType get_output_port_type(int p_port) const override;
|
||||
virtual String get_output_port_name(int p_port) const override;
|
||||
|
||||
void set_op_type(OpType p_type);
|
||||
void set_op_type(OpType p_op_type);
|
||||
OpType get_op_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -1613,6 +1630,7 @@ public:
|
||||
HINT_NONE,
|
||||
HINT_RANGE,
|
||||
HINT_RANGE_STEP,
|
||||
HINT_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -1679,6 +1697,7 @@ public:
|
||||
HINT_NONE,
|
||||
HINT_RANGE,
|
||||
HINT_RANGE_STEP,
|
||||
HINT_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -1919,11 +1938,13 @@ public:
|
||||
TYPE_COLOR,
|
||||
TYPE_NORMAL_MAP,
|
||||
TYPE_ANISO,
|
||||
TYPE_MAX,
|
||||
};
|
||||
|
||||
enum ColorDefault {
|
||||
COLOR_DEFAULT_WHITE,
|
||||
COLOR_DEFAULT_BLACK
|
||||
COLOR_DEFAULT_BLACK,
|
||||
COLOR_DEFAULT_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -2113,7 +2134,7 @@ public:
|
||||
virtual PortType get_output_port_type(int p_port) const override;
|
||||
virtual String get_output_port_name(int p_port) const override;
|
||||
|
||||
void set_op_type(OpType p_type);
|
||||
void set_op_type(OpType p_op_type);
|
||||
OpType get_op_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
@ -2161,6 +2182,7 @@ public:
|
||||
enum Function {
|
||||
FUNC_IS_INF,
|
||||
FUNC_IS_NAN,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -2206,6 +2228,7 @@ public:
|
||||
CTYPE_VECTOR,
|
||||
CTYPE_BOOLEAN,
|
||||
CTYPE_TRANSFORM,
|
||||
CTYPE_MAX,
|
||||
};
|
||||
|
||||
enum Function {
|
||||
@ -2215,15 +2238,17 @@ public:
|
||||
FUNC_GREATER_THAN_EQUAL,
|
||||
FUNC_LESS_THAN,
|
||||
FUNC_LESS_THAN_EQUAL,
|
||||
FUNC_MAX,
|
||||
};
|
||||
|
||||
enum Condition {
|
||||
COND_ALL,
|
||||
COND_ANY,
|
||||
COND_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
ComparisonType ctype = CTYPE_SCALAR;
|
||||
ComparisonType comparison_type = CTYPE_SCALAR;
|
||||
Function func = FUNC_EQUAL;
|
||||
Condition condition = COND_ALL;
|
||||
|
||||
@ -2291,7 +2316,7 @@ public:
|
||||
|
||||
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
|
||||
|
||||
void set_op_type(OpType p_type);
|
||||
void set_op_type(OpType p_op_type);
|
||||
OpType get_op_type() const;
|
||||
|
||||
virtual Vector<StringName> get_editable_properties() const override;
|
||||
|
@ -402,15 +402,16 @@ String VisualShaderNodeParticleRandomness::generate_code(Shader::Mode p_mode, Vi
|
||||
}
|
||||
|
||||
void VisualShaderNodeParticleRandomness::set_op_type(OpType p_op_type) {
|
||||
ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
|
||||
if (p_op_type != op_type) {
|
||||
if (p_op_type == OP_TYPE_SCALAR) {
|
||||
set_input_port_default_value(0, 0.0);
|
||||
set_input_port_default_value(1, 1.0);
|
||||
} else {
|
||||
set_input_port_default_value(0, Vector3(-1.0, -1.0, -1.0));
|
||||
set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0));
|
||||
}
|
||||
ERR_FAIL_INDEX(int(p_op_type), int(OP_TYPE_MAX));
|
||||
if (op_type == p_op_type) {
|
||||
return;
|
||||
}
|
||||
if (p_op_type == OP_TYPE_SCALAR) {
|
||||
set_input_port_default_value(0, 0.0);
|
||||
set_input_port_default_value(1, 1.0);
|
||||
} else {
|
||||
set_input_port_default_value(0, Vector3(-1.0, -1.0, -1.0));
|
||||
set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0));
|
||||
}
|
||||
op_type = p_op_type;
|
||||
emit_changed();
|
||||
@ -500,8 +501,6 @@ String VisualShaderNodeParticleAccelerator::generate_code(Shader::Mode p_mode, V
|
||||
code += " __vec3_buff1 = cross(__ndiff, normalize(" + (p_input_vars[2].is_empty() ? "vec3" + (String)get_input_port_default_value(2) : p_input_vars[2]) + "));\n";
|
||||
code += " " + p_output_vars[0] + " = length(__vec3_buff1) > 0.0 ? normalize(__vec3_buff1) * (" + (p_input_vars[0].is_empty() ? "vec3" + (String)get_input_port_default_value(0) : p_input_vars[0]) + " * mix(1.0, __rand_from_seed(__seed), " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ")) : vec3(0.0);\n";
|
||||
break;
|
||||
case MODE_MAX:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -510,6 +509,10 @@ String VisualShaderNodeParticleAccelerator::generate_code(Shader::Mode p_mode, V
|
||||
}
|
||||
|
||||
void VisualShaderNodeParticleAccelerator::set_mode(Mode p_mode) {
|
||||
ERR_FAIL_INDEX(int(p_mode), int(MODE_MAX));
|
||||
if (mode == p_mode) {
|
||||
return;
|
||||
}
|
||||
mode = p_mode;
|
||||
emit_changed();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user