Jelajahi Sumber

Close #7690 (add info for shader hints and default values) (#8117)

* add comment for default values

* Add a line telling where the default value goes

---------

Co-authored-by: A Thousand Ships <[email protected]>
Hex-4 1 tahun lalu
induk
melakukan
d5ec2c6e5f
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      tutorials/shaders/shader_reference/shading_language.rst

+ 3 - 1
tutorials/shaders/shader_reference/shading_language.rst

@@ -757,7 +757,7 @@ used, and how the editor should allow users to modify it.
 
     uniform vec4 color : source_color;
     uniform float amount : hint_range(0, 1);
-    uniform vec4 other_color : source_color = vec4(1.0);
+    uniform vec4 other_color : source_color = vec4(1.0); // Default values go after the hint.
     uniform sampler2D image : source_color;
 
 It's important to understand that textures that are supplied as color require
@@ -899,6 +899,8 @@ Uniforms can also be assigned default values:
     uniform vec4 some_vector = vec4(0.0);
     uniform vec4 some_color : source_color = vec4(1.0);
 
+Note that when adding a default value and a hint, the default value goes after the hint.
+
 If you need to make multiple uniforms to be grouped in the specific category of an inspector, you can use a `group_uniform` keyword like:
 
 .. code-block:: glsl