Merge pull request #61916 from Calinou/doc-curvetexture

Document the CurveXYZTexture class, improve CurveTexture documentation
This commit is contained in:
Rémi Verschelde 2022-06-12 22:26:33 +02:00 committed by GitHub
commit 4953707784
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View file

@ -5,23 +5,27 @@
</brief_description> </brief_description>
<description> <description>
Renders a given [Curve] provided to it. Simplifies the task of drawing curves and/or saving them as image files. Renders a given [Curve] provided to it. Simplifies the task of drawing curves and/or saving them as image files.
If you need to store up to 3 curves within a single texture, use [CurveXYZTexture] instead. See also [GradientTexture1D] and [GradientTexture2D].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="curve" type="Curve" setter="set_curve" getter="get_curve"> <member name="curve" type="Curve" setter="set_curve" getter="get_curve">
The [code]curve[/code] rendered onto the texture. The [Curve] that is rendered onto the texture.
</member> </member>
<member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="CurveTexture.TextureMode" default="0"> <member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="CurveTexture.TextureMode" default="0">
The format the texture should be generated with. When passing a CurveTexture as a input to a [Shader], this may need to be adjusted.
</member> </member>
<member name="width" type="int" setter="set_width" getter="get_width" default="256"> <member name="width" type="int" setter="set_width" getter="get_width" default="256">
The width of the texture. The width of the texture (in pixels). Higher values make it possible to represent high-frequency data better (such as sudden direction changes), at the cost of increased generation time and memory usage.
</member> </member>
</members> </members>
<constants> <constants>
<constant name="TEXTURE_MODE_RGB" value="0" enum="TextureMode"> <constant name="TEXTURE_MODE_RGB" value="0" enum="TextureMode">
Store the curve equally across the red, green and blue channels. This uses more video memory, but is more compatible with shaders that only read the green and blue values.
</constant> </constant>
<constant name="TEXTURE_MODE_RED" value="1" enum="TextureMode"> <constant name="TEXTURE_MODE_RED" value="1" enum="TextureMode">
Store the curve only in the red channel. This saves video memory, but some custom shaders may not be able to work with this.
</constant> </constant>
</constants> </constants>
</class> </class>

View file

@ -1,19 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CurveXYZTexture" inherits="Texture2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="CurveXYZTexture" inherits="Texture2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description> <brief_description>
A texture that shows 3 different curves (stored on the red, green and blue color channels).
</brief_description> </brief_description>
<description> <description>
Renders 3 given [Curve]s provided to it, on the red, green and blue channels respectively. Compared to using separate [CurveTexture]s, this further simplifies the task of drawing curves and/or saving them as image files.
If you only need to store one curve within a single texture, use [CurveTexture] instead. See also [GradientTexture1D] and [GradientTexture2D].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="curve_x" type="Curve" setter="set_curve_x" getter="get_curve_x"> <member name="curve_x" type="Curve" setter="set_curve_x" getter="get_curve_x">
The [Curve] that is rendered onto the texture's red channel.
</member> </member>
<member name="curve_y" type="Curve" setter="set_curve_y" getter="get_curve_y"> <member name="curve_y" type="Curve" setter="set_curve_y" getter="get_curve_y">
The [Curve] that is rendered onto the texture's green channel.
</member> </member>
<member name="curve_z" type="Curve" setter="set_curve_z" getter="get_curve_z"> <member name="curve_z" type="Curve" setter="set_curve_z" getter="get_curve_z">
The [Curve] that is rendered onto the texture's blue channel.
</member> </member>
<member name="width" type="int" setter="set_width" getter="get_width" default="256"> <member name="width" type="int" setter="set_width" getter="get_width" default="256">
The width of the texture (in pixels). Higher values make it possible to represent high-frequency data better (such as sudden direction changes), at the cost of increased generation time and memory usage.
</member> </member>
</members> </members>
</class> </class>

View file

@ -4,7 +4,7 @@
Gradient-filled texture. Gradient-filled texture.
</brief_description> </brief_description>
<description> <description>
GradientTexture1D uses a [Gradient] to fill the texture data. The gradient will be filled from left to right using colors obtained from the gradient. This means the texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see [member width]). GradientTexture1D uses a [Gradient] to fill the texture data. The gradient will be filled from left to right using colors obtained from the gradient. This means the texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see [member width]). See also [GradientTexture2D], [CurveTexture] and [CurveXYZTexture].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -4,7 +4,7 @@
Gradient-filled 2D texture. Gradient-filled 2D texture.
</brief_description> </brief_description>
<description> <description>
The texture uses a [Gradient] to fill the texture data in 2D space. The gradient is filled according to the specified [member fill] and [member repeat] types using colors obtained from the gradient. The texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see [member width] and [member height]). The texture uses a [Gradient] to fill the texture data in 2D space. The gradient is filled according to the specified [member fill] and [member repeat] types using colors obtained from the gradient. The texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see [member width] and [member height]). See also [GradientTexture1D], [CurveTexture] and [CurveXYZTexture].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>