Struct gdnative_bindings::SpatialMaterial[][src]

pub struct SpatialMaterial { /* fields omitted */ }

core class SpatialMaterial inherits Material (reference counted).

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 Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

impl SpatialMaterial[src]

Constants

pub const BILLBOARD_DISABLED: i64[src]

pub const BILLBOARD_ENABLED: i64[src]

pub const BILLBOARD_FIXED_Y: i64[src]

pub const BILLBOARD_PARTICLES: i64[src]

pub const BLEND_MODE_ADD: i64[src]

pub const BLEND_MODE_MIX: i64[src]

pub const BLEND_MODE_MUL: i64[src]

pub const BLEND_MODE_SUB: i64[src]

pub const CULL_BACK: i64[src]

pub const CULL_DISABLED: i64[src]

pub const CULL_FRONT: i64[src]

pub const DEPTH_DRAW_ALPHA_OPAQUE_PREPASS: i64[src]

pub const DEPTH_DRAW_ALWAYS: i64[src]

pub const DEPTH_DRAW_DISABLED: i64[src]

pub const DEPTH_DRAW_OPAQUE_ONLY: i64[src]

pub const DETAIL_UV_1: i64[src]

pub const DETAIL_UV_2: i64[src]

pub const DIFFUSE_BURLEY: i64[src]

pub const DIFFUSE_LAMBERT: i64[src]

pub const DIFFUSE_LAMBERT_WRAP: i64[src]

pub const DIFFUSE_OREN_NAYAR: i64[src]

pub const DIFFUSE_TOON: i64[src]

pub const DISTANCE_FADE_DISABLED: i64[src]

pub const DISTANCE_FADE_OBJECT_DITHER: i64[src]

pub const DISTANCE_FADE_PIXEL_ALPHA: i64[src]

pub const DISTANCE_FADE_PIXEL_DITHER: i64[src]

pub const EMISSION_OP_ADD: i64[src]

pub const EMISSION_OP_MULTIPLY: i64[src]

pub const FEATURE_AMBIENT_OCCLUSION: i64[src]

pub const FEATURE_ANISOTROPY: i64[src]

pub const FEATURE_CLEARCOAT: i64[src]

pub const FEATURE_DEPTH_MAPPING: i64[src]

pub const FEATURE_DETAIL: i64[src]

pub const FEATURE_EMISSION: i64[src]

pub const FEATURE_MAX: i64[src]

pub const FEATURE_NORMAL_MAPPING: i64[src]

pub const FEATURE_REFRACTION: i64[src]

pub const FEATURE_RIM: i64[src]

pub const FEATURE_SUBSURACE_SCATTERING: i64[src]

pub const FEATURE_TRANSMISSION: i64[src]

pub const FEATURE_TRANSPARENT: i64[src]

pub const FLAG_ALBEDO_FROM_VERTEX_COLOR: i64[src]

pub const FLAG_ALBEDO_TEXTURE_FORCE_SRGB: i64[src]

pub const FLAG_AO_ON_UV2: i64[src]

pub const FLAG_BILLBOARD_KEEP_SCALE: i64[src]

pub const FLAG_DISABLE_AMBIENT_LIGHT: i64[src]

pub const FLAG_DISABLE_DEPTH_TEST: i64[src]

pub const FLAG_DONT_RECEIVE_SHADOWS: i64[src]

pub const FLAG_EMISSION_ON_UV2: i64[src]

pub const FLAG_ENSURE_CORRECT_NORMALS: i64[src]

pub const FLAG_FIXED_SIZE: i64[src]

pub const FLAG_MAX: i64[src]

pub const FLAG_SRGB_VERTEX_COLOR: i64[src]

pub const FLAG_TRIPLANAR_USE_WORLD: i64[src]

pub const FLAG_UNSHADED: i64[src]

pub const FLAG_USE_ALPHA_SCISSOR: i64[src]

pub const FLAG_USE_POINT_SIZE: i64[src]

pub const FLAG_USE_SHADOW_TO_OPACITY: i64[src]

pub const FLAG_USE_VERTEX_LIGHTING: i64[src]

pub const FLAG_UV1_USE_TRIPLANAR: i64[src]

pub const FLAG_UV2_USE_TRIPLANAR: i64[src]

pub const SPECULAR_BLINN: i64[src]

pub const SPECULAR_DISABLED: i64[src]

pub const SPECULAR_PHONG: i64[src]

pub const SPECULAR_SCHLICK_GGX: i64[src]

pub const SPECULAR_TOON: i64[src]

pub const TEXTURE_ALBEDO: i64[src]

pub const TEXTURE_AMBIENT_OCCLUSION: i64[src]

pub const TEXTURE_CHANNEL_ALPHA: i64[src]

pub const TEXTURE_CHANNEL_BLUE: i64[src]

pub const TEXTURE_CHANNEL_GRAYSCALE: i64[src]

pub const TEXTURE_CHANNEL_GREEN: i64[src]

pub const TEXTURE_CHANNEL_RED: i64[src]

pub const TEXTURE_CLEARCOAT: i64[src]

pub const TEXTURE_DEPTH: i64[src]

pub const TEXTURE_DETAIL_ALBEDO: i64[src]

pub const TEXTURE_DETAIL_MASK: i64[src]

pub const TEXTURE_DETAIL_NORMAL: i64[src]

pub const TEXTURE_EMISSION: i64[src]

pub const TEXTURE_FLOWMAP: i64[src]

pub const TEXTURE_MAX: i64[src]

pub const TEXTURE_METALLIC: i64[src]

pub const TEXTURE_NORMAL: i64[src]

pub const TEXTURE_REFRACTION: i64[src]

pub const TEXTURE_RIM: i64[src]

pub const TEXTURE_ROUGHNESS: i64[src]

pub const TEXTURE_SUBSURFACE_SCATTERING: i64[src]

pub const TEXTURE_TRANSMISSION: i64[src]

impl SpatialMaterial[src]

pub fn new() -> Ref<Self, Unique>[src]

Creates a new instance of this object.

This is a reference-counted type. The returned object is automatically managed by Ref.

pub fn albedo(&self) -> Color[src]

The material's base color.

pub fn alpha_scissor_threshold(&self) -> f64[src]

Threshold at which the alpha scissor will discard values.

pub fn anisotropy(&self) -> f64[src]

The strength of the anisotropy effect.

pub fn ao_light_affect(&self) -> f64[src]

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.

pub fn ao_texture_channel(&self) -> TextureChannel[src]

Specifies the channel of the [member 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.

pub fn billboard_mode(&self) -> BillboardMode[src]

Controls how the object faces the camera. See [enum BillboardMode].

pub fn blend_mode(&self) -> BlendMode[src]

The material's blend mode. Note: Values other than Mix force the object into the transparent pipeline. See [enum BlendMode].

pub fn clearcoat(&self) -> f64[src]

Sets the strength of the clearcoat effect. Setting to 0 looks the same as disabling the clearcoat effect.

pub fn clearcoat_gloss(&self) -> f64[src]

Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.

pub fn cull_mode(&self) -> CullMode[src]

Which side of the object is not drawn when backfaces are rendered. See [enum CullMode].

pub fn depth_deep_parallax_flip_binormal(&self) -> bool[src]

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.

pub fn depth_deep_parallax_flip_tangent(&self) -> bool[src]

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.

pub fn depth_deep_parallax_max_layers(&self) -> i64[src]

Number of layers to use when using [member 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.

pub fn depth_deep_parallax_min_layers(&self) -> i64[src]

Number of layers to use when using [member 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.

pub fn depth_draw_mode(&self) -> DepthDrawMode[src]

Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member flags_transparent].

pub fn depth_scale(&self) -> f64[src]

Scales the depth offset effect. A higher number will create a larger depth.

pub fn detail_blend_mode(&self) -> BlendMode[src]

Specifies how the [member detail_albedo] should blend with the current ALBEDO. See [enum BlendMode] for options.

pub fn detail_uv(&self) -> DetailUv[src]

Specifies whether to use UV or UV2 for the detail layer. See [enum DetailUV] for options.

pub fn diffuse_mode(&self) -> DiffuseMode[src]

The algorithm used for diffuse light scattering. See [enum DiffuseMode].

pub fn distance_fade(&self) -> DistanceFadeMode[src]

Specifies which type of fade to use. Can be any of the [enum DistanceFadeMode]s.

pub fn distance_fade_max_distance(&self) -> f64[src]

Distance at which the object fades fully and is no longer visible.

pub fn distance_fade_min_distance(&self) -> f64[src]

Distance at which the object starts to fade. If the object is less than this distance away it will appear normal.

pub fn emission(&self) -> Color[src]

The emitted light's color. See [member emission_enabled].

pub fn emission_energy(&self) -> f64[src]

The emitted light's strength. See [member emission_enabled].

pub fn emission_operator(&self) -> EmissionOperator[src]

Sets how [member emission] interacts with [member emission_texture]. Can either add or multiply. See [enum EmissionOperator] for options.

pub fn feature(&self, feature: i64) -> bool[src]

If true, the transmission effect is enabled.

pub fn flag(&self, flag: i64) -> bool[src]

If true, the vertex color is used as albedo color.

pub fn grow(&self) -> f64[src]

Grows object vertices in the direction of their normals.

pub fn line_width(&self) -> f64[src]

Currently unimplemented in Godot.

pub fn metallic(&self) -> f64[src]

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 [member roughness].

pub fn metallic_texture_channel(&self) -> TextureChannel[src]

Specifies the channel of the [member 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.

pub fn normal_scale(&self) -> f64[src]

The strength of the normal map's effect.

pub fn particles_anim_h_frames(&self) -> i64[src]

The number of horizontal frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].

pub fn particles_anim_loop(&self) -> bool[src]

If true, particle animations are looped. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].

pub fn particles_anim_v_frames(&self) -> i64[src]

The number of vertical frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].

pub fn point_size(&self) -> f64[src]

The point size in pixels. See [member flags_use_point_size].

pub fn proximity_fade_distance(&self) -> f64[src]

Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.

pub fn refraction(&self) -> f64[src]

The strength of the refraction effect.

pub fn refraction_texture_channel(&self) -> TextureChannel[src]

Specifies the channel of the [member 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.

pub fn rim(&self) -> f64[src]

Sets the strength of the rim lighting effect.

pub fn rim_tint(&self) -> f64[src]

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.

pub fn roughness(&self) -> f64[src]

Surface reflection. A value of 0 represents a perfect mirror while a value of 1 completely blurs the reflection. See also [member metallic].

pub fn roughness_texture_channel(&self) -> TextureChannel[src]

Specifies the channel of the [member 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.

pub fn specular(&self) -> f64[src]

Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources. Note: unlike [member metallic], this is not energy-conserving, so it should be left at 0.5 in most cases. See also [member roughness].

pub fn specular_mode(&self) -> SpecularMode[src]

The method for rendering the specular blob. See [enum SpecularMode].

pub fn subsurface_scattering_strength(&self) -> f64[src]

The strength of the subsurface scattering effect.

pub fn texture(&self, param: i64) -> Option<Ref<Texture, Shared>>[src]

Texture used to control the transmission effect per-pixel. Added to [member transmission].

pub fn transmission(&self) -> Color[src]

The color used by the transmission effect. Represents the light passing through an object.

pub fn uv1_offset(&self) -> Vector3[src]

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.

pub fn uv1_scale(&self) -> Vector3[src]

How much to scale the UV coordinates. This is multiplied by UV in the vertex function.

pub fn uv1_triplanar_blend_sharpness(&self) -> f64[src]

A lower number blends the texture more softly while a higher number blends the texture more sharply.

pub fn uv2_offset(&self) -> Vector3[src]

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.

pub fn uv2_scale(&self) -> Vector3[src]

How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function.

pub fn uv2_triplanar_blend_sharpness(&self) -> f64[src]

A lower number blends the texture more softly while a higher number blends the texture more sharply.

pub fn is_depth_deep_parallax_enabled(&self) -> bool[src]

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.

pub fn is_grow_enabled(&self) -> bool[src]

If true, enables the vertex grow setting. See [member params_grow_amount].

pub fn is_proximity_fade_enabled(&self) -> bool[src]

If true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.

pub fn set_albedo(&self, albedo: Color)[src]

The material's base color.

pub fn set_alpha_scissor_threshold(&self, threshold: f64)[src]

Threshold at which the alpha scissor will discard values.

pub fn set_anisotropy(&self, anisotropy: f64)[src]

The strength of the anisotropy effect.

pub fn set_ao_light_affect(&self, amount: f64)[src]

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.

pub fn set_ao_texture_channel(&self, channel: i64)[src]

Specifies the channel of the [member 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.

pub fn set_billboard_mode(&self, mode: i64)[src]

Controls how the object faces the camera. See [enum BillboardMode].

pub fn set_blend_mode(&self, blend_mode: i64)[src]

The material's blend mode. Note: Values other than Mix force the object into the transparent pipeline. See [enum BlendMode].

pub fn set_clearcoat(&self, clearcoat: f64)[src]

Sets the strength of the clearcoat effect. Setting to 0 looks the same as disabling the clearcoat effect.

pub fn set_clearcoat_gloss(&self, clearcoat_gloss: f64)[src]

Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.

pub fn set_cull_mode(&self, cull_mode: i64)[src]

Which side of the object is not drawn when backfaces are rendered. See [enum CullMode].

pub fn set_depth_deep_parallax(&self, enable: bool)[src]

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.

pub fn set_depth_deep_parallax_flip_binormal(&self, flip: bool)[src]

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.

pub fn set_depth_deep_parallax_flip_tangent(&self, flip: bool)[src]

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.

pub fn set_depth_deep_parallax_max_layers(&self, layer: i64)[src]

Number of layers to use when using [member 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.

pub fn set_depth_deep_parallax_min_layers(&self, layer: i64)[src]

Number of layers to use when using [member 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.

pub fn set_depth_draw_mode(&self, depth_draw_mode: i64)[src]

Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member flags_transparent].

pub fn set_depth_scale(&self, depth_scale: f64)[src]

Scales the depth offset effect. A higher number will create a larger depth.

pub fn set_detail_blend_mode(&self, detail_blend_mode: i64)[src]

Specifies how the [member detail_albedo] should blend with the current ALBEDO. See [enum BlendMode] for options.

pub fn set_detail_uv(&self, detail_uv: i64)[src]

Specifies whether to use UV or UV2 for the detail layer. See [enum DetailUV] for options.

pub fn set_diffuse_mode(&self, diffuse_mode: i64)[src]

The algorithm used for diffuse light scattering. See [enum DiffuseMode].

pub fn set_distance_fade(&self, mode: i64)[src]

Specifies which type of fade to use. Can be any of the [enum DistanceFadeMode]s.

pub fn set_distance_fade_max_distance(&self, distance: f64)[src]

Distance at which the object fades fully and is no longer visible.

pub fn set_distance_fade_min_distance(&self, distance: f64)[src]

Distance at which the object starts to fade. If the object is less than this distance away it will appear normal.

pub fn set_emission(&self, emission: Color)[src]

The emitted light's color. See [member emission_enabled].

pub fn set_emission_energy(&self, emission_energy: f64)[src]

The emitted light's strength. See [member emission_enabled].

pub fn set_emission_operator(&self, operator: i64)[src]

Sets how [member emission] interacts with [member emission_texture]. Can either add or multiply. See [enum EmissionOperator] for options.

pub fn set_feature(&self, feature: i64, enable: bool)[src]

If true, the transmission effect is enabled.

pub fn set_flag(&self, flag: i64, enable: bool)[src]

If true, the vertex color is used as albedo color.

pub fn set_grow(&self, amount: f64)[src]

Grows object vertices in the direction of their normals.

pub fn set_grow_enabled(&self, enable: bool)[src]

If true, enables the vertex grow setting. See [member params_grow_amount].

pub fn set_line_width(&self, line_width: f64)[src]

Currently unimplemented in Godot.

pub fn set_metallic(&self, metallic: f64)[src]

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 [member roughness].

pub fn set_metallic_texture_channel(&self, channel: i64)[src]

Specifies the channel of the [member 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.

pub fn set_normal_scale(&self, normal_scale: f64)[src]

The strength of the normal map's effect.

pub fn set_particles_anim_h_frames(&self, frames: i64)[src]

The number of horizontal frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].

pub fn set_particles_anim_loop(&self, _loop: bool)[src]

If true, particle animations are looped. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].

pub fn set_particles_anim_v_frames(&self, frames: i64)[src]

The number of vertical frames in the particle sprite sheet. Only enabled when using [constant BILLBOARD_PARTICLES]. See [member params_billboard_mode].

pub fn set_point_size(&self, point_size: f64)[src]

The point size in pixels. See [member flags_use_point_size].

pub fn set_proximity_fade(&self, enabled: bool)[src]

If true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.

pub fn set_proximity_fade_distance(&self, distance: f64)[src]

Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.

pub fn set_refraction(&self, refraction: f64)[src]

The strength of the refraction effect.

pub fn set_refraction_texture_channel(&self, channel: i64)[src]

Specifies the channel of the [member 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.

pub fn set_rim(&self, rim: f64)[src]

Sets the strength of the rim lighting effect.

pub fn set_rim_tint(&self, rim_tint: f64)[src]

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.

pub fn set_roughness(&self, roughness: f64)[src]

Surface reflection. A value of 0 represents a perfect mirror while a value of 1 completely blurs the reflection. See also [member metallic].

pub fn set_roughness_texture_channel(&self, channel: i64)[src]

Specifies the channel of the [member 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.

pub fn set_specular(&self, specular: f64)[src]

Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources. Note: unlike [member metallic], this is not energy-conserving, so it should be left at 0.5 in most cases. See also [member roughness].

pub fn set_specular_mode(&self, specular_mode: i64)[src]

The method for rendering the specular blob. See [enum SpecularMode].

pub fn set_subsurface_scattering_strength(&self, strength: f64)[src]

The strength of the subsurface scattering effect.

pub fn set_texture(&self, param: i64, texture: impl AsArg<Texture>)[src]

Texture used to control the transmission effect per-pixel. Added to [member transmission].

pub fn set_transmission(&self, transmission: Color)[src]

The color used by the transmission effect. Represents the light passing through an object.

pub fn set_uv1_offset(&self, offset: Vector3)[src]

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.

pub fn set_uv1_scale(&self, scale: Vector3)[src]

How much to scale the UV coordinates. This is multiplied by UV in the vertex function.

pub fn set_uv1_triplanar_blend_sharpness(&self, sharpness: f64)[src]

A lower number blends the texture more softly while a higher number blends the texture more sharply.

pub fn set_uv2_offset(&self, offset: Vector3)[src]

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.

pub fn set_uv2_scale(&self, scale: Vector3)[src]

How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function.

pub fn set_uv2_triplanar_blend_sharpness(&self, sharpness: f64)[src]

A lower number blends the texture more softly while a higher number blends the texture more sharply.

Methods from Deref<Target = Material>

pub fn next_pass(&self) -> Option<Ref<Material, Shared>>[src]

Sets the Material to be used for the next pass. This renders the object again using a different material. Note: only applies to SpatialMaterials and ShaderMaterials with type "Spatial".

pub fn render_priority(&self) -> i64[src]

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).

pub fn set_next_pass(&self, next_pass: impl AsArg<Material>)[src]

Sets the Material to be used for the next pass. This renders the object again using a different material. Note: only applies to SpatialMaterials and ShaderMaterials with type "Spatial".

pub fn set_render_priority(&self, priority: i64)[src]

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>

pub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>[src]

Duplicates the resource, returning a new resource. 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.

Default Arguments

  • subresources - false

pub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>[src]

If [member 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.

pub fn name(&self) -> GodotString[src]

The name of the resource. This is an optional identifier.

pub fn path(&self) -> GodotString[src]

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.

pub fn get_rid(&self) -> Rid[src]

Returns the RID of the resource (or an empty RID). Many resources (such as Texture, Mesh, etc) are high-level abstractions of resources stored in a server, so this function will return the original RID.

pub fn is_local_to_scene(&self) -> bool[src]

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.

pub fn set_local_to_scene(&self, enable: bool)[src]

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.

pub fn set_name(&self, name: impl Into<GodotString>)[src]

The name of the resource. This is an optional identifier.

pub fn set_path(&self, path: impl Into<GodotString>)[src]

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.

pub fn setup_local_to_scene(&self)[src]

This method is called when a resource with [member resource_local_to_scene] enabled is loaded from a PackedScene instantiation. Its behavior can be customized by overriding [method _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.

pub fn take_over_path(&self, path: impl Into<GodotString>)[src]

Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [member resource_path], as the latter would error out if another resource was already cached for the given path.

Methods from Deref<Target = Reference>

pub fn init_ref(&self) -> bool[src]

Initializes the internal reference counter. Use this only if you really know what you are doing. Returns whether the initialization was successful.

Methods from Deref<Target = Object>

pub fn add_user_signal(
    &self,
    signal: impl Into<GodotString>,
    arguments: VariantArray
)
[src]

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 - [ ]

pub unsafe fn call(
    &self,
    method: impl Into<GodotString>,
    varargs: &[Variant]
) -> Variant
[src]

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(), ...).

pub unsafe fn call_deferred(
    &self,
    method: impl Into<GodotString>,
    varargs: &[Variant]
) -> Variant
[src]

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(), ...).

pub unsafe fn callv(
    &self,
    method: impl Into<GodotString>,
    arg_array: VariantArray
) -> Variant
[src]

Sample code is GDScript unless otherwise noted.

Calls the method on the object and returns the result. Contrarily to [method 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(), ...).

pub fn can_translate_messages(&self) -> bool[src]

Returns true if the object can translate strings. See [method set_message_translation] and [method tr].

pub fn connect(
    &self,
    signal: impl Into<GodotString>,
    target: impl AsArg<Object>,
    method: impl Into<GodotString>,
    binds: VariantArray,
    flags: i64
) -> GodotResult
[src]

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 [method emit_signal]. Use flags to set deferred or one-shot connections. See [enum ConnectFlags] constants. A signal can only be connected once to a method. It will throw an error if already connected, unless the signal was connected with [constant CONNECT_REFERENCE_COUNTED]. To avoid this, first, use [method 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 [method connect] and parameters used when calling [method 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

pub fn disconnect(
    &self,
    signal: impl Into<GodotString>,
    target: impl AsArg<Object>,
    method: impl Into<GodotString>
)
[src]

Disconnects a signal from a method on the given target. If you try to disconnect a connection that does not exist, the method will throw an error. Use [method is_connected] to ensure that the connection exists.

pub fn emit_signal(
    &self,
    signal: impl Into<GodotString>,
    varargs: &[Variant]
) -> Variant
[src]

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")

pub fn get(&self, property: impl Into<GodotString>) -> Variant[src]

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).

pub fn get_class(&self) -> GodotString[src]

Returns the object's class as a String.

pub fn get_incoming_connections(&self) -> VariantArray[src]

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.

pub fn get_indexed(&self, property: impl Into<NodePath>) -> Variant[src]

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".

pub fn get_instance_id(&self) -> i64[src]

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].

pub fn get_meta(&self, name: impl Into<GodotString>) -> Variant[src]

Returns the object's metadata entry for the given name.

pub fn get_meta_list(&self) -> StringArray[src]

Returns the object's metadata as a [PoolStringArray].

pub fn get_method_list(&self) -> VariantArray[src]

Returns the object's methods and their signatures as an [Array].

pub fn get_property_list(&self) -> VariantArray[src]

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 [enum PropertyHint]), hint_string: String, and usage: int (see [enum PropertyUsageFlags]).

pub fn get_script(&self) -> Option<Ref<Reference, Shared>>[src]

Returns the object's Script instance, or null if none is assigned.

pub fn get_signal_connection_list(
    &self,
    signal: impl Into<GodotString>
) -> VariantArray
[src]

Returns an [Array] of connections for the given signal.

pub fn get_signal_list(&self) -> VariantArray[src]

Returns the list of signals as an [Array] of dictionaries.

pub fn has_meta(&self, name: impl Into<GodotString>) -> bool[src]

Returns true if a metadata entry is found with the given name.

pub fn has_method(&self, method: impl Into<GodotString>) -> bool[src]

Returns true if the object contains the given method.

pub fn has_signal(&self, signal: impl Into<GodotString>) -> bool[src]

Returns true if the given signal exists.

pub fn has_user_signal(&self, signal: impl Into<GodotString>) -> bool[src]

Returns true if the given user-defined signal exists. Only signals added using [method add_user_signal] are taken into account.

pub fn is_blocking_signals(&self) -> bool[src]

Returns true if signal emission blocking is enabled.

pub fn is_class(&self, class: impl Into<GodotString>) -> bool[src]

Returns true if the object inherits from the given class.

pub fn is_connected(
    &self,
    signal: impl Into<GodotString>,
    target: impl AsArg<Object>,
    method: impl Into<GodotString>
) -> bool
[src]

Returns true if a connection exists for a given signal, target, and method.

pub fn is_queued_for_deletion(&self) -> bool[src]

Returns true if the [method Node.queue_free] method was called for the object.

pub fn notification(&self, what: i64, reversed: bool)[src]

Send a given notification to the object, which will also trigger a call to the [method _notification] method of all classes that the object inherits from. If reversed is true, [method _notification] is called first on the object's own class, and then up to its successive parent classes. If reversed is false, [method _notification] is called first on the highest ancestor (Object itself), and then down to its successive inheriting classes.

Default Arguments

  • reversed - false

pub fn property_list_changed_notify(&self)[src]

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.

pub fn remove_meta(&self, name: impl Into<GodotString>)[src]

Removes a given entry from the object's metadata. See also [method set_meta].

pub fn set(&self, property: impl Into<GodotString>, value: impl OwnedToVariant)[src]

Assigns a new value to the given property. If the property does not exist, 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).

pub fn set_block_signals(&self, enable: bool)[src]

If set to true, signal emission is blocked.

pub fn set_deferred(
    &self,
    property: impl Into<GodotString>,
    value: impl OwnedToVariant
)
[src]

Assigns a new value to the given property, after the current frame's physics step. This is equivalent to calling [method set] via [method 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).

pub fn set_indexed(
    &self,
    property: impl Into<NodePath>,
    value: impl OwnedToVariant
)
[src]

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)

pub fn set_message_translation(&self, enable: bool)[src]

Defines whether the object can translate strings (with calls to [method tr]). Enabled by default.

pub fn set_meta(&self, name: impl Into<GodotString>, value: impl OwnedToVariant)[src]

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 [method 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".

pub fn set_script(&self, script: impl AsArg<Reference>)[src]

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 [method _init] method will be called.

pub fn to_string(&self) -> GodotString[src]

Returns a String representing the object. If not overridden, defaults to "[ClassName:RID]". Override the method [method _to_string] to customize the String representation.

pub fn tr(&self, message: impl Into<GodotString>) -> GodotString[src]

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 [method set_message_translation].

Trait Implementations

impl Debug for SpatialMaterial[src]

impl Deref for SpatialMaterial[src]

type Target = Material

The resulting type after dereferencing.

impl DerefMut for SpatialMaterial[src]

impl GodotObject for SpatialMaterial[src]

type RefKind = RefCounted

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

impl Instanciable for SpatialMaterial[src]

impl Sealed for SpatialMaterial[src]

impl SubClass<Material> for SpatialMaterial[src]

impl SubClass<Object> for SpatialMaterial[src]

impl SubClass<Reference> for SpatialMaterial[src]

impl SubClass<Resource> for SpatialMaterial[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SubClass<T> for T where
    T: GodotObject
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.