Struct gdnative_bindings::SpatialMaterial
source · pub struct SpatialMaterial { /* private fields */ }
Expand description
core class SpatialMaterial
inherits Material
(reference-counted).
This class has related types in the spatial_material
module.
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
Memory management
The lifetime of this object is automatically managed through reference counting.
Class hierarchy
SpatialMaterial inherits methods from:
Safety
All types in the Godot API have interior mutability in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref
and TRef
smart pointers,
and the Instance
API. The typestate Ownership
in these types tracks whether
ownership is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations§
source§impl SpatialMaterial
impl SpatialMaterial
Constants
pub const ASYNC_MODE_VISIBLE: i64 = 0i64
pub const BILLBOARD_DISABLED: i64 = 0i64
pub const BLEND_MODE_MIX: i64 = 0i64
pub const CULL_BACK: i64 = 0i64
pub const DEPTH_DRAW_OPAQUE_ONLY: i64 = 0i64
pub const DETAIL_UV_1: i64 = 0i64
pub const DIFFUSE_BURLEY: i64 = 0i64
pub const DISTANCE_FADE_DISABLED: i64 = 0i64
pub const EMISSION_OP_ADD: i64 = 0i64
pub const FEATURE_TRANSPARENT: i64 = 0i64
pub const FLAG_UNSHADED: i64 = 0i64
pub const SPECULAR_SCHLICK_GGX: i64 = 0i64
pub const TEXTURE_ALBEDO: i64 = 0i64
pub const TEXTURE_CHANNEL_RED: i64 = 0i64
pub const ASYNC_MODE_HIDDEN: i64 = 1i64
pub const BILLBOARD_ENABLED: i64 = 1i64
pub const BLEND_MODE_ADD: i64 = 1i64
pub const CULL_FRONT: i64 = 1i64
pub const DEPTH_DRAW_ALWAYS: i64 = 1i64
pub const DETAIL_UV_2: i64 = 1i64
pub const DIFFUSE_LAMBERT: i64 = 1i64
pub const DISTANCE_FADE_PIXEL_ALPHA: i64 = 1i64
pub const EMISSION_OP_MULTIPLY: i64 = 1i64
pub const FEATURE_EMISSION: i64 = 1i64
pub const FLAG_USE_VERTEX_LIGHTING: i64 = 1i64
pub const SPECULAR_BLINN: i64 = 1i64
pub const TEXTURE_CHANNEL_GREEN: i64 = 1i64
pub const TEXTURE_METALLIC: i64 = 1i64
pub const BILLBOARD_FIXED_Y: i64 = 2i64
pub const BLEND_MODE_SUB: i64 = 2i64
pub const CULL_DISABLED: i64 = 2i64
pub const DEPTH_DRAW_DISABLED: i64 = 2i64
pub const DIFFUSE_LAMBERT_WRAP: i64 = 2i64
pub const DISTANCE_FADE_PIXEL_DITHER: i64 = 2i64
pub const FEATURE_NORMAL_MAPPING: i64 = 2i64
pub const FLAG_DISABLE_DEPTH_TEST: i64 = 2i64
pub const SPECULAR_PHONG: i64 = 2i64
pub const TEXTURE_CHANNEL_BLUE: i64 = 2i64
pub const TEXTURE_ROUGHNESS: i64 = 2i64
pub const BILLBOARD_PARTICLES: i64 = 3i64
pub const BLEND_MODE_MUL: i64 = 3i64
pub const DEPTH_DRAW_ALPHA_OPAQUE_PREPASS: i64 = 3i64
pub const DIFFUSE_OREN_NAYAR: i64 = 3i64
pub const DISTANCE_FADE_OBJECT_DITHER: i64 = 3i64
pub const FEATURE_RIM: i64 = 3i64
pub const FLAG_ALBEDO_FROM_VERTEX_COLOR: i64 = 3i64
pub const SPECULAR_TOON: i64 = 3i64
pub const TEXTURE_CHANNEL_ALPHA: i64 = 3i64
pub const TEXTURE_EMISSION: i64 = 3i64
pub const DIFFUSE_TOON: i64 = 4i64
pub const FEATURE_CLEARCOAT: i64 = 4i64
pub const FLAG_SRGB_VERTEX_COLOR: i64 = 4i64
pub const SPECULAR_DISABLED: i64 = 4i64
pub const TEXTURE_CHANNEL_GRAYSCALE: i64 = 4i64
pub const TEXTURE_NORMAL: i64 = 4i64
pub const FEATURE_ANISOTROPY: i64 = 5i64
pub const FLAG_USE_POINT_SIZE: i64 = 5i64
pub const TEXTURE_RIM: i64 = 5i64
pub const FEATURE_AMBIENT_OCCLUSION: i64 = 6i64
pub const FLAG_FIXED_SIZE: i64 = 6i64
pub const TEXTURE_CLEARCOAT: i64 = 6i64
pub const FEATURE_DEPTH_MAPPING: i64 = 7i64
pub const FLAG_BILLBOARD_KEEP_SCALE: i64 = 7i64
pub const TEXTURE_FLOWMAP: i64 = 7i64
pub const FEATURE_SUBSURACE_SCATTERING: i64 = 8i64
pub const FLAG_UV1_USE_TRIPLANAR: i64 = 8i64
pub const TEXTURE_AMBIENT_OCCLUSION: i64 = 8i64
pub const FEATURE_TRANSMISSION: i64 = 9i64
pub const FLAG_UV2_USE_TRIPLANAR: i64 = 9i64
pub const TEXTURE_DEPTH: i64 = 9i64
pub const FEATURE_REFRACTION: i64 = 10i64
pub const FLAG_TRIPLANAR_USE_WORLD: i64 = 10i64
pub const TEXTURE_SUBSURFACE_SCATTERING: i64 = 10i64
pub const FEATURE_DETAIL: i64 = 11i64
pub const FLAG_AO_ON_UV2: i64 = 11i64
pub const TEXTURE_TRANSMISSION: i64 = 11i64
pub const FEATURE_MAX: i64 = 12i64
pub const FLAG_EMISSION_ON_UV2: i64 = 12i64
pub const TEXTURE_REFRACTION: i64 = 12i64
pub const FLAG_USE_ALPHA_SCISSOR: i64 = 13i64
pub const TEXTURE_DETAIL_MASK: i64 = 13i64
pub const FLAG_ALBEDO_TEXTURE_FORCE_SRGB: i64 = 14i64
pub const TEXTURE_DETAIL_ALBEDO: i64 = 14i64
pub const FLAG_DONT_RECEIVE_SHADOWS: i64 = 15i64
pub const TEXTURE_DETAIL_NORMAL: i64 = 15i64
pub const FLAG_ENSURE_CORRECT_NORMALS: i64 = 16i64
pub const TEXTURE_MAX: i64 = 16i64
pub const FLAG_DISABLE_AMBIENT_LIGHT: i64 = 17i64
pub const FLAG_USE_SHADOW_TO_OPACITY: i64 = 18i64
pub const FLAG_ALBEDO_TEXTURE_SDF: i64 = 19i64
pub const FLAG_MAX: i64 = 20i64
source§impl SpatialMaterial
impl SpatialMaterial
sourcepub fn new() -> Ref<Self, Unique>
pub fn new() -> Ref<Self, Unique>
Creates a new instance of this object.
This is a reference-counted type. The returned object is automatically managed
by Ref
.
sourcepub fn alpha_scissor_threshold(&self) -> f64
pub fn alpha_scissor_threshold(&self) -> f64
Threshold at which the alpha scissor will discard values.
sourcepub fn anisotropy(&self) -> f64
pub fn anisotropy(&self) -> f64
The strength of the anisotropy effect. This is multiplied by anisotropy_flowmap
’s alpha channel if a texture is defined there and the texture contains an alpha channel.
sourcepub fn ao_light_affect(&self) -> f64
pub fn ao_light_affect(&self) -> f64
Amount that ambient occlusion affects lighting from lights. If 0
, ambient occlusion only affects ambient light. If 1
, ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
sourcepub fn ao_texture_channel(&self) -> TextureChannel
pub fn ao_texture_channel(&self) -> TextureChannel
Specifies the channel of the ao_texture
in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn async_mode(&self) -> AsyncMode
pub fn async_mode(&self) -> AsyncMode
If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is Synchronous
(with or without cache), this determines how this material must behave in regards to asynchronous shader compilation.
ASYNC_MODE_VISIBLE
is the default and the best for most cases.
sourcepub fn billboard_mode(&self) -> BillboardMode
pub fn billboard_mode(&self) -> BillboardMode
Controls how the object faces the camera. See BillboardMode
.
Note: Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See GitHub issue #41567 for details.
sourcepub fn blend_mode(&self) -> BlendMode
pub fn blend_mode(&self) -> BlendMode
The material’s blend mode.
Note: Values other than Mix
force the object into the transparent pipeline. See BlendMode
.
sourcepub fn clearcoat(&self) -> f64
pub fn clearcoat(&self) -> f64
Sets the strength of the clearcoat effect. Setting to 0
looks the same as disabling the clearcoat effect.
sourcepub fn clearcoat_gloss(&self) -> f64
pub fn clearcoat_gloss(&self) -> f64
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
sourcepub fn cull_mode(&self) -> CullMode
pub fn cull_mode(&self) -> CullMode
Which side of the object is not drawn when backfaces are rendered. See CullMode
.
sourcepub fn depth_deep_parallax_flip_binormal(&self) -> bool
pub fn depth_deep_parallax_flip_binormal(&self) -> bool
If true
, direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
sourcepub fn depth_deep_parallax_flip_tangent(&self) -> bool
pub fn depth_deep_parallax_flip_tangent(&self) -> bool
If true
, direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
sourcepub fn depth_deep_parallax_max_layers(&self) -> i64
pub fn depth_deep_parallax_max_layers(&self) -> i64
Number of layers to use when using [depth_deep_parallax
][Self::depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn depth_deep_parallax_min_layers(&self) -> i64
pub fn depth_deep_parallax_min_layers(&self) -> i64
Number of layers to use when using [depth_deep_parallax
][Self::depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn depth_draw_mode(&self) -> DepthDrawMode
pub fn depth_draw_mode(&self) -> DepthDrawMode
Determines when depth rendering takes place. See DepthDrawMode
. See also flags_transparent
.
sourcepub fn depth_scale(&self) -> f64
pub fn depth_scale(&self) -> f64
Scales the depth offset effect. A higher number will create a larger depth.
sourcepub fn detail_blend_mode(&self) -> BlendMode
pub fn detail_blend_mode(&self) -> BlendMode
Specifies how the detail_albedo
should blend with the current ALBEDO
. See BlendMode
for options.
sourcepub fn detail_uv(&self) -> DetailUv
pub fn detail_uv(&self) -> DetailUv
Specifies whether to use UV
or UV2
for the detail layer. See [DetailUV
][DetailUV] for options.
sourcepub fn diffuse_mode(&self) -> DiffuseMode
pub fn diffuse_mode(&self) -> DiffuseMode
The algorithm used for diffuse light scattering. See DiffuseMode
.
sourcepub fn distance_fade(&self) -> DistanceFadeMode
pub fn distance_fade(&self) -> DistanceFadeMode
Specifies which type of fade to use. Can be any of the DistanceFadeMode
s.
sourcepub fn distance_fade_max_distance(&self) -> f64
pub fn distance_fade_max_distance(&self) -> f64
Distance at which the object appears fully opaque.
Note: If distance_fade_max_distance
is less than distance_fade_min_distance
, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance
and will fully disappear once it reaches distance_fade_min_distance
.
sourcepub fn distance_fade_min_distance(&self) -> f64
pub fn distance_fade_min_distance(&self) -> f64
Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
Note: If distance_fade_min_distance
is greater than distance_fade_max_distance
, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance
and will fully disappear once it reaches distance_fade_min_distance
.
sourcepub fn emission(&self) -> Color
pub fn emission(&self) -> Color
The emitted light’s color. See emission_enabled
.
sourcepub fn emission_energy(&self) -> f64
pub fn emission_energy(&self) -> f64
The emitted light’s strength. See emission_enabled
.
sourcepub fn emission_operator(&self) -> EmissionOperator
pub fn emission_operator(&self) -> EmissionOperator
Sets how emission
interacts with emission_texture
. Can either add or multiply. See EmissionOperator
for options.
sourcepub fn flag(&self, flag: i64) -> bool
pub fn flag(&self, flag: i64) -> bool
Returns true
, if the specified flag is enabled. See Flags
enumerator for options.
sourcepub fn line_width(&self) -> f64
pub fn line_width(&self) -> f64
Currently unimplemented in Godot.
sourcepub fn metallic(&self) -> f64
pub fn metallic(&self) -> f64
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between 0
and 1
should only be used for blending between metal and non-metal sections. To alter the amount of reflection use roughness
.
sourcepub fn metallic_texture_channel(&self) -> TextureChannel
pub fn metallic_texture_channel(&self) -> TextureChannel
Specifies the channel of the metallic_texture
in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn normal_scale(&self) -> f64
pub fn normal_scale(&self) -> f64
The strength of the normal map’s effect.
sourcepub fn particles_anim_h_frames(&self) -> i64
pub fn particles_anim_h_frames(&self) -> i64
The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES
. See [params_billboard_mode
][Self::params_billboard_mode].
sourcepub fn particles_anim_loop(&self) -> bool
pub fn particles_anim_loop(&self) -> bool
If true
, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES
. See [params_billboard_mode
][Self::params_billboard_mode].
sourcepub fn particles_anim_v_frames(&self) -> i64
pub fn particles_anim_v_frames(&self) -> i64
The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES
. See [params_billboard_mode
][Self::params_billboard_mode].
sourcepub fn point_size(&self) -> f64
pub fn point_size(&self) -> f64
The point size in pixels. See flags_use_point_size
.
sourcepub fn proximity_fade_distance(&self) -> f64
pub fn proximity_fade_distance(&self) -> f64
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
sourcepub fn refraction(&self) -> f64
pub fn refraction(&self) -> f64
The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
sourcepub fn refraction_texture_channel(&self) -> TextureChannel
pub fn refraction_texture_channel(&self) -> TextureChannel
Specifies the channel of the refraction_texture
in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn rim_tint(&self) -> f64
pub fn rim_tint(&self) -> f64
The amount of to blend light and albedo color when rendering rim effect. If 0
the light color is used, while 1
means albedo color is used. An intermediate value generally works best.
sourcepub fn roughness(&self) -> f64
pub fn roughness(&self) -> f64
Surface reflection. A value of 0
represents a perfect mirror while a value of 1
completely blurs the reflection. See also metallic
.
sourcepub fn roughness_texture_channel(&self) -> TextureChannel
pub fn roughness_texture_channel(&self) -> TextureChannel
Specifies the channel of the ao_texture
in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn specular_mode(&self) -> SpecularMode
pub fn specular_mode(&self) -> SpecularMode
The method for rendering the specular blob. See SpecularMode
.
sourcepub fn subsurface_scattering_strength(&self) -> f64
pub fn subsurface_scattering_strength(&self) -> f64
The strength of the subsurface scattering effect.
sourcepub fn texture(&self, param: i64) -> Option<Ref<Texture, Shared>>
pub fn texture(&self, param: i64) -> Option<Ref<Texture, Shared>>
Returns the Texture
associated with the specified TextureParam
.
sourcepub fn transmission(&self) -> Color
pub fn transmission(&self) -> Color
The color used by the transmission effect. Represents the light passing through an object.
sourcepub fn uv1_offset(&self) -> Vector3
pub fn uv1_offset(&self) -> Vector3
How much to offset the UV
coordinates. This amount will be added to UV
in the vertex function. This can be used to offset a texture.
sourcepub fn uv1_scale(&self) -> Vector3
pub fn uv1_scale(&self) -> Vector3
How much to scale the UV
coordinates. This is multiplied by UV
in the vertex function.
sourcepub fn uv1_triplanar_blend_sharpness(&self) -> f64
pub fn uv1_triplanar_blend_sharpness(&self) -> f64
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn uv2_offset(&self) -> Vector3
pub fn uv2_offset(&self) -> Vector3
How much to offset the UV2
coordinates. This amount will be added to UV2
in the vertex function. This can be used to offset a texture.
sourcepub fn uv2_scale(&self) -> Vector3
pub fn uv2_scale(&self) -> Vector3
How much to scale the UV2
coordinates. This is multiplied by UV2
in the vertex function.
sourcepub fn uv2_triplanar_blend_sharpness(&self) -> f64
pub fn uv2_triplanar_blend_sharpness(&self) -> f64
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn is_depth_deep_parallax_enabled(&self) -> bool
pub fn is_depth_deep_parallax_enabled(&self) -> bool
If true
, the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
sourcepub fn is_grow_enabled(&self) -> bool
pub fn is_grow_enabled(&self) -> bool
If true
, enables the vertex grow setting. See [params_grow_amount
][Self::params_grow_amount].
sourcepub fn is_proximity_fade_enabled(&self) -> bool
pub fn is_proximity_fade_enabled(&self) -> bool
If true
, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
sourcepub fn set_albedo(&self, albedo: Color)
pub fn set_albedo(&self, albedo: Color)
The material’s base color.
sourcepub fn set_alpha_scissor_threshold(&self, threshold: f64)
pub fn set_alpha_scissor_threshold(&self, threshold: f64)
Threshold at which the alpha scissor will discard values.
sourcepub fn set_anisotropy(&self, anisotropy: f64)
pub fn set_anisotropy(&self, anisotropy: f64)
The strength of the anisotropy effect. This is multiplied by anisotropy_flowmap
’s alpha channel if a texture is defined there and the texture contains an alpha channel.
sourcepub fn set_ao_light_affect(&self, amount: f64)
pub fn set_ao_light_affect(&self, amount: f64)
Amount that ambient occlusion affects lighting from lights. If 0
, ambient occlusion only affects ambient light. If 1
, ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
sourcepub fn set_ao_texture_channel(&self, channel: i64)
pub fn set_ao_texture_channel(&self, channel: i64)
Specifies the channel of the ao_texture
in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_async_mode(&self, mode: i64)
pub fn set_async_mode(&self, mode: i64)
If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is Synchronous
(with or without cache), this determines how this material must behave in regards to asynchronous shader compilation.
ASYNC_MODE_VISIBLE
is the default and the best for most cases.
sourcepub fn set_billboard_mode(&self, mode: i64)
pub fn set_billboard_mode(&self, mode: i64)
Controls how the object faces the camera. See BillboardMode
.
Note: Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See GitHub issue #41567 for details.
sourcepub fn set_blend_mode(&self, blend_mode: i64)
pub fn set_blend_mode(&self, blend_mode: i64)
The material’s blend mode.
Note: Values other than Mix
force the object into the transparent pipeline. See BlendMode
.
sourcepub fn set_clearcoat(&self, clearcoat: f64)
pub fn set_clearcoat(&self, clearcoat: f64)
Sets the strength of the clearcoat effect. Setting to 0
looks the same as disabling the clearcoat effect.
sourcepub fn set_clearcoat_gloss(&self, clearcoat_gloss: f64)
pub fn set_clearcoat_gloss(&self, clearcoat_gloss: f64)
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
sourcepub fn set_cull_mode(&self, cull_mode: i64)
pub fn set_cull_mode(&self, cull_mode: i64)
Which side of the object is not drawn when backfaces are rendered. See CullMode
.
sourcepub fn set_depth_deep_parallax(&self, enable: bool)
pub fn set_depth_deep_parallax(&self, enable: bool)
If true
, the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
sourcepub fn set_depth_deep_parallax_flip_binormal(&self, flip: bool)
pub fn set_depth_deep_parallax_flip_binormal(&self, flip: bool)
If true
, direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
sourcepub fn set_depth_deep_parallax_flip_tangent(&self, flip: bool)
pub fn set_depth_deep_parallax_flip_tangent(&self, flip: bool)
If true
, direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
sourcepub fn set_depth_deep_parallax_max_layers(&self, layer: i64)
pub fn set_depth_deep_parallax_max_layers(&self, layer: i64)
Number of layers to use when using [depth_deep_parallax
][Self::depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn set_depth_deep_parallax_min_layers(&self, layer: i64)
pub fn set_depth_deep_parallax_min_layers(&self, layer: i64)
Number of layers to use when using [depth_deep_parallax
][Self::depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn set_depth_draw_mode(&self, depth_draw_mode: i64)
pub fn set_depth_draw_mode(&self, depth_draw_mode: i64)
Determines when depth rendering takes place. See DepthDrawMode
. See also flags_transparent
.
sourcepub fn set_depth_scale(&self, depth_scale: f64)
pub fn set_depth_scale(&self, depth_scale: f64)
Scales the depth offset effect. A higher number will create a larger depth.
sourcepub fn set_detail_blend_mode(&self, detail_blend_mode: i64)
pub fn set_detail_blend_mode(&self, detail_blend_mode: i64)
Specifies how the detail_albedo
should blend with the current ALBEDO
. See BlendMode
for options.
sourcepub fn set_detail_uv(&self, detail_uv: i64)
pub fn set_detail_uv(&self, detail_uv: i64)
Specifies whether to use UV
or UV2
for the detail layer. See [DetailUV
][DetailUV] for options.
sourcepub fn set_diffuse_mode(&self, diffuse_mode: i64)
pub fn set_diffuse_mode(&self, diffuse_mode: i64)
The algorithm used for diffuse light scattering. See DiffuseMode
.
sourcepub fn set_distance_fade(&self, mode: i64)
pub fn set_distance_fade(&self, mode: i64)
Specifies which type of fade to use. Can be any of the DistanceFadeMode
s.
sourcepub fn set_distance_fade_max_distance(&self, distance: f64)
pub fn set_distance_fade_max_distance(&self, distance: f64)
Distance at which the object appears fully opaque.
Note: If distance_fade_max_distance
is less than distance_fade_min_distance
, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance
and will fully disappear once it reaches distance_fade_min_distance
.
sourcepub fn set_distance_fade_min_distance(&self, distance: f64)
pub fn set_distance_fade_min_distance(&self, distance: f64)
Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
Note: If distance_fade_min_distance
is greater than distance_fade_max_distance
, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance
and will fully disappear once it reaches distance_fade_min_distance
.
sourcepub fn set_emission(&self, emission: Color)
pub fn set_emission(&self, emission: Color)
The emitted light’s color. See emission_enabled
.
sourcepub fn set_emission_energy(&self, emission_energy: f64)
pub fn set_emission_energy(&self, emission_energy: f64)
The emitted light’s strength. See emission_enabled
.
sourcepub fn set_emission_operator(&self, operator: i64)
pub fn set_emission_operator(&self, operator: i64)
Sets how emission
interacts with emission_texture
. Can either add or multiply. See EmissionOperator
for options.
sourcepub fn set_feature(&self, feature: i64, enable: bool)
pub fn set_feature(&self, feature: i64, enable: bool)
If true
, enables the specified Feature
. Many features that are available in SpatialMaterial
s need to be enabled before use. This way the cost for using the feature is only incurred when specified. Features can also be enabled by setting the corresponding member to true
.
sourcepub fn set_flag(&self, flag: i64, enable: bool)
pub fn set_flag(&self, flag: i64, enable: bool)
If true
, enables the specified flag. Flags are optional behavior that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to true
. See Flags
enumerator for options.
sourcepub fn set_grow_enabled(&self, enable: bool)
pub fn set_grow_enabled(&self, enable: bool)
If true
, enables the vertex grow setting. See [params_grow_amount
][Self::params_grow_amount].
sourcepub fn set_line_width(&self, line_width: f64)
pub fn set_line_width(&self, line_width: f64)
Currently unimplemented in Godot.
sourcepub fn set_metallic(&self, metallic: f64)
pub fn set_metallic(&self, metallic: f64)
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between 0
and 1
should only be used for blending between metal and non-metal sections. To alter the amount of reflection use roughness
.
sourcepub fn set_metallic_texture_channel(&self, channel: i64)
pub fn set_metallic_texture_channel(&self, channel: i64)
Specifies the channel of the metallic_texture
in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_normal_scale(&self, normal_scale: f64)
pub fn set_normal_scale(&self, normal_scale: f64)
The strength of the normal map’s effect.
sourcepub fn set_particles_anim_h_frames(&self, frames: i64)
pub fn set_particles_anim_h_frames(&self, frames: i64)
The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES
. See [params_billboard_mode
][Self::params_billboard_mode].
sourcepub fn set_particles_anim_loop(&self, loop_: bool)
pub fn set_particles_anim_loop(&self, loop_: bool)
If true
, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES
. See [params_billboard_mode
][Self::params_billboard_mode].
sourcepub fn set_particles_anim_v_frames(&self, frames: i64)
pub fn set_particles_anim_v_frames(&self, frames: i64)
The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES
. See [params_billboard_mode
][Self::params_billboard_mode].
sourcepub fn set_point_size(&self, point_size: f64)
pub fn set_point_size(&self, point_size: f64)
The point size in pixels. See flags_use_point_size
.
sourcepub fn set_proximity_fade(&self, enabled: bool)
pub fn set_proximity_fade(&self, enabled: bool)
If true
, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
sourcepub fn set_proximity_fade_distance(&self, distance: f64)
pub fn set_proximity_fade_distance(&self, distance: f64)
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
sourcepub fn set_refraction(&self, refraction: f64)
pub fn set_refraction(&self, refraction: f64)
The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
sourcepub fn set_refraction_texture_channel(&self, channel: i64)
pub fn set_refraction_texture_channel(&self, channel: i64)
Specifies the channel of the refraction_texture
in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_rim_tint(&self, rim_tint: f64)
pub fn set_rim_tint(&self, rim_tint: f64)
The amount of to blend light and albedo color when rendering rim effect. If 0
the light color is used, while 1
means albedo color is used. An intermediate value generally works best.
sourcepub fn set_roughness(&self, roughness: f64)
pub fn set_roughness(&self, roughness: f64)
Surface reflection. A value of 0
represents a perfect mirror while a value of 1
completely blurs the reflection. See also metallic
.
sourcepub fn set_roughness_texture_channel(&self, channel: i64)
pub fn set_roughness_texture_channel(&self, channel: i64)
Specifies the channel of the ao_texture
in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_specular(&self, specular: f64)
pub fn set_specular(&self, specular: f64)
sourcepub fn set_specular_mode(&self, specular_mode: i64)
pub fn set_specular_mode(&self, specular_mode: i64)
The method for rendering the specular blob. See SpecularMode
.
sourcepub fn set_subsurface_scattering_strength(&self, strength: f64)
pub fn set_subsurface_scattering_strength(&self, strength: f64)
The strength of the subsurface scattering effect.
sourcepub fn set_texture(&self, param: i64, texture: impl AsArg<Texture>)
pub fn set_texture(&self, param: i64, texture: impl AsArg<Texture>)
Sets the Texture
to be used by the specified TextureParam
. This function is called when setting members ending in *_texture
.
sourcepub fn set_transmission(&self, transmission: Color)
pub fn set_transmission(&self, transmission: Color)
The color used by the transmission effect. Represents the light passing through an object.
sourcepub fn set_uv1_offset(&self, offset: Vector3)
pub fn set_uv1_offset(&self, offset: Vector3)
How much to offset the UV
coordinates. This amount will be added to UV
in the vertex function. This can be used to offset a texture.
sourcepub fn set_uv1_scale(&self, scale: Vector3)
pub fn set_uv1_scale(&self, scale: Vector3)
How much to scale the UV
coordinates. This is multiplied by UV
in the vertex function.
sourcepub fn set_uv1_triplanar_blend_sharpness(&self, sharpness: f64)
pub fn set_uv1_triplanar_blend_sharpness(&self, sharpness: f64)
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn set_uv2_offset(&self, offset: Vector3)
pub fn set_uv2_offset(&self, offset: Vector3)
How much to offset the UV2
coordinates. This amount will be added to UV2
in the vertex function. This can be used to offset a texture.
sourcepub fn set_uv2_scale(&self, scale: Vector3)
pub fn set_uv2_scale(&self, scale: Vector3)
How much to scale the UV2
coordinates. This is multiplied by UV2
in the vertex function.
sourcepub fn set_uv2_triplanar_blend_sharpness(&self, sharpness: f64)
pub fn set_uv2_triplanar_blend_sharpness(&self, sharpness: f64)
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn albedo_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn albedo_texture(&self) -> Option<Ref<Texture, Shared>>
Texture to multiply by [albedo_color
][Self::albedo_color]. Used for basic texturing of objects.
sourcepub fn set_albedo_texture(&self, value: impl AsArg<Texture>)
pub fn set_albedo_texture(&self, value: impl AsArg<Texture>)
Texture to multiply by [albedo_color
][Self::albedo_color]. Used for basic texturing of objects.
sourcepub fn anisotropy_enabled(&self) -> bool
pub fn anisotropy_enabled(&self) -> bool
If true
, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections.
Note: Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.
Note: Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the Anisotropic checkbox then clicking Reimport. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].
sourcepub fn set_anisotropy_enabled(&self, value: bool)
pub fn set_anisotropy_enabled(&self, value: bool)
If true
, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections.
Note: Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.
Note: Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the Anisotropic checkbox then clicking Reimport. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].
sourcepub fn anisotropy_flowmap(&self) -> Option<Ref<Texture, Shared>>
pub fn anisotropy_flowmap(&self) -> Option<Ref<Texture, Shared>>
Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.
If present, the texture’s alpha channel will be used to multiply the strength of the anisotropy
effect. Fully opaque pixels will keep the anisotropy effect’s original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture’s blue channel is ignored.
sourcepub fn set_anisotropy_flowmap(&self, value: impl AsArg<Texture>)
pub fn set_anisotropy_flowmap(&self, value: impl AsArg<Texture>)
Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.
If present, the texture’s alpha channel will be used to multiply the strength of the anisotropy
effect. Fully opaque pixels will keep the anisotropy effect’s original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture’s blue channel is ignored.
sourcepub fn ao_enabled(&self) -> bool
pub fn ao_enabled(&self) -> bool
If true
, ambient occlusion is enabled. Ambient occlusion darkens areas based on the ao_texture
.
sourcepub fn set_ao_enabled(&self, value: bool)
pub fn set_ao_enabled(&self, value: bool)
If true
, ambient occlusion is enabled. Ambient occlusion darkens areas based on the ao_texture
.
sourcepub fn ao_on_uv2(&self) -> bool
pub fn ao_on_uv2(&self) -> bool
If true
, use UV2
coordinates to look up from the ao_texture
.
sourcepub fn set_ao_on_uv2(&self, value: bool)
pub fn set_ao_on_uv2(&self, value: bool)
If true
, use UV2
coordinates to look up from the ao_texture
.
sourcepub fn ao_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn ao_texture(&self) -> Option<Ref<Texture, Shared>>
Texture that defines the amount of ambient occlusion for a given point on the object.
sourcepub fn set_ao_texture(&self, value: impl AsArg<Texture>)
pub fn set_ao_texture(&self, value: impl AsArg<Texture>)
Texture that defines the amount of ambient occlusion for a given point on the object.
sourcepub fn clearcoat_enabled(&self) -> bool
pub fn clearcoat_enabled(&self) -> bool
If true
, clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
Note: Clearcoat rendering is not visible if the material has flags_unshaded
set to true
.
sourcepub fn set_clearcoat_enabled(&self, value: bool)
pub fn set_clearcoat_enabled(&self, value: bool)
If true
, clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
Note: Clearcoat rendering is not visible if the material has flags_unshaded
set to true
.
sourcepub fn clearcoat_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn clearcoat_texture(&self) -> Option<Ref<Texture, Shared>>
Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
sourcepub fn set_clearcoat_texture(&self, value: impl AsArg<Texture>)
pub fn set_clearcoat_texture(&self, value: impl AsArg<Texture>)
Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
sourcepub fn depth_enabled(&self) -> bool
pub fn depth_enabled(&self) -> bool
If true
, depth mapping is enabled (also called “parallax mapping” or “height mapping”). See also normal_enabled
.
Note: Depth mapping is not supported if triplanar mapping is used on the same material. The value of depth_enabled
will be ignored if uv1_triplanar
is enabled.
sourcepub fn set_depth_enabled(&self, value: bool)
pub fn set_depth_enabled(&self, value: bool)
If true
, depth mapping is enabled (also called “parallax mapping” or “height mapping”). See also normal_enabled
.
Note: Depth mapping is not supported if triplanar mapping is used on the same material. The value of depth_enabled
will be ignored if uv1_triplanar
is enabled.
sourcepub fn depth_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn depth_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
sourcepub fn set_depth_texture(&self, value: impl AsArg<Texture>)
pub fn set_depth_texture(&self, value: impl AsArg<Texture>)
Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
sourcepub fn detail_albedo(&self) -> Option<Ref<Texture, Shared>>
pub fn detail_albedo(&self) -> Option<Ref<Texture, Shared>>
Texture that specifies the color of the detail overlay.
sourcepub fn set_detail_albedo(&self, value: impl AsArg<Texture>)
pub fn set_detail_albedo(&self, value: impl AsArg<Texture>)
Texture that specifies the color of the detail overlay.
sourcepub fn detail_enabled(&self) -> bool
pub fn detail_enabled(&self) -> bool
If true
, enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on detail_mask
. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
sourcepub fn set_detail_enabled(&self, value: bool)
pub fn set_detail_enabled(&self, value: bool)
If true
, enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on detail_mask
. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
sourcepub fn detail_mask(&self) -> Option<Ref<Texture, Shared>>
pub fn detail_mask(&self) -> Option<Ref<Texture, Shared>>
Texture used to specify how the detail textures get blended with the base textures.
sourcepub fn set_detail_mask(&self, value: impl AsArg<Texture>)
pub fn set_detail_mask(&self, value: impl AsArg<Texture>)
Texture used to specify how the detail textures get blended with the base textures.
sourcepub fn detail_normal(&self) -> Option<Ref<Texture, Shared>>
pub fn detail_normal(&self) -> Option<Ref<Texture, Shared>>
Texture that specifies the per-pixel normal of the detail overlay. Note: Godot expects the normal map to use X+, Y+, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.
sourcepub fn set_detail_normal(&self, value: impl AsArg<Texture>)
pub fn set_detail_normal(&self, value: impl AsArg<Texture>)
Texture that specifies the per-pixel normal of the detail overlay. Note: Godot expects the normal map to use X+, Y+, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.
sourcepub fn emission_enabled(&self) -> bool
pub fn emission_enabled(&self) -> bool
If true
, the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a GIProbe
or BakedLightmap
is used and this object is used in baked lighting.
sourcepub fn set_emission_enabled(&self, value: bool)
pub fn set_emission_enabled(&self, value: bool)
If true
, the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a GIProbe
or BakedLightmap
is used and this object is used in baked lighting.
sourcepub fn emission_on_uv2(&self) -> bool
pub fn emission_on_uv2(&self) -> bool
Use UV2
to read from the emission_texture
.
sourcepub fn set_emission_on_uv2(&self, value: bool)
pub fn set_emission_on_uv2(&self, value: bool)
Use UV2
to read from the emission_texture
.
sourcepub fn emission_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn emission_texture(&self) -> Option<Ref<Texture, Shared>>
Texture that specifies how much surface emits light at a given point.
sourcepub fn set_emission_texture(&self, value: impl AsArg<Texture>)
pub fn set_emission_texture(&self, value: impl AsArg<Texture>)
Texture that specifies how much surface emits light at a given point.
sourcepub fn flags_albedo_tex_force_srgb(&self) -> bool
pub fn flags_albedo_tex_force_srgb(&self) -> bool
Forces a conversion of the albedo_texture
from sRGB space to linear space.
sourcepub fn set_flags_albedo_tex_force_srgb(&self, value: bool)
pub fn set_flags_albedo_tex_force_srgb(&self, value: bool)
Forces a conversion of the albedo_texture
from sRGB space to linear space.
sourcepub fn flags_albedo_tex_msdf(&self) -> bool
pub fn flags_albedo_tex_msdf(&self) -> bool
Enables signed distance field rendering shader.
sourcepub fn set_flags_albedo_tex_msdf(&self, value: bool)
pub fn set_flags_albedo_tex_msdf(&self, value: bool)
Enables signed distance field rendering shader.
sourcepub fn flags_disable_ambient_light(&self) -> bool
pub fn flags_disable_ambient_light(&self) -> bool
If true
, the object receives no ambient light.
sourcepub fn set_flags_disable_ambient_light(&self, value: bool)
pub fn set_flags_disable_ambient_light(&self, value: bool)
If true
, the object receives no ambient light.
sourcepub fn flags_do_not_receive_shadows(&self) -> bool
pub fn flags_do_not_receive_shadows(&self) -> bool
If true
, the object receives no shadow that would otherwise be cast onto it.
sourcepub fn set_flags_do_not_receive_shadows(&self, value: bool)
pub fn set_flags_do_not_receive_shadows(&self, value: bool)
If true
, the object receives no shadow that would otherwise be cast onto it.
sourcepub fn flags_ensure_correct_normals(&self) -> bool
pub fn flags_ensure_correct_normals(&self) -> bool
If true
, the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
sourcepub fn set_flags_ensure_correct_normals(&self, value: bool)
pub fn set_flags_ensure_correct_normals(&self, value: bool)
If true
, the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
sourcepub fn flags_fixed_size(&self) -> bool
pub fn flags_fixed_size(&self) -> bool
If true
, the object is rendered at the same size regardless of distance.
sourcepub fn set_flags_fixed_size(&self, value: bool)
pub fn set_flags_fixed_size(&self, value: bool)
If true
, the object is rendered at the same size regardless of distance.
sourcepub fn flags_no_depth_test(&self) -> bool
pub fn flags_no_depth_test(&self) -> bool
If true
, depth testing is disabled and the object will be drawn in render order.
sourcepub fn set_flags_no_depth_test(&self, value: bool)
pub fn set_flags_no_depth_test(&self, value: bool)
If true
, depth testing is disabled and the object will be drawn in render order.
sourcepub fn flags_transparent(&self) -> bool
pub fn flags_transparent(&self) -> bool
If true
, transparency is enabled on the body. See also [params_blend_mode
][Self::params_blend_mode].
sourcepub fn set_flags_transparent(&self, value: bool)
pub fn set_flags_transparent(&self, value: bool)
If true
, transparency is enabled on the body. See also [params_blend_mode
][Self::params_blend_mode].
sourcepub fn flags_unshaded(&self) -> bool
pub fn flags_unshaded(&self) -> bool
If true
, the object is unaffected by lighting.
sourcepub fn set_flags_unshaded(&self, value: bool)
pub fn set_flags_unshaded(&self, value: bool)
If true
, the object is unaffected by lighting.
sourcepub fn flags_use_point_size(&self) -> bool
pub fn flags_use_point_size(&self) -> bool
If true
, render point size can be changed.
Note: This is only effective for objects whose geometry is point-based rather than triangle-based. See also [params_point_size
][Self::params_point_size].
sourcepub fn set_flags_use_point_size(&self, value: bool)
pub fn set_flags_use_point_size(&self, value: bool)
If true
, render point size can be changed.
Note: This is only effective for objects whose geometry is point-based rather than triangle-based. See also [params_point_size
][Self::params_point_size].
sourcepub fn flags_use_shadow_to_opacity(&self) -> bool
pub fn flags_use_shadow_to_opacity(&self) -> bool
If true
, enables the “shadow to opacity” render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
sourcepub fn set_flags_use_shadow_to_opacity(&self, value: bool)
pub fn set_flags_use_shadow_to_opacity(&self, value: bool)
If true
, enables the “shadow to opacity” render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
sourcepub fn flags_vertex_lighting(&self) -> bool
pub fn flags_vertex_lighting(&self) -> bool
If true
, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials.
Note: By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]’s mobile
override.
Note: flags_vertex_lighting
has no effect if flags_unshaded
is true
.
sourcepub fn set_flags_vertex_lighting(&self, value: bool)
pub fn set_flags_vertex_lighting(&self, value: bool)
If true
, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled.
See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials.
Note: By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]’s mobile
override.
Note: flags_vertex_lighting
has no effect if flags_unshaded
is true
.
sourcepub fn flags_world_triplanar(&self) -> bool
pub fn flags_world_triplanar(&self) -> bool
If true
, triplanar mapping is calculated in world space rather than object local space. See also uv1_triplanar
.
sourcepub fn set_flags_world_triplanar(&self, value: bool)
pub fn set_flags_world_triplanar(&self, value: bool)
If true
, triplanar mapping is calculated in world space rather than object local space. See also uv1_triplanar
.
sourcepub fn metallic_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn metallic_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to specify metallic for an object. This is multiplied by metallic
.
sourcepub fn set_metallic_texture(&self, value: impl AsArg<Texture>)
pub fn set_metallic_texture(&self, value: impl AsArg<Texture>)
Texture used to specify metallic for an object. This is multiplied by metallic
.
sourcepub fn normal_enabled(&self) -> bool
pub fn normal_enabled(&self) -> bool
If true
, normal mapping is enabled.
sourcepub fn set_normal_enabled(&self, value: bool)
pub fn set_normal_enabled(&self, value: bool)
If true
, normal mapping is enabled.
sourcepub fn normal_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn normal_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to specify the normal at a given pixel. The normal_texture
only uses the red and green channels; the blue and alpha channels are ignored. The normal read from normal_texture
is oriented around the surface normal provided by the Mesh
.
Note: The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won’t render correctly and will only appear to darken the whole surface. If creating geometry with SurfaceTool
, you can use SurfaceTool.generate_normals
and SurfaceTool.generate_tangents
to automatically generate normals and tangents respectively.
Note: Godot expects the normal map to use X+, Y+, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.
sourcepub fn set_normal_texture(&self, value: impl AsArg<Texture>)
pub fn set_normal_texture(&self, value: impl AsArg<Texture>)
Texture used to specify the normal at a given pixel. The normal_texture
only uses the red and green channels; the blue and alpha channels are ignored. The normal read from normal_texture
is oriented around the surface normal provided by the Mesh
.
Note: The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won’t render correctly and will only appear to darken the whole surface. If creating geometry with SurfaceTool
, you can use SurfaceTool.generate_normals
and SurfaceTool.generate_tangents
to automatically generate normals and tangents respectively.
Note: Godot expects the normal map to use X+, Y+, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.
sourcepub fn params_billboard_keep_scale(&self) -> bool
pub fn params_billboard_keep_scale(&self) -> bool
If true
, the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [params_billboard_mode
][Self::params_billboard_mode] is BILLBOARD_ENABLED
.
sourcepub fn set_params_billboard_keep_scale(&self, value: bool)
pub fn set_params_billboard_keep_scale(&self, value: bool)
If true
, the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when [params_billboard_mode
][Self::params_billboard_mode] is BILLBOARD_ENABLED
.
sourcepub fn params_use_alpha_scissor(&self) -> bool
pub fn params_use_alpha_scissor(&self) -> bool
If true
, the shader will discard all pixels that have an alpha value less than [params_alpha_scissor_threshold
][Self::params_alpha_scissor_threshold].
sourcepub fn set_params_use_alpha_scissor(&self, value: bool)
pub fn set_params_use_alpha_scissor(&self, value: bool)
If true
, the shader will discard all pixels that have an alpha value less than [params_alpha_scissor_threshold
][Self::params_alpha_scissor_threshold].
sourcepub fn refraction_enabled(&self) -> bool
pub fn refraction_enabled(&self) -> bool
If true
, the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material’s roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.
sourcepub fn set_refraction_enabled(&self, value: bool)
pub fn set_refraction_enabled(&self, value: bool)
If true
, the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material’s roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.
sourcepub fn refraction_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn refraction_texture(&self) -> Option<Ref<Texture, Shared>>
Texture that controls the strength of the refraction per-pixel. Multiplied by [refraction_scale
][Self::refraction_scale].
sourcepub fn set_refraction_texture(&self, value: impl AsArg<Texture>)
pub fn set_refraction_texture(&self, value: impl AsArg<Texture>)
Texture that controls the strength of the refraction per-pixel. Multiplied by [refraction_scale
][Self::refraction_scale].
sourcepub fn rim_enabled(&self) -> bool
pub fn rim_enabled(&self) -> bool
If true
, rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
Note: Rim lighting is not visible if the material has flags_unshaded
set to true
.
sourcepub fn set_rim_enabled(&self, value: bool)
pub fn set_rim_enabled(&self, value: bool)
If true
, rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
Note: Rim lighting is not visible if the material has flags_unshaded
set to true
.
sourcepub fn rim_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn rim_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by rim
.
sourcepub fn set_rim_texture(&self, value: impl AsArg<Texture>)
pub fn set_rim_texture(&self, value: impl AsArg<Texture>)
Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by rim
.
sourcepub fn roughness_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn roughness_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to control the roughness per-pixel. Multiplied by roughness
.
sourcepub fn set_roughness_texture(&self, value: impl AsArg<Texture>)
pub fn set_roughness_texture(&self, value: impl AsArg<Texture>)
Texture used to control the roughness per-pixel. Multiplied by roughness
.
sourcepub fn subsurf_scatter_enabled(&self) -> bool
pub fn subsurf_scatter_enabled(&self) -> bool
If true
, subsurface scattering is enabled. Emulates light that penetrates an object’s surface, is scattered, and then emerges.
sourcepub fn set_subsurf_scatter_enabled(&self, value: bool)
pub fn set_subsurf_scatter_enabled(&self, value: bool)
If true
, subsurface scattering is enabled. Emulates light that penetrates an object’s surface, is scattered, and then emerges.
sourcepub fn subsurf_scatter_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn subsurf_scatter_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [subsurf_scatter_strength
][Self::subsurf_scatter_strength].
sourcepub fn set_subsurf_scatter_texture(&self, value: impl AsArg<Texture>)
pub fn set_subsurf_scatter_texture(&self, value: impl AsArg<Texture>)
Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by [subsurf_scatter_strength
][Self::subsurf_scatter_strength].
sourcepub fn transmission_enabled(&self) -> bool
pub fn transmission_enabled(&self) -> bool
If true
, the transmission effect is enabled.
sourcepub fn set_transmission_enabled(&self, value: bool)
pub fn set_transmission_enabled(&self, value: bool)
If true
, the transmission effect is enabled.
sourcepub fn transmission_texture(&self) -> Option<Ref<Texture, Shared>>
pub fn transmission_texture(&self) -> Option<Ref<Texture, Shared>>
Texture used to control the transmission effect per-pixel. Added to transmission
.
sourcepub fn set_transmission_texture(&self, value: impl AsArg<Texture>)
pub fn set_transmission_texture(&self, value: impl AsArg<Texture>)
Texture used to control the transmission effect per-pixel. Added to transmission
.
sourcepub fn uv1_triplanar(&self) -> bool
pub fn uv1_triplanar(&self) -> bool
If true
, instead of using UV
textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object’s surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
sourcepub fn set_uv1_triplanar(&self, value: bool)
pub fn set_uv1_triplanar(&self, value: bool)
If true
, instead of using UV
textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object’s surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
sourcepub fn uv2_triplanar(&self) -> bool
pub fn uv2_triplanar(&self) -> bool
If true
, instead of using UV2
textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object’s surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
sourcepub fn set_uv2_triplanar(&self, value: bool)
pub fn set_uv2_triplanar(&self, value: bool)
If true
, instead of using UV2
textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object’s surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
sourcepub fn vertex_color_is_srgb(&self) -> bool
pub fn vertex_color_is_srgb(&self) -> bool
If true
, the model’s vertex colors are processed as sRGB mode.
sourcepub fn set_vertex_color_is_srgb(&self, value: bool)
pub fn set_vertex_color_is_srgb(&self, value: bool)
If true
, the model’s vertex colors are processed as sRGB mode.
sourcepub fn vertex_color_use_as_albedo(&self) -> bool
pub fn vertex_color_use_as_albedo(&self) -> bool
If true
, the vertex color is used as albedo color.
sourcepub fn set_vertex_color_use_as_albedo(&self, value: bool)
pub fn set_vertex_color_use_as_albedo(&self, value: bool)
If true
, the vertex color is used as albedo color.
Methods from Deref<Target = Material>§
pub const RENDER_PRIORITY_MIN: i64 = -128i64
pub const RENDER_PRIORITY_MAX: i64 = 127i64
sourcepub fn next_pass(&self) -> Option<Ref<Material, Shared>>
pub fn next_pass(&self) -> Option<Ref<Material, Shared>>
Sets the Material
to be used for the next pass. This renders the object again using a different material.
Note: This only applies to SpatialMaterial
s and ShaderMaterial
s with type “Spatial”.
sourcepub fn render_priority(&self) -> i64
pub fn render_priority(&self) -> i64
Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
sourcepub fn set_next_pass(&self, next_pass: impl AsArg<Material>)
pub fn set_next_pass(&self, next_pass: impl AsArg<Material>)
Sets the Material
to be used for the next pass. This renders the object again using a different material.
Note: This only applies to SpatialMaterial
s and ShaderMaterial
s with type “Spatial”.
sourcepub fn set_render_priority(&self, priority: i64)
pub fn set_render_priority(&self, priority: i64)
Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
Methods from Deref<Target = Resource>§
sourcepub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>
pub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>
Duplicates the resource, returning a new resource with the exported members copied. Note: To duplicate the resource the constructor is called without arguments. This method will error when the constructor doesn’t have default values.
By default, sub-resources are shared between resource copies for efficiency. This can be changed by passing true
to the subresources
argument which will copy the subresources.
Note: If subresources
is true
, this method will only perform a shallow copy. Nested resources within subresources will not be duplicated and will still be shared.
Note: When duplicating a resource, only export
ed properties are copied. Other properties will be set to their default value in the new resource.
Default Arguments
subresources
-false
sourcepub fn emit_changed(&self)
pub fn emit_changed(&self)
Sample code is GDScript unless otherwise noted.
Emits the changed
signal.
If external objects which depend on this resource should be updated, this method must be called manually whenever the state of this resource has changed (such as modification of properties).
The method is equivalent to:
emit_signal("changed")
Note: This method is called automatically for built-in resources.
sourcepub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>
pub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>
If [resource_local_to_scene
][Self::resource_local_to_scene] is enabled and the resource was loaded from a PackedScene
instantiation, returns the local scene where this resource’s unique copy is in use. Otherwise, returns null
.
sourcepub fn name(&self) -> GodotString
pub fn name(&self) -> GodotString
The name of the resource. This is an optional identifier. If [resource_name
][Self::resource_name] is not empty, its value will be displayed to represent the current resource in the editor inspector. For built-in scripts, the [resource_name
][Self::resource_name] will be displayed as the tab name in the script editor.
sourcepub fn path(&self) -> GodotString
pub fn path(&self) -> GodotString
The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.
sourcepub fn is_local_to_scene(&self) -> bool
pub fn is_local_to_scene(&self) -> bool
If true
, the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.
sourcepub fn set_local_to_scene(&self, enable: bool)
pub fn set_local_to_scene(&self, enable: bool)
If true
, the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.
sourcepub fn set_name(&self, name: impl Into<GodotString>)
pub fn set_name(&self, name: impl Into<GodotString>)
The name of the resource. This is an optional identifier. If [resource_name
][Self::resource_name] is not empty, its value will be displayed to represent the current resource in the editor inspector. For built-in scripts, the [resource_name
][Self::resource_name] will be displayed as the tab name in the script editor.
sourcepub fn set_path(&self, path: impl Into<GodotString>)
pub fn set_path(&self, path: impl Into<GodotString>)
The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.
sourcepub fn setup_local_to_scene(&self)
pub fn setup_local_to_scene(&self)
This method is called when a resource with [resource_local_to_scene
][Self::resource_local_to_scene] enabled is loaded from a PackedScene
instantiation. Its behavior can be customized by overriding [_setup_local_to_scene
][Self::_setup_local_to_scene] from script.
For most resources, this method performs no base logic. ViewportTexture
performs custom logic to properly set the proxy texture and flags in the local viewport.
sourcepub fn take_over_path(&self, path: impl Into<GodotString>)
pub fn take_over_path(&self, path: impl Into<GodotString>)
Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [resource_path
][Self::resource_path], as the latter would error out if another resource was already cached for the given path.
Methods from Deref<Target = Object>§
pub const NOTIFICATION_POSTINITIALIZE: i64 = 0i64
pub const CONNECT_DEFERRED: i64 = 1i64
pub const NOTIFICATION_PREDELETE: i64 = 1i64
pub const CONNECT_PERSIST: i64 = 2i64
pub const CONNECT_ONESHOT: i64 = 4i64
pub const CONNECT_REFERENCE_COUNTED: i64 = 8i64
sourcepub fn add_user_signal(
&self,
signal: impl Into<GodotString>,
arguments: VariantArray
)
pub fn add_user_signal(
&self,
signal: impl Into<GodotString>,
arguments: VariantArray
)
Adds a user-defined signal
. Arguments are optional, but can be added as an Array
of dictionaries, each containing name: String
and type: int
(see [enum Variant.Type]) entries.
Default Arguments
arguments
-[ ]
sourcepub unsafe fn call(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
pub unsafe fn call(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
Sample code is GDScript unless otherwise noted.
Calls the method
on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
call("set", "position", Vector2(42.0, 0.0))
Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).
Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
sourcepub unsafe fn call_deferred(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
pub unsafe fn call_deferred(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
Sample code is GDScript unless otherwise noted.
Calls the method
on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
call_deferred("set", "position", Vector2(42.0, 0.0))
Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).
Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
sourcepub unsafe fn callv(
&self,
method: impl Into<GodotString>,
arg_array: VariantArray
) -> Variant
pub unsafe fn callv(
&self,
method: impl Into<GodotString>,
arg_array: VariantArray
) -> Variant
Sample code is GDScript unless otherwise noted.
Calls the method
on the object and returns the result. Contrarily to call
, this method does not support a variable number of arguments but expects all parameters to be via a single Array
.
callv("set", [ "position", Vector2(42.0, 0.0) ])
Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
sourcepub fn can_translate_messages(&self) -> bool
pub fn can_translate_messages(&self) -> bool
Returns true
if the object can translate strings. See set_message_translation
and tr
.
sourcepub fn connect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>,
binds: VariantArray,
flags: i64
) -> GodotResult
pub fn connect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>,
binds: VariantArray,
flags: i64
) -> GodotResult
Sample code is GDScript unless otherwise noted.
Connects a signal
to a method
on a target
object. Pass optional binds
to the call as an Array
of parameters. These parameters will be passed to the method after any parameter used in the call to emit_signal
. Use flags
to set deferred or one-shot connections. See ConnectFlags
constants.
A signal
can only be connected once to a method
. It will print an error if already connected, unless the signal was connected with CONNECT_REFERENCE_COUNTED
. To avoid this, first, use is_connected
to check for existing connections.
If the target
is destroyed in the game’s lifecycle, the connection will be lost.
Examples:
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal
An example of the relationship between binds
passed to connect
and parameters used when calling emit_signal
:
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
Default Arguments
binds
-[ ]
flags
-0
sourcepub fn disconnect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
)
pub fn disconnect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
)
Disconnects a signal
from a method
on the given target
.
If you try to disconnect a connection that does not exist, the method will print an error. Use is_connected
to ensure that the connection exists.
sourcepub fn emit_signal(
&self,
signal: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
pub fn emit_signal(
&self,
signal: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
Sample code is GDScript unless otherwise noted.
Emits the given signal
. The signal must exist, so it should be a built-in signal of this class or one of its parent classes, or a user-defined signal. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
emit_signal("hit", weapon_type, damage)
emit_signal("game_over")
sourcepub fn get(&self, property: impl Into<GodotString>) -> Variant
pub fn get(&self, property: impl Into<GodotString>) -> Variant
Returns the Variant
value of the given property
. If the property
doesn’t exist, this will return null
.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
sourcepub fn get_class(&self) -> GodotString
pub fn get_class(&self) -> GodotString
sourcepub fn get_incoming_connections(&self) -> VariantArray
pub fn get_incoming_connections(&self) -> VariantArray
Returns an Array
of dictionaries with information about signals that are connected to the object.
Each Dictionary
contains three String entries:
source
is a reference to the signal emitter.signal_name
is the name of the connected signal.method_name
is the name of the method to which the signal is connected.
sourcepub fn get_indexed(&self, property: impl Into<NodePath>) -> Variant
pub fn get_indexed(&self, property: impl Into<NodePath>) -> Variant
Gets the object’s property indexed by the given NodePath
. The node path should be relative to the current object and can use the colon character (:
) to access nested properties. Examples: "position:x"
or "material:next_pass:blend_mode"
.
Note: Even though the method takes NodePath
argument, it doesn’t support actual paths to Node
s in the scene tree, only colon-separated sub-property paths. For the purpose of nodes, use Node.get_node_and_resource
instead.
sourcepub fn get_instance_id(&self) -> i64
pub fn get_instance_id(&self) -> i64
Returns the object’s unique instance ID.
This ID can be saved in EncodedObjectAsID
, and can be used to retrieve the object instance with [method @GDScript.instance_from_id].
sourcepub fn get_meta(
&self,
name: impl Into<GodotString>,
default: impl OwnedToVariant
) -> Variant
pub fn get_meta(
&self,
name: impl Into<GodotString>,
default: impl OwnedToVariant
) -> Variant
Returns the object’s metadata entry for the given name
.
Throws error if the entry does not exist, unless default
is not null
(in which case the default value will be returned).
Default Arguments
default
-null
sourcepub fn get_meta_list(&self) -> PoolArray<GodotString>
pub fn get_meta_list(&self) -> PoolArray<GodotString>
Returns the object’s metadata as a PoolStringArray
.
sourcepub fn get_method_list(&self) -> VariantArray
pub fn get_method_list(&self) -> VariantArray
Returns the object’s methods and their signatures as an Array
.
sourcepub fn get_property_list(&self) -> VariantArray
pub fn get_property_list(&self) -> VariantArray
Returns the object’s property list as an Array
of dictionaries.
Each property’s Dictionary
contain at least name: String
and type: int
(see [enum Variant.Type]) entries. Optionally, it can also include hint: int
(see [PropertyHint
][PropertyHint]), hint_string: String
, and usage: int
(see [PropertyUsageFlags
][PropertyUsageFlags]).
sourcepub fn get_script(&self) -> Option<Ref<Reference, Shared>>
pub fn get_script(&self) -> Option<Ref<Reference, Shared>>
Returns the object’s Script
instance, or null
if none is assigned.
sourcepub fn get_signal_connection_list(
&self,
signal: impl Into<GodotString>
) -> VariantArray
pub fn get_signal_connection_list(
&self,
signal: impl Into<GodotString>
) -> VariantArray
Returns an Array
of connections for the given signal
.
sourcepub fn get_signal_list(&self) -> VariantArray
pub fn get_signal_list(&self) -> VariantArray
Returns the list of signals as an Array
of dictionaries.
sourcepub fn has_meta(&self, name: impl Into<GodotString>) -> bool
pub fn has_meta(&self, name: impl Into<GodotString>) -> bool
Returns true
if a metadata entry is found with the given name
.
sourcepub fn has_method(&self, method: impl Into<GodotString>) -> bool
pub fn has_method(&self, method: impl Into<GodotString>) -> bool
Returns true
if the object contains the given method
.
sourcepub fn has_signal(&self, signal: impl Into<GodotString>) -> bool
pub fn has_signal(&self, signal: impl Into<GodotString>) -> bool
Returns true
if the given signal
exists.
sourcepub fn has_user_signal(&self, signal: impl Into<GodotString>) -> bool
pub fn has_user_signal(&self, signal: impl Into<GodotString>) -> bool
Returns true
if the given user-defined signal
exists. Only signals added using add_user_signal
are taken into account.
sourcepub fn is_blocking_signals(&self) -> bool
pub fn is_blocking_signals(&self) -> bool
Returns true
if signal emission blocking is enabled.
sourcepub fn is_class(&self, class: impl Into<GodotString>) -> bool
pub fn is_class(&self, class: impl Into<GodotString>) -> bool
sourcepub fn is_connected(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
) -> bool
pub fn is_connected(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
) -> bool
Returns true
if a connection exists for a given signal
, target
, and method
.
sourcepub fn is_queued_for_deletion(&self) -> bool
pub fn is_queued_for_deletion(&self) -> bool
Returns true
if the Node.queue_free
method was called for the object.
sourcepub fn notification(&self, what: i64, reversed: bool)
pub fn notification(&self, what: i64, reversed: bool)
Send a given notification to the object, which will also trigger a call to the [_notification
][Self::_notification] method of all classes that the object inherits from.
If reversed
is true
, [_notification
][Self::_notification] is called first on the object’s own class, and then up to its successive parent classes. If reversed
is false
, [_notification
][Self::_notification] is called first on the highest ancestor (Object
itself), and then down to its successive inheriting classes.
Default Arguments
reversed
-false
sourcepub fn property_list_changed_notify(&self)
pub fn property_list_changed_notify(&self)
Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.
sourcepub fn remove_meta(&self, name: impl Into<GodotString>)
pub fn remove_meta(&self, name: impl Into<GodotString>)
Removes a given entry from the object’s metadata. See also set_meta
.
sourcepub fn set(&self, property: impl Into<GodotString>, value: impl OwnedToVariant)
pub fn set(&self, property: impl Into<GodotString>, value: impl OwnedToVariant)
Assigns a new value to the given property. If the property
does not exist or the given value’s type doesn’t match, nothing will happen.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
sourcepub fn set_block_signals(&self, enable: bool)
pub fn set_block_signals(&self, enable: bool)
If set to true
, signal emission is blocked.
sourcepub fn set_deferred(
&self,
property: impl Into<GodotString>,
value: impl OwnedToVariant
)
pub fn set_deferred(
&self,
property: impl Into<GodotString>,
value: impl OwnedToVariant
)
Assigns a new value to the given property, after the current frame’s physics step. This is equivalent to calling set
via call_deferred
, i.e. call_deferred("set", property, value)
.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
sourcepub fn set_indexed(
&self,
property: impl Into<NodePath>,
value: impl OwnedToVariant
)
pub fn set_indexed(
&self,
property: impl Into<NodePath>,
value: impl OwnedToVariant
)
Sample code is GDScript unless otherwise noted.
Assigns a new value to the property identified by the NodePath
. The node path should be relative to the current object and can use the colon character (:
) to access nested properties. Example:
set_indexed("position", Vector2(42, 0))
set_indexed("position:y", -10)
print(position) # (42, -10)
sourcepub fn set_message_translation(&self, enable: bool)
pub fn set_message_translation(&self, enable: bool)
Defines whether the object can translate strings (with calls to tr
). Enabled by default.
sourcepub fn set_meta(&self, name: impl Into<GodotString>, value: impl OwnedToVariant)
pub fn set_meta(&self, name: impl Into<GodotString>, value: impl OwnedToVariant)
Adds, changes or removes a given entry in the object’s metadata. Metadata are serialized and can take any Variant
value.
To remove a given entry from the object’s metadata, use remove_meta
. Metadata is also removed if its value is set to null
. This means you can also use set_meta("name", null)
to remove metadata for "name"
.
sourcepub fn set_script(&self, script: impl AsArg<Reference>)
pub fn set_script(&self, script: impl AsArg<Reference>)
Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality.
If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script’s [_init
][Self::_init] method will be called.
sourcepub fn to_string(&self) -> GodotString
pub fn to_string(&self) -> GodotString
sourcepub fn tr(&self, message: impl Into<GodotString>) -> GodotString
pub fn tr(&self, message: impl Into<GodotString>) -> GodotString
Translates a message using translation catalogs configured in the Project Settings.
Only works if message translation is enabled (which it is by default), otherwise it returns the message
unchanged. See set_message_translation
.
Trait Implementations§
source§impl Debug for SpatialMaterial
impl Debug for SpatialMaterial
source§impl Deref for SpatialMaterial
impl Deref for SpatialMaterial
source§impl DerefMut for SpatialMaterial
impl DerefMut for SpatialMaterial
source§impl GodotObject for SpatialMaterial
impl GodotObject for SpatialMaterial
§type Memory = RefCounted
type Memory = RefCounted
Ref
smart pointer. See its type-level documentation for more
information.fn class_name() -> &'static str
source§fn null() -> Null<Self>
fn null() -> Null<Self>
Self
as a method argument. This makes type
inference easier for the compiler compared to Option
.source§fn new() -> Ref<Self, Unique>where
Self: Instanciable,
fn new() -> Ref<Self, Unique>where
Self: Instanciable,
Self
using a zero-argument constructor, as a Unique
reference.