Struct gdnative_bindings::VisualServer
source · pub struct VisualServer { /* private fields */ }
Expand description
core singleton class VisualServer
inherits Object
(manually managed).
This class has related types in the visual_server
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.
Class hierarchy
VisualServer 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 VisualServer
impl VisualServer
Constants
pub const CANVAS_ITEM_Z_MIN: i64 = -4_096i64
pub const MATERIAL_RENDER_PRIORITY_MIN: i64 = -128i64
pub const NO_INDEX_ARRAY: i64 = -1i64
pub const ARRAY_VERTEX: i64 = 0i64
pub const BLEND_SHAPE_MODE_NORMALIZED: i64 = 0i64
pub const CANVAS_LIGHT_FILTER_NONE: i64 = 0i64
pub const CANVAS_LIGHT_MODE_ADD: i64 = 0i64
pub const CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: i64 = 0i64
pub const CHANGED_PRIORITY_ANY: i64 = 0i64
pub const CUBEMAP_LEFT: i64 = 0i64
pub const ENV_BG_CLEAR_COLOR: i64 = 0i64
pub const ENV_DOF_BLUR_QUALITY_LOW: i64 = 0i64
pub const ENV_SSAO_BLUR_DISABLED: i64 = 0i64
pub const ENV_SSAO_QUALITY_LOW: i64 = 0i64
pub const ENV_TONE_MAPPER_LINEAR: i64 = 0i64
pub const FEATURE_SHADERS: i64 = 0i64
pub const GLOW_BLEND_MODE_ADDITIVE: i64 = 0i64
pub const INFO_OBJECTS_IN_FRAME: i64 = 0i64
pub const INSTANCE_FLAG_USE_BAKED_LIGHT: i64 = 0i64
pub const INSTANCE_NONE: i64 = 0i64
pub const LIGHT_BAKE_DISABLED: i64 = 0i64
pub const LIGHT_DIRECTIONAL: i64 = 0i64
pub const LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE: i64 = 0i64
pub const LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: i64 = 0i64
pub const LIGHT_OMNI_SHADOW_DETAIL_VERTICAL: i64 = 0i64
pub const LIGHT_OMNI_SHADOW_DUAL_PARABOLOID: i64 = 0i64
pub const LIGHT_PARAM_ENERGY: i64 = 0i64
pub const MULTIMESH_COLOR_NONE: i64 = 0i64
pub const MULTIMESH_CUSTOM_DATA_NONE: i64 = 0i64
pub const MULTIMESH_TRANSFORM_2D: i64 = 0i64
pub const NINE_PATCH_STRETCH: i64 = 0i64
pub const PARTICLES_DRAW_ORDER_INDEX: i64 = 0i64
pub const PRIMITIVE_POINTS: i64 = 0i64
pub const REFLECTION_PROBE_UPDATE_ONCE: i64 = 0i64
pub const SCENARIO_DEBUG_DISABLED: i64 = 0i64
pub const SHADER_SPATIAL: i64 = 0i64
pub const SHADOW_CASTING_SETTING_OFF: i64 = 0i64
pub const TEXTURE_TYPE_2D: i64 = 0i64
pub const VIEWPORT_CLEAR_ALWAYS: i64 = 0i64
pub const VIEWPORT_DEBUG_DRAW_DISABLED: i64 = 0i64
pub const VIEWPORT_MSAA_DISABLED: i64 = 0i64
pub const VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME: i64 = 0i64
pub const VIEWPORT_UPDATE_DISABLED: i64 = 0i64
pub const VIEWPORT_USAGE_2D: i64 = 0i64
pub const ARRAY_FORMAT_VERTEX: i64 = 1i64
pub const ARRAY_NORMAL: i64 = 1i64
pub const BLEND_SHAPE_MODE_RELATIVE: i64 = 1i64
pub const CANVAS_LIGHT_FILTER_PCF3: i64 = 1i64
pub const CANVAS_LIGHT_MODE_SUB: i64 = 1i64
pub const CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: i64 = 1i64
pub const CHANGED_PRIORITY_LOW: i64 = 1i64
pub const CUBEMAP_RIGHT: i64 = 1i64
pub const ENV_BG_COLOR: i64 = 1i64
pub const ENV_DOF_BLUR_QUALITY_MEDIUM: i64 = 1i64
pub const ENV_SSAO_BLUR_1x1: i64 = 1i64
pub const ENV_SSAO_QUALITY_MEDIUM: i64 = 1i64
pub const ENV_TONE_MAPPER_REINHARD: i64 = 1i64
pub const FEATURE_MULTITHREADED: i64 = 1i64
pub const GLOW_BLEND_MODE_SCREEN: i64 = 1i64
pub const INFO_VERTICES_IN_FRAME: i64 = 1i64
pub const INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE: i64 = 1i64
pub const INSTANCE_MESH: i64 = 1i64
pub const LIGHT_BAKE_INDIRECT: i64 = 1i64
pub const LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED: i64 = 1i64
pub const LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: i64 = 1i64
pub const LIGHT_OMNI: i64 = 1i64
pub const LIGHT_OMNI_SHADOW_CUBE: i64 = 1i64
pub const LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL: i64 = 1i64
pub const LIGHT_PARAM_INDIRECT_ENERGY: i64 = 1i64
pub const MULTIMESH_COLOR_8BIT: i64 = 1i64
pub const MULTIMESH_CUSTOM_DATA_8BIT: i64 = 1i64
pub const MULTIMESH_TRANSFORM_3D: i64 = 1i64
pub const NINE_PATCH_TILE: i64 = 1i64
pub const PARTICLES_DRAW_ORDER_LIFETIME: i64 = 1i64
pub const PRIMITIVE_LINES: i64 = 1i64
pub const REFLECTION_PROBE_UPDATE_ALWAYS: i64 = 1i64
pub const SCENARIO_DEBUG_WIREFRAME: i64 = 1i64
pub const SHADER_CANVAS_ITEM: i64 = 1i64
pub const SHADOW_CASTING_SETTING_ON: i64 = 1i64
pub const TEXTURE_FLAG_MIPMAPS: i64 = 1i64
pub const VIEWPORT_CLEAR_NEVER: i64 = 1i64
pub const VIEWPORT_DEBUG_DRAW_UNSHADED: i64 = 1i64
pub const VIEWPORT_MSAA_2X: i64 = 1i64
pub const VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME: i64 = 1i64
pub const VIEWPORT_UPDATE_ONCE: i64 = 1i64
pub const VIEWPORT_USAGE_2D_NO_SAMPLING: i64 = 1i64
pub const ARRAY_FORMAT_NORMAL: i64 = 2i64
pub const ARRAY_TANGENT: i64 = 2i64
pub const CANVAS_LIGHT_FILTER_PCF5: i64 = 2i64
pub const CANVAS_LIGHT_MODE_MIX: i64 = 2i64
pub const CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: i64 = 2i64
pub const CHANGED_PRIORITY_HIGH: i64 = 2i64
pub const CUBEMAP_BOTTOM: i64 = 2i64
pub const ENV_BG_SKY: i64 = 2i64
pub const ENV_DOF_BLUR_QUALITY_HIGH: i64 = 2i64
pub const ENV_SSAO_BLUR_2x2: i64 = 2i64
pub const ENV_SSAO_QUALITY_HIGH: i64 = 2i64
pub const ENV_TONE_MAPPER_FILMIC: i64 = 2i64
pub const GLOW_BLEND_MODE_SOFTLIGHT: i64 = 2i64
pub const INFO_MATERIAL_CHANGES_IN_FRAME: i64 = 2i64
pub const INSTANCE_FLAG_MAX: i64 = 2i64
pub const INSTANCE_MULTIMESH: i64 = 2i64
pub const LIGHT_BAKE_ALL: i64 = 2i64
pub const LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: i64 = 2i64
pub const LIGHT_PARAM_SIZE: i64 = 2i64
pub const LIGHT_SPOT: i64 = 2i64
pub const MULTIMESH_COLOR_FLOAT: i64 = 2i64
pub const MULTIMESH_CUSTOM_DATA_FLOAT: i64 = 2i64
pub const NINE_PATCH_TILE_FIT: i64 = 2i64
pub const PARTICLES_DRAW_ORDER_VIEW_DEPTH: i64 = 2i64
pub const PRIMITIVE_LINE_STRIP: i64 = 2i64
pub const SCENARIO_DEBUG_OVERDRAW: i64 = 2i64
pub const SHADER_PARTICLES: i64 = 2i64
pub const SHADOW_CASTING_SETTING_DOUBLE_SIDED: i64 = 2i64
pub const TEXTURE_FLAG_REPEAT: i64 = 2i64
pub const TEXTURE_TYPE_CUBEMAP: i64 = 2i64
pub const VIEWPORT_CLEAR_ONLY_NEXT_FRAME: i64 = 2i64
pub const VIEWPORT_DEBUG_DRAW_OVERDRAW: i64 = 2i64
pub const VIEWPORT_MSAA_4X: i64 = 2i64
pub const VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME: i64 = 2i64
pub const VIEWPORT_UPDATE_WHEN_VISIBLE: i64 = 2i64
pub const VIEWPORT_USAGE_3D: i64 = 2i64
pub const ARRAY_COLOR: i64 = 3i64
pub const CANVAS_LIGHT_FILTER_PCF7: i64 = 3i64
pub const CANVAS_LIGHT_MODE_MASK: i64 = 3i64
pub const CUBEMAP_TOP: i64 = 3i64
pub const ENV_BG_COLOR_SKY: i64 = 3i64
pub const ENV_SSAO_BLUR_3x3: i64 = 3i64
pub const ENV_TONE_MAPPER_ACES: i64 = 3i64
pub const GLOW_BLEND_MODE_REPLACE: i64 = 3i64
pub const INFO_SHADER_CHANGES_IN_FRAME: i64 = 3i64
pub const INSTANCE_IMMEDIATE: i64 = 3i64
pub const LIGHT_PARAM_SPECULAR: i64 = 3i64
pub const PRIMITIVE_LINE_LOOP: i64 = 3i64
pub const SCENARIO_DEBUG_SHADELESS: i64 = 3i64
pub const SHADER_MAX: i64 = 3i64
pub const SHADOW_CASTING_SETTING_SHADOWS_ONLY: i64 = 3i64
pub const TEXTURE_TYPE_2D_ARRAY: i64 = 3i64
pub const VIEWPORT_DEBUG_DRAW_WIREFRAME: i64 = 3i64
pub const VIEWPORT_MSAA_8X: i64 = 3i64
pub const VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME: i64 = 3i64
pub const VIEWPORT_UPDATE_ALWAYS: i64 = 3i64
pub const VIEWPORT_USAGE_3D_NO_EFFECTS: i64 = 3i64
pub const ARRAY_FORMAT_TANGENT: i64 = 4i64
pub const ARRAY_TEX_UV: i64 = 4i64
pub const ARRAY_WEIGHTS_SIZE: i64 = 4i64
pub const CANVAS_LIGHT_FILTER_PCF9: i64 = 4i64
pub const CUBEMAP_FRONT: i64 = 4i64
pub const ENV_BG_CANVAS: i64 = 4i64
pub const ENV_TONE_MAPPER_ACES_FITTED: i64 = 4i64
pub const INFO_SHADER_COMPILES_IN_FRAME: i64 = 4i64
pub const INSTANCE_PARTICLES: i64 = 4i64
pub const LIGHT_PARAM_RANGE: i64 = 4i64
pub const PRIMITIVE_TRIANGLES: i64 = 4i64
pub const TEXTURE_FLAG_FILTER: i64 = 4i64
pub const TEXTURE_TYPE_3D: i64 = 4i64
pub const VIEWPORT_MSAA_16X: i64 = 4i64
pub const VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME: i64 = 4i64
pub const ARRAY_TEX_UV2: i64 = 5i64
pub const CANVAS_LIGHT_FILTER_PCF13: i64 = 5i64
pub const CUBEMAP_BACK: i64 = 5i64
pub const ENV_BG_KEEP: i64 = 5i64
pub const INFO_SURFACE_CHANGES_IN_FRAME: i64 = 5i64
pub const INSTANCE_LIGHT: i64 = 5i64
pub const LIGHT_PARAM_ATTENUATION: i64 = 5i64
pub const PRIMITIVE_TRIANGLE_STRIP: i64 = 5i64
pub const VIEWPORT_MSAA_EXT_2X: i64 = 5i64
pub const VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME: i64 = 5i64
pub const ARRAY_BONES: i64 = 6i64
pub const INFO_DRAW_CALLS_IN_FRAME: i64 = 6i64
pub const INSTANCE_REFLECTION_PROBE: i64 = 6i64
pub const LIGHT_PARAM_SPOT_ANGLE: i64 = 6i64
pub const PRIMITIVE_TRIANGLE_FAN: i64 = 6i64
pub const VIEWPORT_MSAA_EXT_4X: i64 = 6i64
pub const VIEWPORT_RENDER_INFO_2D_ITEMS_IN_FRAME: i64 = 6i64
pub const ARRAY_WEIGHTS: i64 = 7i64
pub const ENV_BG_MAX: i64 = 7i64
pub const INFO_2D_ITEMS_IN_FRAME: i64 = 7i64
pub const INSTANCE_GI_PROBE: i64 = 7i64
pub const LIGHT_PARAM_SPOT_ATTENUATION: i64 = 7i64
pub const MAX_GLOW_LEVELS: i64 = 7i64
pub const PRIMITIVE_MAX: i64 = 7i64
pub const TEXTURE_FLAGS_DEFAULT: i64 = 7i64
pub const VIEWPORT_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME: i64 = 7i64
pub const ARRAY_FORMAT_COLOR: i64 = 8i64
pub const ARRAY_INDEX: i64 = 8i64
pub const INFO_2D_DRAW_CALLS_IN_FRAME: i64 = 8i64
pub const INSTANCE_LIGHTMAP_CAPTURE: i64 = 8i64
pub const LIGHT_PARAM_CONTACT_SHADOW_SIZE: i64 = 8i64
pub const MAX_CURSORS: i64 = 8i64
pub const TEXTURE_FLAG_ANISOTROPIC_FILTER: i64 = 8i64
pub const VIEWPORT_RENDER_INFO_MAX: i64 = 8i64
pub const ARRAY_MAX: i64 = 9i64
pub const INFO_USAGE_VIDEO_MEM_TOTAL: i64 = 9i64
pub const INSTANCE_MAX: i64 = 9i64
pub const LIGHT_PARAM_SHADOW_MAX_DISTANCE: i64 = 9i64
pub const INFO_VIDEO_MEM_USED: i64 = 10i64
pub const LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET: i64 = 10i64
pub const INFO_TEXTURE_MEM_USED: i64 = 11i64
pub const LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET: i64 = 11i64
pub const INFO_VERTEX_MEM_USED: i64 = 12i64
pub const LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET: i64 = 12i64
pub const LIGHT_PARAM_SHADOW_NORMAL_BIAS: i64 = 13i64
pub const LIGHT_PARAM_SHADOW_BIAS: i64 = 14i64
pub const LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE: i64 = 15i64
pub const ARRAY_FORMAT_TEX_UV: i64 = 16i64
pub const LIGHT_PARAM_MAX: i64 = 16i64
pub const TEXTURE_FLAG_CONVERT_TO_LINEAR: i64 = 16i64
pub const INSTANCE_GEOMETRY_MASK: i64 = 30i64
pub const ARRAY_FORMAT_TEX_UV2: i64 = 32i64
pub const TEXTURE_FLAG_MIRRORED_REPEAT: i64 = 32i64
pub const ARRAY_FORMAT_BONES: i64 = 64i64
pub const MATERIAL_RENDER_PRIORITY_MAX: i64 = 127i64
pub const ARRAY_FORMAT_WEIGHTS: i64 = 128i64
pub const ARRAY_FORMAT_INDEX: i64 = 256i64
pub const ARRAY_COMPRESS_VERTEX: i64 = 512i64
pub const ARRAY_COMPRESS_NORMAL: i64 = 1_024i64
pub const ARRAY_COMPRESS_TANGENT: i64 = 2_048i64
pub const TEXTURE_FLAG_USED_FOR_STREAMING: i64 = 2_048i64
pub const ARRAY_COMPRESS_COLOR: i64 = 4_096i64
pub const CANVAS_ITEM_Z_MAX: i64 = 4_096i64
pub const ARRAY_COMPRESS_TEX_UV: i64 = 8_192i64
pub const ARRAY_COMPRESS_TEX_UV2: i64 = 16_384i64
pub const ARRAY_COMPRESS_BONES: i64 = 32_768i64
pub const ARRAY_COMPRESS_WEIGHTS: i64 = 65_536i64
pub const ARRAY_COMPRESS_INDEX: i64 = 131_072i64
pub const ARRAY_FLAG_USE_2D_VERTICES: i64 = 262_144i64
pub const ARRAY_FLAG_USE_16_BIT_BONES: i64 = 524_288i64
pub const ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION: i64 = 2_097_152i64
pub const ARRAY_COMPRESS_DEFAULT: i64 = 2_194_432i64
source§impl VisualServer
impl VisualServer
sourcepub unsafe fn godot_singleton() -> &'static Self
pub unsafe fn godot_singleton() -> &'static Self
Returns a reference to the singleton instance.
Safety
This singleton server is only safe to access from outside the main thread if thread-safe operations are enabled in the project settings. See the official thread-safety guidelines for more information.
sourcepub unsafe fn black_bars_set_images(
&self,
left: Rid,
top: Rid,
right: Rid,
bottom: Rid
)
pub unsafe fn black_bars_set_images(
&self,
left: Rid,
top: Rid,
right: Rid,
bottom: Rid
)
Sets images to be rendered in the window margin.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn black_bars_set_margins(&self, left: i64, top: i64, right: i64, bottom: i64)
pub fn black_bars_set_margins(&self, left: i64, top: i64, right: i64, bottom: i64)
Sets margin size, where black bars (or images, if black_bars_set_images
was used) are rendered.
sourcepub fn camera_create(&self) -> Rid
pub fn camera_create(&self) -> Rid
Creates a camera and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all camera_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn camera_set_cull_mask(&self, camera: Rid, layers: i64)
pub unsafe fn camera_set_cull_mask(&self, camera: Rid, layers: i64)
Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to Camera.cull_mask
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn camera_set_environment(&self, camera: Rid, env: Rid)
pub unsafe fn camera_set_environment(&self, camera: Rid, env: Rid)
Sets the environment used by this camera. Equivalent to Camera.environment
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn camera_set_frustum(
&self,
camera: Rid,
size: f64,
offset: Vector2,
z_near: f64,
z_far: f64
)
pub unsafe fn camera_set_frustum(
&self,
camera: Rid,
size: f64,
offset: Vector2,
z_near: f64,
z_far: f64
)
Sets camera to use frustum projection. This mode allows adjusting the offset
argument to create “tilted frustum” effects.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn camera_set_orthogonal(
&self,
camera: Rid,
size: f64,
z_near: f64,
z_far: f64
)
pub unsafe fn camera_set_orthogonal(
&self,
camera: Rid,
size: f64,
z_near: f64,
z_far: f64
)
Sets camera to use orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn camera_set_perspective(
&self,
camera: Rid,
fovy_degrees: f64,
z_near: f64,
z_far: f64
)
pub unsafe fn camera_set_perspective(
&self,
camera: Rid,
fovy_degrees: f64,
z_near: f64,
z_far: f64
)
Sets camera to use perspective projection. Objects on the screen becomes smaller when they are far away.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn camera_set_transform(&self, camera: Rid, transform: Transform)
pub unsafe fn camera_set_transform(&self, camera: Rid, transform: Transform)
sourcepub unsafe fn camera_set_use_vertical_aspect(&self, camera: Rid, enable: bool)
pub unsafe fn camera_set_use_vertical_aspect(&self, camera: Rid, enable: bool)
If true
, preserves the horizontal aspect ratio which is equivalent to Camera.KEEP_WIDTH
. If false
, preserves the vertical aspect ratio which is equivalent to Camera.KEEP_HEIGHT
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn canvas_create(&self) -> Rid
pub fn canvas_create(&self) -> Rid
sourcepub unsafe fn canvas_item_add_circle(
&self,
item: Rid,
pos: Vector2,
radius: f64,
color: Color
)
pub unsafe fn canvas_item_add_circle(
&self,
item: Rid,
pos: Vector2,
radius: f64,
color: Color
)
Adds a circle command to the CanvasItem
’s draw commands.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_clip_ignore(&self, item: Rid, ignore: bool)
pub unsafe fn canvas_item_add_clip_ignore(&self, item: Rid, ignore: bool)
If ignore is true
, the VisualServer does not perform clipping.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_line(
&self,
item: Rid,
from: Vector2,
to: Vector2,
color: Color,
width: f64,
antialiased: bool
)
pub unsafe fn canvas_item_add_line(
&self,
item: Rid,
from: Vector2,
to: Vector2,
color: Color,
width: f64,
antialiased: bool
)
Adds a line command to the CanvasItem
’s draw commands.
Default Arguments
width
-1.0
antialiased
-false
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_mesh(
&self,
item: Rid,
mesh: Rid,
transform: Transform2D,
modulate: Color,
texture: Rid,
normal_map: Rid
)
pub unsafe fn canvas_item_add_mesh(
&self,
item: Rid,
mesh: Rid,
transform: Transform2D,
modulate: Color,
texture: Rid,
normal_map: Rid
)
Adds a mesh command to the CanvasItem
’s draw commands.
Default Arguments
transform
-Transform2D( 1, 0, 0, 1, 0, 0 )
modulate
-Color( 1, 1, 1, 1 )
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_multimesh(
&self,
item: Rid,
mesh: Rid,
texture: Rid,
normal_map: Rid
)
pub unsafe fn canvas_item_add_multimesh(
&self,
item: Rid,
mesh: Rid,
texture: Rid,
normal_map: Rid
)
Adds a MultiMesh
to the CanvasItem
’s draw commands. Only affects its aabb at the moment.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_nine_patch(
&self,
item: Rid,
rect: Rect2,
source: Rect2,
texture: Rid,
topleft: Vector2,
bottomright: Vector2,
x_axis_mode: i64,
y_axis_mode: i64,
draw_center: bool,
modulate: Color,
normal_map: Rid
)
pub unsafe fn canvas_item_add_nine_patch(
&self,
item: Rid,
rect: Rect2,
source: Rect2,
texture: Rid,
topleft: Vector2,
bottomright: Vector2,
x_axis_mode: i64,
y_axis_mode: i64,
draw_center: bool,
modulate: Color,
normal_map: Rid
)
Adds a nine patch image to the CanvasItem
’s draw commands.
See NinePatchRect
for more explanation.
Default Arguments
x_axis_mode
-0
y_axis_mode
-0
draw_center
-true
modulate
-Color( 1, 1, 1, 1 )
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_particles(
&self,
item: Rid,
particles: Rid,
texture: Rid,
normal_map: Rid
)
pub unsafe fn canvas_item_add_particles(
&self,
item: Rid,
particles: Rid,
texture: Rid,
normal_map: Rid
)
Adds a particle system to the CanvasItem
’s draw commands.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_polygon(
&self,
item: Rid,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
uvs: PoolArray<Vector2>,
texture: Rid,
normal_map: Rid,
antialiased: bool
)
pub unsafe fn canvas_item_add_polygon(
&self,
item: Rid,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
uvs: PoolArray<Vector2>,
texture: Rid,
normal_map: Rid,
antialiased: bool
)
Adds a polygon to the CanvasItem
’s draw commands.
Default Arguments
uvs
-PoolVector2Array( )
antialiased
-false
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_polyline(
&self,
item: Rid,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
width: f64,
antialiased: bool
)
pub unsafe fn canvas_item_add_polyline(
&self,
item: Rid,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
width: f64,
antialiased: bool
)
Adds a polyline, which is a line from multiple points with a width, to the CanvasItem
’s draw commands.
Default Arguments
width
-1.0
antialiased
-false
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_primitive(
&self,
item: Rid,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
uvs: PoolArray<Vector2>,
texture: Rid,
width: f64,
normal_map: Rid
)
pub unsafe fn canvas_item_add_primitive(
&self,
item: Rid,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
uvs: PoolArray<Vector2>,
texture: Rid,
width: f64,
normal_map: Rid
)
Adds a primitive to the CanvasItem
’s draw commands.
Default Arguments
width
-1.0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_rect(&self, item: Rid, rect: Rect2, color: Color)
pub unsafe fn canvas_item_add_rect(&self, item: Rid, rect: Rect2, color: Color)
Adds a rectangle to the CanvasItem
’s draw commands.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_set_transform(
&self,
item: Rid,
transform: Transform2D
)
pub unsafe fn canvas_item_add_set_transform(
&self,
item: Rid,
transform: Transform2D
)
Adds a Transform2D
command to the CanvasItem
’s draw commands.
This sets the extra_matrix uniform when executed. This affects the later commands of the canvas item.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_texture_rect(
&self,
item: Rid,
rect: Rect2,
texture: Rid,
tile: bool,
modulate: Color,
transpose: bool,
normal_map: Rid
)
pub unsafe fn canvas_item_add_texture_rect(
&self,
item: Rid,
rect: Rect2,
texture: Rid,
tile: bool,
modulate: Color,
transpose: bool,
normal_map: Rid
)
Adds a textured rect to the CanvasItem
’s draw commands.
Default Arguments
tile
-false
modulate
-Color( 1, 1, 1, 1 )
transpose
-false
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_texture_rect_region(
&self,
item: Rid,
rect: Rect2,
texture: Rid,
src_rect: Rect2,
modulate: Color,
transpose: bool,
normal_map: Rid,
clip_uv: bool
)
pub unsafe fn canvas_item_add_texture_rect_region(
&self,
item: Rid,
rect: Rect2,
texture: Rid,
src_rect: Rect2,
modulate: Color,
transpose: bool,
normal_map: Rid,
clip_uv: bool
)
Adds a texture rect with region setting to the CanvasItem
’s draw commands.
Default Arguments
modulate
-Color( 1, 1, 1, 1 )
transpose
-false
clip_uv
-true
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_add_triangle_array(
&self,
item: Rid,
indices: PoolArray<i32>,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
uvs: PoolArray<Vector2>,
bones: PoolArray<i32>,
weights: PoolArray<f32>,
texture: Rid,
count: i64,
normal_map: Rid,
antialiased: bool,
antialiasing_use_indices: bool
)
pub unsafe fn canvas_item_add_triangle_array(
&self,
item: Rid,
indices: PoolArray<i32>,
points: PoolArray<Vector2>,
colors: PoolArray<Color>,
uvs: PoolArray<Vector2>,
bones: PoolArray<i32>,
weights: PoolArray<f32>,
texture: Rid,
count: i64,
normal_map: Rid,
antialiased: bool,
antialiasing_use_indices: bool
)
Adds a triangle array to the CanvasItem
’s draw commands.
Default Arguments
uvs
-PoolVector2Array( )
bones
-PoolIntArray( )
weights
-PoolRealArray( )
count
--1
antialiased
-false
antialiasing_use_indices
-false
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_clear(&self, item: Rid)
pub unsafe fn canvas_item_clear(&self, item: Rid)
Clears the CanvasItem
and removes all commands in it.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn canvas_item_create(&self) -> Rid
pub fn canvas_item_create(&self) -> Rid
Creates a new CanvasItem
and returns its RID
. It can be accessed with the RID that is returned. This RID will be used in all canvas_item_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn canvas_item_set_clip(&self, item: Rid, clip: bool)
pub unsafe fn canvas_item_set_clip(&self, item: Rid, clip: bool)
Sets clipping for the CanvasItem
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_copy_to_backbuffer(
&self,
item: Rid,
enabled: bool,
rect: Rect2
)
pub unsafe fn canvas_item_set_copy_to_backbuffer(
&self,
item: Rid,
enabled: bool,
rect: Rect2
)
Sets the CanvasItem
to copy a rect to the backbuffer.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_custom_rect(
&self,
item: Rid,
use_custom_rect: bool,
rect: Rect2
)
pub unsafe fn canvas_item_set_custom_rect(
&self,
item: Rid,
use_custom_rect: bool,
rect: Rect2
)
Defines a custom drawing rectangle for the CanvasItem
.
Default Arguments
rect
-Rect2( 0, 0, 0, 0 )
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_distance_field_mode(&self, item: Rid, enabled: bool)
pub unsafe fn canvas_item_set_distance_field_mode(&self, item: Rid, enabled: bool)
Enables the use of distance fields for GUI elements that are rendering distance field based fonts.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_draw_behind_parent(&self, item: Rid, enabled: bool)
pub unsafe fn canvas_item_set_draw_behind_parent(&self, item: Rid, enabled: bool)
Sets CanvasItem
to be drawn behind its parent.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_draw_index(&self, item: Rid, index: i64)
pub unsafe fn canvas_item_set_draw_index(&self, item: Rid, index: i64)
Sets the index for the CanvasItem
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_light_mask(&self, item: Rid, mask: i64)
pub unsafe fn canvas_item_set_light_mask(&self, item: Rid, mask: i64)
The light mask. See LightOccluder2D
for more information on light masks.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_material(&self, item: Rid, material: Rid)
pub unsafe fn canvas_item_set_material(&self, item: Rid, material: Rid)
Sets a new material to the CanvasItem
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_modulate(&self, item: Rid, color: Color)
pub unsafe fn canvas_item_set_modulate(&self, item: Rid, color: Color)
Sets the color that modulates the CanvasItem
and its children.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_parent(&self, item: Rid, parent: Rid)
pub unsafe fn canvas_item_set_parent(&self, item: Rid, parent: Rid)
Sets the parent for the CanvasItem
. The parent can be another canvas item, or it can be the root canvas that is attached to the viewport.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_self_modulate(&self, item: Rid, color: Color)
pub unsafe fn canvas_item_set_self_modulate(&self, item: Rid, color: Color)
Sets the color that modulates the CanvasItem
without children.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_sort_children_by_y(&self, item: Rid, enabled: bool)
pub unsafe fn canvas_item_set_sort_children_by_y(&self, item: Rid, enabled: bool)
Sets if CanvasItem
’s children should be sorted by y-position.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_transform(&self, item: Rid, transform: Transform2D)
pub unsafe fn canvas_item_set_transform(&self, item: Rid, transform: Transform2D)
Sets the CanvasItem
’s Transform2D
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_use_parent_material(&self, item: Rid, enabled: bool)
pub unsafe fn canvas_item_set_use_parent_material(&self, item: Rid, enabled: bool)
Sets if the CanvasItem
uses its parent’s material.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_visible(&self, item: Rid, visible: bool)
pub unsafe fn canvas_item_set_visible(&self, item: Rid, visible: bool)
Sets if the canvas item (including its children) is visible.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_z_as_relative_to_parent(
&self,
item: Rid,
enabled: bool
)
pub unsafe fn canvas_item_set_z_as_relative_to_parent(
&self,
item: Rid,
enabled: bool
)
If this is enabled, the Z index of the parent will be added to the children’s Z index.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_item_set_z_index(&self, item: Rid, z_index: i64)
pub unsafe fn canvas_item_set_z_index(&self, item: Rid, z_index: i64)
Sets the CanvasItem
’s Z index, i.e. its draw order (lower indexes are drawn first).
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_attach_to_canvas(&self, light: Rid, canvas: Rid)
pub unsafe fn canvas_light_attach_to_canvas(&self, light: Rid, canvas: Rid)
Attaches the canvas light to the canvas. Removes it from its previous canvas.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn canvas_light_create(&self) -> Rid
pub fn canvas_light_create(&self) -> Rid
Creates a canvas light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn canvas_light_occluder_attach_to_canvas(
&self,
occluder: Rid,
canvas: Rid
)
pub unsafe fn canvas_light_occluder_attach_to_canvas(
&self,
occluder: Rid,
canvas: Rid
)
Attaches a light occluder to the canvas. Removes it from its previous canvas.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn canvas_light_occluder_create(&self) -> Rid
pub fn canvas_light_occluder_create(&self) -> Rid
Creates a light occluder and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_ocluder_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn canvas_light_occluder_set_enabled(
&self,
occluder: Rid,
enabled: bool
)
pub unsafe fn canvas_light_occluder_set_enabled(
&self,
occluder: Rid,
enabled: bool
)
Enables or disables light occluder.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_occluder_set_light_mask(
&self,
occluder: Rid,
mask: i64
)
pub unsafe fn canvas_light_occluder_set_light_mask(
&self,
occluder: Rid,
mask: i64
)
The light mask. See LightOccluder2D
for more information on light masks.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_occluder_set_polygon(
&self,
occluder: Rid,
polygon: Rid
)
pub unsafe fn canvas_light_occluder_set_polygon(
&self,
occluder: Rid,
polygon: Rid
)
Sets a light occluder’s polygon.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_occluder_set_transform(
&self,
occluder: Rid,
transform: Transform2D
)
pub unsafe fn canvas_light_occluder_set_transform(
&self,
occluder: Rid,
transform: Transform2D
)
Sets a light occluder’s Transform2D
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_color(&self, light: Rid, color: Color)
pub unsafe fn canvas_light_set_color(&self, light: Rid, color: Color)
Sets the color for a light.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_enabled(&self, light: Rid, enabled: bool)
pub unsafe fn canvas_light_set_enabled(&self, light: Rid, enabled: bool)
Enables or disables a canvas light.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_energy(&self, light: Rid, energy: f64)
pub unsafe fn canvas_light_set_energy(&self, light: Rid, energy: f64)
Sets a canvas light’s energy.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_height(&self, light: Rid, height: f64)
pub unsafe fn canvas_light_set_height(&self, light: Rid, height: f64)
Sets a canvas light’s height.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_item_cull_mask(&self, light: Rid, mask: i64)
pub unsafe fn canvas_light_set_item_cull_mask(&self, light: Rid, mask: i64)
The light mask. See LightOccluder2D
for more information on light masks.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_item_shadow_cull_mask(&self, light: Rid, mask: i64)
pub unsafe fn canvas_light_set_item_shadow_cull_mask(&self, light: Rid, mask: i64)
The binary mask used to determine which layers this canvas light’s shadows affects. See LightOccluder2D
for more information on light masks.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_layer_range(
&self,
light: Rid,
min_layer: i64,
max_layer: i64
)
pub unsafe fn canvas_light_set_layer_range(
&self,
light: Rid,
min_layer: i64,
max_layer: i64
)
The layer range that gets rendered with this light.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_mode(&self, light: Rid, mode: i64)
pub unsafe fn canvas_light_set_mode(&self, light: Rid, mode: i64)
The mode of the light, see CanvasLightMode
constants.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_scale(&self, light: Rid, scale: f64)
pub unsafe fn canvas_light_set_scale(&self, light: Rid, scale: f64)
Sets the texture’s scale factor of the light. Equivalent to Light2D.texture_scale
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_shadow_buffer_size(&self, light: Rid, size: i64)
pub unsafe fn canvas_light_set_shadow_buffer_size(&self, light: Rid, size: i64)
Sets the width of the shadow buffer, size gets scaled to the next power of two for this.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_shadow_color(&self, light: Rid, color: Color)
pub unsafe fn canvas_light_set_shadow_color(&self, light: Rid, color: Color)
Sets the color of the canvas light’s shadow.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_shadow_enabled(&self, light: Rid, enabled: bool)
pub unsafe fn canvas_light_set_shadow_enabled(&self, light: Rid, enabled: bool)
Enables or disables the canvas light’s shadow.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_shadow_filter(&self, light: Rid, filter: i64)
pub unsafe fn canvas_light_set_shadow_filter(&self, light: Rid, filter: i64)
Sets the canvas light’s shadow’s filter, see CanvasLightShadowFilter
constants.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_shadow_gradient_length(
&self,
light: Rid,
length: f64
)
pub unsafe fn canvas_light_set_shadow_gradient_length(
&self,
light: Rid,
length: f64
)
Sets the length of the shadow’s gradient.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_shadow_smooth(&self, light: Rid, smooth: f64)
pub unsafe fn canvas_light_set_shadow_smooth(&self, light: Rid, smooth: f64)
Smoothens the shadow. The lower, the smoother.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_texture(&self, light: Rid, texture: Rid)
pub unsafe fn canvas_light_set_texture(&self, light: Rid, texture: Rid)
Sets texture to be used by light. Equivalent to Light2D.texture
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_texture_offset(&self, light: Rid, offset: Vector2)
pub unsafe fn canvas_light_set_texture_offset(&self, light: Rid, offset: Vector2)
Sets the offset of the light’s texture. Equivalent to [Light2D.offset
][Light2D::offset].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_transform(
&self,
light: Rid,
transform: Transform2D
)
pub unsafe fn canvas_light_set_transform(
&self,
light: Rid,
transform: Transform2D
)
Sets the canvas light’s Transform2D
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_light_set_z_range(&self, light: Rid, min_z: i64, max_z: i64)
pub unsafe fn canvas_light_set_z_range(&self, light: Rid, min_z: i64, max_z: i64)
Sets the Z range of objects that will be affected by this light. Equivalent to [Light2D.range_z_min
][Light2D::range_z_min] and [Light2D.range_z_max
][Light2D::range_z_max].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn canvas_occluder_polygon_create(&self) -> Rid
pub fn canvas_occluder_polygon_create(&self) -> Rid
Creates a new light occluder polygon and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_occluder_polygon_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn canvas_occluder_polygon_set_cull_mode(
&self,
occluder_polygon: Rid,
mode: i64
)
pub unsafe fn canvas_occluder_polygon_set_cull_mode(
&self,
occluder_polygon: Rid,
mode: i64
)
Sets an occluder polygons cull mode. See CanvasOccluderPolygonCullMode
constants.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_occluder_polygon_set_shape(
&self,
occluder_polygon: Rid,
shape: PoolArray<Vector2>,
closed: bool
)
pub unsafe fn canvas_occluder_polygon_set_shape(
&self,
occluder_polygon: Rid,
shape: PoolArray<Vector2>,
closed: bool
)
Sets the shape of the occluder polygon.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_occluder_polygon_set_shape_as_lines(
&self,
occluder_polygon: Rid,
shape: PoolArray<Vector2>
)
pub unsafe fn canvas_occluder_polygon_set_shape_as_lines(
&self,
occluder_polygon: Rid,
shape: PoolArray<Vector2>
)
Sets the shape of the occluder polygon as lines.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn canvas_set_item_mirroring(
&self,
canvas: Rid,
item: Rid,
mirroring: Vector2
)
pub unsafe fn canvas_set_item_mirroring(
&self,
canvas: Rid,
item: Rid,
mirroring: Vector2
)
sourcepub unsafe fn canvas_set_modulate(&self, canvas: Rid, color: Color)
pub unsafe fn canvas_set_modulate(&self, canvas: Rid, color: Color)
Modulates all colors in the given canvas.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn directional_light_create(&self) -> Rid
pub fn directional_light_create(&self) -> Rid
Creates a directional light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most light_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this directional light to an instance using instance_set_base
using the returned RID.
sourcepub fn draw(&self, swap_buffers: bool, frame_step: f64)
pub fn draw(&self, swap_buffers: bool, frame_step: f64)
Draws a frame. This method is deprecated, please use force_draw
instead.
Default Arguments
swap_buffers
-true
frame_step
-0.0
sourcepub fn environment_create(&self) -> Rid
pub fn environment_create(&self) -> Rid
Creates an environment and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all environment_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn environment_set_adjustment(
&self,
env: Rid,
enable: bool,
brightness: f64,
contrast: f64,
saturation: f64,
ramp: Rid
)
pub unsafe fn environment_set_adjustment(
&self,
env: Rid,
enable: bool,
brightness: f64,
contrast: f64,
saturation: f64,
ramp: Rid
)
Sets the values to be used with the “Adjustment” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_ambient_light(
&self,
env: Rid,
color: Color,
energy: f64,
sky_contibution: f64
)
pub unsafe fn environment_set_ambient_light(
&self,
env: Rid,
color: Color,
energy: f64,
sky_contibution: f64
)
Sets the ambient light parameters. See Environment
for more details.
Default Arguments
energy
-1.0
sky_contibution
-0.0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_background(&self, env: Rid, bg: i64)
pub unsafe fn environment_set_background(&self, env: Rid, bg: i64)
Sets the BGMode of the environment. Equivalent to [Environment.background_mode
][Environment::background_mode].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_bg_color(&self, env: Rid, color: Color)
pub unsafe fn environment_set_bg_color(&self, env: Rid, color: Color)
Color displayed for clear areas of the scene (if using Custom color or Color+Sky background modes).
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_bg_energy(&self, env: Rid, energy: f64)
pub unsafe fn environment_set_bg_energy(&self, env: Rid, energy: f64)
Sets the intensity of the background color.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_canvas_max_layer(&self, env: Rid, max_layer: i64)
pub unsafe fn environment_set_canvas_max_layer(&self, env: Rid, max_layer: i64)
Sets the maximum layer to use if using Canvas background mode.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_dof_blur_far(
&self,
env: Rid,
enable: bool,
distance: f64,
transition: f64,
far_amount: f64,
quality: i64
)
pub unsafe fn environment_set_dof_blur_far(
&self,
env: Rid,
enable: bool,
distance: f64,
transition: f64,
far_amount: f64,
quality: i64
)
Sets the values to be used with the “DoF Far Blur” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_dof_blur_near(
&self,
env: Rid,
enable: bool,
distance: f64,
transition: f64,
far_amount: f64,
quality: i64
)
pub unsafe fn environment_set_dof_blur_near(
&self,
env: Rid,
enable: bool,
distance: f64,
transition: f64,
far_amount: f64,
quality: i64
)
Sets the values to be used with the “DoF Near Blur” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_fog(
&self,
env: Rid,
enable: bool,
color: Color,
sun_color: Color,
sun_amount: f64
)
pub unsafe fn environment_set_fog(
&self,
env: Rid,
enable: bool,
color: Color,
sun_color: Color,
sun_amount: f64
)
Sets the variables to be used with the scene fog. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_fog_depth(
&self,
env: Rid,
enable: bool,
depth_begin: f64,
depth_end: f64,
depth_curve: f64,
transmit: bool,
transmit_curve: f64
)
pub unsafe fn environment_set_fog_depth(
&self,
env: Rid,
enable: bool,
depth_begin: f64,
depth_end: f64,
depth_curve: f64,
transmit: bool,
transmit_curve: f64
)
Sets the variables to be used with the fog depth effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_fog_height(
&self,
env: Rid,
enable: bool,
min_height: f64,
max_height: f64,
height_curve: f64
)
pub unsafe fn environment_set_fog_height(
&self,
env: Rid,
enable: bool,
min_height: f64,
max_height: f64,
height_curve: f64
)
Sets the variables to be used with the fog height effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_glow(
&self,
env: Rid,
enable: bool,
level_flags: i64,
intensity: f64,
strength: f64,
bloom_threshold: f64,
blend_mode: i64,
hdr_bleed_threshold: f64,
hdr_bleed_scale: f64,
hdr_luminance_cap: f64,
bicubic_upscale: bool,
high_quality: bool
)
pub unsafe fn environment_set_glow(
&self,
env: Rid,
enable: bool,
level_flags: i64,
intensity: f64,
strength: f64,
bloom_threshold: f64,
blend_mode: i64,
hdr_bleed_threshold: f64,
hdr_bleed_scale: f64,
hdr_luminance_cap: f64,
bicubic_upscale: bool,
high_quality: bool
)
Sets the variables to be used with the “glow” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_sky(&self, env: Rid, sky: Rid)
pub unsafe fn environment_set_sky(&self, env: Rid, sky: Rid)
Sets the Sky
to be used as the environment’s background when using BGMode sky. Equivalent to [Environment.background_sky
][Environment::background_sky].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_sky_custom_fov(&self, env: Rid, scale: f64)
pub unsafe fn environment_set_sky_custom_fov(&self, env: Rid, scale: f64)
Sets a custom field of view for the background Sky
. Equivalent to [Environment.background_sky_custom_fov
][Environment::background_sky_custom_fov].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_sky_orientation(&self, env: Rid, orientation: Basis)
pub unsafe fn environment_set_sky_orientation(&self, env: Rid, orientation: Basis)
Sets the rotation of the background Sky
expressed as a Basis
. Equivalent to [Environment.background_sky_orientation
][Environment::background_sky_orientation].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_ssao(
&self,
env: Rid,
enable: bool,
radius: f64,
intensity: f64,
radius2: f64,
intensity2: f64,
bias: f64,
light_affect: f64,
ao_channel_affect: f64,
color: Color,
quality: i64,
blur: i64,
bilateral_sharpness: f64
)
pub unsafe fn environment_set_ssao(
&self,
env: Rid,
enable: bool,
radius: f64,
intensity: f64,
radius2: f64,
intensity2: f64,
bias: f64,
light_affect: f64,
ao_channel_affect: f64,
color: Color,
quality: i64,
blur: i64,
bilateral_sharpness: f64
)
Sets the variables to be used with the “Screen Space Ambient Occlusion (SSAO)” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_ssr(
&self,
env: Rid,
enable: bool,
max_steps: i64,
fade_in: f64,
fade_out: f64,
depth_tolerance: f64,
roughness: bool
)
pub unsafe fn environment_set_ssr(
&self,
env: Rid,
enable: bool,
max_steps: i64,
fade_in: f64,
fade_out: f64,
depth_tolerance: f64,
roughness: bool
)
Sets the variables to be used with the “screen space reflections” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn environment_set_tonemap(
&self,
env: Rid,
tone_mapper: i64,
exposure: f64,
white: f64,
auto_exposure: bool,
min_luminance: f64,
max_luminance: f64,
auto_exp_speed: f64,
auto_exp_grey: f64
)
pub unsafe fn environment_set_tonemap(
&self,
env: Rid,
tone_mapper: i64,
exposure: f64,
white: f64,
auto_exposure: bool,
min_luminance: f64,
max_luminance: f64,
auto_exp_speed: f64,
auto_exp_grey: f64
)
Sets the variables to be used with the “tonemap” post-process effect. See Environment
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn force_draw(&self, swap_buffers: bool, frame_step: f64)
pub fn force_draw(&self, swap_buffers: bool, frame_step: f64)
Forces a frame to be drawn when the function is called. Drawing a frame updates all Viewport
s that are set to update. Use with extreme caution.
Default Arguments
swap_buffers
-true
frame_step
-0.0
sourcepub fn force_sync(&self)
pub fn force_sync(&self)
Synchronizes threads.
sourcepub unsafe fn free_rid(&self, rid: Rid)
pub unsafe fn free_rid(&self, rid: Rid)
Tries to free an object in the VisualServer.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn get_render_info(&self, info: i64) -> i64
pub fn get_render_info(&self, info: i64) -> i64
Returns a certain information, see RenderInfo
for options.
sourcepub fn get_test_cube(&self) -> Rid
pub fn get_test_cube(&self) -> Rid
Returns the id of the test cube. Creates one if none exists.
sourcepub fn get_test_texture(&self) -> Rid
pub fn get_test_texture(&self) -> Rid
Returns the id of the test texture. Creates one if none exists.
sourcepub fn get_video_adapter_name(&self) -> GodotString
pub fn get_video_adapter_name(&self) -> GodotString
Returns the name of the video adapter (e.g. “GeForce GTX 1080/PCIe/SSE2”). Note: When running a headless or server binary, this function returns an empty string.
sourcepub fn get_video_adapter_vendor(&self) -> GodotString
pub fn get_video_adapter_vendor(&self) -> GodotString
Returns the vendor of the video adapter (e.g. “NVIDIA Corporation”). Note: When running a headless or server binary, this function returns an empty string.
sourcepub fn get_white_texture(&self) -> Rid
pub fn get_white_texture(&self) -> Rid
Returns the id of a white texture. Creates one if none exists.
sourcepub fn gi_probe_create(&self) -> Rid
pub fn gi_probe_create(&self) -> Rid
Creates a GI probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all gi_probe_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this GI probe to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn gi_probe_get_bias(&self, probe: Rid) -> f64
pub unsafe fn gi_probe_get_bias(&self, probe: Rid) -> f64
Returns the bias value for the GI probe. Bias is used to avoid self occlusion. Equivalent to GIProbeData.bias
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_bounds(&self, probe: Rid) -> Aabb
pub unsafe fn gi_probe_get_bounds(&self, probe: Rid) -> Aabb
Returns the axis-aligned bounding box that covers the full extent of the GI probe.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_cell_size(&self, probe: Rid) -> f64
pub unsafe fn gi_probe_get_cell_size(&self, probe: Rid) -> f64
Returns the cell size set by gi_probe_set_cell_size
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_dynamic_data(&self, probe: Rid) -> PoolArray<i32>
pub unsafe fn gi_probe_get_dynamic_data(&self, probe: Rid) -> PoolArray<i32>
Returns the data used by the GI probe.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_dynamic_range(&self, probe: Rid) -> i64
pub unsafe fn gi_probe_get_dynamic_range(&self, probe: Rid) -> i64
Returns the dynamic range set for this GI probe. Equivalent to GIProbe.dynamic_range
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_energy(&self, probe: Rid) -> f64
pub unsafe fn gi_probe_get_energy(&self, probe: Rid) -> f64
Returns the energy multiplier for this GI probe. Equivalent to GIProbe.energy
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_normal_bias(&self, probe: Rid) -> f64
pub unsafe fn gi_probe_get_normal_bias(&self, probe: Rid) -> f64
Returns the normal bias for this GI probe. Equivalent to GIProbe.normal_bias
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_propagation(&self, probe: Rid) -> f64
pub unsafe fn gi_probe_get_propagation(&self, probe: Rid) -> f64
Returns the propagation value for this GI probe. Equivalent to GIProbe.propagation
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_get_to_cell_xform(&self, probe: Rid) -> Transform
pub unsafe fn gi_probe_get_to_cell_xform(&self, probe: Rid) -> Transform
Returns the Transform set by gi_probe_set_to_cell_xform
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_is_compressed(&self, probe: Rid) -> bool
pub unsafe fn gi_probe_is_compressed(&self, probe: Rid) -> bool
Returns true
if the GI probe data associated with this GI probe is compressed. Equivalent to [GIProbe.compress
][GIProbe::compress].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_is_interior(&self, probe: Rid) -> bool
pub unsafe fn gi_probe_is_interior(&self, probe: Rid) -> bool
Returns true
if the GI probe is set to interior, meaning it does not account for sky light. Equivalent to [GIProbe.interior
][GIProbe::interior].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_bias(&self, probe: Rid, bias: f64)
pub unsafe fn gi_probe_set_bias(&self, probe: Rid, bias: f64)
Sets the bias value to avoid self-occlusion. Equivalent to GIProbe.bias
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_bounds(&self, probe: Rid, bounds: Aabb)
pub unsafe fn gi_probe_set_bounds(&self, probe: Rid, bounds: Aabb)
Sets the axis-aligned bounding box that covers the extent of the GI probe.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_cell_size(&self, probe: Rid, range: f64)
pub unsafe fn gi_probe_set_cell_size(&self, probe: Rid, range: f64)
Sets the size of individual cells within the GI probe.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_compress(&self, probe: Rid, enable: bool)
pub unsafe fn gi_probe_set_compress(&self, probe: Rid, enable: bool)
Sets the compression setting for the GI probe data. Compressed data will take up less space but may look worse. Equivalent to [GIProbe.compress
][GIProbe::compress].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_dynamic_data(&self, probe: Rid, data: PoolArray<i32>)
pub unsafe fn gi_probe_set_dynamic_data(&self, probe: Rid, data: PoolArray<i32>)
Sets the data to be used in the GI probe for lighting calculations. Normally this is created and called internally within the GIProbe
node. You should not try to set this yourself.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_dynamic_range(&self, probe: Rid, range: i64)
pub unsafe fn gi_probe_set_dynamic_range(&self, probe: Rid, range: i64)
Sets the dynamic range of the GI probe. Dynamic range sets the limit for how bright lights can be. A smaller range captures greater detail but limits how bright lights can be. Equivalent to GIProbe.dynamic_range
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_energy(&self, probe: Rid, energy: f64)
pub unsafe fn gi_probe_set_energy(&self, probe: Rid, energy: f64)
Sets the energy multiplier for this GI probe. A higher energy makes the indirect light from the GI probe brighter. Equivalent to GIProbe.energy
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_interior(&self, probe: Rid, enable: bool)
pub unsafe fn gi_probe_set_interior(&self, probe: Rid, enable: bool)
Sets the interior value of this GI probe. A GI probe set to interior does not include the sky when calculating lighting. Equivalent to [GIProbe.interior
][GIProbe::interior].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_normal_bias(&self, probe: Rid, bias: f64)
pub unsafe fn gi_probe_set_normal_bias(&self, probe: Rid, bias: f64)
Sets the normal bias for this GI probe. Normal bias behaves similar to the other form of bias and may help reduce self-occlusion. Equivalent to GIProbe.normal_bias
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_propagation(&self, probe: Rid, propagation: f64)
pub unsafe fn gi_probe_set_propagation(&self, probe: Rid, propagation: f64)
Sets the propagation of light within this GI probe. Equivalent to GIProbe.propagation
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn gi_probe_set_to_cell_xform(&self, probe: Rid, xform: Transform)
pub unsafe fn gi_probe_set_to_cell_xform(&self, probe: Rid, xform: Transform)
sourcepub fn has_changed(&self, queried_priority: i64) -> bool
pub fn has_changed(&self, queried_priority: i64) -> bool
Returns true
if changes have been made to the VisualServer’s data. draw
is usually called if this happens.
As changes are registered as either high or low priority (e.g. dynamic shaders), this function takes an optional argument to query either low or high priority changes, or any changes.
Default Arguments
queried_priority
-0
sourcepub fn has_feature(&self, feature: i64) -> bool
pub fn has_feature(&self, feature: i64) -> bool
Not yet implemented. Always returns false
.
sourcepub fn has_os_feature(&self, feature: impl Into<GodotString>) -> bool
pub fn has_os_feature(&self, feature: impl Into<GodotString>) -> bool
Returns true
if the OS supports a certain feature. Features might be s3tc
, etc
, etc2
, pvrtc
and skinning_fallback
.
When rendering with GLES2, returns true
with skinning_fallback
in case the hardware doesn’t support the default GPU skinning process.
sourcepub unsafe fn immediate_begin(&self, immediate: Rid, primitive: i64, texture: Rid)
pub unsafe fn immediate_begin(&self, immediate: Rid, primitive: i64, texture: Rid)
Sets up ImmediateGeometry
internals to prepare for drawing. Equivalent to ImmediateGeometry.begin
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_clear(&self, immediate: Rid)
pub unsafe fn immediate_clear(&self, immediate: Rid)
Clears everything that was set up between immediate_begin
and immediate_end
. Equivalent to ImmediateGeometry.clear
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_color(&self, immediate: Rid, color: Color)
pub unsafe fn immediate_color(&self, immediate: Rid, color: Color)
Sets the color to be used with next vertex. Equivalent to ImmediateGeometry.set_color
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn immediate_create(&self) -> Rid
pub fn immediate_create(&self) -> Rid
Creates an immediate geometry and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all immediate_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this immediate geometry to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn immediate_end(&self, immediate: Rid)
pub unsafe fn immediate_end(&self, immediate: Rid)
Ends drawing the ImmediateGeometry
and displays it. Equivalent to ImmediateGeometry.end
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_get_material(&self, immediate: Rid) -> Rid
pub unsafe fn immediate_get_material(&self, immediate: Rid) -> Rid
Returns the material assigned to the ImmediateGeometry
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_normal(&self, immediate: Rid, normal: Vector3)
pub unsafe fn immediate_normal(&self, immediate: Rid, normal: Vector3)
Sets the normal to be used with next vertex. Equivalent to ImmediateGeometry.set_normal
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_set_material(&self, immediate: Rid, material: Rid)
pub unsafe fn immediate_set_material(&self, immediate: Rid, material: Rid)
Sets the material to be used to draw the ImmediateGeometry
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_tangent(&self, immediate: Rid, tangent: Plane)
pub unsafe fn immediate_tangent(&self, immediate: Rid, tangent: Plane)
Sets the tangent to be used with next vertex. Equivalent to ImmediateGeometry.set_tangent
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_uv(&self, immediate: Rid, tex_uv: Vector2)
pub unsafe fn immediate_uv(&self, immediate: Rid, tex_uv: Vector2)
Sets the UV to be used with next vertex. Equivalent to ImmediateGeometry.set_uv
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_uv2(&self, immediate: Rid, tex_uv: Vector2)
pub unsafe fn immediate_uv2(&self, immediate: Rid, tex_uv: Vector2)
Sets the UV2 to be used with next vertex. Equivalent to ImmediateGeometry.set_uv2
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_vertex(&self, immediate: Rid, vertex: Vector3)
pub unsafe fn immediate_vertex(&self, immediate: Rid, vertex: Vector3)
Adds the next vertex using the information provided in advance. Equivalent to ImmediateGeometry.add_vertex
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn immediate_vertex_2d(&self, immediate: Rid, vertex: Vector2)
pub unsafe fn immediate_vertex_2d(&self, immediate: Rid, vertex: Vector2)
Adds the next vertex using the information provided in advance. This is a helper class that calls immediate_vertex
under the hood. Equivalent to ImmediateGeometry.add_vertex
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn init(&self)
pub fn init(&self)
Initializes the visual server. This function is called internally by platform-dependent code during engine initialization. If called from a running game, it will not do anything.
sourcepub unsafe fn instance_attach_object_instance_id(&self, instance: Rid, id: i64)
pub unsafe fn instance_attach_object_instance_id(&self, instance: Rid, id: i64)
Attaches a unique Object ID to instance. Object ID must be attached to instance for proper culling with instances_cull_aabb
, instances_cull_convex
, and instances_cull_ray
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_attach_skeleton(&self, instance: Rid, skeleton: Rid)
pub unsafe fn instance_attach_skeleton(&self, instance: Rid, skeleton: Rid)
Attaches a skeleton to an instance. Removes the previous skeleton from the instance.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn instance_create(&self) -> Rid
pub fn instance_create(&self) -> Rid
Creates a visual instance and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all instance_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, and reflection probes need to be associated with an instance to be visible in the scenario using instance_set_base
.
sourcepub unsafe fn instance_create2(&self, base: Rid, scenario: Rid) -> Rid
pub unsafe fn instance_create2(&self, base: Rid, scenario: Rid) -> Rid
Creates a visual instance, adds it to the VisualServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all instance_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_geometry_set_as_instance_lod(
&self,
instance: Rid,
as_lod_of_instance: Rid
)
pub unsafe fn instance_geometry_set_as_instance_lod(
&self,
instance: Rid,
as_lod_of_instance: Rid
)
Not implemented in Godot 3.x.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_geometry_set_cast_shadows_setting(
&self,
instance: Rid,
shadow_casting_setting: i64
)
pub unsafe fn instance_geometry_set_cast_shadows_setting(
&self,
instance: Rid,
shadow_casting_setting: i64
)
Sets the shadow casting setting to one of ShadowCastingSetting
. Equivalent to [GeometryInstance.cast_shadow
][GeometryInstance::cast_shadow].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_geometry_set_draw_range(
&self,
instance: Rid,
min: f64,
max: f64,
min_margin: f64,
max_margin: f64
)
pub unsafe fn instance_geometry_set_draw_range(
&self,
instance: Rid,
min: f64,
max: f64,
min_margin: f64,
max_margin: f64
)
Not implemented in Godot 3.x.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_geometry_set_flag(
&self,
instance: Rid,
flag: i64,
enabled: bool
)
pub unsafe fn instance_geometry_set_flag(
&self,
instance: Rid,
flag: i64,
enabled: bool
)
Sets the flag for a given InstanceFlags
. See InstanceFlags
for more details.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_geometry_set_material_overlay(
&self,
instance: Rid,
material: Rid
)
pub unsafe fn instance_geometry_set_material_overlay(
&self,
instance: Rid,
material: Rid
)
Sets a material that will be rendered for all surfaces on top of active materials for the mesh associated with this instance. Equivalent to GeometryInstance.material_overlay
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_geometry_set_material_override(
&self,
instance: Rid,
material: Rid
)
pub unsafe fn instance_geometry_set_material_override(
&self,
instance: Rid,
material: Rid
)
Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to GeometryInstance.material_override
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_base(&self, instance: Rid, base: Rid)
pub unsafe fn instance_set_base(&self, instance: Rid, base: Rid)
Sets the base of the instance. A base can be any of the 3D objects that are created in the VisualServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_blend_shape_weight(
&self,
instance: Rid,
shape: i64,
weight: f64
)
pub unsafe fn instance_set_blend_shape_weight(
&self,
instance: Rid,
shape: i64,
weight: f64
)
Sets the weight for a given blend shape associated with this instance.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_custom_aabb(&self, instance: Rid, aabb: Aabb)
pub unsafe fn instance_set_custom_aabb(&self, instance: Rid, aabb: Aabb)
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to GeometryInstance.set_custom_aabb
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_exterior(&self, instance: Rid, enabled: bool)
pub unsafe fn instance_set_exterior(&self, instance: Rid, enabled: bool)
Function not implemented in Godot 3.x.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_extra_visibility_margin(
&self,
instance: Rid,
margin: f64
)
pub unsafe fn instance_set_extra_visibility_margin(
&self,
instance: Rid,
margin: f64
)
Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you to avoid culling objects that fall outside the view frustum. Equivalent to GeometryInstance.extra_cull_margin
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_layer_mask(&self, instance: Rid, mask: i64)
pub unsafe fn instance_set_layer_mask(&self, instance: Rid, mask: i64)
Sets the render layers that this instance will be drawn to. Equivalent to [VisualInstance.layers
][VisualInstance::layers].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_scenario(&self, instance: Rid, scenario: Rid)
pub unsafe fn instance_set_scenario(&self, instance: Rid, scenario: Rid)
Sets the scenario that the instance is in. The scenario is the 3D world that the objects will be displayed in.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_surface_material(
&self,
instance: Rid,
surface: i64,
material: Rid
)
pub unsafe fn instance_set_surface_material(
&self,
instance: Rid,
surface: i64,
material: Rid
)
Sets the material of a specific surface. Equivalent to MeshInstance.set_surface_material
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_transform(&self, instance: Rid, transform: Transform)
pub unsafe fn instance_set_transform(&self, instance: Rid, transform: Transform)
Sets the world space transform of the instance. Equivalent to Spatial.transform
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_use_lightmap(
&self,
instance: Rid,
lightmap_instance: Rid,
lightmap: Rid,
lightmap_slice: i64,
lightmap_uv_rect: Rect2
)
pub unsafe fn instance_set_use_lightmap(
&self,
instance: Rid,
lightmap_instance: Rid,
lightmap: Rid,
lightmap_slice: i64,
lightmap_uv_rect: Rect2
)
Sets the lightmap to use with this instance.
Default Arguments
lightmap_slice
--1
lightmap_uv_rect
-Rect2( 0, 0, 1, 1 )
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instance_set_visible(&self, instance: Rid, visible: bool)
pub unsafe fn instance_set_visible(&self, instance: Rid, visible: bool)
Sets whether an instance is drawn or not. Equivalent to [Spatial.visible
][Spatial::visible].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instances_cull_aabb(
&self,
aabb: Aabb,
scenario: Rid
) -> VariantArray
pub unsafe fn instances_cull_aabb(
&self,
aabb: Aabb,
scenario: Rid
) -> VariantArray
Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as MeshInstance
or DirectionalLight
. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the World
you want to query. This forces an update for all resources queued to update.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instances_cull_convex(
&self,
convex: VariantArray,
scenario: Rid
) -> VariantArray
pub unsafe fn instances_cull_convex(
&self,
convex: VariantArray,
scenario: Rid
) -> VariantArray
Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as MeshInstance
or DirectionalLight
. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the World
you want to query. This forces an update for all resources queued to update.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn instances_cull_ray(
&self,
from: Vector3,
to: Vector3,
scenario: Rid
) -> VariantArray
pub unsafe fn instances_cull_ray(
&self,
from: Vector3,
to: Vector3,
scenario: Rid
) -> VariantArray
Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as MeshInstance
or DirectionalLight
. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the World
you want to query. This forces an update for all resources queued to update.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn is_render_loop_enabled(&self) -> bool
pub fn is_render_loop_enabled(&self) -> bool
If false
, disables rendering completely, but the engine logic is still being processed. You can call force_draw
to draw a frame even with rendering disabled.
sourcepub unsafe fn light_directional_set_blend_splits(&self, light: Rid, enable: bool)
pub unsafe fn light_directional_set_blend_splits(&self, light: Rid, enable: bool)
If true
, this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [DirectionalLight.directional_shadow_blend_splits
][DirectionalLight::directional_shadow_blend_splits].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_directional_set_shadow_depth_range_mode(
&self,
light: Rid,
range_mode: i64
)
pub unsafe fn light_directional_set_shadow_depth_range_mode(
&self,
light: Rid,
range_mode: i64
)
Sets the shadow depth range mode for this directional light. Equivalent to [DirectionalLight.directional_shadow_depth_range
][DirectionalLight::directional_shadow_depth_range]. See LightDirectionalShadowDepthRangeMode
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_directional_set_shadow_mode(&self, light: Rid, mode: i64)
pub unsafe fn light_directional_set_shadow_mode(&self, light: Rid, mode: i64)
Sets the shadow mode for this directional light. Equivalent to [DirectionalLight.directional_shadow_mode
][DirectionalLight::directional_shadow_mode]. See LightDirectionalShadowMode
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_omni_set_shadow_detail(&self, light: Rid, detail: i64)
pub unsafe fn light_omni_set_shadow_detail(&self, light: Rid, detail: i64)
Sets whether to use vertical or horizontal detail for this omni light. This can be used to alleviate artifacts in the shadow map. Equivalent to [OmniLight.omni_shadow_detail
][OmniLight::omni_shadow_detail].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_omni_set_shadow_mode(&self, light: Rid, mode: i64)
pub unsafe fn light_omni_set_shadow_mode(&self, light: Rid, mode: i64)
Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to [OmniLight.omni_shadow_mode
][OmniLight::omni_shadow_mode].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_bake_mode(&self, light: Rid, bake_mode: i64)
pub unsafe fn light_set_bake_mode(&self, light: Rid, bake_mode: i64)
Sets the bake mode for this light, see LightBakeMode
for options. The bake mode affects how the light will be baked in BakedLightmap
s and GIProbe
s.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_color(&self, light: Rid, color: Color)
pub unsafe fn light_set_color(&self, light: Rid, color: Color)
Sets the color of the light. Equivalent to [Light.light_color
][Light::light_color].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_cull_mask(&self, light: Rid, mask: i64)
pub unsafe fn light_set_cull_mask(&self, light: Rid, mask: i64)
Sets the cull mask for this Light. Lights only affect objects in the selected layers. Equivalent to [Light.light_cull_mask
][Light::light_cull_mask].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_negative(&self, light: Rid, enable: bool)
pub unsafe fn light_set_negative(&self, light: Rid, enable: bool)
If true
, light will subtract light instead of adding light. Equivalent to [Light.light_negative
][Light::light_negative].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_param(&self, light: Rid, param: i64, value: f64)
pub unsafe fn light_set_param(&self, light: Rid, param: i64, value: f64)
Sets the specified light parameter. See LightParam
for options. Equivalent to Light.set_param
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_projector(&self, light: Rid, texture: Rid)
pub unsafe fn light_set_projector(&self, light: Rid, texture: Rid)
Not implemented in Godot 3.x.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_reverse_cull_face_mode(&self, light: Rid, enabled: bool)
pub unsafe fn light_set_reverse_cull_face_mode(&self, light: Rid, enabled: bool)
If true
, reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double sided shadows with instance_geometry_set_cast_shadows_setting
. Equivalent to Light.shadow_reverse_cull_face
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_shadow(&self, light: Rid, enabled: bool)
pub unsafe fn light_set_shadow(&self, light: Rid, enabled: bool)
If true
, light will cast shadows. Equivalent to [Light.shadow_enabled
][Light::shadow_enabled].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_shadow_color(&self, light: Rid, color: Color)
pub unsafe fn light_set_shadow_color(&self, light: Rid, color: Color)
Sets the color of the shadow cast by the light. Equivalent to Light.shadow_color
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn light_set_use_gi(&self, light: Rid, enabled: bool)
pub unsafe fn light_set_use_gi(&self, light: Rid, enabled: bool)
Sets whether GI probes capture light information from this light. Deprecated method. Use light_set_bake_mode
instead. This method is only kept for compatibility reasons and calls light_set_bake_mode
internally, setting the bake mode to LIGHT_BAKE_DISABLED
or LIGHT_BAKE_INDIRECT
depending on the given parameter.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn lightmap_capture_create(&self) -> Rid
pub fn lightmap_capture_create(&self) -> Rid
Creates a lightmap capture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all lightmap_capture_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this lightmap capture to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn lightmap_capture_get_bounds(&self, capture: Rid) -> Aabb
pub unsafe fn lightmap_capture_get_bounds(&self, capture: Rid) -> Aabb
Returns the size of the lightmap capture area.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_get_energy(&self, capture: Rid) -> f64
pub unsafe fn lightmap_capture_get_energy(&self, capture: Rid) -> f64
Returns the energy multiplier used by the lightmap capture.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_get_octree(&self, capture: Rid) -> PoolArray<u8>
pub unsafe fn lightmap_capture_get_octree(&self, capture: Rid) -> PoolArray<u8>
Returns the octree used by the lightmap capture.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_get_octree_cell_subdiv(&self, capture: Rid) -> i64
pub unsafe fn lightmap_capture_get_octree_cell_subdiv(&self, capture: Rid) -> i64
Returns the cell subdivision amount used by this lightmap capture’s octree.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_get_octree_cell_transform(
&self,
capture: Rid
) -> Transform
pub unsafe fn lightmap_capture_get_octree_cell_transform(
&self,
capture: Rid
) -> Transform
Returns the cell transform for this lightmap capture’s octree.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_is_interior(&self, capture: Rid) -> bool
pub unsafe fn lightmap_capture_is_interior(&self, capture: Rid) -> bool
Returns true
if capture is in “interior” mode.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_set_bounds(&self, capture: Rid, bounds: Aabb)
pub unsafe fn lightmap_capture_set_bounds(&self, capture: Rid, bounds: Aabb)
Sets the size of the area covered by the lightmap capture. Equivalent to BakedLightmapData.bounds
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_set_energy(&self, capture: Rid, energy: f64)
pub unsafe fn lightmap_capture_set_energy(&self, capture: Rid, energy: f64)
Sets the energy multiplier for this lightmap capture. Equivalent to BakedLightmapData.energy
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_set_interior(&self, capture: Rid, interior: bool)
pub unsafe fn lightmap_capture_set_interior(&self, capture: Rid, interior: bool)
Sets the “interior” mode for this lightmap capture. Equivalent to [BakedLightmapData.interior
][BakedLightmapData::interior].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_set_octree(
&self,
capture: Rid,
octree: PoolArray<u8>
)
pub unsafe fn lightmap_capture_set_octree(
&self,
capture: Rid,
octree: PoolArray<u8>
)
Sets the octree to be used by this lightmap capture. This function is normally used by the BakedLightmap
node. Equivalent to BakedLightmapData.octree
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_set_octree_cell_subdiv(
&self,
capture: Rid,
subdiv: i64
)
pub unsafe fn lightmap_capture_set_octree_cell_subdiv(
&self,
capture: Rid,
subdiv: i64
)
Sets the subdivision level of this lightmap capture’s octree. Equivalent to BakedLightmapData.cell_subdiv
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn lightmap_capture_set_octree_cell_transform(
&self,
capture: Rid,
xform: Transform
)
pub unsafe fn lightmap_capture_set_octree_cell_transform(
&self,
capture: Rid,
xform: Transform
)
Sets the octree cell transform for this lightmap capture’s octree. Equivalent to BakedLightmapData.cell_space_transform
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn make_sphere_mesh(&self, latitudes: i64, longitudes: i64, radius: f64) -> Rid
pub fn make_sphere_mesh(&self, latitudes: i64, longitudes: i64, radius: f64) -> Rid
Returns a mesh of a sphere with the given amount of horizontal and vertical subdivisions.
sourcepub fn material_create(&self) -> Rid
pub fn material_create(&self) -> Rid
Creates an empty material and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all material_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn material_get_param(
&self,
material: Rid,
parameter: impl Into<GodotString>
) -> Variant
pub unsafe fn material_get_param(
&self,
material: Rid,
parameter: impl Into<GodotString>
) -> Variant
Returns the value of a certain material’s parameter.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_get_param_default(
&self,
material: Rid,
parameter: impl Into<GodotString>
) -> Variant
pub unsafe fn material_get_param_default(
&self,
material: Rid,
parameter: impl Into<GodotString>
) -> Variant
Returns the default value for the param if available. Returns null
otherwise.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_get_shader(&self, shader_material: Rid) -> Rid
pub unsafe fn material_get_shader(&self, shader_material: Rid) -> Rid
Returns the shader of a certain material’s shader. Returns an empty RID if the material doesn’t have a shader.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_set_line_width(&self, material: Rid, width: f64)
pub unsafe fn material_set_line_width(&self, material: Rid, width: f64)
Sets a material’s line width.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_set_next_pass(&self, material: Rid, next_material: Rid)
pub unsafe fn material_set_next_pass(&self, material: Rid, next_material: Rid)
Sets an object’s next material.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_set_param(
&self,
material: Rid,
parameter: impl Into<GodotString>,
value: impl OwnedToVariant
)
pub unsafe fn material_set_param(
&self,
material: Rid,
parameter: impl Into<GodotString>,
value: impl OwnedToVariant
)
Sets a material’s parameter.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_set_render_priority(&self, material: Rid, priority: i64)
pub unsafe fn material_set_render_priority(&self, material: Rid, priority: i64)
Sets a material’s render priority.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn material_set_shader(&self, shader_material: Rid, shader: Rid)
pub unsafe fn material_set_shader(&self, shader_material: Rid, shader: Rid)
Sets a shader material’s shader.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_add_surface_from_arrays(
&self,
mesh: Rid,
primitive: i64,
arrays: VariantArray,
blend_shapes: VariantArray,
compress_format: i64
)
pub unsafe fn mesh_add_surface_from_arrays(
&self,
mesh: Rid,
primitive: i64,
arrays: VariantArray,
blend_shapes: VariantArray,
compress_format: i64
)
Adds a surface generated from the Arrays to a mesh. See PrimitiveType
constants for types.
Default Arguments
blend_shapes
-[ ]
compress_format
-2194432
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_clear(&self, mesh: Rid)
pub unsafe fn mesh_clear(&self, mesh: Rid)
Removes all surfaces from a mesh.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn mesh_create(&self) -> Rid
pub fn mesh_create(&self) -> Rid
Creates a new mesh and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all mesh_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this mesh to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn mesh_get_blend_shape_count(&self, mesh: Rid) -> i64
pub unsafe fn mesh_get_blend_shape_count(&self, mesh: Rid) -> i64
Returns a mesh’s blend shape count.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_get_blend_shape_mode(&self, mesh: Rid) -> BlendShapeMode
pub unsafe fn mesh_get_blend_shape_mode(&self, mesh: Rid) -> BlendShapeMode
Returns a mesh’s blend shape mode.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_get_custom_aabb(&self, mesh: Rid) -> Aabb
pub unsafe fn mesh_get_custom_aabb(&self, mesh: Rid) -> Aabb
Returns a mesh’s custom aabb.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_get_surface_count(&self, mesh: Rid) -> i64
pub unsafe fn mesh_get_surface_count(&self, mesh: Rid) -> i64
Returns a mesh’s number of surfaces.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_remove_surface(&self, mesh: Rid, index: i64)
pub unsafe fn mesh_remove_surface(&self, mesh: Rid, index: i64)
Removes a mesh’s surface.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_set_blend_shape_count(&self, mesh: Rid, amount: i64)
pub unsafe fn mesh_set_blend_shape_count(&self, mesh: Rid, amount: i64)
Sets a mesh’s blend shape count.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_set_blend_shape_mode(&self, mesh: Rid, mode: i64)
pub unsafe fn mesh_set_blend_shape_mode(&self, mesh: Rid, mode: i64)
Sets a mesh’s blend shape mode.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_set_custom_aabb(&self, mesh: Rid, aabb: Aabb)
pub unsafe fn mesh_set_custom_aabb(&self, mesh: Rid, aabb: Aabb)
Sets a mesh’s custom aabb.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_aabb(&self, mesh: Rid, surface: i64) -> Aabb
pub unsafe fn mesh_surface_get_aabb(&self, mesh: Rid, surface: i64) -> Aabb
Returns a mesh’s surface’s aabb.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_array(
&self,
mesh: Rid,
surface: i64
) -> PoolArray<u8>
pub unsafe fn mesh_surface_get_array(
&self,
mesh: Rid,
surface: i64
) -> PoolArray<u8>
Returns a mesh’s surface’s vertex buffer.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_array_index_len(
&self,
mesh: Rid,
surface: i64
) -> i64
pub unsafe fn mesh_surface_get_array_index_len(
&self,
mesh: Rid,
surface: i64
) -> i64
Returns a mesh’s surface’s amount of indices.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_array_len(&self, mesh: Rid, surface: i64) -> i64
pub unsafe fn mesh_surface_get_array_len(&self, mesh: Rid, surface: i64) -> i64
Returns a mesh’s surface’s amount of vertices.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_arrays(
&self,
mesh: Rid,
surface: i64
) -> VariantArray
pub unsafe fn mesh_surface_get_arrays(
&self,
mesh: Rid,
surface: i64
) -> VariantArray
Returns a mesh’s surface’s buffer arrays.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_blend_shape_arrays(
&self,
mesh: Rid,
surface: i64
) -> VariantArray
pub unsafe fn mesh_surface_get_blend_shape_arrays(
&self,
mesh: Rid,
surface: i64
) -> VariantArray
Returns a mesh’s surface’s arrays for blend shapes.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_format(&self, mesh: Rid, surface: i64) -> i64
pub unsafe fn mesh_surface_get_format(&self, mesh: Rid, surface: i64) -> i64
Returns the format of a mesh’s surface.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn mesh_surface_get_format_offset(
&self,
format: i64,
vertex_len: i64,
index_len: i64,
array_index: i64
) -> i64
pub fn mesh_surface_get_format_offset(
&self,
format: i64,
vertex_len: i64,
index_len: i64,
array_index: i64
) -> i64
Function is unused in Godot 3.x.
sourcepub fn mesh_surface_get_format_stride(
&self,
format: i64,
vertex_len: i64,
index_len: i64,
array_index: i64
) -> i64
pub fn mesh_surface_get_format_stride(
&self,
format: i64,
vertex_len: i64,
index_len: i64,
array_index: i64
) -> i64
sourcepub unsafe fn mesh_surface_get_index_array(
&self,
mesh: Rid,
surface: i64
) -> PoolArray<u8>
pub unsafe fn mesh_surface_get_index_array(
&self,
mesh: Rid,
surface: i64
) -> PoolArray<u8>
Returns a mesh’s surface’s index buffer.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_material(&self, mesh: Rid, surface: i64) -> Rid
pub unsafe fn mesh_surface_get_material(&self, mesh: Rid, surface: i64) -> Rid
Returns a mesh’s surface’s material.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_primitive_type(
&self,
mesh: Rid,
surface: i64
) -> PrimitiveType
pub unsafe fn mesh_surface_get_primitive_type(
&self,
mesh: Rid,
surface: i64
) -> PrimitiveType
Returns the primitive type of a mesh’s surface.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_get_skeleton_aabb(
&self,
mesh: Rid,
surface: i64
) -> VariantArray
pub unsafe fn mesh_surface_get_skeleton_aabb(
&self,
mesh: Rid,
surface: i64
) -> VariantArray
Returns the aabb of a mesh’s surface’s skeleton.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_set_material(
&self,
mesh: Rid,
surface: i64,
material: Rid
)
pub unsafe fn mesh_surface_set_material(
&self,
mesh: Rid,
surface: i64,
material: Rid
)
Sets a mesh’s surface’s material.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn mesh_surface_update_region(
&self,
mesh: Rid,
surface: i64,
offset: i64,
data: PoolArray<u8>
)
pub unsafe fn mesh_surface_update_region(
&self,
mesh: Rid,
surface: i64,
offset: i64,
data: PoolArray<u8>
)
Updates a specific region of a vertex buffer for the specified surface. Warning: this function alters the vertex buffer directly with no safety mechanisms, you can easily corrupt your mesh.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_allocate(
&self,
multimesh: Rid,
instances: i64,
transform_format: i64,
color_format: i64,
custom_data_format: i64
)
pub unsafe fn multimesh_allocate(
&self,
multimesh: Rid,
instances: i64,
transform_format: i64,
color_format: i64,
custom_data_format: i64
)
Allocates space for the multimesh data. Format parameters determine how the data will be stored by OpenGL. See MultimeshTransformFormat
, MultimeshColorFormat
, and MultimeshCustomDataFormat
for usage. Equivalent to MultiMesh.instance_count
.
Default Arguments
custom_data_format
-0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn multimesh_create(&self) -> Rid
pub fn multimesh_create(&self) -> Rid
Creates a new multimesh on the VisualServer and returns an RID
handle. This RID will be used in all multimesh_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this multimesh to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn multimesh_get_aabb(&self, multimesh: Rid) -> Aabb
pub unsafe fn multimesh_get_aabb(&self, multimesh: Rid) -> Aabb
Calculates and returns the axis-aligned bounding box that encloses all instances within the multimesh.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_get_instance_count(&self, multimesh: Rid) -> i64
pub unsafe fn multimesh_get_instance_count(&self, multimesh: Rid) -> i64
Returns the number of instances allocated for this multimesh.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_get_mesh(&self, multimesh: Rid) -> Rid
pub unsafe fn multimesh_get_mesh(&self, multimesh: Rid) -> Rid
Returns the RID of the mesh that will be used in drawing this multimesh.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_get_visible_instances(&self, multimesh: Rid) -> i64
pub unsafe fn multimesh_get_visible_instances(&self, multimesh: Rid) -> i64
Returns the number of visible instances for this multimesh.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_get_color(
&self,
multimesh: Rid,
index: i64
) -> Color
pub unsafe fn multimesh_instance_get_color(
&self,
multimesh: Rid,
index: i64
) -> Color
Returns the color by which the specified instance will be modulated.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_get_custom_data(
&self,
multimesh: Rid,
index: i64
) -> Color
pub unsafe fn multimesh_instance_get_custom_data(
&self,
multimesh: Rid,
index: i64
) -> Color
Returns the custom data associated with the specified instance.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_get_transform(
&self,
multimesh: Rid,
index: i64
) -> Transform
pub unsafe fn multimesh_instance_get_transform(
&self,
multimesh: Rid,
index: i64
) -> Transform
sourcepub unsafe fn multimesh_instance_get_transform_2d(
&self,
multimesh: Rid,
index: i64
) -> Transform2D
pub unsafe fn multimesh_instance_get_transform_2d(
&self,
multimesh: Rid,
index: i64
) -> Transform2D
Returns the Transform2D
of the specified instance. For use when the multimesh is set to use 2D transforms.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_set_color(
&self,
multimesh: Rid,
index: i64,
color: Color
)
pub unsafe fn multimesh_instance_set_color(
&self,
multimesh: Rid,
index: i64,
color: Color
)
Sets the color by which this instance will be modulated. Equivalent to MultiMesh.set_instance_color
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_set_custom_data(
&self,
multimesh: Rid,
index: i64,
custom_data: Color
)
pub unsafe fn multimesh_instance_set_custom_data(
&self,
multimesh: Rid,
index: i64,
custom_data: Color
)
Sets the custom data for this instance. Custom data is passed as a Color
, but is interpreted as a vec4
in the shader. Equivalent to MultiMesh.set_instance_custom_data
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_set_transform(
&self,
multimesh: Rid,
index: i64,
transform: Transform
)
pub unsafe fn multimesh_instance_set_transform(
&self,
multimesh: Rid,
index: i64,
transform: Transform
)
Sets the Transform
for this instance. Equivalent to MultiMesh.set_instance_transform
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_instance_set_transform_2d(
&self,
multimesh: Rid,
index: i64,
transform: Transform2D
)
pub unsafe fn multimesh_instance_set_transform_2d(
&self,
multimesh: Rid,
index: i64,
transform: Transform2D
)
Sets the Transform2D
for this instance. For use when multimesh is used in 2D. Equivalent to MultiMesh.set_instance_transform_2d
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_set_as_bulk_array(
&self,
multimesh: Rid,
array: PoolArray<f32>
)
pub unsafe fn multimesh_set_as_bulk_array(
&self,
multimesh: Rid,
array: PoolArray<f32>
)
Sets all data related to the instances in one go. This is especially useful when loading the data from disk or preparing the data from GDNative.
All data is packed in one large float array. An array may look like this: Transform for instance 1, color data for instance 1, custom data for instance 1, transform for instance 2, color data for instance 2, etc.
Transform
is stored as 12 floats, Transform2D
is stored as 8 floats, COLOR_8BIT
/ CUSTOM_DATA_8BIT
is stored as 1 float (4 bytes as is) and COLOR_FLOAT
/ CUSTOM_DATA_FLOAT
is stored as 4 floats.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_set_mesh(&self, multimesh: Rid, mesh: Rid)
pub unsafe fn multimesh_set_mesh(&self, multimesh: Rid, mesh: Rid)
Sets the mesh to be drawn by the multimesh. Equivalent to MultiMesh.mesh
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn multimesh_set_visible_instances(&self, multimesh: Rid, visible: i64)
pub unsafe fn multimesh_set_visible_instances(&self, multimesh: Rid, visible: i64)
Sets the number of instances visible at a given time. If -1, all instances that have been allocated are drawn. Equivalent to MultiMesh.visible_instance_count
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn omni_light_create(&self) -> Rid
pub fn omni_light_create(&self) -> Rid
Creates a new omni light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most light_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this omni light to an instance using instance_set_base
using the returned RID.
sourcepub fn particles_create(&self) -> Rid
pub fn particles_create(&self) -> Rid
Creates a particle system and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all particles_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach these particles to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn particles_get_current_aabb(&self, particles: Rid) -> Aabb
pub unsafe fn particles_get_current_aabb(&self, particles: Rid) -> Aabb
Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to Particles.capture_aabb
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_get_emitting(&self, particles: Rid) -> bool
pub unsafe fn particles_get_emitting(&self, particles: Rid) -> bool
Returns true
if particles are currently set to emitting.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_is_inactive(&self, particles: Rid) -> bool
pub unsafe fn particles_is_inactive(&self, particles: Rid) -> bool
Returns true
if particles are not emitting and particles are set to inactive.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_request_process(&self, particles: Rid)
pub unsafe fn particles_request_process(&self, particles: Rid)
Add particle system to list of particle systems that need to be updated. Update will take place on the next frame, or on the next call to instances_cull_aabb
, instances_cull_convex
, or instances_cull_ray
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_restart(&self, particles: Rid)
pub unsafe fn particles_restart(&self, particles: Rid)
Reset the particles on the next update. Equivalent to Particles.restart
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_amount(&self, particles: Rid, amount: i64)
pub unsafe fn particles_set_amount(&self, particles: Rid, amount: i64)
Sets the number of particles to be drawn and allocates the memory for them. Equivalent to Particles.amount
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_custom_aabb(&self, particles: Rid, aabb: Aabb)
pub unsafe fn particles_set_custom_aabb(&self, particles: Rid, aabb: Aabb)
Sets a custom axis-aligned bounding box for the particle system. Equivalent to Particles.visibility_aabb
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_draw_order(&self, particles: Rid, order: i64)
pub unsafe fn particles_set_draw_order(&self, particles: Rid, order: i64)
Sets the draw order of the particles to one of the named enums from ParticlesDrawOrder
. See ParticlesDrawOrder
for options. Equivalent to Particles.draw_order
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_draw_pass_mesh(
&self,
particles: Rid,
pass: i64,
mesh: Rid
)
pub unsafe fn particles_set_draw_pass_mesh(
&self,
particles: Rid,
pass: i64,
mesh: Rid
)
Sets the mesh to be used for the specified draw pass. Equivalent to Particles.draw_pass_1
, Particles.draw_pass_2
, Particles.draw_pass_3
, and Particles.draw_pass_4
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_draw_passes(&self, particles: Rid, count: i64)
pub unsafe fn particles_set_draw_passes(&self, particles: Rid, count: i64)
Sets the number of draw passes to use. Equivalent to Particles.draw_passes
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_emission_transform(
&self,
particles: Rid,
transform: Transform
)
pub unsafe fn particles_set_emission_transform(
&self,
particles: Rid,
transform: Transform
)
sourcepub unsafe fn particles_set_emitting(&self, particles: Rid, emitting: bool)
pub unsafe fn particles_set_emitting(&self, particles: Rid, emitting: bool)
If true
, particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to [Particles.emitting
][Particles::emitting].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_explosiveness_ratio(&self, particles: Rid, ratio: f64)
pub unsafe fn particles_set_explosiveness_ratio(&self, particles: Rid, ratio: f64)
Sets the explosiveness ratio. Equivalent to [Particles.explosiveness
][Particles::explosiveness].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_fixed_fps(&self, particles: Rid, fps: i64)
pub unsafe fn particles_set_fixed_fps(&self, particles: Rid, fps: i64)
Sets the frame rate that the particle system rendering will be fixed to. Equivalent to Particles.fixed_fps
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_fractional_delta(&self, particles: Rid, enable: bool)
pub unsafe fn particles_set_fractional_delta(&self, particles: Rid, enable: bool)
If true
, uses fractional delta which smooths the movement of the particles. Equivalent to [Particles.fract_delta
][Particles::fract_delta].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_lifetime(&self, particles: Rid, lifetime: f64)
pub unsafe fn particles_set_lifetime(&self, particles: Rid, lifetime: f64)
Sets the lifetime of each particle in the system. Equivalent to Particles.lifetime
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_one_shot(&self, particles: Rid, one_shot: bool)
pub unsafe fn particles_set_one_shot(&self, particles: Rid, one_shot: bool)
If true
, particles will emit once and then stop. Equivalent to Particles.one_shot
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_pre_process_time(&self, particles: Rid, time: f64)
pub unsafe fn particles_set_pre_process_time(&self, particles: Rid, time: f64)
Sets the preprocess time for the particles’ animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to [Particles.preprocess
][Particles::preprocess].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_process_material(&self, particles: Rid, material: Rid)
pub unsafe fn particles_set_process_material(&self, particles: Rid, material: Rid)
Sets the material for processing the particles.
Note: This is not the material used to draw the materials. Equivalent to Particles.process_material
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_randomness_ratio(&self, particles: Rid, ratio: f64)
pub unsafe fn particles_set_randomness_ratio(&self, particles: Rid, ratio: f64)
Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to [Particles.randomness
][Particles::randomness].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_speed_scale(&self, particles: Rid, scale: f64)
pub unsafe fn particles_set_speed_scale(&self, particles: Rid, scale: f64)
Sets the speed scale of the particle system. Equivalent to Particles.speed_scale
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn particles_set_use_local_coordinates(
&self,
particles: Rid,
enable: bool
)
pub unsafe fn particles_set_use_local_coordinates(
&self,
particles: Rid,
enable: bool
)
If true
, particles use local coordinates. If false
they use global coordinates. Equivalent to [Particles.local_coords
][Particles::local_coords].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn reflection_probe_create(&self) -> Rid
pub fn reflection_probe_create(&self) -> Rid
Creates a reflection probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all reflection_probe_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this reflection probe to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn reflection_probe_set_as_interior(&self, probe: Rid, enable: bool)
pub unsafe fn reflection_probe_set_as_interior(&self, probe: Rid, enable: bool)
If true
, reflections will ignore sky contribution. Equivalent to [ReflectionProbe.interior_enable
][ReflectionProbe::interior_enable].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_cull_mask(&self, probe: Rid, layers: i64)
pub unsafe fn reflection_probe_set_cull_mask(&self, probe: Rid, layers: i64)
Sets the render cull mask for this reflection probe. Only instances with a matching cull mask will be rendered by this probe. Equivalent to ReflectionProbe.cull_mask
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_enable_box_projection(
&self,
probe: Rid,
enable: bool
)
pub unsafe fn reflection_probe_set_enable_box_projection(
&self,
probe: Rid,
enable: bool
)
If true
, uses box projection. This can make reflections look more correct in certain situations. Equivalent to [ReflectionProbe.box_projection
][ReflectionProbe::box_projection].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_enable_shadows(&self, probe: Rid, enable: bool)
pub unsafe fn reflection_probe_set_enable_shadows(&self, probe: Rid, enable: bool)
If true
, computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to [ReflectionProbe.enable_shadows
][ReflectionProbe::enable_shadows].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_extents(&self, probe: Rid, extents: Vector3)
pub unsafe fn reflection_probe_set_extents(&self, probe: Rid, extents: Vector3)
Sets the size of the area that the reflection probe will capture. Equivalent to ReflectionProbe.extents
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_intensity(&self, probe: Rid, intensity: f64)
pub unsafe fn reflection_probe_set_intensity(&self, probe: Rid, intensity: f64)
Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to ReflectionProbe.intensity
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_interior_ambient(
&self,
probe: Rid,
color: Color
)
pub unsafe fn reflection_probe_set_interior_ambient(
&self,
probe: Rid,
color: Color
)
Sets the ambient light color for this reflection probe when set to interior mode. Equivalent to [ReflectionProbe.interior_ambient_color
][ReflectionProbe::interior_ambient_color].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_interior_ambient_energy(
&self,
probe: Rid,
energy: f64
)
pub unsafe fn reflection_probe_set_interior_ambient_energy(
&self,
probe: Rid,
energy: f64
)
Sets the energy multiplier for this reflection probes ambient light contribution when set to interior mode. Equivalent to ReflectionProbe.interior_ambient_energy
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_interior_ambient_probe_contribution(
&self,
probe: Rid,
contrib: f64
)
pub unsafe fn reflection_probe_set_interior_ambient_probe_contribution(
&self,
probe: Rid,
contrib: f64
)
Sets the contribution value for how much the reflection affects the ambient light for this reflection probe when set to interior mode. Useful so that ambient light matches the color of the room. Equivalent to [ReflectionProbe.interior_ambient_contrib
][ReflectionProbe::interior_ambient_contrib].
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_max_distance(&self, probe: Rid, distance: f64)
pub unsafe fn reflection_probe_set_max_distance(&self, probe: Rid, distance: f64)
Sets the max distance away from the probe an object can be before it is culled. Equivalent to ReflectionProbe.max_distance
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_origin_offset(
&self,
probe: Rid,
offset: Vector3
)
pub unsafe fn reflection_probe_set_origin_offset(
&self,
probe: Rid,
offset: Vector3
)
Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent to ReflectionProbe.origin_offset
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn reflection_probe_set_update_mode(&self, probe: Rid, mode: i64)
pub unsafe fn reflection_probe_set_update_mode(&self, probe: Rid, mode: i64)
Sets how often the reflection probe updates. Can either be once or every frame. See ReflectionProbeUpdateMode
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn request_frame_drawn_callback(
&self,
where_: impl AsArg<Object>,
method: impl Into<GodotString>,
userdata: impl OwnedToVariant
)
pub fn request_frame_drawn_callback(
&self,
where_: impl AsArg<Object>,
method: impl Into<GodotString>,
userdata: impl OwnedToVariant
)
Schedules a callback to the corresponding named method
on where
after a frame has been drawn.
The callback method must use only 1 argument which will be called with userdata
.
sourcepub fn scenario_create(&self) -> Rid
pub fn scenario_create(&self) -> Rid
Creates a scenario and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all scenario_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
The scenario is the 3D world that all the visual instances exist in.
sourcepub unsafe fn scenario_set_debug(&self, scenario: Rid, debug_mode: i64)
pub unsafe fn scenario_set_debug(&self, scenario: Rid, debug_mode: i64)
Sets the ScenarioDebugMode
for this scenario. See ScenarioDebugMode
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn scenario_set_environment(&self, scenario: Rid, environment: Rid)
pub unsafe fn scenario_set_environment(&self, scenario: Rid, environment: Rid)
Sets the environment that will be used with this scenario.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn scenario_set_fallback_environment(
&self,
scenario: Rid,
environment: Rid
)
pub unsafe fn scenario_set_fallback_environment(
&self,
scenario: Rid,
environment: Rid
)
Sets the fallback environment to be used by this scenario. The fallback environment is used if no environment is set. Internally, this is used by the editor to provide a default environment.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn scenario_set_reflection_atlas_size(
&self,
scenario: Rid,
size: i64,
subdiv: i64
)
pub unsafe fn scenario_set_reflection_atlas_size(
&self,
scenario: Rid,
size: i64,
subdiv: i64
)
Sets the size of the reflection atlas shared by all reflection probes in this scenario.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn set_boot_image(
&self,
image: impl AsArg<Image>,
color: Color,
scale: bool,
use_filter: bool
)
pub fn set_boot_image(
&self,
image: impl AsArg<Image>,
color: Color,
scale: bool,
use_filter: bool
)
Sets a boot image. The color defines the background color. If scale
is true
, the image will be scaled to fit the screen size. If use_filter
is true
, the image will be scaled with linear interpolation. If use_filter
is false
, the image will be scaled with nearest-neighbor interpolation.
Default Arguments
use_filter
-true
sourcepub fn set_debug_generate_wireframes(&self, generate: bool)
pub fn set_debug_generate_wireframes(&self, generate: bool)
If true
, the engine will generate wireframes for use with the wireframe debug mode.
sourcepub fn set_default_clear_color(&self, color: Color)
pub fn set_default_clear_color(&self, color: Color)
Sets the default clear color which is used when a specific clear color has not been selected.
sourcepub fn set_render_loop_enabled(&self, enabled: bool)
pub fn set_render_loop_enabled(&self, enabled: bool)
If false
, disables rendering completely, but the engine logic is still being processed. You can call force_draw
to draw a frame even with rendering disabled.
If asynchronous shader compilation is enabled, this controls whether SpatialMaterial.ASYNC_MODE_HIDDEN
is obeyed.
For instance, you may want to enable this temporarily before taking a screenshot. This ensures everything is visible even if shaders with async mode hidden are not ready yet.
Reflection probes use this internally to ensure they capture everything regardless the shaders are ready or not.
sourcepub fn set_shader_time_scale(&self, scale: f64)
pub fn set_shader_time_scale(&self, scale: f64)
Sets the scale to apply to the passage of time for the shaders’ TIME
builtin.
The default value is 1.0
, which means TIME
will count the real time as it goes by, without narrowing or stretching it.
sourcepub fn set_use_occlusion_culling(&self, enable: bool)
pub fn set_use_occlusion_culling(&self, enable: bool)
Enables or disables occlusion culling.
sourcepub fn shader_create(&self) -> Rid
pub fn shader_create(&self) -> Rid
Creates an empty shader and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all shader_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn shader_get_code(&self, shader: Rid) -> GodotString
pub unsafe fn shader_get_code(&self, shader: Rid) -> GodotString
Returns a shader’s code.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn shader_get_default_texture_param(
&self,
shader: Rid,
name: impl Into<GodotString>
) -> Rid
pub unsafe fn shader_get_default_texture_param(
&self,
shader: Rid,
name: impl Into<GodotString>
) -> Rid
Returns a default texture from a shader searched by name.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn shader_get_param_list(&self, shader: Rid) -> VariantArray
pub unsafe fn shader_get_param_list(&self, shader: Rid) -> VariantArray
Returns the parameters of a shader.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn shader_set_code(&self, shader: Rid, code: impl Into<GodotString>)
pub unsafe fn shader_set_code(&self, shader: Rid, code: impl Into<GodotString>)
Sets a shader’s code.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn shader_set_default_texture_param(
&self,
shader: Rid,
name: impl Into<GodotString>,
texture: Rid
)
pub unsafe fn shader_set_default_texture_param(
&self,
shader: Rid,
name: impl Into<GodotString>,
texture: Rid
)
Sets a shader’s default texture. Overwrites the texture given by name.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn skeleton_allocate(
&self,
skeleton: Rid,
bones: i64,
is_2d_skeleton: bool
)
pub unsafe fn skeleton_allocate(
&self,
skeleton: Rid,
bones: i64,
is_2d_skeleton: bool
)
Allocates the GPU buffers for this skeleton.
Default Arguments
is_2d_skeleton
-false
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn skeleton_bone_get_transform(
&self,
skeleton: Rid,
bone: i64
) -> Transform
pub unsafe fn skeleton_bone_get_transform(
&self,
skeleton: Rid,
bone: i64
) -> Transform
sourcepub unsafe fn skeleton_bone_get_transform_2d(
&self,
skeleton: Rid,
bone: i64
) -> Transform2D
pub unsafe fn skeleton_bone_get_transform_2d(
&self,
skeleton: Rid,
bone: i64
) -> Transform2D
Returns the Transform2D
set for a specific bone of this skeleton.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn skeleton_bone_set_transform(
&self,
skeleton: Rid,
bone: i64,
transform: Transform
)
pub unsafe fn skeleton_bone_set_transform(
&self,
skeleton: Rid,
bone: i64,
transform: Transform
)
sourcepub unsafe fn skeleton_bone_set_transform_2d(
&self,
skeleton: Rid,
bone: i64,
transform: Transform2D
)
pub unsafe fn skeleton_bone_set_transform_2d(
&self,
skeleton: Rid,
bone: i64,
transform: Transform2D
)
Sets the Transform2D
for a specific bone of this skeleton.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn skeleton_create(&self) -> Rid
pub fn skeleton_create(&self) -> Rid
Creates a skeleton and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all skeleton_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn skeleton_get_bone_count(&self, skeleton: Rid) -> i64
pub unsafe fn skeleton_get_bone_count(&self, skeleton: Rid) -> i64
Returns the number of bones allocated for this skeleton.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn sky_create(&self) -> Rid
pub fn sky_create(&self) -> Rid
Creates an empty sky and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all sky_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn sky_set_texture(&self, sky: Rid, cube_map: Rid, radiance_size: i64)
pub unsafe fn sky_set_texture(&self, sky: Rid, cube_map: Rid, radiance_size: i64)
Sets a sky’s texture.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn spot_light_create(&self) -> Rid
pub fn spot_light_create(&self) -> Rid
Creates a spot light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most light_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
To place in a scene, attach this spot light to an instance using instance_set_base
using the returned RID.
sourcepub unsafe fn texture_allocate(
&self,
texture: Rid,
width: i64,
height: i64,
depth_3d: i64,
format: i64,
type_: i64,
flags: i64
)
pub unsafe fn texture_allocate(
&self,
texture: Rid,
width: i64,
height: i64,
depth_3d: i64,
format: i64,
type_: i64,
flags: i64
)
Allocates the GPU memory for the texture.
Default Arguments
flags
-7
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_bind(&self, texture: Rid, number: i64)
pub unsafe fn texture_bind(&self, texture: Rid, number: i64)
Binds the texture to a texture slot.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn texture_create(&self) -> Rid
pub fn texture_create(&self) -> Rid
Creates an empty texture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all texture_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub fn texture_create_from_image(
&self,
image: impl AsArg<Image>,
flags: i64
) -> Rid
pub fn texture_create_from_image(
&self,
image: impl AsArg<Image>,
flags: i64
) -> Rid
Creates a texture, allocates the space for an image, and fills in the image.
Default Arguments
flags
-7
sourcepub fn texture_debug_usage(&self) -> VariantArray
pub fn texture_debug_usage(&self) -> VariantArray
Returns a list of all the textures and their information.
sourcepub unsafe fn texture_get_data(
&self,
texture: Rid,
cube_side: i64
) -> Option<Ref<Image, Shared>>
pub unsafe fn texture_get_data(
&self,
texture: Rid,
cube_side: i64
) -> Option<Ref<Image, Shared>>
Returns a copy of a texture’s image unless it’s a CubeMap, in which case it returns the RID
of the image at one of the cubes sides.
Default Arguments
cube_side
-0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_depth(&self, texture: Rid) -> i64
pub unsafe fn texture_get_depth(&self, texture: Rid) -> i64
Returns the depth of the texture.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_flags(&self, texture: Rid) -> i64
pub unsafe fn texture_get_flags(&self, texture: Rid) -> i64
Returns the flags of a texture.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_format(&self, texture: Rid) -> Format
pub unsafe fn texture_get_format(&self, texture: Rid) -> Format
Returns the format of the texture’s image.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_height(&self, texture: Rid) -> i64
pub unsafe fn texture_get_height(&self, texture: Rid) -> i64
Returns the texture’s height.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_path(&self, texture: Rid) -> GodotString
pub unsafe fn texture_get_path(&self, texture: Rid) -> GodotString
Returns the texture’s path.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_texid(&self, texture: Rid) -> i64
pub unsafe fn texture_get_texid(&self, texture: Rid) -> i64
Returns the opengl id of the texture’s image.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_type(&self, texture: Rid) -> TextureType
pub unsafe fn texture_get_type(&self, texture: Rid) -> TextureType
Returns the type of the texture, can be any of the TextureType
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_get_width(&self, texture: Rid) -> i64
pub unsafe fn texture_get_width(&self, texture: Rid) -> i64
Returns the texture’s width.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_set_data(
&self,
texture: Rid,
image: impl AsArg<Image>,
layer: i64
)
pub unsafe fn texture_set_data(
&self,
texture: Rid,
image: impl AsArg<Image>,
layer: i64
)
Sets the texture’s image data. If it’s a CubeMap, it sets the image data at a cube side.
Default Arguments
layer
-0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_set_data_partial(
&self,
texture: Rid,
image: impl AsArg<Image>,
src_x: i64,
src_y: i64,
src_w: i64,
src_h: i64,
dst_x: i64,
dst_y: i64,
dst_mip: i64,
layer: i64
)
pub unsafe fn texture_set_data_partial(
&self,
texture: Rid,
image: impl AsArg<Image>,
src_x: i64,
src_y: i64,
src_w: i64,
src_h: i64,
dst_x: i64,
dst_y: i64,
dst_mip: i64,
layer: i64
)
Sets a part of the data for a texture. Warning: this function calls the underlying graphics API directly and may corrupt your texture if used improperly.
Default Arguments
layer
-0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_set_flags(&self, texture: Rid, flags: i64)
pub unsafe fn texture_set_flags(&self, texture: Rid, flags: i64)
Sets the texture’s flags. See TextureFlags
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_set_path(&self, texture: Rid, path: impl Into<GodotString>)
pub unsafe fn texture_set_path(&self, texture: Rid, path: impl Into<GodotString>)
Sets the texture’s path.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn texture_set_proxy(&self, proxy: Rid, base: Rid)
pub unsafe fn texture_set_proxy(&self, proxy: Rid, base: Rid)
Sample code is GDScript unless otherwise noted.
Creates an update link between two textures, similar to how ViewportTexture
s operate. When the base texture is the texture of a Viewport
, every time the viewport renders a new frame, the proxy texture automatically receives an update.
For example, this code links a generic ImageTexture
to the texture output of the Viewport
using the VisualServer API:
func _ready():
var viewport_rid = get_viewport().get_viewport_rid()
var viewport_texture_rid = VisualServer.viewport_get_texture(viewport_rid)
var proxy_texture = ImageTexture.new()
var viewport_texture_image_data = VisualServer.texture_get_data(viewport_texture_rid)
proxy_texture.create_from_image(viewport_texture_image_data)
var proxy_texture_rid = proxy_texture.get_rid()
VisualServer.texture_set_proxy(proxy_texture_rid, viewport_texture_rid)
$TextureRect.texture = proxy_texture
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn texture_set_shrink_all_x2_on_set_data(&self, shrink: bool)
pub fn texture_set_shrink_all_x2_on_set_data(&self, shrink: bool)
If true
, sets internal processes to shrink all image data to half the size.
sourcepub unsafe fn texture_set_size_override(
&self,
texture: Rid,
width: i64,
height: i64,
depth: i64
)
pub unsafe fn texture_set_size_override(
&self,
texture: Rid,
width: i64,
height: i64,
depth: i64
)
Resizes the texture to the specified dimensions.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn textures_keep_original(&self, enable: bool)
pub fn textures_keep_original(&self, enable: bool)
If true
, the image will be stored in the texture’s images array if overwritten.
sourcepub unsafe fn viewport_attach_camera(&self, viewport: Rid, camera: Rid)
pub unsafe fn viewport_attach_camera(&self, viewport: Rid, camera: Rid)
Sets a viewport’s camera.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_attach_canvas(&self, viewport: Rid, canvas: Rid)
pub unsafe fn viewport_attach_canvas(&self, viewport: Rid, canvas: Rid)
Sets a viewport’s canvas.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_attach_to_screen(
&self,
viewport: Rid,
rect: Rect2,
screen: i64
)
pub unsafe fn viewport_attach_to_screen(
&self,
viewport: Rid,
rect: Rect2,
screen: i64
)
Sample code is GDScript unless otherwise noted.
Copies viewport to a region of the screen specified by rect
. If [Viewport.render_direct_to_screen
][Viewport::render_direct_to_screen] is true
, then viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
For example, you can set the root viewport to not render at all with the following code:
func _ready():
get_viewport().set_attach_to_screen_rect(Rect2())
$Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600))
Using this can result in significant optimization, especially on lower-end devices. However, it comes at the cost of having to manage your viewports manually. For further optimization, see viewport_set_render_direct_to_screen
.
Default Arguments
rect
-Rect2( 0, 0, 0, 0 )
screen
-0
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub fn viewport_create(&self) -> Rid
pub fn viewport_create(&self) -> Rid
Creates an empty viewport and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all viewport_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid
static method.
sourcepub unsafe fn viewport_detach(&self, viewport: Rid)
pub unsafe fn viewport_detach(&self, viewport: Rid)
Detaches the viewport from the screen.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_get_render_info(&self, viewport: Rid, info: i64) -> i64
pub unsafe fn viewport_get_render_info(&self, viewport: Rid, info: i64) -> i64
Returns a viewport’s render information. For options, see the ViewportRenderInfo
constants.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_get_texture(&self, viewport: Rid) -> Rid
pub unsafe fn viewport_get_texture(&self, viewport: Rid) -> Rid
Returns the viewport’s last rendered frame.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_remove_canvas(&self, viewport: Rid, canvas: Rid)
pub unsafe fn viewport_remove_canvas(&self, viewport: Rid, canvas: Rid)
Detaches a viewport from a canvas and vice versa.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_active(&self, viewport: Rid, active: bool)
pub unsafe fn viewport_set_active(&self, viewport: Rid, active: bool)
If true
, sets the viewport active, else sets it inactive.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_canvas_stacking(
&self,
viewport: Rid,
canvas: Rid,
layer: i64,
sublayer: i64
)
pub unsafe fn viewport_set_canvas_stacking(
&self,
viewport: Rid,
canvas: Rid,
layer: i64,
sublayer: i64
)
Sets the stacking order for a viewport’s canvas.
layer
is the actual canvas layer, while sublayer
specifies the stacking order of the canvas among those in the same layer.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_canvas_transform(
&self,
viewport: Rid,
canvas: Rid,
offset: Transform2D
)
pub unsafe fn viewport_set_canvas_transform(
&self,
viewport: Rid,
canvas: Rid,
offset: Transform2D
)
Sets the transformation of a viewport’s canvas.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_clear_mode(&self, viewport: Rid, clear_mode: i64)
pub unsafe fn viewport_set_clear_mode(&self, viewport: Rid, clear_mode: i64)
Sets the clear mode of a viewport. See ViewportClearMode
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_debug_draw(&self, viewport: Rid, draw: i64)
pub unsafe fn viewport_set_debug_draw(&self, viewport: Rid, draw: i64)
Sets the debug draw mode of a viewport. See ViewportDebugDraw
for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_disable_3d(&self, viewport: Rid, disabled: bool)
pub unsafe fn viewport_set_disable_3d(&self, viewport: Rid, disabled: bool)
If true
, a viewport’s 3D rendering is disabled.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_disable_environment(
&self,
viewport: Rid,
disabled: bool
)
pub unsafe fn viewport_set_disable_environment(
&self,
viewport: Rid,
disabled: bool
)
If true
, rendering of a viewport’s environment is disabled.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_global_canvas_transform(
&self,
viewport: Rid,
transform: Transform2D
)
pub unsafe fn viewport_set_global_canvas_transform(
&self,
viewport: Rid,
transform: Transform2D
)
Sets the viewport’s global transformation matrix.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_hdr(&self, viewport: Rid, enabled: bool)
pub unsafe fn viewport_set_hdr(&self, viewport: Rid, enabled: bool)
If true
, the viewport renders to high dynamic range (HDR) instead of standard dynamic range (SDR). See also viewport_set_use_32_bpc_depth
.
Note: Only available on the GLES3 backend.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_hide_canvas(&self, viewport: Rid, hidden: bool)
pub unsafe fn viewport_set_hide_canvas(&self, viewport: Rid, hidden: bool)
If true
, the viewport’s canvas is not rendered.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_hide_scenario(&self, viewport: Rid, hidden: bool)
pub unsafe fn viewport_set_hide_scenario(&self, viewport: Rid, hidden: bool)
Currently unimplemented in Godot 3.x.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_msaa(&self, viewport: Rid, msaa: i64)
pub unsafe fn viewport_set_msaa(&self, viewport: Rid, msaa: i64)
Sets the anti-aliasing mode. See [ViewportMSAA
][ViewportMSAA] for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_parent_viewport(
&self,
viewport: Rid,
parent_viewport: Rid
)
pub unsafe fn viewport_set_parent_viewport(
&self,
viewport: Rid,
parent_viewport: Rid
)
Sets the viewport’s parent to another viewport.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_render_direct_to_screen(
&self,
viewport: Rid,
enabled: bool
)
pub unsafe fn viewport_set_render_direct_to_screen(
&self,
viewport: Rid,
enabled: bool
)
If true
, render the contents of the viewport directly to screen. This allows a low-level optimization where you can skip drawing a viewport to the root viewport. While this optimization can result in a significant increase in speed (especially on older devices), it comes at a cost of usability. When this is enabled, you cannot read from the viewport or from the SCREEN_TEXTURE
. You also lose the benefit of certain window settings, such as the various stretch modes. Another consequence to be aware of is that in 2D the rendering happens in window coordinates, so if you have a viewport that is double the size of the window, and you set this, then only the portion that fits within the window will be drawn, no automatic scaling is possible, even if your game scene is significantly larger than the window size.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_scenario(&self, viewport: Rid, scenario: Rid)
pub unsafe fn viewport_set_scenario(&self, viewport: Rid, scenario: Rid)
Sets a viewport’s scenario.
The scenario contains information about the ScenarioDebugMode
, environment information, reflection atlas etc.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_shadow_atlas_quadrant_subdivision(
&self,
viewport: Rid,
quadrant: i64,
subdivision: i64
)
pub unsafe fn viewport_set_shadow_atlas_quadrant_subdivision(
&self,
viewport: Rid,
quadrant: i64,
subdivision: i64
)
Sets the shadow atlas quadrant’s subdivision.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_shadow_atlas_size(&self, viewport: Rid, size: i64)
pub unsafe fn viewport_set_shadow_atlas_size(&self, viewport: Rid, size: i64)
Sets the size of the shadow atlas’s images (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_sharpen_intensity(&self, viewport: Rid, intensity: f64)
pub unsafe fn viewport_set_sharpen_intensity(&self, viewport: Rid, intensity: f64)
Sets the sharpening intensity
for the viewport
. If set to a value greater than 0.0
, contrast-adaptive sharpening will be applied to the 3D viewport. This has a low performance cost and can be used to recover some of the sharpness lost from using FXAA. Values around 0.5
generally give the best results. See also viewport_set_use_fxaa
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_size(&self, viewport: Rid, width: i64, height: i64)
pub unsafe fn viewport_set_size(&self, viewport: Rid, width: i64, height: i64)
Sets the viewport’s width and height.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_transparent_background(
&self,
viewport: Rid,
enabled: bool
)
pub unsafe fn viewport_set_transparent_background(
&self,
viewport: Rid,
enabled: bool
)
If true
, the viewport renders its background as transparent.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_update_mode(&self, viewport: Rid, update_mode: i64)
pub unsafe fn viewport_set_update_mode(&self, viewport: Rid, update_mode: i64)
Sets when the viewport should be updated. See ViewportUpdateMode
constants for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_usage(&self, viewport: Rid, usage: i64)
pub unsafe fn viewport_set_usage(&self, viewport: Rid, usage: i64)
Sets the viewport’s 2D/3D mode. See ViewportUsage
constants for options.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_use_32_bpc_depth(&self, viewport: Rid, enabled: bool)
pub unsafe fn viewport_set_use_32_bpc_depth(&self, viewport: Rid, enabled: bool)
If true
, allocates the viewport’s framebuffer with full floating-point precision (32-bit) instead of half floating-point precision (16-bit). Only effective if viewport_set_use_32_bpc_depth
is used on the same Viewport
to set HDR to true
.
Note: Only available on the GLES3 backend.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_use_arvr(&self, viewport: Rid, use_arvr: bool)
pub unsafe fn viewport_set_use_arvr(&self, viewport: Rid, use_arvr: bool)
If true
, the viewport uses augmented or virtual reality technologies. See ARVRInterface
.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_use_debanding(&self, viewport: Rid, debanding: bool)
pub unsafe fn viewport_set_use_debanding(&self, viewport: Rid, debanding: bool)
If true
, uses a fast post-processing filter to make banding significantly less visible. In some cases, debanding may introduce a slightly noticeable dithering pattern. It’s recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.
Note: Only available on the GLES3 backend. Viewport.hdr
must also be true
for debanding to be effective.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_use_fxaa(&self, viewport: Rid, fxaa: bool)
pub unsafe fn viewport_set_use_fxaa(&self, viewport: Rid, fxaa: bool)
Enables fast approximate antialiasing for this viewport. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. Some of the lost sharpness can be recovered by enabling contrast-adaptive sharpening (see viewport_set_sharpen_intensity
).
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
sourcepub unsafe fn viewport_set_vflip(&self, viewport: Rid, enabled: bool)
pub unsafe fn viewport_set_vflip(&self, viewport: Rid, enabled: bool)
If true
, the viewport’s rendering is flipped vertically.
Safety
This function has parameters of type Rid
(resource ID). RIDs are untyped and interpreted as raw pointers by the engine, so passing an incorrect RID can cause UB.
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 VisualServer
impl Debug for VisualServer
source§impl Deref for VisualServer
impl Deref for VisualServer
source§impl DerefMut for VisualServer
impl DerefMut for VisualServer
source§impl GodotObject for VisualServer
impl GodotObject for VisualServer
§type Memory = ManuallyManaged
type Memory = ManuallyManaged
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
.