Documentation
¶
Overview ¶
Uses the FastNoiseLite library or other noise generators to fill the texture data of your desired size. NoiseTexture2D can also generate normal map textures.
The class uses Threads to generate the texture data internally, so Texture2D.GetImage may return null if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image and the generated byte data:
package main import ( "graphics.gd/classdb/FastNoiseLite" "graphics.gd/classdb/NoiseTexture2D" ) func ExampleNoiseTexture2D() { var texture = NoiseTexture2D.New() texture.SetNoise(FastNoiseLite.New().AsNoise()) texture.AsResource().OnChanged(func() { var image = texture.AsTexture2D().GetImage() var data = image.GetData() _ = data }) }
Index ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsNoiseTexture2D() Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
- func (self *Extension[T]) AsResource() Resource.Instance
- func (self *Extension[T]) AsTexture() Texture.Instance
- func (self *Extension[T]) AsTexture2D() Texture2D.Instance
- type ID
- type Instance
- func (self Instance) AsNoiseTexture2D() Instance
- func (self Instance) AsNormalMap() bool
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTexture() Texture.Instance
- func (self Instance) AsTexture2D() Texture2D.Instance
- func (self Instance) BumpStrength() Float.X
- func (self Instance) ColorRamp() Gradient.Instance
- func (self Instance) GenerateMipmaps() bool
- func (self Instance) ID() ID
- func (self Instance) In3dSpace() bool
- func (self Instance) Invert() bool
- func (self Instance) Noise() Noise.Instance
- func (self Instance) Normalize() bool
- func (self Instance) Seamless() bool
- func (self Instance) SeamlessBlendSkirt() Float.X
- func (self Instance) SetAsNormalMap(value bool)
- func (self Instance) SetBumpStrength(value Float.X)
- func (self Instance) SetColorRamp(value Gradient.Instance)
- func (self Instance) SetGenerateMipmaps(value bool)
- func (self Instance) SetHeight(value int)
- func (self Instance) SetIn3dSpace(value bool)
- func (self Instance) SetInvert(value bool)
- func (self Instance) SetNoise(value Noise.Instance)
- func (self Instance) SetNormalize(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSeamless(value bool)
- func (self Instance) SetSeamlessBlendSkirt(value Float.X)
- func (self Instance) SetWidth(value int)
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsNoiseTexture2D ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
func (*Extension[T]) AsTexture2D ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.NoiseTexture2D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsNoiseTexture2D ¶
func (Instance) AsNormalMap ¶
If true, the resulting texture contains a normal map created from the original noise interpreted as a bump map.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsTexture2D ¶
func (Instance) BumpStrength ¶
Strength of the bump maps used in this texture. A higher value will make the bump maps appear larger while a lower value will make them appear softer.
func (Instance) ColorRamp ¶
A Gradient which is used to map the luminance of each pixel to a color value.
func (Instance) GenerateMipmaps ¶
Determines whether mipmaps are generated for this texture. Enabling this results in less texture aliasing in the distance, at the cost of increasing memory usage by roughly 33% and making the noise texture generation take longer.
Note: GenerateMipmaps requires mipmap filtering to be enabled on the material using the NoiseTexture2D to have an effect.
func (Instance) In3dSpace ¶
Determines whether the noise image is calculated in 3D space. May result in reduced contrast.
func (Instance) Invert ¶
If true, inverts the noise texture. White becomes black, black becomes white.
func (Instance) Normalize ¶
If true, the noise image coming from the noise generator is normalized to the range 0.0 to 1.0.
Turning normalization off can affect the contrast and allows you to generate non repeating tileable noise textures.
func (Instance) Seamless ¶
If true, a seamless texture is requested from the Noise resource.
Note: Seamless noise textures may take longer to generate and/or can have a lower contrast compared to non-seamless noise depending on the used Noise resource. This is because some implementations use higher dimensions for generating seamless noise.
Note: The default FastNoiseLite implementation uses the fallback path for seamless generation. If using a Width or Height lower than the default, you may need to increase SeamlessBlendSkirt to make seamless blending more effective.
func (Instance) SeamlessBlendSkirt ¶
Used for the default/fallback implementation of the seamless texture generation. It determines the distance over which the seams are blended. High values may result in less details and contrast. See Noise for further details.
Note: If using a Width or Height lower than the default, you may need to increase SeamlessBlendSkirt to make seamless blending more effective.
func (Instance) SetAsNormalMap ¶
SetAsNormalMap sets the property returned by [IsNormalMap].
func (Instance) SetBumpStrength ¶
SetBumpStrength sets the property returned by [GetBumpStrength].
func (Instance) SetColorRamp ¶
SetColorRamp sets the property returned by [GetColorRamp].
func (Instance) SetGenerateMipmaps ¶
SetGenerateMipmaps sets the property returned by [IsGeneratingMipmaps].
func (Instance) SetIn3dSpace ¶
SetIn3dSpace sets the property returned by [IsIn3dSpace].
func (Instance) SetNormalize ¶
SetNormalize sets the property returned by [IsNormalized].
func (Instance) SetSeamless ¶
SetSeamless sets the property returned by [GetSeamless].
func (Instance) SetSeamlessBlendSkirt ¶
SetSeamlessBlendSkirt sets the property returned by [GetSeamlessBlendSkirt].