pub struct VisualServer { /* private fields */ }
Expand description
core singleton class VisualServer
inherits Object
(unsafe).
§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 Access
in these types tracks whether the
access is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations§
Source§impl VisualServer
Constants
impl VisualServer
Constants
pub const ARRAY_BONES: i64 = 6i64
pub const ARRAY_COLOR: i64 = 3i64
pub const ARRAY_COMPRESS_BONES: i64 = 32_768i64
pub const ARRAY_COMPRESS_COLOR: i64 = 4_096i64
pub const ARRAY_COMPRESS_DEFAULT: i64 = 97_280i64
pub const ARRAY_COMPRESS_INDEX: i64 = 131_072i64
pub const ARRAY_COMPRESS_NORMAL: i64 = 1_024i64
pub const ARRAY_COMPRESS_TANGENT: i64 = 2_048i64
pub const ARRAY_COMPRESS_TEX_UV: i64 = 8_192i64
pub const ARRAY_COMPRESS_TEX_UV2: i64 = 16_384i64
pub const ARRAY_COMPRESS_VERTEX: i64 = 512i64
pub const ARRAY_COMPRESS_WEIGHTS: i64 = 65_536i64
pub const ARRAY_FLAG_USE_16_BIT_BONES: i64 = 524_288i64
pub const ARRAY_FLAG_USE_2D_VERTICES: i64 = 262_144i64
pub const ARRAY_FORMAT_BONES: i64 = 64i64
pub const ARRAY_FORMAT_COLOR: i64 = 8i64
pub const ARRAY_FORMAT_INDEX: i64 = 256i64
pub const ARRAY_FORMAT_NORMAL: i64 = 2i64
pub const ARRAY_FORMAT_TANGENT: i64 = 4i64
pub const ARRAY_FORMAT_TEX_UV: i64 = 16i64
pub const ARRAY_FORMAT_TEX_UV2: i64 = 32i64
pub const ARRAY_FORMAT_VERTEX: i64 = 1i64
pub const ARRAY_FORMAT_WEIGHTS: i64 = 128i64
pub const ARRAY_INDEX: i64 = 8i64
pub const ARRAY_MAX: i64 = 9i64
pub const ARRAY_NORMAL: i64 = 1i64
pub const ARRAY_TANGENT: i64 = 2i64
pub const ARRAY_TEX_UV: i64 = 4i64
pub const ARRAY_TEX_UV2: i64 = 5i64
pub const ARRAY_VERTEX: i64 = 0i64
pub const ARRAY_WEIGHTS: i64 = 7i64
pub const ARRAY_WEIGHTS_SIZE: i64 = 4i64
pub const BLEND_SHAPE_MODE_NORMALIZED: i64 = 0i64
pub const BLEND_SHAPE_MODE_RELATIVE: i64 = 1i64
pub const CANVAS_ITEM_Z_MAX: i64 = 4_096i64
pub const CANVAS_ITEM_Z_MIN: i64 = -4_096i64
pub const CANVAS_LIGHT_FILTER_NONE: i64 = 0i64
pub const CANVAS_LIGHT_FILTER_PCF13: i64 = 5i64
pub const CANVAS_LIGHT_FILTER_PCF3: i64 = 1i64
pub const CANVAS_LIGHT_FILTER_PCF5: i64 = 2i64
pub const CANVAS_LIGHT_FILTER_PCF7: i64 = 3i64
pub const CANVAS_LIGHT_FILTER_PCF9: i64 = 4i64
pub const CANVAS_LIGHT_MODE_ADD: i64 = 0i64
pub const CANVAS_LIGHT_MODE_MASK: i64 = 3i64
pub const CANVAS_LIGHT_MODE_MIX: i64 = 2i64
pub const CANVAS_LIGHT_MODE_SUB: i64 = 1i64
pub const CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: i64 = 1i64
pub const CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: i64 = 2i64
pub const CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: i64 = 0i64
pub const CUBEMAP_BACK: i64 = 5i64
pub const CUBEMAP_BOTTOM: i64 = 2i64
pub const CUBEMAP_FRONT: i64 = 4i64
pub const CUBEMAP_LEFT: i64 = 0i64
pub const CUBEMAP_RIGHT: i64 = 1i64
pub const CUBEMAP_TOP: i64 = 3i64
pub const ENV_BG_CANVAS: i64 = 4i64
pub const ENV_BG_CLEAR_COLOR: i64 = 0i64
pub const ENV_BG_COLOR: i64 = 1i64
pub const ENV_BG_COLOR_SKY: i64 = 3i64
pub const ENV_BG_KEEP: i64 = 5i64
pub const ENV_BG_MAX: i64 = 7i64
pub const ENV_BG_SKY: i64 = 2i64
pub const ENV_DOF_BLUR_QUALITY_HIGH: i64 = 2i64
pub const ENV_DOF_BLUR_QUALITY_LOW: i64 = 0i64
pub const ENV_DOF_BLUR_QUALITY_MEDIUM: i64 = 1i64
pub const ENV_SSAO_BLUR_1x1: i64 = 1i64
pub const ENV_SSAO_BLUR_2x2: i64 = 2i64
pub const ENV_SSAO_BLUR_3x3: i64 = 3i64
pub const ENV_SSAO_BLUR_DISABLED: i64 = 0i64
pub const ENV_SSAO_QUALITY_HIGH: i64 = 2i64
pub const ENV_SSAO_QUALITY_LOW: i64 = 0i64
pub const ENV_SSAO_QUALITY_MEDIUM: i64 = 1i64
pub const ENV_TONE_MAPPER_ACES: i64 = 3i64
pub const ENV_TONE_MAPPER_FILMIC: i64 = 2i64
pub const ENV_TONE_MAPPER_LINEAR: i64 = 0i64
pub const ENV_TONE_MAPPER_REINHARD: i64 = 1i64
pub const FEATURE_MULTITHREADED: i64 = 1i64
pub const FEATURE_SHADERS: i64 = 0i64
pub const GLOW_BLEND_MODE_ADDITIVE: i64 = 0i64
pub const GLOW_BLEND_MODE_REPLACE: i64 = 3i64
pub const GLOW_BLEND_MODE_SCREEN: i64 = 1i64
pub const GLOW_BLEND_MODE_SOFTLIGHT: i64 = 2i64
pub const INFO_2D_DRAW_CALLS_IN_FRAME: i64 = 7i64
pub const INFO_2D_ITEMS_IN_FRAME: i64 = 6i64
pub const INFO_DRAW_CALLS_IN_FRAME: i64 = 5i64
pub const INFO_MATERIAL_CHANGES_IN_FRAME: i64 = 2i64
pub const INFO_OBJECTS_IN_FRAME: i64 = 0i64
pub const INFO_SHADER_CHANGES_IN_FRAME: i64 = 3i64
pub const INFO_SURFACE_CHANGES_IN_FRAME: i64 = 4i64
pub const INFO_TEXTURE_MEM_USED: i64 = 10i64
pub const INFO_USAGE_VIDEO_MEM_TOTAL: i64 = 8i64
pub const INFO_VERTEX_MEM_USED: i64 = 11i64
pub const INFO_VERTICES_IN_FRAME: i64 = 1i64
pub const INFO_VIDEO_MEM_USED: i64 = 9i64
pub const INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE: i64 = 1i64
pub const INSTANCE_FLAG_MAX: i64 = 2i64
pub const INSTANCE_FLAG_USE_BAKED_LIGHT: i64 = 0i64
pub const INSTANCE_GEOMETRY_MASK: i64 = 30i64
pub const INSTANCE_GI_PROBE: i64 = 7i64
pub const INSTANCE_IMMEDIATE: i64 = 3i64
pub const INSTANCE_LIGHT: i64 = 5i64
pub const INSTANCE_LIGHTMAP_CAPTURE: i64 = 8i64
pub const INSTANCE_MAX: i64 = 9i64
pub const INSTANCE_MESH: i64 = 1i64
pub const INSTANCE_MULTIMESH: i64 = 2i64
pub const INSTANCE_NONE: i64 = 0i64
pub const INSTANCE_PARTICLES: i64 = 4i64
pub const INSTANCE_REFLECTION_PROBE: i64 = 6i64
pub const LIGHT_BAKE_ALL: i64 = 2i64
pub const LIGHT_BAKE_DISABLED: i64 = 0i64
pub const LIGHT_BAKE_INDIRECT: i64 = 1i64
pub const LIGHT_DIRECTIONAL: i64 = 0i64
pub const LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED: i64 = 1i64
pub const LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE: i64 = 0i64
pub const LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: i64 = 0i64
pub const LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: i64 = 1i64
pub const LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: i64 = 2i64
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_OMNI_SHADOW_DETAIL_VERTICAL: i64 = 0i64
pub const LIGHT_OMNI_SHADOW_DUAL_PARABOLOID: i64 = 0i64
pub const LIGHT_PARAM_ATTENUATION: i64 = 4i64
pub const LIGHT_PARAM_CONTACT_SHADOW_SIZE: i64 = 7i64
pub const LIGHT_PARAM_ENERGY: i64 = 0i64
pub const LIGHT_PARAM_MAX: i64 = 15i64
pub const LIGHT_PARAM_RANGE: i64 = 3i64
pub const LIGHT_PARAM_SHADOW_BIAS: i64 = 13i64
pub const LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE: i64 = 14i64
pub const LIGHT_PARAM_SHADOW_MAX_DISTANCE: i64 = 8i64
pub const LIGHT_PARAM_SHADOW_NORMAL_BIAS: i64 = 12i64
pub const LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET: i64 = 9i64
pub const LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET: i64 = 10i64
pub const LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET: i64 = 11i64
pub const LIGHT_PARAM_SPECULAR: i64 = 2i64
pub const LIGHT_PARAM_SPOT_ANGLE: i64 = 5i64
pub const LIGHT_PARAM_SPOT_ATTENUATION: i64 = 6i64
pub const LIGHT_SPOT: i64 = 2i64
pub const MATERIAL_RENDER_PRIORITY_MAX: i64 = 127i64
pub const MATERIAL_RENDER_PRIORITY_MIN: i64 = -128i64
pub const MAX_CURSORS: i64 = 8i64
pub const MAX_GLOW_LEVELS: i64 = 7i64
pub const MULTIMESH_COLOR_8BIT: i64 = 1i64
pub const MULTIMESH_COLOR_FLOAT: i64 = 2i64
pub const MULTIMESH_COLOR_NONE: i64 = 0i64
pub const MULTIMESH_CUSTOM_DATA_8BIT: i64 = 1i64
pub const MULTIMESH_CUSTOM_DATA_FLOAT: i64 = 2i64
pub const MULTIMESH_CUSTOM_DATA_NONE: i64 = 0i64
pub const MULTIMESH_TRANSFORM_2D: i64 = 0i64
pub const MULTIMESH_TRANSFORM_3D: i64 = 1i64
pub const NINE_PATCH_STRETCH: i64 = 0i64
pub const NINE_PATCH_TILE: i64 = 1i64
pub const NINE_PATCH_TILE_FIT: i64 = 2i64
pub const NO_INDEX_ARRAY: i64 = -1i64
pub const PARTICLES_DRAW_ORDER_INDEX: i64 = 0i64
pub const PARTICLES_DRAW_ORDER_LIFETIME: i64 = 1i64
pub const PARTICLES_DRAW_ORDER_VIEW_DEPTH: i64 = 2i64
pub const PRIMITIVE_LINES: i64 = 1i64
pub const PRIMITIVE_LINE_LOOP: i64 = 3i64
pub const PRIMITIVE_LINE_STRIP: i64 = 2i64
pub const PRIMITIVE_MAX: i64 = 7i64
pub const PRIMITIVE_POINTS: i64 = 0i64
pub const PRIMITIVE_TRIANGLES: i64 = 4i64
pub const PRIMITIVE_TRIANGLE_FAN: i64 = 6i64
pub const PRIMITIVE_TRIANGLE_STRIP: i64 = 5i64
pub const REFLECTION_PROBE_UPDATE_ALWAYS: i64 = 1i64
pub const REFLECTION_PROBE_UPDATE_ONCE: i64 = 0i64
pub const SCENARIO_DEBUG_DISABLED: i64 = 0i64
pub const SCENARIO_DEBUG_OVERDRAW: i64 = 2i64
pub const SCENARIO_DEBUG_SHADELESS: i64 = 3i64
pub const SCENARIO_DEBUG_WIREFRAME: i64 = 1i64
pub const SHADER_CANVAS_ITEM: i64 = 1i64
pub const SHADER_MAX: i64 = 3i64
pub const SHADER_PARTICLES: i64 = 2i64
pub const SHADER_SPATIAL: i64 = 0i64
pub const SHADOW_CASTING_SETTING_DOUBLE_SIDED: i64 = 2i64
pub const SHADOW_CASTING_SETTING_OFF: i64 = 0i64
pub const SHADOW_CASTING_SETTING_ON: i64 = 1i64
pub const SHADOW_CASTING_SETTING_SHADOWS_ONLY: i64 = 3i64
pub const TEXTURE_FLAGS_DEFAULT: i64 = 7i64
pub const TEXTURE_FLAG_ANISOTROPIC_FILTER: i64 = 8i64
pub const TEXTURE_FLAG_CONVERT_TO_LINEAR: i64 = 16i64
pub const TEXTURE_FLAG_FILTER: i64 = 4i64
pub const TEXTURE_FLAG_MIPMAPS: i64 = 1i64
pub const TEXTURE_FLAG_MIRRORED_REPEAT: i64 = 32i64
pub const TEXTURE_FLAG_REPEAT: i64 = 2i64
pub const TEXTURE_FLAG_USED_FOR_STREAMING: i64 = 2_048i64
pub const TEXTURE_TYPE_2D: i64 = 0i64
pub const TEXTURE_TYPE_2D_ARRAY: i64 = 3i64
pub const TEXTURE_TYPE_3D: i64 = 4i64
pub const TEXTURE_TYPE_CUBEMAP: i64 = 2i64
pub const VIEWPORT_CLEAR_ALWAYS: i64 = 0i64
pub const VIEWPORT_CLEAR_NEVER: i64 = 1i64
pub const VIEWPORT_CLEAR_ONLY_NEXT_FRAME: i64 = 2i64
pub const VIEWPORT_DEBUG_DRAW_DISABLED: i64 = 0i64
pub const VIEWPORT_DEBUG_DRAW_OVERDRAW: i64 = 2i64
pub const VIEWPORT_DEBUG_DRAW_UNSHADED: i64 = 1i64
pub const VIEWPORT_DEBUG_DRAW_WIREFRAME: i64 = 3i64
pub const VIEWPORT_MSAA_16X: i64 = 4i64
pub const VIEWPORT_MSAA_2X: i64 = 1i64
pub const VIEWPORT_MSAA_4X: i64 = 2i64
pub const VIEWPORT_MSAA_8X: i64 = 3i64
pub const VIEWPORT_MSAA_DISABLED: i64 = 0i64
pub const VIEWPORT_MSAA_EXT_2X: i64 = 5i64
pub const VIEWPORT_MSAA_EXT_4X: i64 = 6i64
pub const VIEWPORT_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME: i64 = 7i64
pub const VIEWPORT_RENDER_INFO_2D_ITEMS_IN_FRAME: i64 = 6i64
pub const VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME: i64 = 5i64
pub const VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME: i64 = 2i64
pub const VIEWPORT_RENDER_INFO_MAX: i64 = 8i64
pub const VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME: i64 = 0i64
pub const VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME: i64 = 3i64
pub const VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME: i64 = 4i64
pub const VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME: i64 = 1i64
pub const VIEWPORT_UPDATE_ALWAYS: i64 = 3i64
pub const VIEWPORT_UPDATE_DISABLED: i64 = 0i64
pub const VIEWPORT_UPDATE_ONCE: i64 = 1i64
pub const VIEWPORT_UPDATE_WHEN_VISIBLE: i64 = 2i64
pub const VIEWPORT_USAGE_2D: i64 = 0i64
pub const VIEWPORT_USAGE_2D_NO_SAMPLING: i64 = 1i64
pub const VIEWPORT_USAGE_3D: i64 = 2i64
pub const VIEWPORT_USAGE_3D_NO_EFFECTS: i64 = 3i64
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 fn black_bars_set_images(
&self,
left: Rid,
top: Rid,
right: Rid,
bottom: Rid,
)
pub fn black_bars_set_images( &self, left: Rid, top: Rid, right: Rid, bottom: Rid, )
Sets images to be rendered in the window margin.
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 [method 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 [method free_rid] static method.
Sourcepub fn camera_set_cull_mask(&self, camera: Rid, layers: i64)
pub 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 [member Camera.cull_mask].
Sourcepub fn camera_set_environment(&self, camera: Rid, env: Rid)
pub fn camera_set_environment(&self, camera: Rid, env: Rid)
Sets the environment used by this camera. Equivalent to [member Camera.environment].
Sourcepub fn camera_set_frustum(
&self,
camera: Rid,
size: f64,
offset: Vector2,
z_near: f64,
z_far: f64,
)
pub 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.
Sourcepub fn camera_set_orthogonal(
&self,
camera: Rid,
size: f64,
z_near: f64,
z_far: f64,
)
pub 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.
Sourcepub fn camera_set_perspective(
&self,
camera: Rid,
fovy_degrees: f64,
z_near: f64,
z_far: f64,
)
pub 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.
Sourcepub fn camera_set_transform(&self, camera: Rid, transform: Transform)
pub fn camera_set_transform(&self, camera: Rid, transform: Transform)
Sets Transform of camera.
Sourcepub fn camera_set_use_vertical_aspect(&self, camera: Rid, enable: bool)
pub fn camera_set_use_vertical_aspect(&self, camera: Rid, enable: bool)
If true
, preserves the horizontal aspect ratio which is equivalent to [constant Camera.KEEP_WIDTH]. If false
, preserves the vertical aspect ratio which is equivalent to [constant Camera.KEEP_HEIGHT].
Sourcepub fn canvas_create(&self) -> Rid
pub fn canvas_create(&self) -> Rid
Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all canvas_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s [method free_rid] static method.
Sourcepub fn canvas_item_add_circle(
&self,
item: Rid,
pos: Vector2,
radius: f64,
color: Color,
)
pub fn canvas_item_add_circle( &self, item: Rid, pos: Vector2, radius: f64, color: Color, )
Adds a circle command to the CanvasItem’s draw commands.
Sourcepub fn canvas_item_add_clip_ignore(&self, item: Rid, ignore: bool)
pub fn canvas_item_add_clip_ignore(&self, item: Rid, ignore: bool)
If ignore is true
, the VisualServer does not perform clipping.
Sourcepub fn canvas_item_add_line(
&self,
item: Rid,
from: Vector2,
to: Vector2,
color: Color,
width: f64,
antialiased: bool,
)
pub 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
Sourcepub fn canvas_item_add_mesh(
&self,
item: Rid,
mesh: Rid,
transform: Transform2D,
modulate: Color,
texture: Rid,
normal_map: Rid,
)
pub 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 )
Sourcepub fn canvas_item_add_multimesh(
&self,
item: Rid,
mesh: Rid,
texture: Rid,
normal_map: Rid,
)
pub 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.
Sourcepub 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 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 )
Sourcepub fn canvas_item_add_particles(
&self,
item: Rid,
particles: Rid,
texture: Rid,
normal_map: Rid,
)
pub 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.
Sourcepub fn canvas_item_add_polygon(
&self,
item: Rid,
points: Vector2Array,
colors: ColorArray,
uvs: Vector2Array,
texture: Rid,
normal_map: Rid,
antialiased: bool,
)
pub fn canvas_item_add_polygon( &self, item: Rid, points: Vector2Array, colors: ColorArray, uvs: Vector2Array, texture: Rid, normal_map: Rid, antialiased: bool, )
Adds a polygon to the CanvasItem’s draw commands.
§Default Arguments
uvs
-PoolVector2Array( )
antialiased
-false
Sourcepub fn canvas_item_add_polyline(
&self,
item: Rid,
points: Vector2Array,
colors: ColorArray,
width: f64,
antialiased: bool,
)
pub fn canvas_item_add_polyline( &self, item: Rid, points: Vector2Array, colors: ColorArray, 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
Sourcepub fn canvas_item_add_primitive(
&self,
item: Rid,
points: Vector2Array,
colors: ColorArray,
uvs: Vector2Array,
texture: Rid,
width: f64,
normal_map: Rid,
)
pub fn canvas_item_add_primitive( &self, item: Rid, points: Vector2Array, colors: ColorArray, uvs: Vector2Array, texture: Rid, width: f64, normal_map: Rid, )
Sourcepub fn canvas_item_add_rect(&self, item: Rid, rect: Rect2, color: Color)
pub fn canvas_item_add_rect(&self, item: Rid, rect: Rect2, color: Color)
Adds a rectangle to the CanvasItem’s draw commands.
Sourcepub fn canvas_item_add_set_transform(&self, item: Rid, transform: Transform2D)
pub 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.
Sourcepub fn canvas_item_add_texture_rect(
&self,
item: Rid,
rect: Rect2,
texture: Rid,
tile: bool,
modulate: Color,
transpose: bool,
normal_map: Rid,
)
pub 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
Sourcepub 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 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
Sourcepub fn canvas_item_add_triangle_array(
&self,
item: Rid,
indices: Int32Array,
points: Vector2Array,
colors: ColorArray,
uvs: Vector2Array,
bones: Int32Array,
weights: Float32Array,
texture: Rid,
count: i64,
normal_map: Rid,
antialiased: bool,
antialiasing_use_indices: bool,
)
pub fn canvas_item_add_triangle_array( &self, item: Rid, indices: Int32Array, points: Vector2Array, colors: ColorArray, uvs: Vector2Array, bones: Int32Array, weights: Float32Array, 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
Sourcepub fn canvas_item_clear(&self, item: Rid)
pub fn canvas_item_clear(&self, item: Rid)
Clears the CanvasItem and removes all commands in it.
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 [method free_rid] static method.
Sourcepub fn canvas_item_set_clip(&self, item: Rid, clip: bool)
pub fn canvas_item_set_clip(&self, item: Rid, clip: bool)
Sets clipping for the CanvasItem.
Sourcepub fn canvas_item_set_copy_to_backbuffer(
&self,
item: Rid,
enabled: bool,
rect: Rect2,
)
pub fn canvas_item_set_copy_to_backbuffer( &self, item: Rid, enabled: bool, rect: Rect2, )
Sets the CanvasItem to copy a rect to the backbuffer.
Sourcepub fn canvas_item_set_custom_rect(
&self,
item: Rid,
use_custom_rect: bool,
rect: Rect2,
)
pub 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 )
Sourcepub fn canvas_item_set_distance_field_mode(&self, item: Rid, enabled: bool)
pub 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.
Sourcepub fn canvas_item_set_draw_behind_parent(&self, item: Rid, enabled: bool)
pub fn canvas_item_set_draw_behind_parent(&self, item: Rid, enabled: bool)
Sets CanvasItem to be drawn behind its parent.
Sourcepub fn canvas_item_set_draw_index(&self, item: Rid, index: i64)
pub fn canvas_item_set_draw_index(&self, item: Rid, index: i64)
Sets the index for the CanvasItem.
Sourcepub fn canvas_item_set_light_mask(&self, item: Rid, mask: i64)
pub fn canvas_item_set_light_mask(&self, item: Rid, mask: i64)
The light mask. See LightOccluder2D for more information on light masks.
Sourcepub fn canvas_item_set_material(&self, item: Rid, material: Rid)
pub fn canvas_item_set_material(&self, item: Rid, material: Rid)
Sets a new material to the CanvasItem.
Sourcepub fn canvas_item_set_modulate(&self, item: Rid, color: Color)
pub fn canvas_item_set_modulate(&self, item: Rid, color: Color)
Sets the color that modulates the CanvasItem and its children.
Sourcepub fn canvas_item_set_parent(&self, item: Rid, parent: Rid)
pub 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.
Sourcepub fn canvas_item_set_self_modulate(&self, item: Rid, color: Color)
pub fn canvas_item_set_self_modulate(&self, item: Rid, color: Color)
Sets the color that modulates the CanvasItem without children.
Sourcepub fn canvas_item_set_sort_children_by_y(&self, item: Rid, enabled: bool)
pub fn canvas_item_set_sort_children_by_y(&self, item: Rid, enabled: bool)
Sets if CanvasItem’s children should be sorted by y-position.
Sourcepub fn canvas_item_set_transform(&self, item: Rid, transform: Transform2D)
pub fn canvas_item_set_transform(&self, item: Rid, transform: Transform2D)
Sets the CanvasItem’s Transform2D.
Sourcepub fn canvas_item_set_use_parent_material(&self, item: Rid, enabled: bool)
pub fn canvas_item_set_use_parent_material(&self, item: Rid, enabled: bool)
Sets if the CanvasItem uses its parent’s material.
Sourcepub fn canvas_item_set_visible(&self, item: Rid, visible: bool)
pub fn canvas_item_set_visible(&self, item: Rid, visible: bool)
Sets if the canvas item (including its children) is visible.
Sourcepub fn canvas_item_set_z_as_relative_to_parent(&self, item: Rid, enabled: bool)
pub 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.
Sourcepub fn canvas_item_set_z_index(&self, item: Rid, z_index: i64)
pub 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).
Sourcepub fn canvas_light_attach_to_canvas(&self, light: Rid, canvas: Rid)
pub fn canvas_light_attach_to_canvas(&self, light: Rid, canvas: Rid)
Attaches the canvas light to the canvas. Removes it from its previous canvas.
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 [method free_rid] static method.
Sourcepub fn canvas_light_occluder_attach_to_canvas(&self, occluder: Rid, canvas: Rid)
pub 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.
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 [method free_rid] static method.
Sourcepub fn canvas_light_occluder_set_enabled(&self, occluder: Rid, enabled: bool)
pub fn canvas_light_occluder_set_enabled(&self, occluder: Rid, enabled: bool)
Enables or disables light occluder.
Sourcepub fn canvas_light_occluder_set_light_mask(&self, occluder: Rid, mask: i64)
pub fn canvas_light_occluder_set_light_mask(&self, occluder: Rid, mask: i64)
The light mask. See LightOccluder2D for more information on light masks.
Sourcepub fn canvas_light_occluder_set_polygon(&self, occluder: Rid, polygon: Rid)
pub fn canvas_light_occluder_set_polygon(&self, occluder: Rid, polygon: Rid)
Sets a light occluder’s polygon.
Sourcepub fn canvas_light_occluder_set_transform(
&self,
occluder: Rid,
transform: Transform2D,
)
pub fn canvas_light_occluder_set_transform( &self, occluder: Rid, transform: Transform2D, )
Sets a light occluder’s Transform2D.
Sourcepub fn canvas_light_set_color(&self, light: Rid, color: Color)
pub fn canvas_light_set_color(&self, light: Rid, color: Color)
Sets the color for a light.
Sourcepub fn canvas_light_set_enabled(&self, light: Rid, enabled: bool)
pub fn canvas_light_set_enabled(&self, light: Rid, enabled: bool)
Enables or disables a canvas light.
Sourcepub fn canvas_light_set_energy(&self, light: Rid, energy: f64)
pub fn canvas_light_set_energy(&self, light: Rid, energy: f64)
Sets a canvas light’s energy.
Sourcepub fn canvas_light_set_height(&self, light: Rid, height: f64)
pub fn canvas_light_set_height(&self, light: Rid, height: f64)
Sets a canvas light’s height.
Sourcepub fn canvas_light_set_item_cull_mask(&self, light: Rid, mask: i64)
pub fn canvas_light_set_item_cull_mask(&self, light: Rid, mask: i64)
The light mask. See LightOccluder2D for more information on light masks.
Sourcepub fn canvas_light_set_item_shadow_cull_mask(&self, light: Rid, mask: i64)
pub 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.
Sourcepub fn canvas_light_set_layer_range(
&self,
light: Rid,
min_layer: i64,
max_layer: i64,
)
pub fn canvas_light_set_layer_range( &self, light: Rid, min_layer: i64, max_layer: i64, )
The layer range that gets rendered with this light.
Sourcepub fn canvas_light_set_mode(&self, light: Rid, mode: i64)
pub fn canvas_light_set_mode(&self, light: Rid, mode: i64)
The mode of the light, see [enum CanvasLightMode] constants.
Sourcepub fn canvas_light_set_scale(&self, light: Rid, scale: f64)
pub fn canvas_light_set_scale(&self, light: Rid, scale: f64)
Sets the texture’s scale factor of the light. Equivalent to [member Light2D.texture_scale].
Sourcepub fn canvas_light_set_shadow_buffer_size(&self, light: Rid, size: i64)
pub 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.
Sourcepub fn canvas_light_set_shadow_color(&self, light: Rid, color: Color)
pub fn canvas_light_set_shadow_color(&self, light: Rid, color: Color)
Sets the color of the canvas light’s shadow.
Sourcepub fn canvas_light_set_shadow_enabled(&self, light: Rid, enabled: bool)
pub fn canvas_light_set_shadow_enabled(&self, light: Rid, enabled: bool)
Enables or disables the canvas light’s shadow.
Sourcepub fn canvas_light_set_shadow_filter(&self, light: Rid, filter: i64)
pub fn canvas_light_set_shadow_filter(&self, light: Rid, filter: i64)
Sets the canvas light’s shadow’s filter, see [enum CanvasLightShadowFilter] constants.
Sourcepub fn canvas_light_set_shadow_gradient_length(&self, light: Rid, length: f64)
pub fn canvas_light_set_shadow_gradient_length(&self, light: Rid, length: f64)
Sets the length of the shadow’s gradient.
Sourcepub fn canvas_light_set_shadow_smooth(&self, light: Rid, smooth: f64)
pub fn canvas_light_set_shadow_smooth(&self, light: Rid, smooth: f64)
Smoothens the shadow. The lower, the smoother.
Sourcepub fn canvas_light_set_texture(&self, light: Rid, texture: Rid)
pub fn canvas_light_set_texture(&self, light: Rid, texture: Rid)
Sets texture to be used by light. Equivalent to [member Light2D.texture].
Sourcepub fn canvas_light_set_texture_offset(&self, light: Rid, offset: Vector2)
pub fn canvas_light_set_texture_offset(&self, light: Rid, offset: Vector2)
Sets the offset of the light’s texture. Equivalent to [member Light2D.offset].
Sourcepub fn canvas_light_set_transform(&self, light: Rid, transform: Transform2D)
pub fn canvas_light_set_transform(&self, light: Rid, transform: Transform2D)
Sets the canvas light’s Transform2D.
Sourcepub fn canvas_light_set_z_range(&self, light: Rid, min_z: i64, max_z: i64)
pub 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 [member Light2D.range_z_min] and [member Light2D.range_z_max].
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 [method free_rid] static method.
Sourcepub fn canvas_occluder_polygon_set_cull_mode(
&self,
occluder_polygon: Rid,
mode: i64,
)
pub fn canvas_occluder_polygon_set_cull_mode( &self, occluder_polygon: Rid, mode: i64, )
Sets an occluder polygons cull mode. See [enum CanvasOccluderPolygonCullMode] constants.
Sourcepub fn canvas_occluder_polygon_set_shape(
&self,
occluder_polygon: Rid,
shape: Vector2Array,
closed: bool,
)
pub fn canvas_occluder_polygon_set_shape( &self, occluder_polygon: Rid, shape: Vector2Array, closed: bool, )
Sets the shape of the occluder polygon.
Sourcepub fn canvas_occluder_polygon_set_shape_as_lines(
&self,
occluder_polygon: Rid,
shape: Vector2Array,
)
pub fn canvas_occluder_polygon_set_shape_as_lines( &self, occluder_polygon: Rid, shape: Vector2Array, )
Sets the shape of the occluder polygon as lines.
Sourcepub fn canvas_set_item_mirroring(
&self,
canvas: Rid,
item: Rid,
mirroring: Vector2,
)
pub fn canvas_set_item_mirroring( &self, canvas: Rid, item: Rid, mirroring: Vector2, )
A copy of the canvas item will be drawn with a local offset of the mirroring Vector2.
Sourcepub fn canvas_set_modulate(&self, canvas: Rid, color: Color)
pub fn canvas_set_modulate(&self, canvas: Rid, color: Color)
Modulates all colors in the given canvas.
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 [method free_rid] static method.
To place in a scene, attach this directional light to an instance using [method 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. [i]This method is deprecated[/i], please use [method 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 [method free_rid] static method.
Sourcepub fn environment_set_adjustment(
&self,
env: Rid,
enable: bool,
brightness: f64,
contrast: f64,
saturation: f64,
ramp: Rid,
)
pub 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.
Sourcepub fn environment_set_ambient_light(
&self,
env: Rid,
color: Color,
energy: f64,
sky_contibution: f64,
)
pub 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
Sourcepub fn environment_set_background(&self, env: Rid, bg: i64)
pub fn environment_set_background(&self, env: Rid, bg: i64)
Sets the [i]BGMode[/i] of the environment. Equivalent to [member Environment.background_mode].
Sourcepub fn environment_set_bg_color(&self, env: Rid, color: Color)
pub 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).
Sourcepub fn environment_set_bg_energy(&self, env: Rid, energy: f64)
pub fn environment_set_bg_energy(&self, env: Rid, energy: f64)
Sets the intensity of the background color.
Sourcepub fn environment_set_canvas_max_layer(&self, env: Rid, max_layer: i64)
pub fn environment_set_canvas_max_layer(&self, env: Rid, max_layer: i64)
Sets the maximum layer to use if using Canvas background mode.
Sourcepub fn environment_set_dof_blur_far(
&self,
env: Rid,
enable: bool,
distance: f64,
transition: f64,
far_amount: f64,
quality: i64,
)
pub 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.
Sourcepub fn environment_set_dof_blur_near(
&self,
env: Rid,
enable: bool,
distance: f64,
transition: f64,
far_amount: f64,
quality: i64,
)
pub 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.
Sourcepub fn environment_set_fog(
&self,
env: Rid,
enable: bool,
color: Color,
sun_color: Color,
sun_amount: f64,
)
pub 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.
Sourcepub 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 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.
Sourcepub fn environment_set_fog_height(
&self,
env: Rid,
enable: bool,
min_height: f64,
max_height: f64,
height_curve: f64,
)
pub 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.
Sourcepub 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,
)
pub 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, )
Sets the variables to be used with the “glow” post-process effect. See Environment for more details.
Sourcepub fn environment_set_sky(&self, env: Rid, sky: Rid)
pub fn environment_set_sky(&self, env: Rid, sky: Rid)
Sets the Sky to be used as the environment’s background when using [i]BGMode[/i] sky. Equivalent to [member Environment.background_sky].
Sourcepub fn environment_set_sky_custom_fov(&self, env: Rid, scale: f64)
pub fn environment_set_sky_custom_fov(&self, env: Rid, scale: f64)
Sets a custom field of view for the background Sky. Equivalent to [member Environment.background_sky_custom_fov].
Sourcepub fn environment_set_sky_orientation(&self, env: Rid, orientation: Basis)
pub fn environment_set_sky_orientation(&self, env: Rid, orientation: Basis)
Sourcepub 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 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.
Sourcepub fn environment_set_ssr(
&self,
env: Rid,
enable: bool,
max_steps: i64,
fade_in: f64,
fade_out: f64,
depth_tolerance: f64,
roughness: bool,
)
pub 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.
Sourcepub 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 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.
Sourcepub fn force_draw(&self, swap_buffers: bool, frame_step: f64)
pub fn force_draw(&self, swap_buffers: bool, frame_step: f64)
Sourcepub fn force_sync(&self)
pub fn force_sync(&self)
Synchronizes threads.
Sourcepub fn get_render_info(&self, info: i64) -> i64
pub fn get_render_info(&self, info: i64) -> i64
Returns a certain information, see [enum 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 [method free_rid] static method.
To place in a scene, attach this GI probe to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn gi_probe_get_bias(&self, probe: Rid) -> f64
pub 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 [member GIProbeData.bias].
Sourcepub fn gi_probe_get_bounds(&self, probe: Rid) -> Aabb
pub fn gi_probe_get_bounds(&self, probe: Rid) -> Aabb
Returns the axis-aligned bounding box that covers the full extent of the GI probe.
Sourcepub fn gi_probe_get_cell_size(&self, probe: Rid) -> f64
pub fn gi_probe_get_cell_size(&self, probe: Rid) -> f64
Returns the cell size set by [method gi_probe_set_cell_size].
Sourcepub fn gi_probe_get_dynamic_data(&self, probe: Rid) -> Int32Array
pub fn gi_probe_get_dynamic_data(&self, probe: Rid) -> Int32Array
Returns the data used by the GI probe.
Sourcepub fn gi_probe_get_dynamic_range(&self, probe: Rid) -> i64
pub fn gi_probe_get_dynamic_range(&self, probe: Rid) -> i64
Returns the dynamic range set for this GI probe. Equivalent to [member GIProbe.dynamic_range].
Sourcepub fn gi_probe_get_energy(&self, probe: Rid) -> f64
pub fn gi_probe_get_energy(&self, probe: Rid) -> f64
Returns the energy multiplier for this GI probe. Equivalent to [member GIProbe.energy].
Sourcepub fn gi_probe_get_normal_bias(&self, probe: Rid) -> f64
pub fn gi_probe_get_normal_bias(&self, probe: Rid) -> f64
Returns the normal bias for this GI probe. Equivalent to [member GIProbe.normal_bias].
Sourcepub fn gi_probe_get_propagation(&self, probe: Rid) -> f64
pub fn gi_probe_get_propagation(&self, probe: Rid) -> f64
Returns the propagation value for this GI probe. Equivalent to [member GIProbe.propagation].
Sourcepub fn gi_probe_get_to_cell_xform(&self, probe: Rid) -> Transform
pub fn gi_probe_get_to_cell_xform(&self, probe: Rid) -> Transform
Returns the Transform set by [method gi_probe_set_to_cell_xform].
Sourcepub fn gi_probe_is_compressed(&self, probe: Rid) -> bool
pub 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 [member GIProbe.compress].
Sourcepub fn gi_probe_is_interior(&self, probe: Rid) -> bool
pub 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 [member GIProbe.interior].
Sourcepub fn gi_probe_set_bias(&self, probe: Rid, bias: f64)
pub fn gi_probe_set_bias(&self, probe: Rid, bias: f64)
Sets the bias value to avoid self-occlusion. Equivalent to [member GIProbe.bias].
Sourcepub fn gi_probe_set_bounds(&self, probe: Rid, bounds: Aabb)
pub fn gi_probe_set_bounds(&self, probe: Rid, bounds: Aabb)
Sets the axis-aligned bounding box that covers the extent of the GI probe.
Sourcepub fn gi_probe_set_cell_size(&self, probe: Rid, range: f64)
pub fn gi_probe_set_cell_size(&self, probe: Rid, range: f64)
Sets the size of individual cells within the GI probe.
Sourcepub fn gi_probe_set_compress(&self, probe: Rid, enable: bool)
pub 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 [member GIProbe.compress].
Sourcepub fn gi_probe_set_dynamic_data(&self, probe: Rid, data: Int32Array)
pub fn gi_probe_set_dynamic_data(&self, probe: Rid, data: Int32Array)
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.
Sourcepub fn gi_probe_set_dynamic_range(&self, probe: Rid, range: i64)
pub 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 [member GIProbe.dynamic_range].
Sourcepub fn gi_probe_set_energy(&self, probe: Rid, energy: f64)
pub 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 [member GIProbe.energy].
Sourcepub fn gi_probe_set_interior(&self, probe: Rid, enable: bool)
pub 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 [member GIProbe.interior].
Sourcepub fn gi_probe_set_normal_bias(&self, probe: Rid, bias: f64)
pub 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 [member GIProbe.normal_bias].
Sourcepub fn gi_probe_set_propagation(&self, probe: Rid, propagation: f64)
pub fn gi_probe_set_propagation(&self, probe: Rid, propagation: f64)
Sets the propagation of light within this GI probe. Equivalent to [member GIProbe.propagation].
Sourcepub fn gi_probe_set_to_cell_xform(&self, probe: Rid, xform: Transform)
pub fn gi_probe_set_to_cell_xform(&self, probe: Rid, xform: Transform)
Sets the to cell Transform for this GI probe.
Sourcepub fn has_changed(&self) -> bool
pub fn has_changed(&self) -> bool
Returns true
if changes have been made to the VisualServer’s data. [method draw] is usually called if this happens.
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
and pvrtc
.
Sourcepub fn immediate_begin(&self, immediate: Rid, primitive: i64, texture: Rid)
pub fn immediate_begin(&self, immediate: Rid, primitive: i64, texture: Rid)
Sets up ImmediateGeometry internals to prepare for drawing. Equivalent to [method ImmediateGeometry.begin].
Sourcepub fn immediate_clear(&self, immediate: Rid)
pub fn immediate_clear(&self, immediate: Rid)
Clears everything that was set up between [method immediate_begin] and [method immediate_end]. Equivalent to [method ImmediateGeometry.clear].
Sourcepub fn immediate_color(&self, immediate: Rid, color: Color)
pub fn immediate_color(&self, immediate: Rid, color: Color)
Sets the color to be used with next vertex. Equivalent to [method ImmediateGeometry.set_color].
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 [method free_rid] static method.
To place in a scene, attach this immediate geometry to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn immediate_end(&self, immediate: Rid)
pub fn immediate_end(&self, immediate: Rid)
Ends drawing the ImmediateGeometry and displays it. Equivalent to [method ImmediateGeometry.end].
Sourcepub fn immediate_get_material(&self, immediate: Rid) -> Rid
pub fn immediate_get_material(&self, immediate: Rid) -> Rid
Returns the material assigned to the ImmediateGeometry.
Sourcepub fn immediate_normal(&self, immediate: Rid, normal: Vector3)
pub fn immediate_normal(&self, immediate: Rid, normal: Vector3)
Sets the normal to be used with next vertex. Equivalent to [method ImmediateGeometry.set_normal].
Sourcepub fn immediate_set_material(&self, immediate: Rid, material: Rid)
pub fn immediate_set_material(&self, immediate: Rid, material: Rid)
Sets the material to be used to draw the ImmediateGeometry.
Sourcepub fn immediate_tangent(&self, immediate: Rid, tangent: Plane)
pub fn immediate_tangent(&self, immediate: Rid, tangent: Plane)
Sets the tangent to be used with next vertex. Equivalent to [method ImmediateGeometry.set_tangent].
Sourcepub fn immediate_uv(&self, immediate: Rid, tex_uv: Vector2)
pub fn immediate_uv(&self, immediate: Rid, tex_uv: Vector2)
Sets the UV to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv].
Sourcepub fn immediate_uv2(&self, immediate: Rid, tex_uv: Vector2)
pub fn immediate_uv2(&self, immediate: Rid, tex_uv: Vector2)
Sets the UV2 to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv2].
Sourcepub fn immediate_vertex(&self, immediate: Rid, vertex: Vector3)
pub fn immediate_vertex(&self, immediate: Rid, vertex: Vector3)
Adds the next vertex using the information provided in advance. Equivalent to [method ImmediateGeometry.add_vertex].
Sourcepub fn immediate_vertex_2d(&self, immediate: Rid, vertex: Vector2)
pub 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 [method immediate_vertex] under the hood. Equivalent to [method ImmediateGeometry.add_vertex].
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 fn instance_attach_object_instance_id(&self, instance: Rid, id: i64)
pub 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 [method instances_cull_aabb], [method instances_cull_convex], and [method instances_cull_ray].
Sourcepub fn instance_attach_skeleton(&self, instance: Rid, skeleton: Rid)
pub fn instance_attach_skeleton(&self, instance: Rid, skeleton: Rid)
Attaches a skeleton to an instance. Removes the previous skeleton from the instance.
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 [method 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 [method instance_set_base].
Sourcepub fn instance_create2(&self, base: Rid, scenario: Rid) -> Rid
pub 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 [method free_rid] static method.
Sourcepub fn instance_geometry_set_as_instance_lod(
&self,
instance: Rid,
as_lod_of_instance: Rid,
)
pub fn instance_geometry_set_as_instance_lod( &self, instance: Rid, as_lod_of_instance: Rid, )
Not implemented in Godot 3.x.
Sourcepub fn instance_geometry_set_cast_shadows_setting(
&self,
instance: Rid,
shadow_casting_setting: i64,
)
pub fn instance_geometry_set_cast_shadows_setting( &self, instance: Rid, shadow_casting_setting: i64, )
Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance.cast_shadow].
Sourcepub fn instance_geometry_set_draw_range(
&self,
instance: Rid,
min: f64,
max: f64,
min_margin: f64,
max_margin: f64,
)
pub 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.
Sourcepub fn instance_geometry_set_flag(
&self,
instance: Rid,
flag: i64,
enabled: bool,
)
pub fn instance_geometry_set_flag( &self, instance: Rid, flag: i64, enabled: bool, )
Sets the flag for a given [enum InstanceFlags]. See [enum InstanceFlags] for more details.
Sourcepub fn instance_geometry_set_material_override(
&self,
instance: Rid,
material: Rid,
)
pub 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 [member GeometryInstance.material_override].
Sourcepub fn instance_set_base(&self, instance: Rid, base: Rid)
pub 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.
Sourcepub fn instance_set_blend_shape_weight(
&self,
instance: Rid,
shape: i64,
weight: f64,
)
pub 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.
Sourcepub fn instance_set_custom_aabb(&self, instance: Rid, aabb: Aabb)
pub 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 [method GeometryInstance.set_custom_aabb].
Sourcepub fn instance_set_exterior(&self, instance: Rid, enabled: bool)
pub fn instance_set_exterior(&self, instance: Rid, enabled: bool)
Function not implemented in Godot 3.x.
Sourcepub fn instance_set_extra_visibility_margin(&self, instance: Rid, margin: f64)
pub 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 avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance.extra_cull_margin].
Sourcepub fn instance_set_layer_mask(&self, instance: Rid, mask: i64)
pub fn instance_set_layer_mask(&self, instance: Rid, mask: i64)
Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance.layers].
Sourcepub fn instance_set_scenario(&self, instance: Rid, scenario: Rid)
pub 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.
Sourcepub fn instance_set_surface_material(
&self,
instance: Rid,
surface: i64,
material: Rid,
)
pub fn instance_set_surface_material( &self, instance: Rid, surface: i64, material: Rid, )
Sets the material of a specific surface. Equivalent to [method MeshInstance.set_surface_material].
Sourcepub fn instance_set_transform(&self, instance: Rid, transform: Transform)
pub fn instance_set_transform(&self, instance: Rid, transform: Transform)
Sets the world space transform of the instance. Equivalent to [member Spatial.transform].
Sourcepub fn instance_set_use_lightmap(
&self,
instance: Rid,
lightmap_instance: Rid,
lightmap: Rid,
lightmap_slice: i64,
lightmap_uv_rect: Rect2,
)
pub 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.
Sourcepub fn instance_set_visible(&self, instance: Rid, visible: bool)
pub fn instance_set_visible(&self, instance: Rid, visible: bool)
Sets whether an instance is drawn or not. Equivalent to [member Spatial.visible].
Sourcepub fn instances_cull_aabb(&self, aabb: Aabb, scenario: Rid) -> VariantArray
pub 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.
Sourcepub fn instances_cull_convex(
&self,
convex: VariantArray,
scenario: Rid,
) -> VariantArray
pub 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.
Sourcepub fn instances_cull_ray(
&self,
from: Vector3,
to: Vector3,
scenario: Rid,
) -> VariantArray
pub 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.
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 [method force_draw] to draw a frame even with rendering disabled.
Sourcepub fn light_directional_set_blend_splits(&self, light: Rid, enable: bool)
pub 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 [member DirectionalLight.directional_shadow_blend_splits].
Sourcepub fn light_directional_set_shadow_depth_range_mode(
&self,
light: Rid,
range_mode: i64,
)
pub 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 [member DirectionalLight.directional_shadow_depth_range]. See [enum LightDirectionalShadowDepthRangeMode] for options.
Sourcepub fn light_directional_set_shadow_mode(&self, light: Rid, mode: i64)
pub fn light_directional_set_shadow_mode(&self, light: Rid, mode: i64)
Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options.
Sourcepub fn light_omni_set_shadow_detail(&self, light: Rid, detail: i64)
pub 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 [member OmniLight.omni_shadow_detail].
Sourcepub fn light_omni_set_shadow_mode(&self, light: Rid, mode: i64)
pub 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 [member OmniLight.omni_shadow_mode].
Sourcepub fn light_set_bake_mode(&self, light: Rid, bake_mode: i64)
pub fn light_set_bake_mode(&self, light: Rid, bake_mode: i64)
Sourcepub fn light_set_color(&self, light: Rid, color: Color)
pub fn light_set_color(&self, light: Rid, color: Color)
Sets the color of the light. Equivalent to [member Light.light_color].
Sourcepub fn light_set_cull_mask(&self, light: Rid, mask: i64)
pub 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 [member Light.light_cull_mask].
Sourcepub fn light_set_negative(&self, light: Rid, enable: bool)
pub fn light_set_negative(&self, light: Rid, enable: bool)
If true
, light will subtract light instead of adding light. Equivalent to [member Light.light_negative].
Sourcepub fn light_set_param(&self, light: Rid, param: i64, value: f64)
pub fn light_set_param(&self, light: Rid, param: i64, value: f64)
Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light.set_param].
Sourcepub fn light_set_projector(&self, light: Rid, texture: Rid)
pub fn light_set_projector(&self, light: Rid, texture: Rid)
Not implemented in Godot 3.x.
Sourcepub fn light_set_reverse_cull_face_mode(&self, light: Rid, enabled: bool)
pub 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 [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light.shadow_reverse_cull_face].
Sourcepub fn light_set_shadow(&self, light: Rid, enabled: bool)
pub fn light_set_shadow(&self, light: Rid, enabled: bool)
If true
, light will cast shadows. Equivalent to [member Light.shadow_enabled].
Sourcepub fn light_set_shadow_color(&self, light: Rid, color: Color)
pub fn light_set_shadow_color(&self, light: Rid, color: Color)
Sets the color of the shadow cast by the light. Equivalent to [member Light.shadow_color].
Sourcepub fn light_set_use_gi(&self, light: Rid, enabled: bool)
pub fn light_set_use_gi(&self, light: Rid, enabled: bool)
Sets whether GI probes capture light information from this light.
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 [method free_rid] static method.
To place in a scene, attach this lightmap capture to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn lightmap_capture_get_bounds(&self, capture: Rid) -> Aabb
pub fn lightmap_capture_get_bounds(&self, capture: Rid) -> Aabb
Returns the size of the lightmap capture area.
Sourcepub fn lightmap_capture_get_energy(&self, capture: Rid) -> f64
pub fn lightmap_capture_get_energy(&self, capture: Rid) -> f64
Returns the energy multiplier used by the lightmap capture.
Sourcepub fn lightmap_capture_get_octree(&self, capture: Rid) -> ByteArray
pub fn lightmap_capture_get_octree(&self, capture: Rid) -> ByteArray
Returns the octree used by the lightmap capture.
Sourcepub fn lightmap_capture_get_octree_cell_subdiv(&self, capture: Rid) -> i64
pub fn lightmap_capture_get_octree_cell_subdiv(&self, capture: Rid) -> i64
Returns the cell subdivision amount used by this lightmap capture’s octree.
Sourcepub fn lightmap_capture_get_octree_cell_transform(
&self,
capture: Rid,
) -> Transform
pub fn lightmap_capture_get_octree_cell_transform( &self, capture: Rid, ) -> Transform
Returns the cell transform for this lightmap capture’s octree.
Sourcepub fn lightmap_capture_is_interior(&self, capture: Rid) -> bool
pub fn lightmap_capture_is_interior(&self, capture: Rid) -> bool
Sourcepub fn lightmap_capture_set_bounds(&self, capture: Rid, bounds: Aabb)
pub fn lightmap_capture_set_bounds(&self, capture: Rid, bounds: Aabb)
Sets the size of the area covered by the lightmap capture. Equivalent to [member BakedLightmapData.bounds].
Sourcepub fn lightmap_capture_set_energy(&self, capture: Rid, energy: f64)
pub fn lightmap_capture_set_energy(&self, capture: Rid, energy: f64)
Sets the energy multiplier for this lightmap capture. Equivalent to [member BakedLightmapData.energy].
Sourcepub fn lightmap_capture_set_interior(&self, capture: Rid, interior: bool)
pub fn lightmap_capture_set_interior(&self, capture: Rid, interior: bool)
Sourcepub fn lightmap_capture_set_octree(&self, capture: Rid, octree: ByteArray)
pub fn lightmap_capture_set_octree(&self, capture: Rid, octree: ByteArray)
Sets the octree to be used by this lightmap capture. This function is normally used by the BakedLightmap node. Equivalent to [member BakedLightmapData.octree].
Sourcepub fn lightmap_capture_set_octree_cell_subdiv(&self, capture: Rid, subdiv: i64)
pub fn lightmap_capture_set_octree_cell_subdiv(&self, capture: Rid, subdiv: i64)
Sets the subdivision level of this lightmap capture’s octree. Equivalent to [member BakedLightmapData.cell_subdiv].
Sourcepub fn lightmap_capture_set_octree_cell_transform(
&self,
capture: Rid,
xform: Transform,
)
pub 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 [member BakedLightmapData.cell_space_transform].
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 [method free_rid] static method.
Sourcepub fn material_get_param(
&self,
material: Rid,
parameter: impl Into<GodotString>,
) -> Variant
pub fn material_get_param( &self, material: Rid, parameter: impl Into<GodotString>, ) -> Variant
Returns the value of a certain material’s parameter.
Sourcepub fn material_get_param_default(
&self,
material: Rid,
parameter: impl Into<GodotString>,
) -> Variant
pub fn material_get_param_default( &self, material: Rid, parameter: impl Into<GodotString>, ) -> Variant
Returns the default value for the param if available. Otherwise returns an empty Variant.
Sourcepub fn material_get_shader(&self, shader_material: Rid) -> Rid
pub 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.
Sourcepub fn material_set_line_width(&self, material: Rid, width: f64)
pub fn material_set_line_width(&self, material: Rid, width: f64)
Sets a material’s line width.
Sourcepub fn material_set_next_pass(&self, material: Rid, next_material: Rid)
pub fn material_set_next_pass(&self, material: Rid, next_material: Rid)
Sets an object’s next material.
Sourcepub fn material_set_param(
&self,
material: Rid,
parameter: impl Into<GodotString>,
value: impl OwnedToVariant,
)
pub fn material_set_param( &self, material: Rid, parameter: impl Into<GodotString>, value: impl OwnedToVariant, )
Sets a material’s parameter.
Sourcepub fn material_set_render_priority(&self, material: Rid, priority: i64)
pub fn material_set_render_priority(&self, material: Rid, priority: i64)
Sets a material’s render priority.
Sourcepub fn material_set_shader(&self, shader_material: Rid, shader: Rid)
pub fn material_set_shader(&self, shader_material: Rid, shader: Rid)
Sets a shader material’s shader.
Sourcepub fn mesh_add_surface_from_arrays(
&self,
mesh: Rid,
primitive: i64,
arrays: VariantArray,
blend_shapes: VariantArray,
compress_format: i64,
)
pub 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 [enum PrimitiveType] constants for types.
§Default Arguments
blend_shapes
-[ ]
compress_format
-97280
Sourcepub fn mesh_clear(&self, mesh: Rid)
pub fn mesh_clear(&self, mesh: Rid)
Removes all surfaces from a mesh.
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 [method free_rid] static method.
To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn mesh_get_blend_shape_count(&self, mesh: Rid) -> i64
pub fn mesh_get_blend_shape_count(&self, mesh: Rid) -> i64
Returns a mesh’s blend shape count.
Sourcepub fn mesh_get_blend_shape_mode(&self, mesh: Rid) -> BlendShapeMode
pub fn mesh_get_blend_shape_mode(&self, mesh: Rid) -> BlendShapeMode
Returns a mesh’s blend shape mode.
Sourcepub fn mesh_get_custom_aabb(&self, mesh: Rid) -> Aabb
pub fn mesh_get_custom_aabb(&self, mesh: Rid) -> Aabb
Returns a mesh’s custom aabb.
Sourcepub fn mesh_get_surface_count(&self, mesh: Rid) -> i64
pub fn mesh_get_surface_count(&self, mesh: Rid) -> i64
Returns a mesh’s number of surfaces.
Sourcepub fn mesh_remove_surface(&self, mesh: Rid, index: i64)
pub fn mesh_remove_surface(&self, mesh: Rid, index: i64)
Removes a mesh’s surface.
Sourcepub fn mesh_set_blend_shape_count(&self, mesh: Rid, amount: i64)
pub fn mesh_set_blend_shape_count(&self, mesh: Rid, amount: i64)
Sets a mesh’s blend shape count.
Sourcepub fn mesh_set_blend_shape_mode(&self, mesh: Rid, mode: i64)
pub fn mesh_set_blend_shape_mode(&self, mesh: Rid, mode: i64)
Sets a mesh’s blend shape mode.
Sourcepub fn mesh_set_custom_aabb(&self, mesh: Rid, aabb: Aabb)
pub fn mesh_set_custom_aabb(&self, mesh: Rid, aabb: Aabb)
Sets a mesh’s custom aabb.
Sourcepub fn mesh_surface_get_aabb(&self, mesh: Rid, surface: i64) -> Aabb
pub fn mesh_surface_get_aabb(&self, mesh: Rid, surface: i64) -> Aabb
Returns a mesh’s surface’s aabb.
Sourcepub fn mesh_surface_get_array(&self, mesh: Rid, surface: i64) -> ByteArray
pub fn mesh_surface_get_array(&self, mesh: Rid, surface: i64) -> ByteArray
Returns a mesh’s surface’s vertex buffer.
Sourcepub fn mesh_surface_get_array_index_len(&self, mesh: Rid, surface: i64) -> i64
pub fn mesh_surface_get_array_index_len(&self, mesh: Rid, surface: i64) -> i64
Returns a mesh’s surface’s amount of indices.
Sourcepub fn mesh_surface_get_array_len(&self, mesh: Rid, surface: i64) -> i64
pub fn mesh_surface_get_array_len(&self, mesh: Rid, surface: i64) -> i64
Returns a mesh’s surface’s amount of vertices.
Sourcepub fn mesh_surface_get_arrays(&self, mesh: Rid, surface: i64) -> VariantArray
pub fn mesh_surface_get_arrays(&self, mesh: Rid, surface: i64) -> VariantArray
Returns a mesh’s surface’s buffer arrays.
Sourcepub fn mesh_surface_get_blend_shape_arrays(
&self,
mesh: Rid,
surface: i64,
) -> VariantArray
pub fn mesh_surface_get_blend_shape_arrays( &self, mesh: Rid, surface: i64, ) -> VariantArray
Returns a mesh’s surface’s arrays for blend shapes.
Sourcepub fn mesh_surface_get_format(&self, mesh: Rid, surface: i64) -> i64
pub fn mesh_surface_get_format(&self, mesh: Rid, surface: i64) -> i64
Returns the format of a mesh’s surface.
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,
) -> i64
pub fn mesh_surface_get_format_stride( &self, format: i64, vertex_len: i64, index_len: i64, ) -> i64
Function is unused in Godot 3.x.
Sourcepub fn mesh_surface_get_index_array(&self, mesh: Rid, surface: i64) -> ByteArray
pub fn mesh_surface_get_index_array(&self, mesh: Rid, surface: i64) -> ByteArray
Returns a mesh’s surface’s index buffer.
Sourcepub fn mesh_surface_get_material(&self, mesh: Rid, surface: i64) -> Rid
pub fn mesh_surface_get_material(&self, mesh: Rid, surface: i64) -> Rid
Returns a mesh’s surface’s material.
Sourcepub fn mesh_surface_get_primitive_type(
&self,
mesh: Rid,
surface: i64,
) -> PrimitiveType
pub fn mesh_surface_get_primitive_type( &self, mesh: Rid, surface: i64, ) -> PrimitiveType
Returns the primitive type of a mesh’s surface.
Sourcepub fn mesh_surface_get_skeleton_aabb(
&self,
mesh: Rid,
surface: i64,
) -> VariantArray
pub fn mesh_surface_get_skeleton_aabb( &self, mesh: Rid, surface: i64, ) -> VariantArray
Returns the aabb of a mesh’s surface’s skeleton.
Sourcepub fn mesh_surface_set_material(&self, mesh: Rid, surface: i64, material: Rid)
pub fn mesh_surface_set_material(&self, mesh: Rid, surface: i64, material: Rid)
Sets a mesh’s surface’s material.
Sourcepub fn mesh_surface_update_region(
&self,
mesh: Rid,
surface: i64,
offset: i64,
data: ByteArray,
)
pub fn mesh_surface_update_region( &self, mesh: Rid, surface: i64, offset: i64, data: ByteArray, )
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.
Sourcepub fn multimesh_allocate(
&self,
multimesh: Rid,
instances: i64,
transform_format: i64,
color_format: i64,
custom_data_format: i64,
)
pub 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 [enum MultimeshTransformFormat], [enum MultimeshColorFormat], and [enum MultimeshCustomDataFormat] for usage. Equivalent to [member MultiMesh.instance_count].
§Default Arguments
custom_data_format
-0
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 [method free_rid] static method.
To place in a scene, attach this multimesh to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn multimesh_get_aabb(&self, multimesh: Rid) -> Aabb
pub fn multimesh_get_aabb(&self, multimesh: Rid) -> Aabb
Calculates and returns the axis-aligned bounding box that encloses all instances within the multimesh.
Sourcepub fn multimesh_get_instance_count(&self, multimesh: Rid) -> i64
pub fn multimesh_get_instance_count(&self, multimesh: Rid) -> i64
Returns the number of instances allocated for this multimesh.
Sourcepub fn multimesh_get_mesh(&self, multimesh: Rid) -> Rid
pub fn multimesh_get_mesh(&self, multimesh: Rid) -> Rid
Returns the RID of the mesh that will be used in drawing this multimesh.
Sourcepub fn multimesh_get_visible_instances(&self, multimesh: Rid) -> i64
pub fn multimesh_get_visible_instances(&self, multimesh: Rid) -> i64
Returns the number of visible instances for this multimesh.
Sourcepub fn multimesh_instance_get_color(&self, multimesh: Rid, index: i64) -> Color
pub fn multimesh_instance_get_color(&self, multimesh: Rid, index: i64) -> Color
Returns the color by which the specified instance will be modulated.
Sourcepub fn multimesh_instance_get_custom_data(
&self,
multimesh: Rid,
index: i64,
) -> Color
pub fn multimesh_instance_get_custom_data( &self, multimesh: Rid, index: i64, ) -> Color
Returns the custom data associated with the specified instance.
Sourcepub fn multimesh_instance_get_transform(
&self,
multimesh: Rid,
index: i64,
) -> Transform
pub fn multimesh_instance_get_transform( &self, multimesh: Rid, index: i64, ) -> Transform
Returns the Transform of the specified instance.
Sourcepub fn multimesh_instance_get_transform_2d(
&self,
multimesh: Rid,
index: i64,
) -> Transform2D
pub 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.
Sourcepub fn multimesh_instance_set_color(
&self,
multimesh: Rid,
index: i64,
color: Color,
)
pub fn multimesh_instance_set_color( &self, multimesh: Rid, index: i64, color: Color, )
Sets the color by which this instance will be modulated. Equivalent to [method MultiMesh.set_instance_color].
Sourcepub fn multimesh_instance_set_custom_data(
&self,
multimesh: Rid,
index: i64,
custom_data: Color,
)
pub 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 [method MultiMesh.set_instance_custom_data].
Sourcepub fn multimesh_instance_set_transform(
&self,
multimesh: Rid,
index: i64,
transform: Transform,
)
pub fn multimesh_instance_set_transform( &self, multimesh: Rid, index: i64, transform: Transform, )
Sets the Transform for this instance. Equivalent to [method MultiMesh.set_instance_transform].
Sourcepub fn multimesh_instance_set_transform_2d(
&self,
multimesh: Rid,
index: i64,
transform: Transform2D,
)
pub 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 [method MultiMesh.set_instance_transform_2d].
Sourcepub fn multimesh_set_as_bulk_array(&self, multimesh: Rid, array: Float32Array)
pub fn multimesh_set_as_bulk_array(&self, multimesh: Rid, array: Float32Array)
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.
Sourcepub fn multimesh_set_mesh(&self, multimesh: Rid, mesh: Rid)
pub fn multimesh_set_mesh(&self, multimesh: Rid, mesh: Rid)
Sets the mesh to be drawn by the multimesh. Equivalent to [member MultiMesh.mesh].
Sourcepub fn multimesh_set_visible_instances(&self, multimesh: Rid, visible: i64)
pub 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 [member MultiMesh.visible_instance_count].
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 [method free_rid] static method.
To place in a scene, attach this omni light to an instance using [method 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 [method free_rid] static method.
To place in a scene, attach these particles to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn particles_get_current_aabb(&self, particles: Rid) -> Aabb
pub fn particles_get_current_aabb(&self, particles: Rid) -> Aabb
Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to [method Particles.capture_aabb].
Sourcepub fn particles_get_emitting(&self, particles: Rid) -> bool
pub fn particles_get_emitting(&self, particles: Rid) -> bool
Returns true
if particles are currently set to emitting.
Sourcepub fn particles_is_inactive(&self, particles: Rid) -> bool
pub fn particles_is_inactive(&self, particles: Rid) -> bool
Returns true
if particles are not emitting and particles are set to inactive.
Sourcepub fn particles_request_process(&self, particles: Rid)
pub 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 [method instances_cull_aabb], [method instances_cull_convex], or [method instances_cull_ray].
Sourcepub fn particles_restart(&self, particles: Rid)
pub fn particles_restart(&self, particles: Rid)
Reset the particles on the next update. Equivalent to [method Particles.restart].
Sourcepub fn particles_set_amount(&self, particles: Rid, amount: i64)
pub 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 [member Particles.amount].
Sourcepub fn particles_set_custom_aabb(&self, particles: Rid, aabb: Aabb)
pub fn particles_set_custom_aabb(&self, particles: Rid, aabb: Aabb)
Sets a custom axis-aligned bounding box for the particle system. Equivalent to [member Particles.visibility_aabb].
Sourcepub fn particles_set_draw_order(&self, particles: Rid, order: i64)
pub fn particles_set_draw_order(&self, particles: Rid, order: i64)
Sets the draw order of the particles to one of the named enums from [enum ParticlesDrawOrder]. See [enum ParticlesDrawOrder] for options. Equivalent to [member Particles.draw_order].
Sourcepub fn particles_set_draw_pass_mesh(&self, particles: Rid, pass: i64, mesh: Rid)
pub 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 [member Particles.draw_pass_1], [member Particles.draw_pass_2], [member Particles.draw_pass_3], and [member Particles.draw_pass_4].
Sourcepub fn particles_set_draw_passes(&self, particles: Rid, count: i64)
pub fn particles_set_draw_passes(&self, particles: Rid, count: i64)
Sets the number of draw passes to use. Equivalent to [member Particles.draw_passes].
Sourcepub fn particles_set_emission_transform(
&self,
particles: Rid,
transform: Transform,
)
pub fn particles_set_emission_transform( &self, particles: Rid, transform: Transform, )
Sets the Transform that will be used by the particles when they first emit.
Sourcepub fn particles_set_emitting(&self, particles: Rid, emitting: bool)
pub 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 [member Particles.emitting].
Sourcepub fn particles_set_explosiveness_ratio(&self, particles: Rid, ratio: f64)
pub fn particles_set_explosiveness_ratio(&self, particles: Rid, ratio: f64)
Sets the explosiveness ratio. Equivalent to [member Particles.explosiveness].
Sourcepub fn particles_set_fixed_fps(&self, particles: Rid, fps: i64)
pub 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 [member Particles.fixed_fps].
Sourcepub fn particles_set_fractional_delta(&self, particles: Rid, enable: bool)
pub fn particles_set_fractional_delta(&self, particles: Rid, enable: bool)
If true
, uses fractional delta which smooths the movement of the particles. Equivalent to [member Particles.fract_delta].
Sourcepub fn particles_set_lifetime(&self, particles: Rid, lifetime: f64)
pub fn particles_set_lifetime(&self, particles: Rid, lifetime: f64)
Sets the lifetime of each particle in the system. Equivalent to [member Particles.lifetime].
Sourcepub fn particles_set_one_shot(&self, particles: Rid, one_shot: bool)
pub fn particles_set_one_shot(&self, particles: Rid, one_shot: bool)
If true
, particles will emit once and then stop. Equivalent to [member Particles.one_shot].
Sourcepub fn particles_set_pre_process_time(&self, particles: Rid, time: f64)
pub 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 [member Particles.preprocess].
Sourcepub fn particles_set_process_material(&self, particles: Rid, material: Rid)
pub 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 [member Particles.process_material].
Sourcepub fn particles_set_randomness_ratio(&self, particles: Rid, ratio: f64)
pub 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 [member Particles.randomness].
Sourcepub fn particles_set_speed_scale(&self, particles: Rid, scale: f64)
pub fn particles_set_speed_scale(&self, particles: Rid, scale: f64)
Sets the speed scale of the particle system. Equivalent to [member Particles.speed_scale].
Sourcepub fn particles_set_use_local_coordinates(&self, particles: Rid, enable: bool)
pub 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 [member Particles.local_coords].
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 [method free_rid] static method.
To place in a scene, attach this reflection probe to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn reflection_probe_set_as_interior(&self, probe: Rid, enable: bool)
pub fn reflection_probe_set_as_interior(&self, probe: Rid, enable: bool)
If true
, reflections will ignore sky contribution. Equivalent to [member ReflectionProbe.interior_enable].
Sourcepub fn reflection_probe_set_cull_mask(&self, probe: Rid, layers: i64)
pub 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 [member ReflectionProbe.cull_mask].
Sourcepub fn reflection_probe_set_enable_box_projection(
&self,
probe: Rid,
enable: bool,
)
pub 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 [member ReflectionProbe.box_projection].
Sourcepub fn reflection_probe_set_enable_shadows(&self, probe: Rid, enable: bool)
pub 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 [member ReflectionProbe.enable_shadows].
Sourcepub fn reflection_probe_set_extents(&self, probe: Rid, extents: Vector3)
pub fn reflection_probe_set_extents(&self, probe: Rid, extents: Vector3)
Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.extents].
Sourcepub fn reflection_probe_set_intensity(&self, probe: Rid, intensity: f64)
pub 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 [member ReflectionProbe.intensity].
Sourcepub fn reflection_probe_set_interior_ambient(&self, probe: Rid, color: Color)
pub 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 [member ReflectionProbe.interior_ambient_color].
Sourcepub fn reflection_probe_set_interior_ambient_energy(
&self,
probe: Rid,
energy: f64,
)
pub 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 [member ReflectionProbe.interior_ambient_energy].
Sourcepub fn reflection_probe_set_interior_ambient_probe_contribution(
&self,
probe: Rid,
contrib: f64,
)
pub 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 [member ReflectionProbe.interior_ambient_contrib].
Sourcepub fn reflection_probe_set_max_distance(&self, probe: Rid, distance: f64)
pub 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 [member ReflectionProbe.max_distance].
Sourcepub fn reflection_probe_set_origin_offset(&self, probe: Rid, offset: Vector3)
pub 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 [member ReflectionProbe.origin_offset].
Sourcepub fn reflection_probe_set_update_mode(&self, probe: Rid, mode: i64)
pub 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 [enum ReflectionProbeUpdateMode] for options.
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 [method free_rid] static method.
The scenario is the 3D world that all the visual instances exist in.
Sourcepub fn scenario_set_debug(&self, scenario: Rid, debug_mode: i64)
pub fn scenario_set_debug(&self, scenario: Rid, debug_mode: i64)
Sets the [enum ScenarioDebugMode] for this scenario. See [enum ScenarioDebugMode] for options.
Sourcepub fn scenario_set_environment(&self, scenario: Rid, environment: Rid)
pub fn scenario_set_environment(&self, scenario: Rid, environment: Rid)
Sets the environment that will be used with this scenario.
Sourcepub fn scenario_set_fallback_environment(&self, scenario: Rid, environment: Rid)
pub 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.
Sourcepub fn scenario_set_reflection_atlas_size(
&self,
scenario: Rid,
size: i64,
subdiv: i64,
)
pub 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.
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 [method force_draw] to draw a frame even with rendering disabled.
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 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 [method free_rid] static method.
Sourcepub fn shader_get_code(&self, shader: Rid) -> GodotString
pub fn shader_get_code(&self, shader: Rid) -> GodotString
Returns a shader’s code.
Sourcepub fn shader_get_default_texture_param(
&self,
shader: Rid,
name: impl Into<GodotString>,
) -> Rid
pub fn shader_get_default_texture_param( &self, shader: Rid, name: impl Into<GodotString>, ) -> Rid
Returns a default texture from a shader searched by name.
Sourcepub fn shader_get_param_list(&self, shader: Rid) -> VariantArray
pub fn shader_get_param_list(&self, shader: Rid) -> VariantArray
Returns the parameters of a shader.
Sourcepub fn shader_set_code(&self, shader: Rid, code: impl Into<GodotString>)
pub fn shader_set_code(&self, shader: Rid, code: impl Into<GodotString>)
Sets a shader’s code.
Sourcepub fn shader_set_default_texture_param(
&self,
shader: Rid,
name: impl Into<GodotString>,
texture: Rid,
)
pub 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.
Sourcepub fn skeleton_allocate(&self, skeleton: Rid, bones: i64, is_2d_skeleton: bool)
pub fn skeleton_allocate(&self, skeleton: Rid, bones: i64, is_2d_skeleton: bool)
Sourcepub fn skeleton_bone_get_transform(&self, skeleton: Rid, bone: i64) -> Transform
pub fn skeleton_bone_get_transform(&self, skeleton: Rid, bone: i64) -> Transform
Returns the Transform set for a specific bone of this skeleton.
Sourcepub fn skeleton_bone_get_transform_2d(
&self,
skeleton: Rid,
bone: i64,
) -> Transform2D
pub fn skeleton_bone_get_transform_2d( &self, skeleton: Rid, bone: i64, ) -> Transform2D
Returns the Transform2D set for a specific bone of this skeleton.
Sourcepub fn skeleton_bone_set_transform(
&self,
skeleton: Rid,
bone: i64,
transform: Transform,
)
pub fn skeleton_bone_set_transform( &self, skeleton: Rid, bone: i64, transform: Transform, )
Sets the Transform for a specific bone of this skeleton.
Sourcepub fn skeleton_bone_set_transform_2d(
&self,
skeleton: Rid,
bone: i64,
transform: Transform2D,
)
pub fn skeleton_bone_set_transform_2d( &self, skeleton: Rid, bone: i64, transform: Transform2D, )
Sets the Transform2D for a specific bone of this skeleton.
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 [method free_rid] static method.
Sourcepub fn skeleton_get_bone_count(&self, skeleton: Rid) -> i64
pub fn skeleton_get_bone_count(&self, skeleton: Rid) -> i64
Returns the number of bones allocated for this skeleton.
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 [method free_rid] static method.
Sourcepub fn sky_set_texture(&self, sky: Rid, cube_map: Rid, radiance_size: i64)
pub fn sky_set_texture(&self, sky: Rid, cube_map: Rid, radiance_size: i64)
Sets a sky’s texture.
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 [method free_rid] static method.
To place in a scene, attach this spot light to an instance using [method instance_set_base] using the returned RID.
Sourcepub fn texture_allocate(
&self,
texture: Rid,
width: i64,
height: i64,
depth_3d: i64,
format: i64,
_type: i64,
flags: i64,
)
pub fn texture_allocate( &self, texture: Rid, width: i64, height: i64, depth_3d: i64, format: i64, _type: i64, flags: i64, )
Sourcepub fn texture_bind(&self, texture: Rid, number: i64)
pub fn texture_bind(&self, texture: Rid, number: i64)
Binds the texture to a texture slot.
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 [method 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 fn texture_get_data(
&self,
texture: Rid,
cube_side: i64,
) -> Option<Ref<Image, Shared>>
pub 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
Sourcepub fn texture_get_depth(&self, texture: Rid) -> i64
pub fn texture_get_depth(&self, texture: Rid) -> i64
Returns the depth of the texture.
Sourcepub fn texture_get_flags(&self, texture: Rid) -> i64
pub fn texture_get_flags(&self, texture: Rid) -> i64
Returns the flags of a texture.
Sourcepub fn texture_get_format(&self, texture: Rid) -> Format
pub fn texture_get_format(&self, texture: Rid) -> Format
Returns the format of the texture’s image.
Sourcepub fn texture_get_height(&self, texture: Rid) -> i64
pub fn texture_get_height(&self, texture: Rid) -> i64
Returns the texture’s height.
Sourcepub fn texture_get_path(&self, texture: Rid) -> GodotString
pub fn texture_get_path(&self, texture: Rid) -> GodotString
Returns the texture’s path.
Sourcepub fn texture_get_texid(&self, texture: Rid) -> i64
pub fn texture_get_texid(&self, texture: Rid) -> i64
Returns the opengl id of the texture’s image.
Sourcepub fn texture_get_type(&self, texture: Rid) -> TextureType
pub fn texture_get_type(&self, texture: Rid) -> TextureType
Returns the type of the texture, can be any of the [enum TextureType].
Sourcepub fn texture_get_width(&self, texture: Rid) -> i64
pub fn texture_get_width(&self, texture: Rid) -> i64
Returns the texture’s width.
Sourcepub fn texture_set_data(
&self,
texture: Rid,
image: impl AsArg<Image>,
layer: i64,
)
pub 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
Sourcepub 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 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
Sourcepub fn texture_set_flags(&self, texture: Rid, flags: i64)
pub fn texture_set_flags(&self, texture: Rid, flags: i64)
Sets the texture’s flags. See [enum TextureFlags] for options.
Sourcepub fn texture_set_path(&self, texture: Rid, path: impl Into<GodotString>)
pub fn texture_set_path(&self, texture: Rid, path: impl Into<GodotString>)
Sets the texture’s path.
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 fn texture_set_size_override(
&self,
texture: Rid,
width: i64,
height: i64,
depth: i64,
)
pub fn texture_set_size_override( &self, texture: Rid, width: i64, height: i64, depth: i64, )
Resizes the texture to the specified dimensions.
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 fn viewport_attach_camera(&self, viewport: Rid, camera: Rid)
pub fn viewport_attach_camera(&self, viewport: Rid, camera: Rid)
Sets a viewport’s camera.
Sourcepub fn viewport_attach_canvas(&self, viewport: Rid, canvas: Rid)
pub fn viewport_attach_canvas(&self, viewport: Rid, canvas: Rid)
Sets a viewport’s canvas.
Sourcepub fn viewport_attach_to_screen(&self, viewport: Rid, rect: Rect2, screen: i64)
pub 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 [member 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 a further optimization see, [method viewport_set_render_direct_to_screen].
§Default Arguments
rect
-Rect2( 0, 0, 0, 0 )
screen
-0
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 [method free_rid] static method.
Sourcepub fn viewport_detach(&self, viewport: Rid)
pub fn viewport_detach(&self, viewport: Rid)
Detaches the viewport from the screen.
Sourcepub fn viewport_get_render_info(&self, viewport: Rid, info: i64) -> i64
pub fn viewport_get_render_info(&self, viewport: Rid, info: i64) -> i64
Returns a viewport’s render information. For options, see the [enum ViewportRenderInfo] constants.
Sourcepub fn viewport_get_texture(&self, viewport: Rid) -> Rid
pub fn viewport_get_texture(&self, viewport: Rid) -> Rid
Returns the viewport’s last rendered frame.
Sourcepub fn viewport_remove_canvas(&self, viewport: Rid, canvas: Rid)
pub fn viewport_remove_canvas(&self, viewport: Rid, canvas: Rid)
Detaches a viewport from a canvas and vice versa.
Sourcepub fn viewport_set_active(&self, viewport: Rid, active: bool)
pub fn viewport_set_active(&self, viewport: Rid, active: bool)
If true
, sets the viewport active, else sets it inactive.
Sourcepub fn viewport_set_canvas_stacking(
&self,
viewport: Rid,
canvas: Rid,
layer: i64,
sublayer: i64,
)
pub 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.
Sourcepub fn viewport_set_canvas_transform(
&self,
viewport: Rid,
canvas: Rid,
offset: Transform2D,
)
pub fn viewport_set_canvas_transform( &self, viewport: Rid, canvas: Rid, offset: Transform2D, )
Sets the transformation of a viewport’s canvas.
Sourcepub fn viewport_set_clear_mode(&self, viewport: Rid, clear_mode: i64)
pub fn viewport_set_clear_mode(&self, viewport: Rid, clear_mode: i64)
Sets the clear mode of a viewport. See [enum ViewportClearMode] for options.
Sourcepub fn viewport_set_debug_draw(&self, viewport: Rid, draw: i64)
pub fn viewport_set_debug_draw(&self, viewport: Rid, draw: i64)
Sets the debug draw mode of a viewport. See [enum ViewportDebugDraw] for options.
Sourcepub fn viewport_set_disable_3d(&self, viewport: Rid, disabled: bool)
pub fn viewport_set_disable_3d(&self, viewport: Rid, disabled: bool)
If true
, a viewport’s 3D rendering is disabled.
Sourcepub fn viewport_set_disable_environment(&self, viewport: Rid, disabled: bool)
pub fn viewport_set_disable_environment(&self, viewport: Rid, disabled: bool)
If true
, rendering of a viewport’s environment is disabled.
Sourcepub fn viewport_set_global_canvas_transform(
&self,
viewport: Rid,
transform: Transform2D,
)
pub fn viewport_set_global_canvas_transform( &self, viewport: Rid, transform: Transform2D, )
Sets the viewport’s global transformation matrix.
Sourcepub fn viewport_set_hdr(&self, viewport: Rid, enabled: bool)
pub fn viewport_set_hdr(&self, viewport: Rid, enabled: bool)
If true
, the viewport renders to hdr.
Sourcepub fn viewport_set_hide_canvas(&self, viewport: Rid, hidden: bool)
pub fn viewport_set_hide_canvas(&self, viewport: Rid, hidden: bool)
If true
, the viewport’s canvas is not rendered.
Sourcepub fn viewport_set_hide_scenario(&self, viewport: Rid, hidden: bool)
pub fn viewport_set_hide_scenario(&self, viewport: Rid, hidden: bool)
Currently unimplemented in Godot 3.x.
Sourcepub fn viewport_set_msaa(&self, viewport: Rid, msaa: i64)
pub fn viewport_set_msaa(&self, viewport: Rid, msaa: i64)
Sets the anti-aliasing mode. See [enum ViewportMSAA] for options.
Sourcepub fn viewport_set_parent_viewport(&self, viewport: Rid, parent_viewport: Rid)
pub fn viewport_set_parent_viewport(&self, viewport: Rid, parent_viewport: Rid)
Sets the viewport’s parent to another viewport.
Sourcepub fn viewport_set_render_direct_to_screen(&self, viewport: Rid, enabled: bool)
pub 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.
Sourcepub fn viewport_set_scenario(&self, viewport: Rid, scenario: Rid)
pub fn viewport_set_scenario(&self, viewport: Rid, scenario: Rid)
Sets a viewport’s scenario. The scenario contains information about the [enum ScenarioDebugMode], environment information, reflection atlas etc.
Sourcepub fn viewport_set_shadow_atlas_quadrant_subdivision(
&self,
viewport: Rid,
quadrant: i64,
subdivision: i64,
)
pub fn viewport_set_shadow_atlas_quadrant_subdivision( &self, viewport: Rid, quadrant: i64, subdivision: i64, )
Sets the shadow atlas quadrant’s subdivision.
Sourcepub fn viewport_set_shadow_atlas_size(&self, viewport: Rid, size: i64)
pub 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.
Sourcepub fn viewport_set_size(&self, viewport: Rid, width: i64, height: i64)
pub fn viewport_set_size(&self, viewport: Rid, width: i64, height: i64)
Sets the viewport’s width and height.
Sourcepub fn viewport_set_transparent_background(&self, viewport: Rid, enabled: bool)
pub fn viewport_set_transparent_background(&self, viewport: Rid, enabled: bool)
If true
, the viewport renders its background as transparent.
Sourcepub fn viewport_set_update_mode(&self, viewport: Rid, update_mode: i64)
pub fn viewport_set_update_mode(&self, viewport: Rid, update_mode: i64)
Sets when the viewport should be updated. See [enum ViewportUpdateMode] constants for options.
Sourcepub fn viewport_set_usage(&self, viewport: Rid, usage: i64)
pub fn viewport_set_usage(&self, viewport: Rid, usage: i64)
Sets the viewport’s 2D/3D mode. See [enum ViewportUsage] constants for options.
Sourcepub fn viewport_set_use_arvr(&self, viewport: Rid, use_arvr: bool)
pub fn viewport_set_use_arvr(&self, viewport: Rid, use_arvr: bool)
If true
, the viewport uses augmented or virtual reality technologies. See ARVRInterface.
Sourcepub fn viewport_set_use_debanding(&self, viewport: Rid, debanding: bool)
pub fn viewport_set_use_debanding(&self, viewport: Rid, debanding: bool)
Sourcepub fn viewport_set_use_fxaa(&self, viewport: Rid, fxaa: bool)
pub fn viewport_set_use_fxaa(&self, viewport: Rid, fxaa: bool)
Sourcepub fn viewport_set_vflip(&self, viewport: Rid, enabled: bool)
pub fn viewport_set_vflip(&self, viewport: Rid, enabled: bool)
If true
, the viewport’s rendering is flipped vertically.
Methods from Deref<Target = Object>§
pub const CONNECT_DEFERRED: i64 = 1i64
pub const CONNECT_ONESHOT: i64 = 4i64
pub const CONNECT_PERSIST: i64 = 2i64
pub const CONNECT_REFERENCE_COUNTED: i64 = 8i64
pub const NOTIFICATION_POSTINITIALIZE: i64 = 0i64
pub const NOTIFICATION_PREDELETE: i64 = 1i64
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 [method call], this method does not support a variable number of arguments but expects all parameters to be via a single [Array].
callv("set", [ "position", Vector2(42.0, 0.0) ])
§Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
Sourcepub fn can_translate_messages(&self) -> bool
pub fn can_translate_messages(&self) -> bool
Returns true
if the object can translate strings. See [method set_message_translation] and [method 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 [method emit_signal]. Use flags
to set deferred or one-shot connections. See [enum ConnectFlags] constants.
A signal
can only be connected once to a method
. It will throw an error if already connected, unless the signal was connected with [constant CONNECT_REFERENCE_COUNTED]. To avoid this, first, use [method is_connected] to check for existing connections.
If the target
is destroyed in the game’s lifecycle, the connection will be lost.
Examples:
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal
An example of the relationship between binds
passed to [method connect] and parameters used when calling [method emit_signal]:
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
§Default Arguments
binds
-[ ]
flags
-0
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 throw an error. Use [method 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
Returns the object’s class as a String.
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"
.
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>) -> Variant
pub fn get_meta(&self, name: impl Into<GodotString>) -> Variant
Returns the object’s metadata entry for the given name
.
Sourcepub fn get_meta_list(&self) -> StringArray
pub fn get_meta_list(&self) -> StringArray
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 [enum PropertyHint]), hint_string: String
, and usage: int
(see [enum 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 [method 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
Returns true
if the object inherits from the given class
.
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 [method 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 [method _notification] method of all classes that the object inherits from.
If reversed
is true
, [method _notification] is called first on the object’s own class, and then up to its successive parent classes. If reversed
is false
, [method _notification] is called first on the highest ancestor (Object itself), and then down to its successive inheriting classes.
§Default Arguments
reversed
-false
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 [method 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, 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 [method set] via [method call_deferred], i.e. call_deferred("set", property, value)
.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
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 [method 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 [method remove_meta]. Metadata is also removed if its value is set to null
. This means you can also use set_meta("name", null)
to remove metadata for "name"
.
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 [method _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 [method 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
Source§type RefKind = ManuallyManaged
type RefKind = 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
.