2023-01-05 13:25:55 +01:00
/**************************************************************************/
/* rendering_server.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
2018-01-05 00:50:27 +01:00
2020-03-27 19:21:27 +01:00
# ifndef RENDERING_SERVER_H
# define RENDERING_SERVER_H
2014-02-10 02:10:30 +01:00
2020-11-07 23:33:38 +01:00
# include "core/io/image.h"
2020-05-25 19:20:45 +02:00
# include "core/math/geometry_3d.h"
2018-09-11 18:13:45 +02:00
# include "core/math/transform_2d.h"
2020-11-07 23:33:38 +01:00
# include "core/object/class_db.h"
2022-07-23 19:12:41 +02:00
# include "core/object/worker_thread_pool.h"
2020-11-07 23:33:38 +01:00
# include "core/templates/rid.h"
# include "core/variant/typed_array.h"
# include "core/variant/variant.h"
2020-03-04 02:51:12 +01:00
# include "servers/display_server.h"
2020-09-17 06:11:39 +02:00
# include "servers/rendering/rendering_device.h"
2014-02-10 02:10:30 +01:00
2022-08-05 20:35:08 +02:00
template < typename T >
class TypedArray ;
2020-03-27 19:21:27 +01:00
class RenderingServer : public Object {
GDCLASS ( RenderingServer , Object ) ;
2014-02-10 02:10:30 +01:00
2020-03-27 19:21:27 +01:00
static RenderingServer * singleton ;
2014-02-10 02:10:30 +01:00
2022-05-02 16:28:25 +02:00
int mm_policy = 0 ;
2020-06-14 19:06:48 +02:00
bool render_loop_enabled = true ;
2014-02-10 02:10:30 +01:00
2020-12-02 02:40:47 +01:00
Array _get_array_from_surface ( uint32_t p_format , Vector < uint8_t > p_vertex_data , Vector < uint8_t > p_attrib_data , Vector < uint8_t > p_skin_data , int p_vertex_len , Vector < uint8_t > p_index_data , int p_index_len ) const ;
2016-11-10 03:55:06 +01:00
2021-11-28 01:12:10 +01:00
const Vector2 SMALL_VEC2 = Vector2 ( CMP_EPSILON , CMP_EPSILON ) ;
const Vector3 SMALL_VEC3 = Vector3 ( CMP_EPSILON , CMP_EPSILON , CMP_EPSILON ) ;
2016-03-09 00:00:52 +01:00
protected :
2014-02-10 02:10:30 +01:00
RID _make_test_cube ( ) ;
2015-04-21 00:38:02 +02:00
void _free_internal_rids ( ) ;
2014-02-10 02:10:30 +01:00
RID test_texture ;
2014-05-29 15:56:39 +02:00
RID white_texture ;
2015-04-21 00:38:02 +02:00
RID test_material ;
2016-03-09 00:00:52 +01:00
2020-12-02 02:40:47 +01:00
Error _surface_set_data ( Array p_arrays , uint32_t p_format , uint32_t * p_offsets , uint32_t p_vertex_stride , uint32_t p_attrib_stride , uint32_t p_skin_stride , Vector < uint8_t > & r_vertex_array , Vector < uint8_t > & r_attrib_array , Vector < uint8_t > & r_skin_array , int p_vertex_array_len , Vector < uint8_t > & r_index_array , int p_index_array_len , AABB & r_aabb , Vector < AABB > & r_bone_aabb ) ;
2016-10-19 16:14:41 +02:00
2020-03-27 19:21:27 +01:00
static RenderingServer * ( * create_func ) ( ) ;
2016-03-09 00:00:52 +01:00
static void _bind_methods ( ) ;
2017-03-05 16:44:50 +01:00
public :
2020-03-27 19:21:27 +01:00
static RenderingServer * get_singleton ( ) ;
static RenderingServer * create ( ) ;
2014-02-10 02:10:30 +01:00
enum {
NO_INDEX_ARRAY = - 1 ,
ARRAY_WEIGHTS_SIZE = 4 ,
2015-01-13 14:49:26 +01:00
CANVAS_ITEM_Z_MIN = - 4096 ,
CANVAS_ITEM_Z_MAX = 4096 ,
2016-12-08 13:48:38 +01:00
MAX_GLOW_LEVELS = 7 ,
2014-02-10 02:10:30 +01:00
MAX_CURSORS = 8 ,
2021-07-13 01:32:05 +02:00
MAX_2D_DIRECTIONAL_LIGHTS = 8 ,
MAX_MESH_SURFACES = 256
2014-02-10 02:10:30 +01:00
} ;
2016-03-09 00:00:52 +01:00
2014-02-10 02:10:30 +01:00
/* TEXTURE API */
2019-06-11 20:43:37 +02:00
enum TextureLayeredType {
TEXTURE_LAYERED_2D_ARRAY ,
TEXTURE_LAYERED_CUBEMAP ,
TEXTURE_LAYERED_CUBEMAP_ARRAY ,
2016-03-09 00:00:52 +01:00
} ;
2019-06-11 20:43:37 +02:00
enum CubeMapLayer {
CUBEMAP_LAYER_LEFT ,
CUBEMAP_LAYER_RIGHT ,
CUBEMAP_LAYER_BOTTOM ,
CUBEMAP_LAYER_TOP ,
CUBEMAP_LAYER_FRONT ,
CUBEMAP_LAYER_BACK
2018-06-26 13:59:26 +02:00
} ;
2019-06-11 20:43:37 +02:00
virtual RID texture_2d_create ( const Ref < Image > & p_image ) = 0 ;
2020-03-17 07:33:00 +01:00
virtual RID texture_2d_layered_create ( const Vector < Ref < Image > > & p_layers , TextureLayeredType p_layered_type ) = 0 ;
2020-09-09 17:40:51 +02:00
virtual RID texture_3d_create ( Image : : Format , int p_width , int p_height , int p_depth , bool p_mipmaps , const Vector < Ref < Image > > & p_data ) = 0 ; //all slices, then all the mipmaps, must be coherent
2019-06-24 21:13:06 +02:00
virtual RID texture_proxy_create ( RID p_base ) = 0 ;
2016-03-09 00:00:52 +01:00
2019-06-11 20:43:37 +02:00
virtual void texture_2d_update ( RID p_texture , const Ref < Image > & p_image , int p_layer = 0 ) = 0 ;
2020-09-09 17:40:51 +02:00
virtual void texture_3d_update ( RID p_texture , const Vector < Ref < Image > > & p_data ) = 0 ;
2019-06-24 21:13:06 +02:00
virtual void texture_proxy_update ( RID p_texture , RID p_proxy_to ) = 0 ;
2019-06-11 20:43:37 +02:00
2021-11-28 01:12:10 +01:00
// These two APIs can be used together or in combination with the others.
2019-06-11 20:43:37 +02:00
virtual RID texture_2d_placeholder_create ( ) = 0 ;
2020-05-01 14:34:23 +02:00
virtual RID texture_2d_layered_placeholder_create ( TextureLayeredType p_layered_type ) = 0 ;
2019-06-11 20:43:37 +02:00
virtual RID texture_3d_placeholder_create ( ) = 0 ;
2014-02-10 02:10:30 +01:00
2019-06-11 20:43:37 +02:00
virtual Ref < Image > texture_2d_get ( RID p_texture ) const = 0 ;
virtual Ref < Image > texture_2d_layer_get ( RID p_texture , int p_layer ) const = 0 ;
2020-09-09 17:40:51 +02:00
virtual Vector < Ref < Image > > texture_3d_get ( RID p_texture ) const = 0 ;
2019-06-11 20:43:37 +02:00
virtual void texture_replace ( RID p_texture , RID p_by_texture ) = 0 ;
virtual void texture_set_size_override ( RID p_texture , int p_width , int p_height ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void texture_set_path ( RID p_texture , const String & p_path ) = 0 ;
virtual String texture_get_path ( RID p_texture ) const = 0 ;
2016-05-04 17:36:51 +02:00
typedef void ( * TextureDetectCallback ) ( void * ) ;
2017-02-06 04:38:39 +01:00
virtual void texture_set_detect_3d_callback ( RID p_texture , TextureDetectCallback p_callback , void * p_userdata ) = 0 ;
2017-06-17 02:47:28 +02:00
virtual void texture_set_detect_normal_callback ( RID p_texture , TextureDetectCallback p_callback , void * p_userdata ) = 0 ;
2017-02-06 04:38:39 +01:00
2019-06-11 20:43:37 +02:00
enum TextureDetectRoughnessChannel {
2021-01-02 06:27:12 +01:00
TEXTURE_DETECT_ROUGHNESS_R ,
TEXTURE_DETECT_ROUGHNESS_G ,
TEXTURE_DETECT_ROUGHNESS_B ,
TEXTURE_DETECT_ROUGHNESS_A ,
TEXTURE_DETECT_ROUGHNESS_GRAY ,
2019-06-11 20:43:37 +02:00
} ;
typedef void ( * TextureDetectRoughnessCallback ) ( void * , const String & , TextureDetectRoughnessChannel ) ;
virtual void texture_set_detect_roughness_callback ( RID p_texture , TextureDetectRoughnessCallback p_callback , void * p_userdata ) = 0 ;
2015-10-21 14:50:44 +02:00
struct TextureInfo {
RID texture ;
2018-06-26 13:59:26 +02:00
uint32_t width ;
uint32_t height ;
uint32_t depth ;
2015-10-21 14:50:44 +02:00
Image : : Format format ;
int bytes ;
String path ;
} ;
virtual void texture_debug_usage ( List < TextureInfo > * r_info ) = 0 ;
2017-10-20 00:24:49 +02:00
Array _texture_debug_usage_bind ( ) ;
2014-02-10 02:10:30 +01:00
2018-07-16 16:43:26 +02:00
virtual void texture_set_force_redraw_if_visible ( RID p_texture , bool p_enable ) = 0 ;
2017-12-04 19:55:20 +01:00
2022-11-01 18:50:36 +01:00
virtual RID texture_get_rd_texture_rid ( RID p_texture , bool p_srgb = false ) const = 0 ;
2014-02-10 02:10:30 +01:00
/* SHADER API */
enum ShaderMode {
2016-10-03 21:33:42 +02:00
SHADER_SPATIAL ,
2014-02-10 02:10:30 +01:00
SHADER_CANVAS_ITEM ,
2017-01-02 02:16:52 +01:00
SHADER_PARTICLES ,
2019-09-15 11:58:38 +02:00
SHADER_SKY ,
2021-10-03 13:28:55 +02:00
SHADER_FOG ,
2016-10-10 23:31:01 +02:00
SHADER_MAX
2014-02-10 02:10:30 +01:00
} ;
2017-04-07 04:36:37 +02:00
virtual RID shader_create ( ) = 0 ;
2014-02-10 02:10:30 +01:00
2014-12-21 15:42:44 +01:00
virtual void shader_set_code ( RID p_shader , const String & p_code ) = 0 ;
2022-06-29 11:31:18 +02:00
virtual void shader_set_path_hint ( RID p_shader , const String & p_path ) = 0 ;
2014-12-21 15:42:44 +01:00
virtual String shader_get_code ( RID p_shader ) const = 0 ;
2022-08-27 11:22:43 +02:00
virtual void get_shader_parameter_list ( RID p_shader , List < PropertyInfo > * p_param_list ) const = 0 ;
virtual Variant shader_get_parameter_default ( RID p_shader , const StringName & p_param ) const = 0 ;
2014-12-21 15:42:44 +01:00
2022-08-27 11:22:43 +02:00
virtual void shader_set_default_texture_parameter ( RID p_shader , const StringName & p_name , RID p_texture , int p_index = 0 ) = 0 ;
virtual RID shader_get_default_texture_parameter ( RID p_shader , const StringName & p_name , int p_index = 0 ) const = 0 ;
2014-02-10 02:10:30 +01:00
2021-01-06 00:01:50 +01:00
struct ShaderNativeSourceCode {
struct Version {
struct Stage {
String name ;
String code ;
} ;
Vector < Stage > stages ;
} ;
Vector < Version > versions ;
} ;
virtual ShaderNativeSourceCode shader_get_native_source_code ( RID p_shader ) const = 0 ;
2014-02-10 02:10:30 +01:00
/* COMMON MATERIAL API */
2017-09-01 17:56:52 +02:00
enum {
MATERIAL_RENDER_PRIORITY_MIN = - 128 ,
MATERIAL_RENDER_PRIORITY_MAX = 127 ,
} ;
2020-04-20 11:48:00 +02:00
2014-02-10 02:10:30 +01:00
virtual RID material_create ( ) = 0 ;
virtual void material_set_shader ( RID p_shader_material , RID p_shader ) = 0 ;
virtual void material_set_param ( RID p_material , const StringName & p_param , const Variant & p_value ) = 0 ;
virtual Variant material_get_param ( RID p_material , const StringName & p_param ) const = 0 ;
2017-09-01 17:56:52 +02:00
virtual void material_set_render_priority ( RID p_material , int priority ) = 0 ;
2017-07-08 17:34:05 +02:00
virtual void material_set_next_pass ( RID p_material , RID p_next_material ) = 0 ;
2014-02-10 02:10:30 +01:00
/* MESH API */
enum ArrayType {
2020-12-02 02:40:47 +01:00
ARRAY_VERTEX = 0 , // RG32F or RGB32F (depending on 2D bit)
2021-11-28 01:12:10 +01:00
ARRAY_NORMAL = 1 , // A2B10G10R10, A is ignored.
ARRAY_TANGENT = 2 , // A2B10G10R10, A flips sign of binormal.
2021-07-01 04:17:47 +02:00
ARRAY_COLOR = 3 , // RGBA8
2020-12-02 02:40:47 +01:00
ARRAY_TEX_UV = 4 , // RG32F
ARRAY_TEX_UV2 = 5 , // RG32F
2021-11-28 01:12:10 +01:00
ARRAY_CUSTOM0 = 6 , // Depends on ArrayCustomFormat.
2020-12-02 02:40:47 +01:00
ARRAY_CUSTOM1 = 7 ,
ARRAY_CUSTOM2 = 8 ,
ARRAY_CUSTOM3 = 9 ,
ARRAY_BONES = 10 , // RGBA16UI (x2 if 8 weights)
ARRAY_WEIGHTS = 11 , // RGBA16UNORM (x2 if 8 weights)
2021-11-28 01:12:10 +01:00
ARRAY_INDEX = 12 , // 16 or 32 bits depending on length > 0xFFFF.
2020-12-02 02:40:47 +01:00
ARRAY_MAX = 13
} ;
enum {
ARRAY_CUSTOM_COUNT = ARRAY_BONES - ARRAY_CUSTOM0
} ;
enum ArrayCustomFormat {
ARRAY_CUSTOM_RGBA8_UNORM ,
ARRAY_CUSTOM_RGBA8_SNORM ,
ARRAY_CUSTOM_RG_HALF ,
ARRAY_CUSTOM_RGBA_HALF ,
ARRAY_CUSTOM_R_FLOAT ,
ARRAY_CUSTOM_RG_FLOAT ,
ARRAY_CUSTOM_RGB_FLOAT ,
ARRAY_CUSTOM_RGBA_FLOAT ,
ARRAY_CUSTOM_MAX
2016-03-09 00:00:52 +01:00
} ;
2014-02-10 02:10:30 +01:00
enum ArrayFormat {
/* ARRAY FORMAT FLAGS */
2022-06-24 20:22:26 +02:00
ARRAY_FORMAT_VERTEX = 1 < < ARRAY_VERTEX ,
2014-02-10 02:10:30 +01:00
ARRAY_FORMAT_NORMAL = 1 < < ARRAY_NORMAL ,
ARRAY_FORMAT_TANGENT = 1 < < ARRAY_TANGENT ,
ARRAY_FORMAT_COLOR = 1 < < ARRAY_COLOR ,
ARRAY_FORMAT_TEX_UV = 1 < < ARRAY_TEX_UV ,
ARRAY_FORMAT_TEX_UV2 = 1 < < ARRAY_TEX_UV2 ,
2020-12-02 02:40:47 +01:00
ARRAY_FORMAT_CUSTOM0 = 1 < < ARRAY_CUSTOM0 ,
ARRAY_FORMAT_CUSTOM1 = 1 < < ARRAY_CUSTOM1 ,
ARRAY_FORMAT_CUSTOM2 = 1 < < ARRAY_CUSTOM2 ,
ARRAY_FORMAT_CUSTOM3 = 1 < < ARRAY_CUSTOM3 ,
2014-02-10 02:10:30 +01:00
ARRAY_FORMAT_BONES = 1 < < ARRAY_BONES ,
ARRAY_FORMAT_WEIGHTS = 1 < < ARRAY_WEIGHTS ,
ARRAY_FORMAT_INDEX = 1 < < ARRAY_INDEX ,
2017-03-05 16:44:50 +01:00
2022-02-08 13:38:19 +01:00
ARRAY_FORMAT_BLEND_SHAPE_MASK = ARRAY_FORMAT_VERTEX | ARRAY_FORMAT_NORMAL | ARRAY_FORMAT_TANGENT ,
2020-12-02 02:40:47 +01:00
ARRAY_FORMAT_CUSTOM_BASE = ( ARRAY_INDEX + 1 ) ,
ARRAY_FORMAT_CUSTOM_BITS = 3 ,
2022-06-24 20:22:26 +02:00
ARRAY_FORMAT_CUSTOM_MASK = 0x7 ,
2020-12-02 02:40:47 +01:00
ARRAY_FORMAT_CUSTOM0_SHIFT = ( ARRAY_FORMAT_CUSTOM_BASE + 0 ) ,
ARRAY_FORMAT_CUSTOM1_SHIFT = ( ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS ) ,
ARRAY_FORMAT_CUSTOM2_SHIFT = ( ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * 2 ) ,
ARRAY_FORMAT_CUSTOM3_SHIFT = ( ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * 3 ) ,
ARRAY_COMPRESS_FLAGS_BASE = ( ARRAY_INDEX + 1 + 12 ) ,
ARRAY_FLAG_USE_2D_VERTICES = 1 < < ( ARRAY_COMPRESS_FLAGS_BASE + 0 ) ,
ARRAY_FLAG_USE_DYNAMIC_UPDATE = 1 < < ( ARRAY_COMPRESS_FLAGS_BASE + 1 ) ,
ARRAY_FLAG_USE_8_BONE_WEIGHTS = 1 < < ( ARRAY_COMPRESS_FLAGS_BASE + 2 ) ,
2022-06-24 20:22:26 +02:00
ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = 1 < < ( ARRAY_INDEX + 1 + 15 ) ,
2016-03-09 00:00:52 +01:00
} ;
2014-02-10 02:10:30 +01:00
enum PrimitiveType {
2019-06-16 04:45:24 +02:00
PRIMITIVE_POINTS ,
PRIMITIVE_LINES ,
2019-08-19 00:40:52 +02:00
PRIMITIVE_LINE_STRIP ,
2019-06-16 04:45:24 +02:00
PRIMITIVE_TRIANGLES ,
2019-08-19 00:40:52 +02:00
PRIMITIVE_TRIANGLE_STRIP ,
2019-06-16 04:45:24 +02:00
PRIMITIVE_MAX ,
2016-03-09 00:00:52 +01:00
} ;
2014-02-10 02:10:30 +01:00
2019-08-19 00:40:52 +02:00
struct SurfaceData {
PrimitiveType primitive = PRIMITIVE_MAX ;
uint32_t format = 0 ;
2021-11-28 01:12:10 +01:00
Vector < uint8_t > vertex_data ; // Vertex, Normal, Tangent (change with skinning, blendshape).
Vector < uint8_t > attribute_data ; // Color, UV, UV2, Custom0-3.
Vector < uint8_t > skin_data ; // Bone index, Bone weight.
2019-08-19 00:40:52 +02:00
uint32_t vertex_count = 0 ;
2020-02-17 22:06:54 +01:00
Vector < uint8_t > index_data ;
2019-08-19 00:40:52 +02:00
uint32_t index_count = 0 ;
AABB aabb ;
struct LOD {
2021-09-07 17:44:50 +02:00
float edge_length = 0.0f ;
2020-02-17 22:06:54 +01:00
Vector < uint8_t > index_data ;
2019-08-19 00:40:52 +02:00
} ;
Vector < LOD > lods ;
Vector < AABB > bone_aabbs ;
2020-12-02 02:40:47 +01:00
Vector < uint8_t > blend_shape_data ;
2019-08-19 00:40:52 +02:00
RID material ;
} ;
2020-12-16 15:07:08 +01:00
virtual RID mesh_create_from_surfaces ( const Vector < SurfaceData > & p_surfaces , int p_blend_shape_count = 0 ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual RID mesh_create ( ) = 0 ;
2020-12-16 15:07:08 +01:00
virtual void mesh_set_blend_shape_count ( RID p_mesh , int p_blend_shape_count ) = 0 ;
2023-01-07 20:37:21 +01:00
virtual uint32_t mesh_surface_get_format_offset ( BitField < ArrayFormat > p_format , int p_vertex_len , int p_array_index ) const ;
virtual uint32_t mesh_surface_get_format_vertex_stride ( BitField < ArrayFormat > p_format , int p_vertex_len ) const ;
virtual uint32_t mesh_surface_get_format_attribute_stride ( BitField < ArrayFormat > p_format , int p_vertex_len ) const ;
virtual uint32_t mesh_surface_get_format_skin_stride ( BitField < ArrayFormat > p_format , int p_vertex_len ) const ;
2020-12-02 02:40:47 +01:00
2017-11-21 01:36:32 +01:00
/// Returns stride
2020-12-02 02:40:47 +01:00
virtual void mesh_surface_make_offsets_from_format ( uint32_t p_format , int p_vertex_len , int p_index_len , uint32_t * r_offsets , uint32_t & r_vertex_element_size , uint32_t & r_attrib_element_size , uint32_t & r_skin_element_size ) const ;
virtual Error mesh_create_surface_data_from_arrays ( SurfaceData * r_surface_data , PrimitiveType p_primitive , const Array & p_arrays , const Array & p_blend_shapes = Array ( ) , const Dictionary & p_lods = Dictionary ( ) , uint32_t p_compress_format = 0 ) ;
2019-08-19 00:40:52 +02:00
Array mesh_create_arrays_from_surface_data ( const SurfaceData & p_data ) const ;
Array mesh_surface_get_arrays ( RID p_mesh , int p_surface ) const ;
2022-08-05 20:35:08 +02:00
TypedArray < Array > mesh_surface_get_blend_shape_arrays ( RID p_mesh , int p_surface ) const ;
2019-08-19 00:40:52 +02:00
Dictionary mesh_surface_get_lods ( RID p_mesh , int p_surface ) const ;
2023-01-07 20:37:21 +01:00
virtual void mesh_add_surface_from_arrays ( RID p_mesh , PrimitiveType p_primitive , const Array & p_arrays , const Array & p_blend_shapes = Array ( ) , const Dictionary & p_lods = Dictionary ( ) , BitField < ArrayFormat > p_compress_format = 0 ) ;
2019-08-19 00:40:52 +02:00
virtual void mesh_add_surface ( RID p_mesh , const SurfaceData & p_surface ) = 0 ;
2014-02-10 02:10:30 +01:00
2017-01-12 12:34:00 +01:00
virtual int mesh_get_blend_shape_count ( RID p_mesh ) const = 0 ;
2014-02-10 02:10:30 +01:00
2017-01-12 12:34:00 +01:00
enum BlendShapeMode {
BLEND_SHAPE_MODE_NORMALIZED ,
BLEND_SHAPE_MODE_RELATIVE ,
2014-02-10 02:10:30 +01:00
} ;
2017-01-12 12:34:00 +01:00
virtual void mesh_set_blend_shape_mode ( RID p_mesh , BlendShapeMode p_mode ) = 0 ;
virtual BlendShapeMode mesh_get_blend_shape_mode ( RID p_mesh ) const = 0 ;
2014-02-10 02:10:30 +01:00
2021-06-30 03:55:11 +02:00
virtual void mesh_surface_update_vertex_region ( RID p_mesh , int p_surface , int p_offset , const Vector < uint8_t > & p_data ) = 0 ;
virtual void mesh_surface_update_attribute_region ( RID p_mesh , int p_surface , int p_offset , const Vector < uint8_t > & p_data ) = 0 ;
virtual void mesh_surface_update_skin_region ( RID p_mesh , int p_surface , int p_offset , const Vector < uint8_t > & p_data ) = 0 ;
2017-11-14 21:25:42 +01:00
2016-10-03 21:33:42 +02:00
virtual void mesh_surface_set_material ( RID p_mesh , int p_surface , RID p_material ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual RID mesh_surface_get_material ( RID p_mesh , int p_surface ) const = 0 ;
2019-08-19 00:40:52 +02:00
virtual SurfaceData mesh_get_surface ( RID p_mesh , int p_surface ) const = 0 ;
2016-10-03 21:33:42 +02:00
2014-02-10 02:10:30 +01:00
virtual int mesh_get_surface_count ( RID p_mesh ) const = 0 ;
2014-05-05 03:50:23 +02:00
2017-11-17 03:09:00 +01:00
virtual void mesh_set_custom_aabb ( RID p_mesh , const AABB & p_aabb ) = 0 ;
virtual AABB mesh_get_custom_aabb ( RID p_mesh ) const = 0 ;
2014-05-05 03:50:23 +02:00
2021-01-25 16:20:11 +01:00
virtual void mesh_set_shadow_mesh ( RID p_mesh , RID p_shadow_mesh ) = 0 ;
2015-09-20 18:03:46 +02:00
virtual void mesh_clear ( RID p_mesh ) = 0 ;
2014-02-10 02:10:30 +01:00
/* MULTIMESH API */
virtual RID multimesh_create ( ) = 0 ;
2016-10-03 21:33:42 +02:00
enum MultimeshTransformFormat {
MULTIMESH_TRANSFORM_2D ,
MULTIMESH_TRANSFORM_3D ,
} ;
2021-02-09 17:19:03 +01:00
virtual void multimesh_allocate_data ( RID p_multimesh , int p_instances , MultimeshTransformFormat p_transform_format , bool p_use_colors = false , bool p_use_custom_data = false ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual int multimesh_get_instance_count ( RID p_multimesh ) const = 0 ;
virtual void multimesh_set_mesh ( RID p_multimesh , RID p_mesh ) = 0 ;
2020-10-17 07:08:21 +02:00
virtual void multimesh_instance_set_transform ( RID p_multimesh , int p_index , const Transform3D & p_transform ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void multimesh_instance_set_transform_2d ( RID p_multimesh , int p_index , const Transform2D & p_transform ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void multimesh_instance_set_color ( RID p_multimesh , int p_index , const Color & p_color ) = 0 ;
2018-07-07 01:21:13 +02:00
virtual void multimesh_instance_set_custom_data ( RID p_multimesh , int p_index , const Color & p_color ) = 0 ;
2014-02-10 02:10:30 +01:00
2017-01-11 04:52:51 +01:00
virtual RID multimesh_get_mesh ( RID p_multimesh ) const = 0 ;
2017-11-17 03:09:00 +01:00
virtual AABB multimesh_get_aabb ( RID p_multimesh ) const = 0 ;
2014-02-10 02:10:30 +01:00
2020-10-17 07:08:21 +02:00
virtual Transform3D multimesh_instance_get_transform ( RID p_multimesh , int p_index ) const = 0 ;
2014-02-10 02:10:30 +01:00
virtual Transform2D multimesh_instance_get_transform_2d ( RID p_multimesh , int p_index ) const = 0 ;
virtual Color multimesh_instance_get_color ( RID p_multimesh , int p_index ) const = 0 ;
2018-07-07 01:21:13 +02:00
virtual Color multimesh_instance_get_custom_data ( RID p_multimesh , int p_index ) const = 0 ;
2020-02-17 22:06:54 +01:00
virtual void multimesh_set_buffer ( RID p_multimesh , const Vector < float > & p_buffer ) = 0 ;
virtual Vector < float > multimesh_get_buffer ( RID p_multimesh ) const = 0 ;
2014-02-10 02:10:30 +01:00
virtual void multimesh_set_visible_instances ( RID p_multimesh , int p_visible ) = 0 ;
virtual int multimesh_get_visible_instances ( RID p_multimesh ) const = 0 ;
2016-10-03 21:33:42 +02:00
/* SKELETON API */
2014-05-29 15:56:39 +02:00
2016-10-03 21:33:42 +02:00
virtual RID skeleton_create ( ) = 0 ;
2021-02-09 17:19:03 +01:00
virtual void skeleton_allocate_data ( RID p_skeleton , int p_bones , bool p_2d_skeleton = false ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual int skeleton_get_bone_count ( RID p_skeleton ) const = 0 ;
2020-10-17 07:08:21 +02:00
virtual void skeleton_bone_set_transform ( RID p_skeleton , int p_bone , const Transform3D & p_transform ) = 0 ;
virtual Transform3D skeleton_bone_get_transform ( RID p_skeleton , int p_bone ) const = 0 ;
2017-01-11 04:52:51 +01:00
virtual void skeleton_bone_set_transform_2d ( RID p_skeleton , int p_bone , const Transform2D & p_transform ) = 0 ;
virtual Transform2D skeleton_bone_get_transform_2d ( RID p_skeleton , int p_bone ) const = 0 ;
2018-05-03 22:29:15 +02:00
virtual void skeleton_set_base_transform_2d ( RID p_skeleton , const Transform2D & p_base_transform ) = 0 ;
2014-02-10 02:10:30 +01:00
/* Light API */
2016-03-09 00:00:52 +01:00
2014-02-10 02:10:30 +01:00
enum LightType {
LIGHT_DIRECTIONAL ,
LIGHT_OMNI ,
LIGHT_SPOT
} ;
enum LightParam {
LIGHT_PARAM_ENERGY ,
2017-11-20 01:45:42 +01:00
LIGHT_PARAM_INDIRECT_ENERGY ,
2021-07-09 10:28:33 +02:00
LIGHT_PARAM_VOLUMETRIC_FOG_ENERGY ,
2016-10-03 21:33:42 +02:00
LIGHT_PARAM_SPECULAR ,
LIGHT_PARAM_RANGE ,
2020-04-09 20:11:15 +02:00
LIGHT_PARAM_SIZE ,
2014-02-10 02:10:30 +01:00
LIGHT_PARAM_ATTENUATION ,
2016-10-03 21:33:42 +02:00
LIGHT_PARAM_SPOT_ANGLE ,
2016-10-27 16:50:26 +02:00
LIGHT_PARAM_SPOT_ATTENUATION ,
2016-10-03 21:33:42 +02:00
LIGHT_PARAM_SHADOW_MAX_DISTANCE ,
LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET ,
LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET ,
LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET ,
2019-09-07 19:38:17 +02:00
LIGHT_PARAM_SHADOW_FADE_START ,
2016-10-03 21:33:42 +02:00
LIGHT_PARAM_SHADOW_NORMAL_BIAS ,
2016-10-27 16:50:26 +02:00
LIGHT_PARAM_SHADOW_BIAS ,
2020-04-08 03:51:52 +02:00
LIGHT_PARAM_SHADOW_PANCAKE_SIZE ,
2022-06-10 12:47:06 +02:00
LIGHT_PARAM_SHADOW_OPACITY ,
2020-04-10 11:30:36 +02:00
LIGHT_PARAM_SHADOW_BLUR ,
2020-04-08 03:51:52 +02:00
LIGHT_PARAM_TRANSMITTANCE_BIAS ,
2022-08-01 01:20:24 +02:00
LIGHT_PARAM_INTENSITY ,
2014-02-10 02:10:30 +01:00
LIGHT_PARAM_MAX
} ;
2017-11-10 03:34:01 +01:00
virtual RID directional_light_create ( ) = 0 ;
virtual RID omni_light_create ( ) = 0 ;
virtual RID spot_light_create ( ) = 0 ;
2014-02-10 02:10:30 +01:00
2016-10-03 21:33:42 +02:00
virtual void light_set_color ( RID p_light , const Color & p_color ) = 0 ;
virtual void light_set_param ( RID p_light , LightParam p_param , float p_value ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void light_set_shadow ( RID p_light , bool p_enabled ) = 0 ;
virtual void light_set_projector ( RID p_light , RID p_texture ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void light_set_negative ( RID p_light , bool p_enable ) = 0 ;
virtual void light_set_cull_mask ( RID p_light , uint32_t p_mask ) = 0 ;
2022-02-24 22:55:14 +01:00
virtual void light_set_distance_fade ( RID p_light , bool p_enabled , float p_begin , float p_shadow , float p_length ) = 0 ;
2017-08-20 01:06:40 +02:00
virtual void light_set_reverse_cull_face_mode ( RID p_light , bool p_enabled ) = 0 ;
2020-06-25 15:33:28 +02:00
enum LightBakeMode {
LIGHT_BAKE_DISABLED ,
LIGHT_BAKE_STATIC ,
2021-11-26 17:47:37 +01:00
LIGHT_BAKE_DYNAMIC ,
2020-06-25 15:33:28 +02:00
} ;
virtual void light_set_bake_mode ( RID p_light , LightBakeMode p_bake_mode ) = 0 ;
virtual void light_set_max_sdfgi_cascade ( RID p_light , uint32_t p_cascade ) = 0 ;
2014-02-10 02:10:30 +01:00
2021-11-28 01:12:10 +01:00
// Omni light
2014-02-10 02:10:30 +01:00
enum LightOmniShadowMode {
LIGHT_OMNI_SHADOW_DUAL_PARABOLOID ,
2016-11-10 03:55:06 +01:00
LIGHT_OMNI_SHADOW_CUBE ,
2014-02-10 02:10:30 +01:00
} ;
virtual void light_omni_set_shadow_mode ( RID p_light , LightOmniShadowMode p_mode ) = 0 ;
2016-11-10 03:55:06 +01:00
2021-11-28 01:12:10 +01:00
// Directional light
2014-02-10 02:10:30 +01:00
enum LightDirectionalShadowMode {
LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL ,
2014-05-05 03:50:23 +02:00
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS ,
2020-07-01 14:18:13 +02:00
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS ,
2014-02-10 02:10:30 +01:00
} ;
2021-10-20 00:40:46 +02:00
enum LightDirectionalSkyMode {
LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_AND_SKY ,
LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_ONLY ,
LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY ,
} ;
2014-02-10 02:10:30 +01:00
virtual void light_directional_set_shadow_mode ( RID p_light , LightDirectionalShadowMode p_mode ) = 0 ;
2016-11-11 16:27:52 +01:00
virtual void light_directional_set_blend_splits ( RID p_light , bool p_enable ) = 0 ;
2021-10-20 00:40:46 +02:00
virtual void light_directional_set_sky_mode ( RID p_light , LightDirectionalSkyMode p_mode ) = 0 ;
2014-02-10 02:10:30 +01:00
2022-09-12 11:44:48 +02:00
// Shadow atlas
virtual RID shadow_atlas_create ( ) = 0 ;
virtual void shadow_atlas_set_size ( RID p_atlas , int p_size , bool p_use_16_bits = true ) = 0 ;
virtual void shadow_atlas_set_quadrant_subdivision ( RID p_atlas , int p_quadrant , int p_subdivision ) = 0 ;
2022-02-04 16:41:08 +01:00
virtual void directional_shadow_atlas_set_size ( int p_size , bool p_16_bits = true ) = 0 ;
2021-07-01 04:17:47 +02:00
enum ShadowQuality {
SHADOW_QUALITY_HARD ,
2021-10-19 16:52:57 +02:00
SHADOW_QUALITY_SOFT_VERY_LOW ,
2021-07-01 04:17:47 +02:00
SHADOW_QUALITY_SOFT_LOW ,
SHADOW_QUALITY_SOFT_MEDIUM ,
SHADOW_QUALITY_SOFT_HIGH ,
SHADOW_QUALITY_SOFT_ULTRA ,
SHADOW_QUALITY_MAX
} ;
2022-05-01 01:40:30 +02:00
virtual void positional_soft_shadow_filter_set_quality ( ShadowQuality p_quality ) = 0 ;
virtual void directional_soft_shadow_filter_set_quality ( ShadowQuality p_quality ) = 0 ;
2021-07-19 21:41:55 +02:00
enum LightProjectorFilter {
LIGHT_PROJECTOR_FILTER_NEAREST ,
LIGHT_PROJECTOR_FILTER_LINEAR ,
2021-08-12 00:44:24 +02:00
LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS ,
2021-07-19 21:41:55 +02:00
LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS ,
2021-08-12 00:44:24 +02:00
LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS_ANISOTROPIC ,
2021-07-19 21:41:55 +02:00
LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS_ANISOTROPIC ,
} ;
virtual void light_projectors_set_filter ( LightProjectorFilter p_filter ) = 0 ;
2016-10-03 21:33:42 +02:00
/* PROBE API */
2014-02-10 02:10:30 +01:00
2016-10-03 21:33:42 +02:00
virtual RID reflection_probe_create ( ) = 0 ;
2014-02-10 02:10:30 +01:00
2016-11-19 17:23:37 +01:00
enum ReflectionProbeUpdateMode {
REFLECTION_PROBE_UPDATE_ONCE ,
REFLECTION_PROBE_UPDATE_ALWAYS ,
2014-02-10 02:10:30 +01:00
} ;
2016-11-19 17:23:37 +01:00
virtual void reflection_probe_set_update_mode ( RID p_probe , ReflectionProbeUpdateMode p_mode ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void reflection_probe_set_intensity ( RID p_probe , float p_intensity ) = 0 ;
2020-06-25 15:33:28 +02:00
enum ReflectionProbeAmbientMode {
REFLECTION_PROBE_AMBIENT_DISABLED ,
REFLECTION_PROBE_AMBIENT_ENVIRONMENT ,
2020-07-01 14:18:13 +02:00
REFLECTION_PROBE_AMBIENT_COLOR ,
2020-06-25 15:33:28 +02:00
} ;
virtual void reflection_probe_set_ambient_mode ( RID p_probe , ReflectionProbeAmbientMode p_mode ) = 0 ;
virtual void reflection_probe_set_ambient_color ( RID p_probe , const Color & p_color ) = 0 ;
virtual void reflection_probe_set_ambient_energy ( RID p_probe , float p_energy ) = 0 ;
2016-11-19 17:23:37 +01:00
virtual void reflection_probe_set_max_distance ( RID p_probe , float p_distance ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void reflection_probe_set_extents ( RID p_probe , const Vector3 & p_extents ) = 0 ;
virtual void reflection_probe_set_origin_offset ( RID p_probe , const Vector3 & p_offset ) = 0 ;
2016-11-19 17:23:37 +01:00
virtual void reflection_probe_set_as_interior ( RID p_probe , bool p_enable ) = 0 ;
virtual void reflection_probe_set_enable_box_projection ( RID p_probe , bool p_enable ) = 0 ;
virtual void reflection_probe_set_enable_shadows ( RID p_probe , bool p_enable ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void reflection_probe_set_cull_mask ( RID p_probe , uint32_t p_layers ) = 0 ;
2018-09-28 21:40:20 +02:00
virtual void reflection_probe_set_resolution ( RID p_probe , int p_resolution ) = 0 ;
2021-12-29 00:10:41 +01:00
virtual void reflection_probe_set_mesh_lod_threshold ( RID p_probe , float p_pixels ) = 0 ;
2016-03-09 00:00:52 +01:00
2020-04-14 05:05:21 +02:00
/* DECAL API */
enum DecalTexture {
DECAL_TEXTURE_ALBEDO ,
DECAL_TEXTURE_NORMAL ,
DECAL_TEXTURE_ORM ,
DECAL_TEXTURE_EMISSION ,
DECAL_TEXTURE_MAX
} ;
virtual RID decal_create ( ) = 0 ;
virtual void decal_set_extents ( RID p_decal , const Vector3 & p_extents ) = 0 ;
virtual void decal_set_texture ( RID p_decal , DecalTexture p_type , RID p_texture ) = 0 ;
virtual void decal_set_emission_energy ( RID p_decal , float p_energy ) = 0 ;
virtual void decal_set_albedo_mix ( RID p_decal , float p_mix ) = 0 ;
virtual void decal_set_modulate ( RID p_decal , const Color & p_modulate ) = 0 ;
virtual void decal_set_cull_mask ( RID p_decal , uint32_t p_layers ) = 0 ;
virtual void decal_set_distance_fade ( RID p_decal , bool p_enabled , float p_begin , float p_length ) = 0 ;
virtual void decal_set_fade ( RID p_decal , float p_above , float p_below ) = 0 ;
virtual void decal_set_normal_fade ( RID p_decal , float p_fade ) = 0 ;
2021-07-19 21:41:55 +02:00
enum DecalFilter {
DECAL_FILTER_NEAREST ,
DECAL_FILTER_LINEAR ,
2021-08-12 00:44:24 +02:00
DECAL_FILTER_NEAREST_MIPMAPS ,
2021-07-19 21:41:55 +02:00
DECAL_FILTER_LINEAR_MIPMAPS ,
2021-08-12 00:44:24 +02:00
DECAL_FILTER_NEAREST_MIPMAPS_ANISOTROPIC ,
2021-07-19 21:41:55 +02:00
DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC ,
} ;
virtual void decals_set_filter ( DecalFilter p_quality ) = 0 ;
2021-06-05 00:47:26 +02:00
/* VOXEL GI API */
2014-05-29 15:56:39 +02:00
2021-06-05 00:47:26 +02:00
virtual RID voxel_gi_create ( ) = 0 ;
2014-06-11 15:41:03 +02:00
2021-06-05 00:47:26 +02:00
virtual void voxel_gi_allocate_data ( RID p_voxel_gi , const Transform3D & p_to_cell_xform , const AABB & p_aabb , const Vector3i & p_octree_size , const Vector < uint8_t > & p_octree_cells , const Vector < uint8_t > & p_data_cells , const Vector < uint8_t > & p_distance_field , const Vector < int > & p_level_counts ) = 0 ;
2014-06-11 15:41:03 +02:00
2021-06-05 00:47:26 +02:00
virtual AABB voxel_gi_get_bounds ( RID p_voxel_gi ) const = 0 ;
virtual Vector3i voxel_gi_get_octree_size ( RID p_voxel_gi ) const = 0 ;
virtual Vector < uint8_t > voxel_gi_get_octree_cells ( RID p_voxel_gi ) const = 0 ;
virtual Vector < uint8_t > voxel_gi_get_data_cells ( RID p_voxel_gi ) const = 0 ;
virtual Vector < uint8_t > voxel_gi_get_distance_field ( RID p_voxel_gi ) const = 0 ;
virtual Vector < int > voxel_gi_get_level_counts ( RID p_voxel_gi ) const = 0 ;
virtual Transform3D voxel_gi_get_to_cell_xform ( RID p_voxel_gi ) const = 0 ;
2014-06-11 15:41:03 +02:00
2021-06-05 00:47:26 +02:00
virtual void voxel_gi_set_dynamic_range ( RID p_voxel_gi , float p_range ) = 0 ;
virtual void voxel_gi_set_propagation ( RID p_voxel_gi , float p_range ) = 0 ;
virtual void voxel_gi_set_energy ( RID p_voxel_gi , float p_energy ) = 0 ;
2022-08-01 01:20:24 +02:00
virtual void voxel_gi_set_baked_exposure_normalization ( RID p_voxel_gi , float p_baked_exposure ) = 0 ;
2021-06-05 00:47:26 +02:00
virtual void voxel_gi_set_bias ( RID p_voxel_gi , float p_bias ) = 0 ;
virtual void voxel_gi_set_normal_bias ( RID p_voxel_gi , float p_range ) = 0 ;
virtual void voxel_gi_set_interior ( RID p_voxel_gi , bool p_enable ) = 0 ;
virtual void voxel_gi_set_use_two_bounces ( RID p_voxel_gi , bool p_enable ) = 0 ;
2016-01-31 13:56:53 +01:00
2021-06-05 00:47:26 +02:00
enum VoxelGIQuality {
VOXEL_GI_QUALITY_LOW ,
VOXEL_GI_QUALITY_HIGH ,
2020-06-25 15:33:28 +02:00
} ;
2021-06-05 00:47:26 +02:00
virtual void voxel_gi_set_quality ( VoxelGIQuality ) = 0 ;
2020-06-25 15:33:28 +02:00
2020-05-01 14:34:23 +02:00
/* LIGHTMAP */
2017-12-14 12:59:46 +01:00
2020-05-01 14:34:23 +02:00
virtual RID lightmap_create ( ) = 0 ;
virtual void lightmap_set_textures ( RID p_lightmap , RID p_light , bool p_uses_spherical_haromics ) = 0 ;
virtual void lightmap_set_probe_bounds ( RID p_lightmap , const AABB & p_bounds ) = 0 ;
virtual void lightmap_set_probe_interior ( RID p_lightmap , bool p_interior ) = 0 ;
virtual void lightmap_set_probe_capture_data ( RID p_lightmap , const PackedVector3Array & p_points , const PackedColorArray & p_point_sh , const PackedInt32Array & p_tetrahedra , const PackedInt32Array & p_bsp_tree ) = 0 ;
2022-08-01 01:20:24 +02:00
virtual void lightmap_set_baked_exposure_normalization ( RID p_lightmap , float p_exposure ) = 0 ;
2020-05-01 14:34:23 +02:00
virtual PackedVector3Array lightmap_get_probe_capture_points ( RID p_lightmap ) const = 0 ;
virtual PackedColorArray lightmap_get_probe_capture_sh ( RID p_lightmap ) const = 0 ;
virtual PackedInt32Array lightmap_get_probe_capture_tetrahedra ( RID p_lightmap ) const = 0 ;
virtual PackedInt32Array lightmap_get_probe_capture_bsp_tree ( RID p_lightmap ) const = 0 ;
virtual void lightmap_set_probe_capture_update_speed ( float p_speed ) = 0 ;
2017-12-14 12:59:46 +01:00
2016-12-30 12:35:54 +01:00
/* PARTICLES API */
virtual RID particles_create ( ) = 0 ;
2021-05-10 18:12:44 +02:00
enum ParticlesMode {
PARTICLES_MODE_2D ,
PARTICLES_MODE_3D
} ;
virtual void particles_set_mode ( RID p_particles , ParticlesMode p_mode ) = 0 ;
2020-09-06 14:18:10 +02:00
virtual void particles_set_emitting ( RID p_particles , bool p_enable ) = 0 ;
2017-12-23 05:08:50 +01:00
virtual bool particles_get_emitting ( RID p_particles ) = 0 ;
2016-12-30 12:35:54 +01:00
virtual void particles_set_amount ( RID p_particles , int p_amount ) = 0 ;
2021-02-02 03:16:37 +01:00
virtual void particles_set_lifetime ( RID p_particles , double p_lifetime ) = 0 ;
2017-06-25 13:01:15 +02:00
virtual void particles_set_one_shot ( RID p_particles , bool p_one_shot ) = 0 ;
2021-02-02 03:16:37 +01:00
virtual void particles_set_pre_process_time ( RID p_particles , double p_time ) = 0 ;
2016-12-30 12:35:54 +01:00
virtual void particles_set_explosiveness_ratio ( RID p_particles , float p_ratio ) = 0 ;
virtual void particles_set_randomness_ratio ( RID p_particles , float p_ratio ) = 0 ;
2017-11-17 03:09:00 +01:00
virtual void particles_set_custom_aabb ( RID p_particles , const AABB & p_aabb ) = 0 ;
2021-02-02 03:16:37 +01:00
virtual void particles_set_speed_scale ( RID p_particles , double p_scale ) = 0 ;
2016-12-30 12:35:54 +01:00
virtual void particles_set_use_local_coordinates ( RID p_particles , bool p_enable ) = 0 ;
virtual void particles_set_process_material ( RID p_particles , RID p_material ) = 0 ;
2017-04-07 04:36:37 +02:00
virtual void particles_set_fixed_fps ( RID p_particles , int p_fps ) = 0 ;
2021-04-27 17:43:49 +02:00
virtual void particles_set_interpolate ( RID p_particles , bool p_enable ) = 0 ;
2017-04-07 04:36:37 +02:00
virtual void particles_set_fractional_delta ( RID p_particles , bool p_enable ) = 0 ;
2020-10-08 02:29:49 +02:00
virtual void particles_set_collision_base_size ( RID p_particles , float p_size ) = 0 ;
2021-04-27 17:43:49 +02:00
enum ParticlesTransformAlign {
PARTICLES_TRANSFORM_ALIGN_DISABLED ,
PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD ,
PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY ,
PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY ,
} ;
virtual void particles_set_transform_align ( RID p_particles , ParticlesTransformAlign p_transform_align ) = 0 ;
virtual void particles_set_trails ( RID p_particles , bool p_enable , float p_length_sec ) = 0 ;
2020-10-17 07:08:21 +02:00
virtual void particles_set_trail_bind_poses ( RID p_particles , const Vector < Transform3D > & p_bind_poses ) = 0 ;
2021-04-27 17:43:49 +02:00
2019-11-09 09:51:17 +01:00
virtual bool particles_is_inactive ( RID p_particles ) = 0 ;
virtual void particles_request_process ( RID p_particles ) = 0 ;
2017-06-25 13:01:15 +02:00
virtual void particles_restart ( RID p_particles ) = 0 ;
2016-01-31 13:56:53 +01:00
2020-09-06 14:18:10 +02:00
virtual void particles_set_subemitter ( RID p_particles , RID p_subemitter_particles ) = 0 ;
enum ParticlesEmitFlags {
PARTICLES_EMIT_FLAG_POSITION = 1 ,
PARTICLES_EMIT_FLAG_ROTATION_SCALE = 2 ,
PARTICLES_EMIT_FLAG_VELOCITY = 4 ,
PARTICLES_EMIT_FLAG_COLOR = 8 ,
PARTICLES_EMIT_FLAG_CUSTOM = 16
} ;
2020-10-17 07:08:21 +02:00
virtual void particles_emit ( RID p_particles , const Transform3D & p_transform , const Vector3 & p_velocity , const Color & p_color , const Color & p_custom , uint32_t p_emit_flags ) = 0 ;
2020-09-06 14:18:10 +02:00
2016-12-30 12:35:54 +01:00
enum ParticlesDrawOrder {
PARTICLES_DRAW_ORDER_INDEX ,
PARTICLES_DRAW_ORDER_LIFETIME ,
2021-05-20 16:25:06 +02:00
PARTICLES_DRAW_ORDER_REVERSE_LIFETIME ,
2016-12-30 12:35:54 +01:00
PARTICLES_DRAW_ORDER_VIEW_DEPTH ,
} ;
2014-10-28 02:54:32 +01:00
2016-12-30 12:35:54 +01:00
virtual void particles_set_draw_order ( RID p_particles , ParticlesDrawOrder p_order ) = 0 ;
2014-10-28 02:54:32 +01:00
2016-12-30 12:35:54 +01:00
virtual void particles_set_draw_passes ( RID p_particles , int p_count ) = 0 ;
virtual void particles_set_draw_pass_mesh ( RID p_particles , int p_pass , RID p_mesh ) = 0 ;
2014-10-28 02:54:32 +01:00
2017-11-17 03:09:00 +01:00
virtual AABB particles_get_current_aabb ( RID p_particles ) = 0 ;
2014-05-29 15:56:39 +02:00
2021-11-28 01:12:10 +01:00
virtual void particles_set_emission_transform ( RID p_particles , const Transform3D & p_transform ) = 0 ; // This is only used for 2D, in 3D it's automatic.
2017-06-21 21:25:45 +02:00
2020-10-08 02:29:49 +02:00
/* PARTICLES COLLISION API */
virtual RID particles_collision_create ( ) = 0 ;
enum ParticlesCollisionType {
PARTICLES_COLLISION_TYPE_SPHERE_ATTRACT ,
PARTICLES_COLLISION_TYPE_BOX_ATTRACT ,
PARTICLES_COLLISION_TYPE_VECTOR_FIELD_ATTRACT ,
PARTICLES_COLLISION_TYPE_SPHERE_COLLIDE ,
PARTICLES_COLLISION_TYPE_BOX_COLLIDE ,
PARTICLES_COLLISION_TYPE_SDF_COLLIDE ,
PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE ,
} ;
virtual void particles_collision_set_collision_type ( RID p_particles_collision , ParticlesCollisionType p_type ) = 0 ;
virtual void particles_collision_set_cull_mask ( RID p_particles_collision , uint32_t p_cull_mask ) = 0 ;
2021-11-28 01:12:10 +01:00
virtual void particles_collision_set_sphere_radius ( RID p_particles_collision , real_t p_radius ) = 0 ; // For spheres.
virtual void particles_collision_set_box_extents ( RID p_particles_collision , const Vector3 & p_extents ) = 0 ; // For non-spheres.
2021-08-12 16:07:47 +02:00
virtual void particles_collision_set_attractor_strength ( RID p_particles_collision , real_t p_strength ) = 0 ;
virtual void particles_collision_set_attractor_directionality ( RID p_particles_collision , real_t p_directionality ) = 0 ;
virtual void particles_collision_set_attractor_attenuation ( RID p_particles_collision , real_t p_curve ) = 0 ;
2021-11-28 01:12:10 +01:00
virtual void particles_collision_set_field_texture ( RID p_particles_collision , RID p_texture ) = 0 ; // For SDF and vector field, heightfield is dynamic.
2020-10-08 02:29:49 +02:00
2021-11-28 01:12:10 +01:00
virtual void particles_collision_height_field_update ( RID p_particles_collision ) = 0 ; // For SDF and vector field.
2020-10-08 02:29:49 +02:00
2021-11-28 01:12:10 +01:00
enum ParticlesCollisionHeightfieldResolution { // Longest axis resolution.
2020-10-08 02:29:49 +02:00
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_256 ,
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_512 ,
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_1024 ,
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_2048 ,
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_4096 ,
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_8192 ,
PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX ,
} ;
2021-11-28 01:12:10 +01:00
virtual void particles_collision_set_height_field_resolution ( RID p_particles_collision , ParticlesCollisionHeightfieldResolution p_resolution ) = 0 ; // For SDF and vector field.
2020-10-08 02:29:49 +02:00
2021-10-03 13:28:55 +02:00
/* FOG VOLUME API */
virtual RID fog_volume_create ( ) = 0 ;
enum FogVolumeShape {
FOG_VOLUME_SHAPE_ELLIPSOID ,
2022-05-21 12:17:49 +02:00
FOG_VOLUME_SHAPE_CONE ,
FOG_VOLUME_SHAPE_CYLINDER ,
2021-10-03 13:28:55 +02:00
FOG_VOLUME_SHAPE_BOX ,
FOG_VOLUME_SHAPE_WORLD ,
2022-05-21 12:17:49 +02:00
FOG_VOLUME_SHAPE_MAX ,
2021-10-03 13:28:55 +02:00
} ;
virtual void fog_volume_set_shape ( RID p_fog_volume , FogVolumeShape p_shape ) = 0 ;
virtual void fog_volume_set_extents ( RID p_fog_volume , const Vector3 & p_extents ) = 0 ;
virtual void fog_volume_set_material ( RID p_fog_volume , RID p_material ) = 0 ;
2021-06-16 20:43:02 +02:00
/* VISIBILITY NOTIFIER API */
virtual RID visibility_notifier_create ( ) = 0 ;
virtual void visibility_notifier_set_aabb ( RID p_notifier , const AABB & p_aabb ) = 0 ;
virtual void visibility_notifier_set_callbacks ( RID p_notifier , const Callable & p_enter_callbable , const Callable & p_exit_callable ) = 0 ;
/* OCCLUDER API */
virtual RID occluder_create ( ) = 0 ;
virtual void occluder_set_mesh ( RID p_occluder , const PackedVector3Array & p_vertices , const PackedInt32Array & p_indices ) = 0 ;
2014-02-10 02:10:30 +01:00
/* CAMERA API */
2016-03-09 00:00:52 +01:00
2014-02-10 02:10:30 +01:00
virtual RID camera_create ( ) = 0 ;
virtual void camera_set_perspective ( RID p_camera , float p_fovy_degrees , float p_z_near , float p_z_far ) = 0 ;
virtual void camera_set_orthogonal ( RID p_camera , float p_size , float p_z_near , float p_z_far ) = 0 ;
2019-02-19 17:17:02 +01:00
virtual void camera_set_frustum ( RID p_camera , float p_size , Vector2 p_offset , float p_z_near , float p_z_far ) = 0 ;
2020-10-17 07:08:21 +02:00
virtual void camera_set_transform ( RID p_camera , const Transform3D & p_transform ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void camera_set_cull_mask ( RID p_camera , uint32_t p_layers ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void camera_set_environment ( RID p_camera , RID p_env ) = 0 ;
2022-08-01 01:20:24 +02:00
virtual void camera_set_camera_attributes ( RID p_camera , RID p_camera_attributes ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void camera_set_use_vertical_aspect ( RID p_camera , bool p_enable ) = 0 ;
2021-07-01 04:17:47 +02:00
/* VIEWPORT API */
2014-02-10 02:10:30 +01:00
2020-10-24 17:15:43 +02:00
enum CanvasItemTextureFilter {
2021-11-28 01:12:10 +01:00
CANVAS_ITEM_TEXTURE_FILTER_DEFAULT , // Uses canvas item setting for draw command, uses global setting for canvas item.
2020-10-24 17:15:43 +02:00
CANVAS_ITEM_TEXTURE_FILTER_NEAREST ,
CANVAS_ITEM_TEXTURE_FILTER_LINEAR ,
CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS ,
CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS ,
CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC ,
CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC ,
CANVAS_ITEM_TEXTURE_FILTER_MAX
} ;
enum CanvasItemTextureRepeat {
2021-11-28 01:12:10 +01:00
CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT , // Uses canvas item setting for draw command, uses global setting for canvas item.
2020-10-24 17:15:43 +02:00
CANVAS_ITEM_TEXTURE_REPEAT_DISABLED ,
CANVAS_ITEM_TEXTURE_REPEAT_ENABLED ,
CANVAS_ITEM_TEXTURE_REPEAT_MIRROR ,
CANVAS_ITEM_TEXTURE_REPEAT_MAX ,
} ;
2014-02-10 02:10:30 +01:00
virtual RID viewport_create ( ) = 0 ;
2021-11-23 22:16:03 +01:00
enum ViewportScaling3DMode {
VIEWPORT_SCALING_3D_MODE_BILINEAR ,
VIEWPORT_SCALING_3D_MODE_FSR ,
VIEWPORT_SCALING_3D_MODE_MAX
} ;
2020-04-08 16:47:36 +02:00
virtual void viewport_set_use_xr ( RID p_viewport , bool p_use_xr ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void viewport_set_size ( RID p_viewport , int p_width , int p_height ) = 0 ;
virtual void viewport_set_active ( RID p_viewport , bool p_active ) = 0 ;
2016-10-05 06:26:35 +02:00
virtual void viewport_set_parent_viewport ( RID p_viewport , RID p_parent_viewport ) = 0 ;
2021-09-02 20:07:04 +02:00
virtual void viewport_set_canvas_cull_mask ( RID p_viewport , uint32_t p_canvas_cull_mask ) = 0 ;
2016-10-03 21:33:42 +02:00
2020-03-04 02:51:12 +01:00
virtual void viewport_attach_to_screen ( RID p_viewport , const Rect2 & p_rect = Rect2 ( ) , DisplayServer : : WindowID p_screen = DisplayServer : : MAIN_WINDOW_ID ) = 0 ;
2019-05-08 20:25:34 +02:00
virtual void viewport_set_render_direct_to_screen ( RID p_viewport , bool p_enable ) = 0 ;
2014-02-10 02:10:30 +01:00
2021-11-23 22:16:03 +01:00
virtual void viewport_set_scaling_3d_mode ( RID p_viewport , ViewportScaling3DMode p_scaling_3d_mode ) = 0 ;
virtual void viewport_set_scaling_3d_scale ( RID p_viewport , float p_scaling_3d_scale ) = 0 ;
virtual void viewport_set_fsr_sharpness ( RID p_viewport , float p_fsr_sharpness ) = 0 ;
2022-06-12 01:49:59 +02:00
virtual void viewport_set_texture_mipmap_bias ( RID p_viewport , float p_texture_mipmap_bias ) = 0 ;
2021-11-23 22:16:03 +01:00
2016-10-03 21:33:42 +02:00
enum ViewportUpdateMode {
VIEWPORT_UPDATE_DISABLED ,
2021-11-28 01:12:10 +01:00
VIEWPORT_UPDATE_ONCE , // Then goes to disabled, must be manually updated.
VIEWPORT_UPDATE_WHEN_VISIBLE , // Default
2020-03-14 17:06:39 +01:00
VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE ,
2016-10-03 21:33:42 +02:00
VIEWPORT_UPDATE_ALWAYS
2014-02-10 02:10:30 +01:00
} ;
2016-10-03 21:33:42 +02:00
virtual void viewport_set_update_mode ( RID p_viewport , ViewportUpdateMode p_mode ) = 0 ;
2014-04-15 03:43:44 +02:00
2016-10-03 21:33:42 +02:00
enum ViewportClearMode {
VIEWPORT_CLEAR_ALWAYS ,
2016-10-05 06:26:35 +02:00
VIEWPORT_CLEAR_NEVER ,
2016-10-03 21:33:42 +02:00
VIEWPORT_CLEAR_ONLY_NEXT_FRAME
2014-02-10 02:10:30 +01:00
} ;
2016-03-09 00:00:52 +01:00
2016-10-03 21:33:42 +02:00
virtual void viewport_set_clear_mode ( RID p_viewport , ViewportClearMode p_clear_mode ) = 0 ;
virtual RID viewport_get_texture ( RID p_viewport ) const = 0 ;
2016-03-09 00:00:52 +01:00
2015-03-16 04:47:37 +01:00
virtual void viewport_set_disable_environment ( RID p_viewport , bool p_disable ) = 0 ;
2021-06-29 18:36:32 +02:00
virtual void viewport_set_disable_3d ( RID p_viewport , bool p_disable ) = 0 ;
2021-07-01 04:17:47 +02:00
virtual void viewport_set_disable_2d ( RID p_viewport , bool p_disable ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void viewport_attach_camera ( RID p_viewport , RID p_camera ) = 0 ;
virtual void viewport_set_scenario ( RID p_viewport , RID p_scenario ) = 0 ;
virtual void viewport_attach_canvas ( RID p_viewport , RID p_canvas ) = 0 ;
virtual void viewport_remove_canvas ( RID p_viewport , RID p_canvas ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void viewport_set_canvas_transform ( RID p_viewport , RID p_canvas , const Transform2D & p_offset ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void viewport_set_transparent_background ( RID p_viewport , bool p_enabled ) = 0 ;
2020-10-29 22:09:16 +01:00
virtual void viewport_set_snap_2d_transforms_to_pixel ( RID p_viewport , bool p_enabled ) = 0 ;
virtual void viewport_set_snap_2d_vertices_to_pixel ( RID p_viewport , bool p_enabled ) = 0 ;
2014-02-10 02:10:30 +01:00
2020-10-24 17:15:43 +02:00
virtual void viewport_set_default_canvas_item_texture_filter ( RID p_viewport , CanvasItemTextureFilter p_filter ) = 0 ;
virtual void viewport_set_default_canvas_item_texture_repeat ( RID p_viewport , CanvasItemTextureRepeat p_repeat ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void viewport_set_global_canvas_transform ( RID p_viewport , const Transform2D & p_transform ) = 0 ;
2018-10-30 21:53:00 +01:00
virtual void viewport_set_canvas_stacking ( RID p_viewport , RID p_canvas , int p_layer , int p_sublayer ) = 0 ;
2014-02-10 02:10:30 +01:00
2020-11-26 13:50:21 +01:00
enum ViewportSDFOversize {
VIEWPORT_SDF_OVERSIZE_100_PERCENT ,
VIEWPORT_SDF_OVERSIZE_120_PERCENT ,
VIEWPORT_SDF_OVERSIZE_150_PERCENT ,
VIEWPORT_SDF_OVERSIZE_200_PERCENT ,
VIEWPORT_SDF_OVERSIZE_MAX
} ;
enum ViewportSDFScale {
VIEWPORT_SDF_SCALE_100_PERCENT ,
VIEWPORT_SDF_SCALE_50_PERCENT ,
VIEWPORT_SDF_SCALE_25_PERCENT ,
VIEWPORT_SDF_SCALE_MAX
} ;
virtual void viewport_set_sdf_oversize_and_scale ( RID p_viewport , ViewportSDFOversize p_oversize , ViewportSDFScale p_scale ) = 0 ;
2022-05-01 01:40:30 +02:00
virtual void viewport_set_positional_shadow_atlas_size ( RID p_viewport , int p_size , bool p_16_bits = true ) = 0 ;
virtual void viewport_set_positional_shadow_atlas_quadrant_subdivision ( RID p_viewport , int p_quadrant , int p_subdiv ) = 0 ;
2016-11-10 03:55:06 +01:00
2017-01-02 02:16:52 +01:00
enum ViewportMSAA {
VIEWPORT_MSAA_DISABLED ,
VIEWPORT_MSAA_2X ,
VIEWPORT_MSAA_4X ,
VIEWPORT_MSAA_8X ,
2020-04-12 20:33:57 +02:00
VIEWPORT_MSAA_MAX ,
2017-01-02 02:16:52 +01:00
} ;
2014-02-10 02:10:30 +01:00
2022-08-13 01:02:32 +02:00
virtual void viewport_set_msaa_3d ( RID p_viewport , ViewportMSAA p_msaa ) = 0 ;
virtual void viewport_set_msaa_2d ( RID p_viewport , ViewportMSAA p_msaa ) = 0 ;
2017-06-09 05:23:50 +02:00
2020-04-12 06:49:10 +02:00
enum ViewportScreenSpaceAA {
VIEWPORT_SCREEN_SPACE_AA_DISABLED ,
VIEWPORT_SCREEN_SPACE_AA_FXAA ,
2020-04-20 11:48:00 +02:00
VIEWPORT_SCREEN_SPACE_AA_MAX ,
2020-04-12 06:49:10 +02:00
} ;
2020-04-20 11:48:00 +02:00
2020-04-12 06:49:10 +02:00
virtual void viewport_set_screen_space_aa ( RID p_viewport , ViewportScreenSpaceAA p_mode ) = 0 ;
2022-04-04 16:10:22 +02:00
virtual void viewport_set_use_taa ( RID p_viewport , bool p_use_taa ) = 0 ;
2020-04-20 23:34:47 +02:00
virtual void viewport_set_use_debanding ( RID p_viewport , bool p_use_debanding ) = 0 ;
2021-12-29 00:10:41 +01:00
virtual void viewport_set_mesh_lod_threshold ( RID p_viewport , float p_pixels ) = 0 ;
2020-12-17 19:56:59 +01:00
2022-04-04 16:10:22 +02:00
virtual void viewport_set_use_occlusion_culling ( RID p_viewport , bool p_use_occlusion_culling ) = 0 ;
2021-04-20 18:40:24 +02:00
virtual void viewport_set_occlusion_rays_per_thread ( int p_rays_per_thread ) = 0 ;
enum ViewportOcclusionCullingBuildQuality {
VIEWPORT_OCCLUSION_BUILD_QUALITY_LOW = 0 ,
VIEWPORT_OCCLUSION_BUILD_QUALITY_MEDIUM = 1 ,
VIEWPORT_OCCLUSION_BUILD_QUALITY_HIGH = 2 ,
} ;
virtual void viewport_set_occlusion_culling_build_quality ( ViewportOcclusionCullingBuildQuality p_quality ) = 0 ;
2017-06-11 20:52:03 +02:00
enum ViewportRenderInfo {
VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME ,
2021-07-03 01:14:19 +02:00
VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME ,
2017-06-11 20:52:03 +02:00
VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME ,
2020-04-20 11:48:00 +02:00
VIEWPORT_RENDER_INFO_MAX ,
2017-06-11 20:52:03 +02:00
} ;
2021-07-03 01:14:19 +02:00
enum ViewportRenderInfoType {
VIEWPORT_RENDER_INFO_TYPE_VISIBLE ,
VIEWPORT_RENDER_INFO_TYPE_SHADOW ,
VIEWPORT_RENDER_INFO_TYPE_MAX
} ;
virtual int viewport_get_render_info ( RID p_viewport , ViewportRenderInfoType p_type , ViewportRenderInfo p_info ) = 0 ;
2017-06-11 20:52:03 +02:00
enum ViewportDebugDraw {
VIEWPORT_DEBUG_DRAW_DISABLED ,
VIEWPORT_DEBUG_DRAW_UNSHADED ,
2019-09-07 03:51:27 +02:00
VIEWPORT_DEBUG_DRAW_LIGHTING ,
2017-06-11 20:52:03 +02:00
VIEWPORT_DEBUG_DRAW_OVERDRAW ,
VIEWPORT_DEBUG_DRAW_WIREFRAME ,
2020-01-27 00:09:40 +01:00
VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER ,
2021-06-05 00:47:26 +02:00
VIEWPORT_DEBUG_DRAW_VOXEL_GI_ALBEDO ,
VIEWPORT_DEBUG_DRAW_VOXEL_GI_LIGHTING ,
VIEWPORT_DEBUG_DRAW_VOXEL_GI_EMISSION ,
2019-10-03 22:39:08 +02:00
VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS ,
VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS ,
2020-01-12 02:26:52 +01:00
VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE ,
2020-01-25 11:18:55 +01:00
VIEWPORT_DEBUG_DRAW_SSAO ,
2021-08-03 09:07:32 +02:00
VIEWPORT_DEBUG_DRAW_SSIL ,
2020-04-08 03:51:52 +02:00
VIEWPORT_DEBUG_DRAW_PSSM_SPLITS ,
2020-04-14 05:05:21 +02:00
VIEWPORT_DEBUG_DRAW_DECAL_ATLAS ,
2020-06-25 15:33:28 +02:00
VIEWPORT_DEBUG_DRAW_SDFGI ,
VIEWPORT_DEBUG_DRAW_SDFGI_PROBES ,
VIEWPORT_DEBUG_DRAW_GI_BUFFER ,
2020-12-17 19:56:59 +01:00
VIEWPORT_DEBUG_DRAW_DISABLE_LOD ,
2021-01-17 17:25:38 +01:00
VIEWPORT_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS ,
VIEWPORT_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS ,
VIEWPORT_DEBUG_DRAW_CLUSTER_DECALS ,
VIEWPORT_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES ,
2021-04-20 18:40:24 +02:00
VIEWPORT_DEBUG_DRAW_OCCLUDERS ,
2022-04-04 16:10:22 +02:00
VIEWPORT_DEBUG_DRAW_MOTION_VECTORS ,
2017-06-11 20:52:03 +02:00
} ;
virtual void viewport_set_debug_draw ( RID p_viewport , ViewportDebugDraw p_draw ) = 0 ;
2020-04-10 19:18:42 +02:00
virtual void viewport_set_measure_render_time ( RID p_viewport , bool p_enable ) = 0 ;
2021-02-02 03:16:37 +01:00
virtual double viewport_get_measured_render_time_cpu ( RID p_viewport ) const = 0 ;
virtual double viewport_get_measured_render_time_gpu ( RID p_viewport ) const = 0 ;
2020-04-10 19:18:42 +02:00
Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
2022-06-17 00:55:19 +02:00
virtual RID viewport_find_from_screen_attachment ( DisplayServer : : WindowID p_id = DisplayServer : : MAIN_WINDOW_ID ) const = 0 ;
2022-02-11 12:33:54 +01:00
enum ViewportVRSMode {
VIEWPORT_VRS_DISABLED ,
VIEWPORT_VRS_TEXTURE ,
VIEWPORT_VRS_XR ,
VIEWPORT_VRS_MAX ,
} ;
virtual void viewport_set_vrs_mode ( RID p_viewport , ViewportVRSMode p_mode ) = 0 ;
virtual void viewport_set_vrs_texture ( RID p_viewport , RID p_texture ) = 0 ;
2019-08-26 22:43:58 +02:00
/* SKY API */
enum SkyMode {
2020-07-11 02:07:30 +02:00
SKY_MODE_AUTOMATIC ,
2019-08-26 22:43:58 +02:00
SKY_MODE_QUALITY ,
2020-07-11 02:07:30 +02:00
SKY_MODE_INCREMENTAL ,
2019-08-26 22:43:58 +02:00
SKY_MODE_REALTIME
} ;
virtual RID sky_create ( ) = 0 ;
virtual void sky_set_radiance_size ( RID p_sky , int p_radiance_size ) = 0 ;
virtual void sky_set_mode ( RID p_sky , SkyMode p_mode ) = 0 ;
2020-03-20 01:32:19 +01:00
virtual void sky_set_material ( RID p_sky , RID p_material ) = 0 ;
2020-05-01 14:34:23 +02:00
virtual Ref < Image > sky_bake_panorama ( RID p_sky , float p_energy , bool p_bake_irradiance , const Size2i & p_size ) = 0 ;
2019-08-26 22:43:58 +02:00
2014-02-10 02:10:30 +01:00
/* ENVIRONMENT API */
virtual RID environment_create ( ) = 0 ;
enum EnvironmentBG {
2016-10-21 12:27:13 +02:00
ENV_BG_CLEAR_COLOR ,
2014-02-10 02:10:30 +01:00
ENV_BG_COLOR ,
2017-05-25 18:53:59 +02:00
ENV_BG_SKY ,
2015-03-16 04:47:37 +01:00
ENV_BG_CANVAS ,
2016-10-21 12:27:13 +02:00
ENV_BG_KEEP ,
2017-08-20 16:17:24 +02:00
ENV_BG_CAMERA_FEED ,
2014-02-10 02:10:30 +01:00
ENV_BG_MAX
} ;
2019-08-26 22:43:58 +02:00
enum EnvironmentAmbientSource {
ENV_AMBIENT_SOURCE_BG ,
ENV_AMBIENT_SOURCE_DISABLED ,
ENV_AMBIENT_SOURCE_COLOR ,
ENV_AMBIENT_SOURCE_SKY ,
} ;
enum EnvironmentReflectionSource {
ENV_REFLECTION_SOURCE_BG ,
ENV_REFLECTION_SOURCE_DISABLED ,
ENV_REFLECTION_SOURCE_SKY ,
} ;
2014-02-10 02:10:30 +01:00
virtual void environment_set_background ( RID p_env , EnvironmentBG p_bg ) = 0 ;
2017-05-25 18:53:59 +02:00
virtual void environment_set_sky ( RID p_env , RID p_sky ) = 0 ;
2017-09-29 23:56:05 +02:00
virtual void environment_set_sky_custom_fov ( RID p_env , float p_scale ) = 0 ;
2018-12-15 06:27:03 +01:00
virtual void environment_set_sky_orientation ( RID p_env , const Basis & p_orientation ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void environment_set_bg_color ( RID p_env , const Color & p_color ) = 0 ;
2022-08-01 01:20:24 +02:00
virtual void environment_set_bg_energy ( RID p_env , float p_multiplier , float p_exposure_value ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void environment_set_canvas_max_layer ( RID p_env , int p_max_layer ) = 0 ;
2021-10-07 15:01:14 +02:00
virtual void environment_set_ambient_light ( RID p_env , const Color & p_color , EnvironmentAmbientSource p_ambient = ENV_AMBIENT_SOURCE_BG , float p_energy = 1.0 , float p_sky_contribution = 0.0 , EnvironmentReflectionSource p_reflection_source = ENV_REFLECTION_SOURCE_BG ) = 0 ;
2014-02-10 02:10:30 +01:00
2016-10-03 21:33:42 +02:00
enum EnvironmentGlowBlendMode {
2020-02-12 09:59:06 +01:00
ENV_GLOW_BLEND_MODE_ADDITIVE ,
ENV_GLOW_BLEND_MODE_SCREEN ,
ENV_GLOW_BLEND_MODE_SOFTLIGHT ,
ENV_GLOW_BLEND_MODE_REPLACE ,
ENV_GLOW_BLEND_MODE_MIX ,
2014-05-29 15:56:39 +02:00
} ;
2020-04-20 11:48:00 +02:00
2022-01-20 16:47:25 +01:00
virtual void environment_set_glow ( RID p_env , bool p_enable , Vector < float > p_levels , float p_intensity , float p_strength , float p_mix , float p_bloom_threshold , EnvironmentGlowBlendMode p_blend_mode , float p_hdr_bleed_threshold , float p_hdr_bleed_scale , float p_hdr_luminance_cap , float p_glow_map_strength , RID p_glow_map ) = 0 ;
2020-03-30 15:46:03 +02:00
virtual void environment_glow_set_use_bicubic_upscale ( bool p_enable ) = 0 ;
2014-06-28 04:21:45 +02:00
2016-10-03 21:33:42 +02:00
enum EnvironmentToneMapper {
ENV_TONE_MAPPER_LINEAR ,
2018-08-26 12:29:20 +02:00
ENV_TONE_MAPPER_REINHARD ,
2016-10-30 01:48:09 +02:00
ENV_TONE_MAPPER_FILMIC ,
2016-12-07 21:49:52 +01:00
ENV_TONE_MAPPER_ACES
2014-02-10 02:10:30 +01:00
} ;
2022-08-01 01:20:24 +02:00
virtual void environment_set_tonemap ( RID p_env , EnvironmentToneMapper p_tone_mapper , float p_exposure , float p_white ) = 0 ;
2020-11-23 02:51:31 +01:00
virtual void environment_set_adjustment ( RID p_env , bool p_enable , float p_brightness , float p_contrast , float p_saturation , bool p_use_1d_color_correction , RID p_color_correction ) = 0 ;
2014-02-10 02:10:30 +01:00
2020-04-02 04:24:52 +02:00
virtual void environment_set_ssr ( RID p_env , bool p_enable , int p_max_steps , float p_fade_in , float p_fade_out , float p_depth_tolerance ) = 0 ;
enum EnvironmentSSRRoughnessQuality {
2022-02-28 01:06:26 +01:00
ENV_SSR_ROUGHNESS_QUALITY_DISABLED ,
ENV_SSR_ROUGHNESS_QUALITY_LOW ,
ENV_SSR_ROUGHNESS_QUALITY_MEDIUM ,
ENV_SSR_ROUGHNESS_QUALITY_HIGH ,
2020-04-02 04:24:52 +02:00
} ;
virtual void environment_set_ssr_roughness_quality ( EnvironmentSSRRoughnessQuality p_quality ) = 0 ;
2017-10-22 18:52:31 +02:00
2020-12-08 06:37:09 +01:00
virtual void environment_set_ssao ( RID p_env , bool p_enable , float p_radius , float p_intensity , float p_power , float p_detail , float p_horizon , float p_sharpness , float p_light_affect , float p_ao_channel_affect ) = 0 ;
2020-01-25 11:18:55 +01:00
enum EnvironmentSSAOQuality {
2020-12-08 06:37:09 +01:00
ENV_SSAO_QUALITY_VERY_LOW ,
2020-01-25 11:18:55 +01:00
ENV_SSAO_QUALITY_LOW ,
ENV_SSAO_QUALITY_MEDIUM ,
ENV_SSAO_QUALITY_HIGH ,
ENV_SSAO_QUALITY_ULTRA ,
} ;
2020-12-08 06:37:09 +01:00
virtual void environment_set_ssao_quality ( EnvironmentSSAOQuality p_quality , bool p_half_size , float p_adaptive_target , int p_blur_passes , float p_fadeout_from , float p_fadeout_to ) = 0 ;
2021-08-03 09:07:32 +02:00
virtual void environment_set_ssil ( RID p_env , bool p_enable , float p_radius , float p_intensity , float p_sharpness , float p_normal_rejection ) = 0 ;
enum EnvironmentSSILQuality {
ENV_SSIL_QUALITY_VERY_LOW ,
ENV_SSIL_QUALITY_LOW ,
ENV_SSIL_QUALITY_MEDIUM ,
ENV_SSIL_QUALITY_HIGH ,
ENV_SSIL_QUALITY_ULTRA ,
} ;
virtual void environment_set_ssil_quality ( EnvironmentSSILQuality p_quality , bool p_half_size , float p_adaptive_target , int p_blur_passes , float p_fadeout_from , float p_fadeout_to ) = 0 ;
2014-02-10 02:10:30 +01:00
2020-06-25 15:33:28 +02:00
enum EnvironmentSDFGIYScale {
2021-05-23 19:10:26 +02:00
ENV_SDFGI_Y_SCALE_50_PERCENT ,
2020-06-25 15:33:28 +02:00
ENV_SDFGI_Y_SCALE_75_PERCENT ,
2021-05-23 19:10:26 +02:00
ENV_SDFGI_Y_SCALE_100_PERCENT ,
2020-06-25 15:33:28 +02:00
} ;
2022-01-13 19:46:14 +01:00
virtual void environment_set_sdfgi ( RID p_env , bool p_enable , int p_cascades , float p_min_cell_size , EnvironmentSDFGIYScale p_y_scale , bool p_use_occlusion , float p_bounce_feedback , bool p_read_sky , float p_energy , float p_normal_bias , float p_probe_bias ) = 0 ;
2020-06-25 15:33:28 +02:00
enum EnvironmentSDFGIRayCount {
2021-01-23 00:50:24 +01:00
ENV_SDFGI_RAY_COUNT_4 ,
2020-06-25 15:33:28 +02:00
ENV_SDFGI_RAY_COUNT_8 ,
ENV_SDFGI_RAY_COUNT_16 ,
ENV_SDFGI_RAY_COUNT_32 ,
ENV_SDFGI_RAY_COUNT_64 ,
ENV_SDFGI_RAY_COUNT_96 ,
ENV_SDFGI_RAY_COUNT_128 ,
ENV_SDFGI_RAY_COUNT_MAX ,
} ;
virtual void environment_set_sdfgi_ray_count ( EnvironmentSDFGIRayCount p_ray_count ) = 0 ;
enum EnvironmentSDFGIFramesToConverge {
ENV_SDFGI_CONVERGE_IN_5_FRAMES ,
ENV_SDFGI_CONVERGE_IN_10_FRAMES ,
ENV_SDFGI_CONVERGE_IN_15_FRAMES ,
ENV_SDFGI_CONVERGE_IN_20_FRAMES ,
ENV_SDFGI_CONVERGE_IN_25_FRAMES ,
ENV_SDFGI_CONVERGE_IN_30_FRAMES ,
ENV_SDFGI_CONVERGE_MAX
} ;
virtual void environment_set_sdfgi_frames_to_converge ( EnvironmentSDFGIFramesToConverge p_frames ) = 0 ;
2021-01-23 00:50:24 +01:00
enum EnvironmentSDFGIFramesToUpdateLight {
ENV_SDFGI_UPDATE_LIGHT_IN_1_FRAME ,
ENV_SDFGI_UPDATE_LIGHT_IN_2_FRAMES ,
ENV_SDFGI_UPDATE_LIGHT_IN_4_FRAMES ,
ENV_SDFGI_UPDATE_LIGHT_IN_8_FRAMES ,
ENV_SDFGI_UPDATE_LIGHT_IN_16_FRAMES ,
ENV_SDFGI_UPDATE_LIGHT_MAX ,
} ;
virtual void environment_set_sdfgi_frames_to_update_light ( EnvironmentSDFGIFramesToUpdateLight p_update ) = 0 ;
2022-02-23 23:54:06 +01:00
virtual void environment_set_fog ( RID p_env , bool p_enable , const Color & p_light_color , float p_light_energy , float p_sun_scatter , float p_density , float p_height , float p_height_density , float p_aerial_perspective , float p_sky_affect ) = 0 ;
2017-06-07 04:16:17 +02:00
2022-02-23 23:54:06 +01:00
virtual void environment_set_volumetric_fog ( RID p_env , bool p_enable , float p_density , const Color & p_albedo , const Color & p_emission , float p_emission_energy , float p_anisotropy , float p_length , float p_detail_spread , float p_gi_inject , bool p_temporal_reprojection , float p_temporal_reprojection_amount , float p_ambient_inject , float p_sky_affect ) = 0 ;
2020-08-13 03:21:01 +02:00
virtual void environment_set_volumetric_fog_volume_size ( int p_size , int p_depth ) = 0 ;
virtual void environment_set_volumetric_fog_filter_active ( bool p_enable ) = 0 ;
2020-05-01 14:34:23 +02:00
virtual Ref < Image > environment_bake_panorama ( RID p_env , bool p_bake_irradiance , const Size2i & p_size ) = 0 ;
2020-06-25 15:33:28 +02:00
virtual void screen_space_roughness_limiter_set_active ( bool p_enable , float p_amount , float p_limit ) = 0 ;
2020-01-27 00:09:40 +01:00
2020-04-04 04:42:26 +02:00
enum SubSurfaceScatteringQuality {
SUB_SURFACE_SCATTERING_QUALITY_DISABLED ,
SUB_SURFACE_SCATTERING_QUALITY_LOW ,
SUB_SURFACE_SCATTERING_QUALITY_MEDIUM ,
SUB_SURFACE_SCATTERING_QUALITY_HIGH ,
} ;
virtual void sub_surface_scattering_set_quality ( SubSurfaceScatteringQuality p_quality ) = 0 ;
virtual void sub_surface_scattering_set_scale ( float p_scale , float p_depth_scale ) = 0 ;
2020-01-13 19:37:24 +01:00
/* CAMERA EFFECTS */
2022-08-01 01:20:24 +02:00
virtual RID camera_attributes_create ( ) = 0 ;
2020-01-13 19:37:24 +01:00
enum DOFBlurQuality {
2020-01-16 01:23:21 +01:00
DOF_BLUR_QUALITY_VERY_LOW ,
2020-01-13 19:37:24 +01:00
DOF_BLUR_QUALITY_LOW ,
DOF_BLUR_QUALITY_MEDIUM ,
DOF_BLUR_QUALITY_HIGH ,
} ;
2022-08-01 01:20:24 +02:00
virtual void camera_attributes_set_dof_blur_quality ( DOFBlurQuality p_quality , bool p_use_jitter ) = 0 ;
2020-01-16 01:23:21 +01:00
enum DOFBokehShape {
DOF_BOKEH_BOX ,
DOF_BOKEH_HEXAGON ,
DOF_BOKEH_CIRCLE
} ;
2022-08-01 01:20:24 +02:00
virtual void camera_attributes_set_dof_blur_bokeh_shape ( DOFBokehShape p_shape ) = 0 ;
2020-01-16 01:23:21 +01:00
2022-08-01 01:20:24 +02:00
virtual void camera_attributes_set_dof_blur ( RID p_camera_attributes , bool p_far_enable , float p_far_distance , float p_far_transition , bool p_near_enable , float p_near_distance , float p_near_transition , float p_amount ) = 0 ;
virtual void camera_attributes_set_exposure ( RID p_camera_attributes , float p_multiplier , float p_exposure_normalization ) = 0 ;
virtual void camera_attributes_set_auto_exposure ( RID p_camera_attributes , bool p_enable , float p_min_sensitivity , float p_max_sensitivity , float p_speed , float p_scale ) = 0 ;
2020-01-13 19:37:24 +01:00
2014-02-10 02:10:30 +01:00
/* SCENARIO API */
2016-03-09 00:00:52 +01:00
virtual RID scenario_create ( ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void scenario_set_environment ( RID p_scenario , RID p_environment ) = 0 ;
2014-10-12 07:13:22 +02:00
virtual void scenario_set_fallback_environment ( RID p_scenario , RID p_environment ) = 0 ;
2022-08-01 01:20:24 +02:00
virtual void scenario_set_camera_attributes ( RID p_scenario , RID p_camera_attributes ) = 0 ;
2014-02-10 02:10:30 +01:00
/* INSTANCING API */
2016-03-09 00:00:52 +01:00
2014-02-10 02:10:30 +01:00
enum InstanceType {
INSTANCE_NONE ,
INSTANCE_MESH ,
INSTANCE_MULTIMESH ,
INSTANCE_PARTICLES ,
2020-10-08 02:29:49 +02:00
INSTANCE_PARTICLES_COLLISION ,
2014-02-10 02:10:30 +01:00
INSTANCE_LIGHT ,
2016-10-03 21:33:42 +02:00
INSTANCE_REFLECTION_PROBE ,
2020-04-14 05:05:21 +02:00
INSTANCE_DECAL ,
2021-06-05 00:47:26 +02:00
INSTANCE_VOXEL_GI ,
2020-05-01 14:34:23 +02:00
INSTANCE_LIGHTMAP ,
2021-04-20 18:40:24 +02:00
INSTANCE_OCCLUDER ,
2021-06-16 20:43:02 +02:00
INSTANCE_VISIBLITY_NOTIFIER ,
2021-10-03 13:28:55 +02:00
INSTANCE_FOG_VOLUME ,
2016-10-19 16:14:41 +02:00
INSTANCE_MAX ,
2014-10-28 02:54:32 +01:00
2021-06-30 03:55:11 +02:00
INSTANCE_GEOMETRY_MASK = ( 1 < < INSTANCE_MESH ) | ( 1 < < INSTANCE_MULTIMESH ) | ( 1 < < INSTANCE_PARTICLES )
2014-02-10 02:10:30 +01:00
} ;
2016-03-09 00:00:52 +01:00
2014-02-10 02:10:30 +01:00
virtual RID instance_create2 ( RID p_base , RID p_scenario ) ;
2020-01-21 21:32:27 +01:00
virtual RID instance_create ( ) = 0 ;
2014-02-10 02:10:30 +01:00
2020-01-21 21:32:27 +01:00
virtual void instance_set_base ( RID p_instance , RID p_base ) = 0 ;
virtual void instance_set_scenario ( RID p_instance , RID p_scenario ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void instance_set_layer_mask ( RID p_instance , uint32_t p_mask ) = 0 ;
2022-12-13 05:13:16 +01:00
virtual void instance_set_pivot_data ( RID p_instance , float p_sorting_offset , bool p_use_aabb_center ) = 0 ;
2020-10-17 07:08:21 +02:00
virtual void instance_set_transform ( RID p_instance , const Transform3D & p_transform ) = 0 ;
2019-05-09 11:21:49 +02:00
virtual void instance_attach_object_instance_id ( RID p_instance , ObjectID p_id ) = 0 ;
2017-01-12 12:34:00 +01:00
virtual void instance_set_blend_shape_weight ( RID p_instance , int p_shape , float p_weight ) = 0 ;
2021-04-14 05:45:16 +02:00
virtual void instance_set_surface_override_material ( RID p_instance , int p_surface , RID p_material ) = 0 ;
2017-01-04 05:16:14 +01:00
virtual void instance_set_visible ( RID p_instance , bool p_visible ) = 0 ;
2016-05-27 19:18:40 +02:00
2017-11-20 20:54:26 +01:00
virtual void instance_set_custom_aabb ( RID p_instance , AABB aabb ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void instance_attach_skeleton ( RID p_instance , RID p_skeleton ) = 0 ;
virtual void instance_set_extra_visibility_margin ( RID p_instance , real_t p_margin ) = 0 ;
2021-05-09 18:23:20 +02:00
virtual void instance_set_visibility_parent ( RID p_instance , RID p_parent_instance ) = 0 ;
2014-02-10 02:10:30 +01:00
2021-10-03 13:28:55 +02:00
virtual void instance_set_ignore_culling ( RID p_instance , bool p_enabled ) = 0 ;
2021-11-28 01:12:10 +01:00
// Don't use these in a game!
2017-11-17 03:09:00 +01:00
virtual Vector < ObjectID > instances_cull_aabb ( const AABB & p_aabb , RID p_scenario = RID ( ) ) const = 0 ;
2016-10-03 21:33:42 +02:00
virtual Vector < ObjectID > instances_cull_ray ( const Vector3 & p_from , const Vector3 & p_to , RID p_scenario = RID ( ) ) const = 0 ;
virtual Vector < ObjectID > instances_cull_convex ( const Vector < Plane > & p_convex , RID p_scenario = RID ( ) ) const = 0 ;
2014-02-10 02:10:30 +01:00
2022-08-08 00:52:20 +02:00
PackedInt64Array _instances_cull_aabb_bind ( const AABB & p_aabb , RID p_scenario = RID ( ) ) const ;
PackedInt64Array _instances_cull_ray_bind ( const Vector3 & p_from , const Vector3 & p_to , RID p_scenario = RID ( ) ) const ;
2022-08-31 19:24:04 +02:00
PackedInt64Array _instances_cull_convex_bind ( const TypedArray < Plane > & p_convex , RID p_scenario = RID ( ) ) const ;
Added all missing VisualServer bindings
- Added bindings for multimesh, immediate, skeleton, light, reflection probe, gi probe, lightmap, particles, camera, environment, scenario, instance
- Removed draw and sync, were duplicates of force_* equivalents
- Bumped binders max arguments from 11 to 13
- Wrote some wrappers as not all methods were variant-friendly
2018-01-20 16:18:51 +01:00
2014-02-10 02:10:30 +01:00
enum InstanceFlags {
2014-06-11 15:41:03 +02:00
INSTANCE_FLAG_USE_BAKED_LIGHT ,
2019-10-11 04:14:56 +02:00
INSTANCE_FLAG_USE_DYNAMIC_GI ,
2018-07-27 13:58:56 +02:00
INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE ,
2021-04-20 18:40:24 +02:00
INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING ,
2014-02-10 02:10:30 +01:00
INSTANCE_FLAG_MAX
} ;
2016-03-08 00:00:55 +01:00
enum ShadowCastingSetting {
SHADOW_CASTING_SETTING_OFF ,
SHADOW_CASTING_SETTING_ON ,
SHADOW_CASTING_SETTING_DOUBLE_SIDED ,
SHADOW_CASTING_SETTING_SHADOWS_ONLY ,
} ;
2021-07-20 20:17:34 +02:00
enum VisibilityRangeFadeMode {
VISIBILITY_RANGE_FADE_DISABLED ,
VISIBILITY_RANGE_FADE_SELF ,
VISIBILITY_RANGE_FADE_DEPENDENCIES ,
} ;
2014-02-10 02:10:30 +01:00
virtual void instance_geometry_set_flag ( RID p_instance , InstanceFlags p_flags , bool p_enabled ) = 0 ;
2016-03-08 00:00:55 +01:00
virtual void instance_geometry_set_cast_shadows_setting ( RID p_instance , ShadowCastingSetting p_shadow_casting_setting ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void instance_geometry_set_material_override ( RID p_instance , RID p_material ) = 0 ;
2021-09-25 20:40:26 +02:00
virtual void instance_geometry_set_material_overlay ( RID p_instance , RID p_material ) = 0 ;
2021-07-20 20:17:34 +02:00
virtual void instance_geometry_set_visibility_range ( RID p_instance , float p_min , float p_max , float p_min_margin , float p_max_margin , VisibilityRangeFadeMode p_fade_mode ) = 0 ;
2020-05-01 14:34:23 +02:00
virtual void instance_geometry_set_lightmap ( RID p_instance , RID p_lightmap , const Rect2 & p_lightmap_uv_scale , int p_lightmap_slice ) = 0 ;
2020-12-17 19:56:59 +01:00
virtual void instance_geometry_set_lod_bias ( RID p_instance , float p_lod_bias ) = 0 ;
2021-07-20 20:17:34 +02:00
virtual void instance_geometry_set_transparency ( RID p_instance , float p_transparency ) = 0 ;
2014-02-10 02:10:30 +01:00
2022-08-27 11:22:43 +02:00
virtual void instance_geometry_set_shader_parameter ( RID p_instance , const StringName & , const Variant & p_value ) = 0 ;
virtual Variant instance_geometry_get_shader_parameter ( RID p_instance , const StringName & ) const = 0 ;
virtual Variant instance_geometry_get_shader_parameter_default_value ( RID p_instance , const StringName & ) const = 0 ;
virtual void instance_geometry_get_shader_parameter_list ( RID p_instance , List < PropertyInfo > * p_parameters ) const = 0 ;
2020-04-17 04:52:00 +02:00
2020-05-01 14:34:23 +02:00
/* Bake 3D objects */
enum BakeChannels {
BAKE_CHANNEL_ALBEDO_ALPHA ,
BAKE_CHANNEL_NORMAL ,
BAKE_CHANNEL_ORM ,
BAKE_CHANNEL_EMISSION
} ;
2022-08-31 19:24:04 +02:00
virtual TypedArray < Image > bake_render_uv2 ( RID p_base , const TypedArray < RID > & p_material_overrides , const Size2i & p_image_size ) = 0 ;
2020-05-01 14:34:23 +02:00
2014-02-10 02:10:30 +01:00
/* CANVAS (2D) */
virtual RID canvas_create ( ) = 0 ;
virtual void canvas_set_item_mirroring ( RID p_canvas , RID p_item , const Point2 & p_mirroring ) = 0 ;
2015-02-18 23:39:44 +01:00
virtual void canvas_set_modulate ( RID p_canvas , const Color & p_color ) = 0 ;
2019-04-05 15:24:54 +02:00
virtual void canvas_set_parent ( RID p_canvas , RID p_parent , float p_scale ) = 0 ;
virtual void canvas_set_disable_scale ( bool p_disable ) = 0 ;
2014-02-10 02:10:30 +01:00
2021-07-01 04:17:47 +02:00
/* CANVAS TEXTURE */
2020-10-24 17:15:43 +02:00
virtual RID canvas_texture_create ( ) = 0 ;
enum CanvasTextureChannel {
CANVAS_TEXTURE_CHANNEL_DIFFUSE ,
CANVAS_TEXTURE_CHANNEL_NORMAL ,
CANVAS_TEXTURE_CHANNEL_SPECULAR ,
} ;
virtual void canvas_texture_set_channel ( RID p_canvas_texture , CanvasTextureChannel p_channel , RID p_texture ) = 0 ;
virtual void canvas_texture_set_shading_parameters ( RID p_canvas_texture , const Color & p_base_color , float p_shininess ) = 0 ;
2021-11-28 01:12:10 +01:00
// Takes effect only for new draw commands.
2020-10-24 17:15:43 +02:00
virtual void canvas_texture_set_texture_filter ( RID p_canvas_texture , CanvasItemTextureFilter p_filter ) = 0 ;
virtual void canvas_texture_set_texture_repeat ( RID p_canvas_texture , CanvasItemTextureRepeat p_repeat ) = 0 ;
2021-07-01 04:17:47 +02:00
/* CANVAS ITEM */
2014-02-10 02:10:30 +01:00
virtual RID canvas_item_create ( ) = 0 ;
virtual void canvas_item_set_parent ( RID p_item , RID p_parent ) = 0 ;
2020-10-24 17:15:43 +02:00
virtual void canvas_item_set_default_texture_filter ( RID p_item , CanvasItemTextureFilter p_filter ) = 0 ;
virtual void canvas_item_set_default_texture_repeat ( RID p_item , CanvasItemTextureRepeat p_repeat ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void canvas_item_set_visible ( RID p_item , bool p_visible ) = 0 ;
2015-02-18 23:39:44 +01:00
virtual void canvas_item_set_light_mask ( RID p_item , int p_mask ) = 0 ;
2018-08-29 21:48:32 +02:00
virtual void canvas_item_set_update_when_visible ( RID p_item , bool p_update ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void canvas_item_set_transform ( RID p_item , const Transform2D & p_transform ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void canvas_item_set_clip ( RID p_item , bool p_clip ) = 0 ;
2015-03-21 04:43:33 +01:00
virtual void canvas_item_set_distance_field_mode ( RID p_item , bool p_enable ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void canvas_item_set_custom_rect ( RID p_item , bool p_custom_rect , const Rect2 & p_rect = Rect2 ( ) ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void canvas_item_set_modulate ( RID p_item , const Color & p_color ) = 0 ;
virtual void canvas_item_set_self_modulate ( RID p_item , const Color & p_color ) = 0 ;
2021-09-02 20:07:04 +02:00
virtual void canvas_item_set_visibility_layer ( RID p_item , uint32_t p_visibility_layer ) = 0 ;
2014-02-10 02:10:30 +01:00
2016-10-03 21:33:42 +02:00
virtual void canvas_item_set_draw_behind_parent ( RID p_item , bool p_enable ) = 0 ;
2014-02-10 02:10:30 +01:00
2016-10-03 21:33:42 +02:00
enum NinePatchAxisMode {
NINE_PATCH_STRETCH ,
NINE_PATCH_TILE ,
NINE_PATCH_TILE_FIT ,
} ;
2014-02-10 02:10:30 +01:00
2022-04-11 19:42:46 +02:00
virtual void canvas_item_add_line ( RID p_item , const Point2 & p_from , const Point2 & p_to , const Color & p_color , float p_width = 1.0 , bool p_antialiased = false ) = 0 ;
2020-11-24 16:15:10 +01:00
virtual void canvas_item_add_polyline ( RID p_item , const Vector < Point2 > & p_points , const Vector < Color > & p_colors , float p_width = 1.0 , bool p_antialiased = false ) = 0 ;
2019-06-25 03:24:07 +02:00
virtual void canvas_item_add_multiline ( RID p_item , const Vector < Point2 > & p_points , const Vector < Color > & p_colors , float p_width = 1.0 ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void canvas_item_add_rect ( RID p_item , const Rect2 & p_rect , const Color & p_color ) = 0 ;
virtual void canvas_item_add_circle ( RID p_item , const Point2 & p_pos , float p_radius , const Color & p_color ) = 0 ;
2020-10-24 17:15:43 +02:00
virtual void canvas_item_add_texture_rect ( RID p_item , const Rect2 & p_rect , RID p_texture , bool p_tile = false , const Color & p_modulate = Color ( 1 , 1 , 1 ) , bool p_transpose = false ) = 0 ;
virtual void canvas_item_add_texture_rect_region ( RID p_item , const Rect2 & p_rect , RID p_texture , const Rect2 & p_src_rect , const Color & p_modulate = Color ( 1 , 1 , 1 ) , bool p_transpose = false , bool p_clip_uv = false ) = 0 ;
2022-12-17 21:47:33 +01:00
virtual void canvas_item_add_msdf_texture_rect_region ( RID p_item , const Rect2 & p_rect , RID p_texture , const Rect2 & p_src_rect , const Color & p_modulate = Color ( 1 , 1 , 1 ) , int p_outline_size = 0 , float p_px_range = 1.0 , float p_scale = 1.0 ) = 0 ;
2022-08-12 13:03:28 +02:00
virtual void canvas_item_add_lcd_texture_rect_region ( RID p_item , const Rect2 & p_rect , RID p_texture , const Rect2 & p_src_rect , const Color & p_modulate = Color ( 1 , 1 , 1 ) ) = 0 ;
2020-10-24 17:15:43 +02:00
virtual void canvas_item_add_nine_patch ( RID p_item , const Rect2 & p_rect , const Rect2 & p_source , RID p_texture , const Vector2 & p_topleft , const Vector2 & p_bottomright , NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH , NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH , bool p_draw_center = true , const Color & p_modulate = Color ( 1 , 1 , 1 ) ) = 0 ;
virtual void canvas_item_add_primitive ( RID p_item , const Vector < Point2 > & p_points , const Vector < Color > & p_colors , const Vector < Point2 > & p_uvs , RID p_texture , float p_width = 1.0 ) = 0 ;
virtual void canvas_item_add_polygon ( RID p_item , const Vector < Point2 > & p_points , const Vector < Color > & p_colors , const Vector < Point2 > & p_uvs = Vector < Point2 > ( ) , RID p_texture = RID ( ) ) = 0 ;
virtual void canvas_item_add_triangle_array ( RID p_item , const Vector < int > & p_indices , const Vector < Point2 > & p_points , const Vector < Color > & p_colors , const Vector < Point2 > & p_uvs = Vector < Point2 > ( ) , const Vector < int > & p_bones = Vector < int > ( ) , const Vector < float > & p_weights = Vector < float > ( ) , RID p_texture = RID ( ) , int p_count = - 1 ) = 0 ;
virtual void canvas_item_add_mesh ( RID p_item , const RID & p_mesh , const Transform2D & p_transform = Transform2D ( ) , const Color & p_modulate = Color ( 1 , 1 , 1 ) , RID p_texture = RID ( ) ) = 0 ;
virtual void canvas_item_add_multimesh ( RID p_item , RID p_mesh , RID p_texture = RID ( ) ) = 0 ;
virtual void canvas_item_add_particles ( RID p_item , RID p_particles , RID p_texture ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void canvas_item_add_set_transform ( RID p_item , const Transform2D & p_transform ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void canvas_item_add_clip_ignore ( RID p_item , bool p_ignore ) = 0 ;
2021-06-17 16:30:20 +02:00
virtual void canvas_item_add_animation_slice ( RID p_item , double p_animation_length , double p_slice_begin , double p_slice_end , double p_offset ) = 0 ;
2021-07-01 04:17:47 +02:00
2014-10-03 05:10:51 +02:00
virtual void canvas_item_set_sort_children_by_y ( RID p_item , bool p_enable ) = 0 ;
2017-12-29 23:06:03 +01:00
virtual void canvas_item_set_z_index ( RID p_item , int p_z ) = 0 ;
2015-01-13 14:49:26 +01:00
virtual void canvas_item_set_z_as_relative_to_parent ( RID p_item , bool p_enable ) = 0 ;
2015-03-12 05:05:50 +01:00
virtual void canvas_item_set_copy_to_backbuffer ( RID p_item , bool p_enable , const Rect2 & p_rect ) = 0 ;
2017-03-05 16:44:50 +01:00
2018-02-21 21:23:27 +01:00
virtual void canvas_item_attach_skeleton ( RID p_item , RID p_skeleton ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void canvas_item_clear ( RID p_item ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void canvas_item_set_draw_index ( RID p_item , int p_index ) = 0 ;
2017-03-05 16:44:50 +01:00
2015-03-02 04:54:10 +01:00
virtual void canvas_item_set_material ( RID p_item , RID p_material ) = 0 ;
2017-03-05 16:44:50 +01:00
2015-03-02 04:54:10 +01:00
virtual void canvas_item_set_use_parent_material ( RID p_item , bool p_enable ) = 0 ;
2017-03-05 16:44:50 +01:00
2021-06-15 22:33:24 +02:00
virtual void canvas_item_set_visibility_notifier ( RID p_item , bool p_enable , const Rect2 & p_area , const Callable & p_enter_callbable , const Callable & p_exit_callable ) = 0 ;
2020-10-28 19:34:27 +01:00
enum CanvasGroupMode {
CANVAS_GROUP_MODE_DISABLED ,
2022-10-12 21:45:47 +02:00
CANVAS_GROUP_MODE_CLIP_ONLY ,
CANVAS_GROUP_MODE_CLIP_AND_DRAW ,
2020-10-28 19:34:27 +01:00
CANVAS_GROUP_MODE_TRANSPARENT ,
} ;
virtual void canvas_item_set_canvas_group_mode ( RID p_item , CanvasGroupMode p_mode , float p_clear_margin = 5.0 , bool p_fit_empty = false , float p_fit_margin = 0.0 , bool p_blur_mipmaps = false ) = 0 ;
2021-07-01 04:17:47 +02:00
/* CANVAS LIGHT */
2015-01-22 15:07:16 +01:00
virtual RID canvas_light_create ( ) = 0 ;
2020-11-03 20:51:53 +01:00
enum CanvasLightMode {
CANVAS_LIGHT_MODE_POINT ,
CANVAS_LIGHT_MODE_DIRECTIONAL ,
} ;
virtual void canvas_light_set_mode ( RID p_light , CanvasLightMode p_mode ) = 0 ;
2015-01-22 15:07:16 +01:00
virtual void canvas_light_attach_to_canvas ( RID p_light , RID p_canvas ) = 0 ;
virtual void canvas_light_set_enabled ( RID p_light , bool p_enabled ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void canvas_light_set_transform ( RID p_light , const Transform2D & p_transform ) = 0 ;
2015-01-22 15:07:16 +01:00
virtual void canvas_light_set_color ( RID p_light , const Color & p_color ) = 0 ;
virtual void canvas_light_set_height ( RID p_light , float p_height ) = 0 ;
2015-04-03 06:43:37 +02:00
virtual void canvas_light_set_energy ( RID p_light , float p_energy ) = 0 ;
2015-01-22 15:07:16 +01:00
virtual void canvas_light_set_z_range ( RID p_light , int p_min_z , int p_max_z ) = 0 ;
2015-02-18 23:39:44 +01:00
virtual void canvas_light_set_layer_range ( RID p_light , int p_min_layer , int p_max_layer ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void canvas_light_set_item_cull_mask ( RID p_light , int p_mask ) = 0 ;
virtual void canvas_light_set_item_shadow_cull_mask ( RID p_light , int p_mask ) = 0 ;
2015-01-22 15:07:16 +01:00
2020-11-03 20:51:53 +01:00
virtual void canvas_light_set_directional_distance ( RID p_light , float p_distance ) = 0 ;
virtual void canvas_light_set_texture_scale ( RID p_light , float p_scale ) = 0 ;
virtual void canvas_light_set_texture ( RID p_light , RID p_texture ) = 0 ;
virtual void canvas_light_set_texture_offset ( RID p_light , const Vector2 & p_offset ) = 0 ;
enum CanvasLightBlendMode {
CANVAS_LIGHT_BLEND_MODE_ADD ,
CANVAS_LIGHT_BLEND_MODE_SUB ,
CANVAS_LIGHT_BLEND_MODE_MIX ,
2015-04-03 06:43:37 +02:00
} ;
2020-11-03 20:51:53 +01:00
virtual void canvas_light_set_blend_mode ( RID p_light , CanvasLightBlendMode p_mode ) = 0 ;
2016-10-03 21:33:42 +02:00
enum CanvasLightShadowFilter {
CANVAS_LIGHT_FILTER_NONE ,
CANVAS_LIGHT_FILTER_PCF5 ,
CANVAS_LIGHT_FILTER_PCF13 ,
2019-07-07 06:49:40 +02:00
CANVAS_LIGHT_FILTER_MAX
2016-10-03 21:33:42 +02:00
} ;
2015-01-22 15:07:16 +01:00
virtual void canvas_light_set_shadow_enabled ( RID p_light , bool p_enabled ) = 0 ;
2016-10-03 21:33:42 +02:00
virtual void canvas_light_set_shadow_filter ( RID p_light , CanvasLightShadowFilter p_filter ) = 0 ;
2015-06-24 23:15:43 +02:00
virtual void canvas_light_set_shadow_color ( RID p_light , const Color & p_color ) = 0 ;
2017-06-13 06:23:04 +02:00
virtual void canvas_light_set_shadow_smooth ( RID p_light , float p_smooth ) = 0 ;
2015-03-02 04:54:10 +01:00
2021-07-01 04:17:47 +02:00
/* CANVAS LIGHT OCCLUDER */
2015-01-22 15:07:16 +01:00
virtual RID canvas_light_occluder_create ( ) = 0 ;
virtual void canvas_light_occluder_attach_to_canvas ( RID p_occluder , RID p_canvas ) = 0 ;
virtual void canvas_light_occluder_set_enabled ( RID p_occluder , bool p_enabled ) = 0 ;
2015-03-02 04:54:10 +01:00
virtual void canvas_light_occluder_set_polygon ( RID p_occluder , RID p_polygon ) = 0 ;
2020-11-26 13:50:21 +01:00
virtual void canvas_light_occluder_set_as_sdf_collision ( RID p_occluder , bool p_enable ) = 0 ;
2017-01-11 04:52:51 +01:00
virtual void canvas_light_occluder_set_transform ( RID p_occluder , const Transform2D & p_xform ) = 0 ;
2015-03-02 04:54:10 +01:00
virtual void canvas_light_occluder_set_light_mask ( RID p_occluder , int p_mask ) = 0 ;
2015-01-22 15:07:16 +01:00
2021-07-01 04:17:47 +02:00
/* CANVAS LIGHT OCCLUDER POLYGON */
2015-03-02 04:54:10 +01:00
virtual RID canvas_occluder_polygon_create ( ) = 0 ;
2020-02-17 22:06:54 +01:00
virtual void canvas_occluder_polygon_set_shape ( RID p_occluder_polygon , const Vector < Vector2 > & p_shape , bool p_closed ) = 0 ;
2016-10-03 21:33:42 +02:00
2015-03-02 04:54:10 +01:00
enum CanvasOccluderPolygonCullMode {
CANVAS_OCCLUDER_POLYGON_CULL_DISABLED ,
CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ,
CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE ,
} ;
2020-04-20 11:48:00 +02:00
2015-03-02 04:54:10 +01:00
virtual void canvas_occluder_polygon_set_cull_mode ( RID p_occluder_polygon , CanvasOccluderPolygonCullMode p_mode ) = 0 ;
2015-01-22 15:07:16 +01:00
2020-10-24 17:15:43 +02:00
virtual void canvas_set_shadow_texture_size ( int p_size ) = 0 ;
2022-04-03 18:56:43 +02:00
/* GLOBAL SHADER UNIFORMS */
2020-04-17 04:52:00 +02:00
2022-08-27 11:22:43 +02:00
enum GlobalShaderParameterType {
2020-04-17 04:52:00 +02:00
GLOBAL_VAR_TYPE_BOOL ,
GLOBAL_VAR_TYPE_BVEC2 ,
GLOBAL_VAR_TYPE_BVEC3 ,
GLOBAL_VAR_TYPE_BVEC4 ,
GLOBAL_VAR_TYPE_INT ,
GLOBAL_VAR_TYPE_IVEC2 ,
GLOBAL_VAR_TYPE_IVEC3 ,
GLOBAL_VAR_TYPE_IVEC4 ,
GLOBAL_VAR_TYPE_RECT2I ,
GLOBAL_VAR_TYPE_UINT ,
GLOBAL_VAR_TYPE_UVEC2 ,
GLOBAL_VAR_TYPE_UVEC3 ,
GLOBAL_VAR_TYPE_UVEC4 ,
GLOBAL_VAR_TYPE_FLOAT ,
GLOBAL_VAR_TYPE_VEC2 ,
GLOBAL_VAR_TYPE_VEC3 ,
GLOBAL_VAR_TYPE_VEC4 ,
GLOBAL_VAR_TYPE_COLOR ,
GLOBAL_VAR_TYPE_RECT2 ,
GLOBAL_VAR_TYPE_MAT2 ,
GLOBAL_VAR_TYPE_MAT3 ,
GLOBAL_VAR_TYPE_MAT4 ,
GLOBAL_VAR_TYPE_TRANSFORM_2D ,
GLOBAL_VAR_TYPE_TRANSFORM ,
GLOBAL_VAR_TYPE_SAMPLER2D ,
GLOBAL_VAR_TYPE_SAMPLER2DARRAY ,
GLOBAL_VAR_TYPE_SAMPLER3D ,
GLOBAL_VAR_TYPE_SAMPLERCUBE ,
GLOBAL_VAR_TYPE_MAX
} ;
2022-08-27 11:22:43 +02:00
virtual void global_shader_parameter_add ( const StringName & p_name , GlobalShaderParameterType p_type , const Variant & p_value ) = 0 ;
virtual void global_shader_parameter_remove ( const StringName & p_name ) = 0 ;
virtual Vector < StringName > global_shader_parameter_get_list ( ) const = 0 ;
2020-04-17 04:52:00 +02:00
2022-08-27 11:22:43 +02:00
virtual void global_shader_parameter_set ( const StringName & p_name , const Variant & p_value ) = 0 ;
virtual void global_shader_parameter_set_override ( const StringName & p_name , const Variant & p_value ) = 0 ;
2020-04-17 04:52:00 +02:00
2022-08-27 11:22:43 +02:00
virtual Variant global_shader_parameter_get ( const StringName & p_name ) const = 0 ;
virtual GlobalShaderParameterType global_shader_parameter_get_type ( const StringName & p_name ) const = 0 ;
2020-04-17 04:52:00 +02:00
2022-08-27 11:22:43 +02:00
virtual void global_shader_parameters_load_settings ( bool p_load_textures ) = 0 ;
virtual void global_shader_parameters_clear ( ) = 0 ;
2020-04-17 04:52:00 +02:00
2022-08-27 11:22:43 +02:00
static int global_shader_uniform_type_get_shader_datatype ( GlobalShaderParameterType p_type ) ;
2020-04-17 04:52:00 +02:00
2014-02-10 02:10:30 +01:00
/* FREE */
2021-11-28 01:12:10 +01:00
virtual void free ( RID p_rid ) = 0 ; // Free RIDs associated with the rendering server.
2014-02-10 02:10:30 +01:00
/* EVENT QUEUING */
2021-11-05 06:59:38 +01:00
virtual void request_frame_drawn_callback ( const Callable & p_callable ) = 0 ;
2018-05-09 08:11:43 +02:00
virtual void draw ( bool p_swap_buffers = true , double frame_step = 0.0 ) = 0 ;
2015-06-07 03:06:58 +02:00
virtual void sync ( ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual bool has_changed ( ) const = 0 ;
2022-05-28 13:09:23 +02:00
virtual void init ( ) ;
2014-02-10 02:10:30 +01:00
virtual void finish ( ) = 0 ;
/* STATUS INFORMATION */
2021-07-03 01:14:19 +02:00
enum RenderingInfo {
RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME ,
RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME ,
RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME ,
RENDERING_INFO_TEXTURE_MEM_USED ,
RENDERING_INFO_BUFFER_MEM_USED ,
RENDERING_INFO_VIDEO_MEM_USED ,
RENDERING_INFO_MAX
2014-02-10 02:10:30 +01:00
} ;
2021-07-03 01:14:19 +02:00
virtual uint64_t get_rendering_info ( RenderingInfo p_info ) = 0 ;
2019-09-13 20:08:05 +02:00
virtual String get_video_adapter_name ( ) const = 0 ;
virtual String get_video_adapter_vendor ( ) const = 0 ;
2021-12-10 17:01:51 +01:00
virtual RenderingDevice : : DeviceType get_video_adapter_type ( ) const = 0 ;
2021-07-31 15:39:46 +02:00
virtual String get_video_adapter_api_version ( ) const = 0 ;
2014-05-29 15:56:39 +02:00
2019-09-20 22:58:06 +02:00
struct FrameProfileArea {
String name ;
2021-02-02 03:16:37 +01:00
double gpu_msec ;
double cpu_msec ;
2019-09-20 22:58:06 +02:00
} ;
virtual void set_frame_profiling_enabled ( bool p_enable ) = 0 ;
virtual Vector < FrameProfileArea > get_frame_profile ( ) = 0 ;
virtual uint64_t get_frame_profile_frame ( ) = 0 ;
2021-02-02 03:16:37 +01:00
virtual double get_frame_setup_time_cpu ( ) const = 0 ;
2020-12-24 04:13:52 +01:00
2021-01-23 00:50:24 +01:00
virtual void gi_set_use_half_resolution ( bool p_enable ) = 0 ;
2014-02-10 02:10:30 +01:00
/* TESTING */
2016-03-09 00:00:52 +01:00
2014-02-10 02:10:30 +01:00
virtual RID get_test_cube ( ) = 0 ;
virtual RID get_test_texture ( ) ;
2014-05-29 15:56:39 +02:00
virtual RID get_white_texture ( ) ;
2014-02-10 02:10:30 +01:00
2020-06-25 15:33:28 +02:00
virtual void sdfgi_set_debug_probe_select ( const Vector3 & p_position , const Vector3 & p_dir ) = 0 ;
2021-08-10 00:15:17 +02:00
virtual RID make_sphere_mesh ( int p_lats , int p_lons , real_t p_radius ) ;
2014-02-10 02:10:30 +01:00
2020-05-25 19:20:45 +02:00
virtual void mesh_add_surface_from_mesh_data ( RID p_mesh , const Geometry3D : : MeshData & p_mesh_data ) ;
2020-02-17 22:06:54 +01:00
virtual void mesh_add_surface_from_planes ( RID p_mesh , const Vector < Plane > & p_planes ) ;
2014-02-10 02:10:30 +01:00
2022-01-19 16:09:52 +01:00
virtual void set_boot_image ( const Ref < Image > & p_image , const Color & p_color , bool p_scale , bool p_use_filter = true ) = 0 ;
2023-01-11 19:14:43 +01:00
virtual Color get_default_clear_color ( ) = 0 ;
2014-02-10 02:10:30 +01:00
virtual void set_default_clear_color ( const Color & p_color ) = 0 ;
enum Features {
FEATURE_SHADERS ,
FEATURE_MULTITHREADED ,
} ;
virtual bool has_feature ( Features p_feature ) const = 0 ;
2017-02-06 04:38:39 +01:00
virtual bool has_os_feature ( const String & p_feature ) const = 0 ;
2017-06-11 20:52:03 +02:00
virtual void set_debug_generate_wireframes ( bool p_generate ) = 0 ;
2021-06-19 17:44:59 +02:00
virtual void call_set_vsync_mode ( DisplayServer : : VSyncMode p_mode , DisplayServer : : WindowID p_window ) = 0 ;
2017-12-16 21:09:25 +01:00
2018-09-29 01:32:40 +02:00
virtual bool is_low_end ( ) const = 0 ;
2021-01-23 00:50:24 +01:00
virtual void set_print_gpu_profile ( bool p_enable ) = 0 ;
2022-08-22 00:16:56 +02:00
virtual Size2i get_maximum_viewport_size ( ) const = 0 ;
2021-08-29 04:52:19 +02:00
RenderingDevice * get_rendering_device ( ) const ;
2020-09-17 06:11:39 +02:00
RenderingDevice * create_local_rendering_device ( ) const ;
2020-06-14 19:06:48 +02:00
bool is_render_loop_enabled ( ) const ;
void set_render_loop_enabled ( bool p_enabled ) ;
2020-03-27 19:21:27 +01:00
RenderingServer ( ) ;
virtual ~ RenderingServer ( ) ;
2021-07-01 04:17:47 +02:00
private :
2021-11-28 01:12:10 +01:00
// Binder helpers
2021-07-01 04:17:47 +02:00
RID _texture_2d_layered_create ( const TypedArray < Image > & p_layers , TextureLayeredType p_layered_type ) ;
RID _texture_3d_create ( Image : : Format p_format , int p_width , int p_height , int p_depth , bool p_mipmaps , const TypedArray < Image > & p_data ) ;
void _texture_3d_update ( RID p_texture , const TypedArray < Image > & p_data ) ;
TypedArray < Image > _texture_3d_get ( RID p_texture ) const ;
2022-08-27 11:22:43 +02:00
TypedArray < Dictionary > _shader_get_shader_parameter_list ( RID p_shader ) const ;
2021-07-01 04:17:47 +02:00
RID _mesh_create_from_surfaces ( const TypedArray < Dictionary > & p_surfaces , int p_blend_shape_count ) ;
void _mesh_add_surface ( RID p_mesh , const Dictionary & p_surface ) ;
Dictionary _mesh_get_surface ( RID p_mesh , int p_idx ) ;
2022-08-27 11:22:43 +02:00
TypedArray < Dictionary > _instance_geometry_get_shader_parameter_list ( RID p_instance ) const ;
2021-07-01 04:17:47 +02:00
TypedArray < Image > _bake_render_uv2 ( RID p_base , const TypedArray < RID > & p_material_overrides , const Size2i & p_image_size ) ;
void _particles_set_trail_bind_poses ( RID p_particles , const TypedArray < Transform3D > & p_bind_poses ) ;
2014-02-10 02:10:30 +01:00
} ;
2021-11-28 01:12:10 +01:00
// Make variant understand the enums.
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : TextureLayeredType ) ;
VARIANT_ENUM_CAST ( RenderingServer : : CubeMapLayer ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ShaderMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ArrayType ) ;
2023-01-07 20:37:21 +01:00
VARIANT_BITFIELD_CAST ( RenderingServer : : ArrayFormat ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ArrayCustomFormat ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : PrimitiveType ) ;
VARIANT_ENUM_CAST ( RenderingServer : : BlendShapeMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : MultimeshTransformFormat ) ;
VARIANT_ENUM_CAST ( RenderingServer : : LightType ) ;
VARIANT_ENUM_CAST ( RenderingServer : : LightParam ) ;
2020-06-25 15:33:28 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : LightBakeMode ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : LightOmniShadowMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : LightDirectionalShadowMode ) ;
2021-10-20 00:40:46 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : LightDirectionalSkyMode ) ;
2021-07-19 21:41:55 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : LightProjectorFilter ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ReflectionProbeUpdateMode ) ;
2020-06-25 15:33:28 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ReflectionProbeAmbientMode ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : VoxelGIQuality ) ;
2020-04-14 05:05:21 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : DecalTexture ) ;
2021-07-19 21:41:55 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : DecalFilter ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ParticlesMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ParticlesTransformAlign ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ParticlesDrawOrder ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ParticlesEmitFlags ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ParticlesCollisionType ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ParticlesCollisionHeightfieldResolution ) ;
2021-10-03 13:28:55 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : FogVolumeShape ) ;
2021-11-23 22:16:03 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportScaling3DMode ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportUpdateMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ViewportClearMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ViewportMSAA ) ;
2020-04-20 11:48:00 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportScreenSpaceAA ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportRenderInfo ) ;
2021-07-03 01:14:19 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportRenderInfoType ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportDebugDraw ) ;
2021-04-20 18:40:24 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportOcclusionCullingBuildQuality ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportSDFOversize ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ViewportSDFScale ) ;
2022-02-11 12:33:54 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : ViewportVRSMode ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : SkyMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentBG ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentAmbientSource ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentReflectionSource ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentGlowBlendMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentToneMapper ) ;
2020-04-20 11:48:00 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSSRRoughnessQuality ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSSAOQuality ) ;
2022-01-06 02:35:49 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSSILQuality ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSDFGIFramesToConverge ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSDFGIRayCount ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSDFGIFramesToUpdateLight ) ;
VARIANT_ENUM_CAST ( RenderingServer : : EnvironmentSDFGIYScale ) ;
2020-04-20 11:48:00 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : SubSurfaceScatteringQuality ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : DOFBlurQuality ) ;
VARIANT_ENUM_CAST ( RenderingServer : : DOFBokehShape ) ;
2020-04-20 11:48:00 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : ShadowQuality ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : InstanceType ) ;
VARIANT_ENUM_CAST ( RenderingServer : : InstanceFlags ) ;
VARIANT_ENUM_CAST ( RenderingServer : : ShadowCastingSetting ) ;
2021-07-20 20:17:34 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : VisibilityRangeFadeMode ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : NinePatchAxisMode ) ;
VARIANT_ENUM_CAST ( RenderingServer : : CanvasItemTextureFilter ) ;
VARIANT_ENUM_CAST ( RenderingServer : : CanvasItemTextureRepeat ) ;
2020-11-04 15:38:26 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : CanvasGroupMode ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : CanvasLightMode ) ;
2020-11-03 20:51:53 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : CanvasLightBlendMode ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : CanvasLightShadowFilter ) ;
VARIANT_ENUM_CAST ( RenderingServer : : CanvasOccluderPolygonCullMode ) ;
2022-08-27 11:22:43 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : GlobalShaderParameterType ) ;
2021-07-03 01:14:19 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : RenderingInfo ) ;
2020-03-27 19:21:27 +01:00
VARIANT_ENUM_CAST ( RenderingServer : : Features ) ;
2021-07-01 04:17:47 +02:00
VARIANT_ENUM_CAST ( RenderingServer : : CanvasTextureChannel ) ;
VARIANT_ENUM_CAST ( RenderingServer : : BakeChannels ) ;
2020-03-27 19:21:27 +01:00
2020-04-20 11:48:00 +02:00
// Alias to make it easier to use.
2020-03-27 19:21:27 +01:00
# define RS RenderingServer
2014-02-10 02:10:30 +01:00
2020-04-20 11:48:00 +02:00
# endif // RENDERING_SERVER_H