Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vector4 to VisualShader #60175

Merged
merged 1 commit into from Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions doc/classes/VisualShader.xml
Expand Up @@ -214,11 +214,13 @@
</constant>
<constant name="VARYING_TYPE_VECTOR_3D" value="2" enum="VaryingType">
</constant>
<constant name="VARYING_TYPE_COLOR" value="3" enum="VaryingType">
<constant name="VARYING_TYPE_VECTOR_4D" value="3" enum="VaryingType">
</constant>
<constant name="VARYING_TYPE_TRANSFORM" value="4" enum="VaryingType">
<constant name="VARYING_TYPE_COLOR" value="4" enum="VaryingType">
</constant>
<constant name="VARYING_TYPE_MAX" value="5" enum="VaryingType">
<constant name="VARYING_TYPE_TRANSFORM" value="5" enum="VaryingType">
</constant>
<constant name="VARYING_TYPE_MAX" value="6" enum="VaryingType">
</constant>
<constant name="NODE_ID_INVALID" value="-1">
</constant>
Expand Down
11 changes: 7 additions & 4 deletions doc/classes/VisualShaderNode.xml
Expand Up @@ -78,16 +78,19 @@
<constant name="PORT_TYPE_VECTOR_3D" value="3" enum="PortType">
3D vector of floating-point values. Translated to [code]vec3[/code] type in shader code.
</constant>
<constant name="PORT_TYPE_BOOLEAN" value="4" enum="PortType">
<constant name="PORT_TYPE_VECTOR_4D" value="4" enum="PortType">
4D vector of floating-point values. Translated to [code]vec4[/code] type in shader code.
</constant>
<constant name="PORT_TYPE_BOOLEAN" value="5" enum="PortType">
Boolean type. Translated to [code]bool[/code] type in shader code.
</constant>
<constant name="PORT_TYPE_TRANSFORM" value="5" enum="PortType">
<constant name="PORT_TYPE_TRANSFORM" value="6" enum="PortType">
Transform type. Translated to [code]mat4[/code] type in shader code.
</constant>
<constant name="PORT_TYPE_SAMPLER" value="6" enum="PortType">
<constant name="PORT_TYPE_SAMPLER" value="7" enum="PortType">
Sampler type. Translated to reference of sampler uniform in shader code. Can only be used for input ports in non-uniform nodes.
</constant>
<constant name="PORT_TYPE_MAX" value="7" enum="PortType">
<constant name="PORT_TYPE_MAX" value="8" enum="PortType">
Represents the size of the [enum PortType] enum.
</constant>
</constants>
Expand Down
5 changes: 4 additions & 1 deletion doc/classes/VisualShaderNodeClamp.xml
Expand Up @@ -26,7 +26,10 @@
<constant name="OP_TYPE_VECTOR_3D" value="3" enum="OpType">
A 3D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="4" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="4" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="5" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
9 changes: 6 additions & 3 deletions doc/classes/VisualShaderNodeCompare.xml
Expand Up @@ -32,13 +32,16 @@
<constant name="CTYPE_VECTOR_3D" value="3" enum="ComparisonType">
A 3D vector type.
</constant>
<constant name="CTYPE_BOOLEAN" value="4" enum="ComparisonType">
<constant name="CTYPE_VECTOR_4D" value="4" enum="ComparisonType">
A 4D vector type.
</constant>
<constant name="CTYPE_BOOLEAN" value="5" enum="ComparisonType">
A boolean type.
</constant>
<constant name="CTYPE_TRANSFORM" value="5" enum="ComparisonType">
<constant name="CTYPE_TRANSFORM" value="6" enum="ComparisonType">
A transform ([code]mat4[/code]) type.
</constant>
<constant name="CTYPE_MAX" value="6" enum="ComparisonType">
<constant name="CTYPE_MAX" value="7" enum="ComparisonType">
Represents the size of the [enum ComparisonType] enum.
</constant>
<constant name="FUNC_EQUAL" value="0" enum="Function">
Expand Down
5 changes: 4 additions & 1 deletion doc/classes/VisualShaderNodeDerivativeFunc.xml
Expand Up @@ -26,7 +26,10 @@
<constant name="OP_TYPE_VECTOR_3D" value="2" enum="OpType">
A 3D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="3" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="3" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="4" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
<constant name="FUNC_SUM" value="0" enum="Function">
Expand Down
8 changes: 7 additions & 1 deletion doc/classes/VisualShaderNodeMix.xml
Expand Up @@ -29,7 +29,13 @@
<constant name="OP_TYPE_VECTOR_3D_SCALAR" value="4" enum="OpType">
The [code]a[/code] and [code]b[/code] ports use a 3D vector type. The [code]weight[/code] port uses a scalar type.
</constant>
<constant name="OP_TYPE_MAX" value="5" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="5" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_VECTOR_4D_SCALAR" value="6" enum="OpType">
The [code]a[/code] and [code]b[/code] ports use a 4D vector type. The [code]weight[/code] port uses a scalar type.
</constant>
<constant name="OP_TYPE_MAX" value="7" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
5 changes: 4 additions & 1 deletion doc/classes/VisualShaderNodeMultiplyAdd.xml
Expand Up @@ -23,7 +23,10 @@
<constant name="OP_TYPE_VECTOR_3D" value="2" enum="OpType">
A 3D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="3" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="3" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="4" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
8 changes: 7 additions & 1 deletion doc/classes/VisualShaderNodeSmoothStep.xml
Expand Up @@ -30,7 +30,13 @@
<constant name="OP_TYPE_VECTOR_3D_SCALAR" value="4" enum="OpType">
The [code]x[/code] port uses a 3D vector type. The first two ports use a floating-point scalar type.
</constant>
<constant name="OP_TYPE_MAX" value="5" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="5" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_VECTOR_4D_SCALAR" value="6" enum="OpType">
The [code]a[/code] and [code]b[/code] ports use a 4D vector type. The [code]weight[/code] port uses a scalar type.
</constant>
<constant name="OP_TYPE_MAX" value="7" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
8 changes: 7 additions & 1 deletion doc/classes/VisualShaderNodeStep.xml
Expand Up @@ -30,7 +30,13 @@
<constant name="OP_TYPE_VECTOR_3D_SCALAR" value="4" enum="OpType">
The [code]x[/code] port uses a 3D vector type, while the [code]edge[/code] port uses a floating-point scalar type.
</constant>
<constant name="OP_TYPE_MAX" value="5" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="5" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_VECTOR_4D_SCALAR" value="6" enum="OpType">
The [code]a[/code] and [code]b[/code] ports use a 4D vector type. The [code]weight[/code] port uses a scalar type.
</constant>
<constant name="OP_TYPE_MAX" value="7" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
9 changes: 6 additions & 3 deletions doc/classes/VisualShaderNodeSwitch.xml
Expand Up @@ -26,13 +26,16 @@
<constant name="OP_TYPE_VECTOR_3D" value="3" enum="OpType">
A 3D vector type.
</constant>
<constant name="OP_TYPE_BOOLEAN" value="4" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="4" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_BOOLEAN" value="5" enum="OpType">
A boolean type.
</constant>
<constant name="OP_TYPE_TRANSFORM" value="5" enum="OpType">
<constant name="OP_TYPE_TRANSFORM" value="6" enum="OpType">
A transform type.
</constant>
<constant name="OP_TYPE_MAX" value="6" enum="OpType">
<constant name="OP_TYPE_MAX" value="7" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
16 changes: 16 additions & 0 deletions doc/classes/VisualShaderNodeVec4Constant.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVec4Constant" inherits="VisualShaderNodeConstant" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A 4D vector (represented as a [Quaternion]) constant to be used within the visual shader graph.
</brief_description>
<description>
A constant 4D vector (represented as a [Quaternion]), which can be used as an input node.
</description>
<tutorials>
</tutorials>
<members>
<member name="constant" type="Quaternion" setter="set_constant" getter="get_constant" default="Quaternion(0, 0, 0, 1)">
A 4D vector (represented as a [Quaternion]) constant which represents the state of this node.
</member>
</members>
</class>
19 changes: 19 additions & 0 deletions doc/classes/VisualShaderNodeVec4Uniform.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVec4Uniform" inherits="VisualShaderNodeUniform" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A 4D vector (represented as a [Quaternion]) uniform to be used within the visual shader graph.
</brief_description>
<description>
Translated to [code]uniform vec4[/code] in the shader language.
</description>
<tutorials>
</tutorials>
<members>
<member name="default_value" type="Quaternion" setter="set_default_value" getter="get_default_value" default="Quaternion(0, 0, 0, 1)">
A default value to be assigned within the shader.
</member>
<member name="default_value_enabled" type="bool" setter="set_default_value_enabled" getter="is_default_value_enabled" default="false">
Enables usage of the [member default_value].
</member>
</members>
</class>
5 changes: 4 additions & 1 deletion doc/classes/VisualShaderNodeVectorBase.xml
Expand Up @@ -19,7 +19,10 @@
<constant name="OP_TYPE_VECTOR_3D" value="1" enum="OpType">
A 3D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="2" enum="OpType">
<constant name="OP_TYPE_VECTOR_4D" value="2" enum="OpType">
A 4D vector type.
</constant>
<constant name="OP_TYPE_MAX" value="3" enum="OpType">
Represents the size of the [enum OpType] enum.
</constant>
</constants>
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/VisualShaderNodeVectorCompose.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorCompose" inherits="VisualShaderNodeVectorBase" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Composes a [Vector3] from three scalars within the visual shader graph.
Composes a [Vector2], [Vector3] or 4D vector (represented as a [Quaternion]) from scalars within the visual shader graph.
</brief_description>
<description>
Creates a [code]vec3[/code] using three scalar values that can be provided from separate inputs.
Creates a [code]vec2[/code], [code]vec3[/code] or [code]vec4[/code] using scalar values that can be provided from separate inputs.
</description>
<tutorials>
</tutorials>
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/VisualShaderNodeVectorDecompose.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorDecompose" inherits="VisualShaderNodeVectorBase" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Decomposes a [Vector3] into three scalars within the visual shader graph.
Decomposes a [Vector2], [Vector3] or 4D vector (represented as a [Quaternion]) into scalars within the visual shader graph.
</brief_description>
<description>
Takes a [code]vec3[/code] and decomposes it into three scalar values that can be used as separate inputs.
Takes a [code]vec2[/code], [code]vec3[/code] or [code]vec4[/code] and decomposes it into scalar values that can be used as separate outputs.
</description>
<tutorials>
</tutorials>
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/storage/material_storage.cpp
Expand Up @@ -308,7 +308,7 @@ void MaterialStorage::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_
if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
pi.type = Variant::COLOR;
} else {
pi.type = Variant::PLANE;
pi.type = Variant::QUATERNION;
}
} break;

Expand Down
1 change: 1 addition & 0 deletions editor/icons/Vector4.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.