1/**************************************************************************/
2/* rendering_server.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef RENDERING_SERVER_H
32#define RENDERING_SERVER_H
33
34#include "core/io/image.h"
35#include "core/math/geometry_3d.h"
36#include "core/math/transform_2d.h"
37#include "core/object/class_db.h"
38#include "core/templates/rid.h"
39#include "core/variant/typed_array.h"
40#include "core/variant/variant.h"
41#include "servers/display_server.h"
42#include "servers/rendering/rendering_device.h"
43
44template <typename T>
45class TypedArray;
46
47class RenderingServer : public Object {
48 GDCLASS(RenderingServer, Object);
49
50 static RenderingServer *singleton;
51
52 int mm_policy = 0;
53 bool render_loop_enabled = true;
54
55 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;
56
57 const Vector2 SMALL_VEC2 = Vector2(CMP_EPSILON, CMP_EPSILON);
58 const Vector3 SMALL_VEC3 = Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON);
59
60 virtual TypedArray<StringName> _global_shader_parameter_get_list() const;
61
62protected:
63 RID _make_test_cube();
64 void _free_internal_rids();
65 RID test_texture;
66 RID white_texture;
67 RID test_material;
68
69 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);
70
71 static RenderingServer *(*create_func)();
72 static void _bind_methods();
73
74public:
75 static RenderingServer *get_singleton();
76 static RenderingServer *create();
77
78 enum {
79 NO_INDEX_ARRAY = -1,
80 ARRAY_WEIGHTS_SIZE = 4,
81 CANVAS_ITEM_Z_MIN = -4096,
82 CANVAS_ITEM_Z_MAX = 4096,
83 MAX_GLOW_LEVELS = 7,
84 MAX_CURSORS = 8,
85 MAX_2D_DIRECTIONAL_LIGHTS = 8,
86 MAX_MESH_SURFACES = 256
87 };
88
89 /* TEXTURE API */
90
91 enum TextureLayeredType {
92 TEXTURE_LAYERED_2D_ARRAY,
93 TEXTURE_LAYERED_CUBEMAP,
94 TEXTURE_LAYERED_CUBEMAP_ARRAY,
95 };
96
97 enum CubeMapLayer {
98 CUBEMAP_LAYER_LEFT,
99 CUBEMAP_LAYER_RIGHT,
100 CUBEMAP_LAYER_BOTTOM,
101 CUBEMAP_LAYER_TOP,
102 CUBEMAP_LAYER_FRONT,
103 CUBEMAP_LAYER_BACK
104 };
105
106 virtual RID texture_2d_create(const Ref<Image> &p_image) = 0;
107 virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, TextureLayeredType p_layered_type) = 0;
108 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
109 virtual RID texture_proxy_create(RID p_base) = 0;
110
111 virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) = 0;
112 virtual void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) = 0;
113 virtual void texture_proxy_update(RID p_texture, RID p_proxy_to) = 0;
114
115 // These two APIs can be used together or in combination with the others.
116 virtual RID texture_2d_placeholder_create() = 0;
117 virtual RID texture_2d_layered_placeholder_create(TextureLayeredType p_layered_type) = 0;
118 virtual RID texture_3d_placeholder_create() = 0;
119
120 virtual Ref<Image> texture_2d_get(RID p_texture) const = 0;
121 virtual Ref<Image> texture_2d_layer_get(RID p_texture, int p_layer) const = 0;
122 virtual Vector<Ref<Image>> texture_3d_get(RID p_texture) const = 0;
123
124 virtual void texture_replace(RID p_texture, RID p_by_texture) = 0;
125 virtual void texture_set_size_override(RID p_texture, int p_width, int p_height) = 0;
126
127 virtual void texture_set_path(RID p_texture, const String &p_path) = 0;
128 virtual String texture_get_path(RID p_texture) const = 0;
129
130 virtual Image::Format texture_get_format(RID p_texture) const = 0;
131
132 typedef void (*TextureDetectCallback)(void *);
133
134 virtual void texture_set_detect_3d_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
135 virtual void texture_set_detect_normal_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
136
137 enum TextureDetectRoughnessChannel {
138 TEXTURE_DETECT_ROUGHNESS_R,
139 TEXTURE_DETECT_ROUGHNESS_G,
140 TEXTURE_DETECT_ROUGHNESS_B,
141 TEXTURE_DETECT_ROUGHNESS_A,
142 TEXTURE_DETECT_ROUGHNESS_GRAY,
143 };
144
145 typedef void (*TextureDetectRoughnessCallback)(void *, const String &, TextureDetectRoughnessChannel);
146 virtual void texture_set_detect_roughness_callback(RID p_texture, TextureDetectRoughnessCallback p_callback, void *p_userdata) = 0;
147
148 struct TextureInfo {
149 RID texture;
150 uint32_t width;
151 uint32_t height;
152 uint32_t depth;
153 Image::Format format;
154 int bytes;
155 String path;
156 };
157
158 virtual void texture_debug_usage(List<TextureInfo> *r_info) = 0;
159 Array _texture_debug_usage_bind();
160
161 virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) = 0;
162
163 virtual RID texture_rd_create(const RID &p_rd_texture, const RenderingServer::TextureLayeredType p_layer_type = RenderingServer::TEXTURE_LAYERED_2D_ARRAY) = 0;
164 virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const = 0;
165 virtual uint64_t texture_get_native_handle(RID p_texture, bool p_srgb = false) const = 0;
166
167 /* SHADER API */
168
169 enum ShaderMode {
170 SHADER_SPATIAL,
171 SHADER_CANVAS_ITEM,
172 SHADER_PARTICLES,
173 SHADER_SKY,
174 SHADER_FOG,
175 SHADER_MAX
176 };
177
178 virtual RID shader_create() = 0;
179
180 virtual void shader_set_code(RID p_shader, const String &p_code) = 0;
181 virtual void shader_set_path_hint(RID p_shader, const String &p_path) = 0;
182 virtual String shader_get_code(RID p_shader) const = 0;
183 virtual void get_shader_parameter_list(RID p_shader, List<PropertyInfo> *p_param_list) const = 0;
184 virtual Variant shader_get_parameter_default(RID p_shader, const StringName &p_param) const = 0;
185
186 virtual void shader_set_default_texture_parameter(RID p_shader, const StringName &p_name, RID p_texture, int p_index = 0) = 0;
187 virtual RID shader_get_default_texture_parameter(RID p_shader, const StringName &p_name, int p_index = 0) const = 0;
188
189 struct ShaderNativeSourceCode {
190 struct Version {
191 struct Stage {
192 String name;
193 String code;
194 };
195 Vector<Stage> stages;
196 };
197 Vector<Version> versions;
198 };
199
200 virtual ShaderNativeSourceCode shader_get_native_source_code(RID p_shader) const = 0;
201
202 /* COMMON MATERIAL API */
203
204 enum {
205 MATERIAL_RENDER_PRIORITY_MIN = -128,
206 MATERIAL_RENDER_PRIORITY_MAX = 127,
207 };
208
209 virtual RID material_create() = 0;
210
211 virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0;
212
213 virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
214 virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
215
216 virtual void material_set_render_priority(RID p_material, int priority) = 0;
217
218 virtual void material_set_next_pass(RID p_material, RID p_next_material) = 0;
219
220 /* MESH API */
221
222 enum ArrayType {
223 ARRAY_VERTEX = 0, // RG32F or RGB32F (depending on 2D bit)
224 ARRAY_NORMAL = 1, // A2B10G10R10, A is ignored.
225 ARRAY_TANGENT = 2, // A2B10G10R10, A flips sign of binormal.
226 ARRAY_COLOR = 3, // RGBA8
227 ARRAY_TEX_UV = 4, // RG32F
228 ARRAY_TEX_UV2 = 5, // RG32F
229 ARRAY_CUSTOM0 = 6, // Depends on ArrayCustomFormat.
230 ARRAY_CUSTOM1 = 7,
231 ARRAY_CUSTOM2 = 8,
232 ARRAY_CUSTOM3 = 9,
233 ARRAY_BONES = 10, // RGBA16UI (x2 if 8 weights)
234 ARRAY_WEIGHTS = 11, // RGBA16UNORM (x2 if 8 weights)
235 ARRAY_INDEX = 12, // 16 or 32 bits depending on length > 0xFFFF.
236 ARRAY_MAX = 13
237 };
238
239 enum {
240 ARRAY_CUSTOM_COUNT = ARRAY_BONES - ARRAY_CUSTOM0
241 };
242
243 enum ArrayCustomFormat {
244 ARRAY_CUSTOM_RGBA8_UNORM,
245 ARRAY_CUSTOM_RGBA8_SNORM,
246 ARRAY_CUSTOM_RG_HALF,
247 ARRAY_CUSTOM_RGBA_HALF,
248 ARRAY_CUSTOM_R_FLOAT,
249 ARRAY_CUSTOM_RG_FLOAT,
250 ARRAY_CUSTOM_RGB_FLOAT,
251 ARRAY_CUSTOM_RGBA_FLOAT,
252 ARRAY_CUSTOM_MAX
253 };
254
255 enum ArrayFormat {
256 /* ARRAY FORMAT FLAGS */
257 ARRAY_FORMAT_VERTEX = 1 << ARRAY_VERTEX,
258 ARRAY_FORMAT_NORMAL = 1 << ARRAY_NORMAL,
259 ARRAY_FORMAT_TANGENT = 1 << ARRAY_TANGENT,
260 ARRAY_FORMAT_COLOR = 1 << ARRAY_COLOR,
261 ARRAY_FORMAT_TEX_UV = 1 << ARRAY_TEX_UV,
262 ARRAY_FORMAT_TEX_UV2 = 1 << ARRAY_TEX_UV2,
263 ARRAY_FORMAT_CUSTOM0 = 1 << ARRAY_CUSTOM0,
264 ARRAY_FORMAT_CUSTOM1 = 1 << ARRAY_CUSTOM1,
265 ARRAY_FORMAT_CUSTOM2 = 1 << ARRAY_CUSTOM2,
266 ARRAY_FORMAT_CUSTOM3 = 1 << ARRAY_CUSTOM3,
267 ARRAY_FORMAT_BONES = 1 << ARRAY_BONES,
268 ARRAY_FORMAT_WEIGHTS = 1 << ARRAY_WEIGHTS,
269 ARRAY_FORMAT_INDEX = 1 << ARRAY_INDEX,
270
271 ARRAY_FORMAT_BLEND_SHAPE_MASK = ARRAY_FORMAT_VERTEX | ARRAY_FORMAT_NORMAL | ARRAY_FORMAT_TANGENT,
272
273 ARRAY_FORMAT_CUSTOM_BASE = (ARRAY_INDEX + 1),
274 ARRAY_FORMAT_CUSTOM_BITS = 3,
275 ARRAY_FORMAT_CUSTOM_MASK = 0x7,
276 ARRAY_FORMAT_CUSTOM0_SHIFT = (ARRAY_FORMAT_CUSTOM_BASE + 0),
277 ARRAY_FORMAT_CUSTOM1_SHIFT = (ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS),
278 ARRAY_FORMAT_CUSTOM2_SHIFT = (ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * 2),
279 ARRAY_FORMAT_CUSTOM3_SHIFT = (ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * 3),
280
281 ARRAY_COMPRESS_FLAGS_BASE = (ARRAY_INDEX + 1 + 12),
282
283 ARRAY_FLAG_USE_2D_VERTICES = 1 << (ARRAY_COMPRESS_FLAGS_BASE + 0),
284 ARRAY_FLAG_USE_DYNAMIC_UPDATE = 1 << (ARRAY_COMPRESS_FLAGS_BASE + 1),
285 ARRAY_FLAG_USE_8_BONE_WEIGHTS = 1 << (ARRAY_COMPRESS_FLAGS_BASE + 2),
286
287 ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = 1 << (ARRAY_INDEX + 1 + 15),
288 };
289
290 enum PrimitiveType {
291 PRIMITIVE_POINTS,
292 PRIMITIVE_LINES,
293 PRIMITIVE_LINE_STRIP,
294 PRIMITIVE_TRIANGLES,
295 PRIMITIVE_TRIANGLE_STRIP,
296 PRIMITIVE_MAX,
297 };
298
299 struct SurfaceData {
300 PrimitiveType primitive = PRIMITIVE_MAX;
301
302 uint32_t format = 0;
303 Vector<uint8_t> vertex_data; // Vertex, Normal, Tangent (change with skinning, blendshape).
304 Vector<uint8_t> attribute_data; // Color, UV, UV2, Custom0-3.
305 Vector<uint8_t> skin_data; // Bone index, Bone weight.
306 uint32_t vertex_count = 0;
307 Vector<uint8_t> index_data;
308 uint32_t index_count = 0;
309
310 AABB aabb;
311 struct LOD {
312 float edge_length = 0.0f;
313 Vector<uint8_t> index_data;
314 };
315 Vector<LOD> lods;
316 Vector<AABB> bone_aabbs;
317
318 Vector<uint8_t> blend_shape_data;
319
320 RID material;
321 };
322
323 virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces, int p_blend_shape_count = 0) = 0;
324 virtual RID mesh_create() = 0;
325
326 virtual void mesh_set_blend_shape_count(RID p_mesh, int p_blend_shape_count) = 0;
327
328 virtual uint32_t mesh_surface_get_format_offset(BitField<ArrayFormat> p_format, int p_vertex_len, int p_array_index) const;
329 virtual uint32_t mesh_surface_get_format_vertex_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const;
330 virtual uint32_t mesh_surface_get_format_attribute_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const;
331 virtual uint32_t mesh_surface_get_format_skin_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const;
332
333 /// Returns stride
334 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;
335 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);
336 Array mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const;
337 Array mesh_surface_get_arrays(RID p_mesh, int p_surface) const;
338 TypedArray<Array> mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const;
339 Dictionary mesh_surface_get_lods(RID p_mesh, int p_surface) const;
340
341 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);
342 virtual void mesh_add_surface(RID p_mesh, const SurfaceData &p_surface) = 0;
343
344 virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0;
345
346 enum BlendShapeMode {
347 BLEND_SHAPE_MODE_NORMALIZED,
348 BLEND_SHAPE_MODE_RELATIVE,
349 };
350
351 virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0;
352 virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
353
354 virtual void mesh_surface_update_vertex_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0;
355 virtual void mesh_surface_update_attribute_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0;
356 virtual void mesh_surface_update_skin_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0;
357
358 virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0;
359 virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0;
360
361 virtual SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const = 0;
362
363 virtual int mesh_get_surface_count(RID p_mesh) const = 0;
364
365 virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0;
366 virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0;
367
368 virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) = 0;
369
370 virtual void mesh_clear(RID p_mesh) = 0;
371
372 /* MULTIMESH API */
373
374 virtual RID multimesh_create() = 0;
375
376 enum MultimeshTransformFormat {
377 MULTIMESH_TRANSFORM_2D,
378 MULTIMESH_TRANSFORM_3D,
379 };
380
381 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;
382 virtual int multimesh_get_instance_count(RID p_multimesh) const = 0;
383
384 virtual void multimesh_set_mesh(RID p_multimesh, RID p_mesh) = 0;
385 virtual void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform3D &p_transform) = 0;
386 virtual void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) = 0;
387 virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) = 0;
388 virtual void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) = 0;
389
390 virtual RID multimesh_get_mesh(RID p_multimesh) const = 0;
391 virtual AABB multimesh_get_aabb(RID p_multimesh) const = 0;
392
393 virtual Transform3D multimesh_instance_get_transform(RID p_multimesh, int p_index) const = 0;
394 virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const = 0;
395 virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0;
396 virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0;
397
398 virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0;
399 virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const = 0;
400
401 virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0;
402 virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0;
403
404 /* SKELETON API */
405
406 virtual RID skeleton_create() = 0;
407 virtual void skeleton_allocate_data(RID p_skeleton, int p_bones, bool p_2d_skeleton = false) = 0;
408 virtual int skeleton_get_bone_count(RID p_skeleton) const = 0;
409 virtual void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform3D &p_transform) = 0;
410 virtual Transform3D skeleton_bone_get_transform(RID p_skeleton, int p_bone) const = 0;
411 virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) = 0;
412 virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const = 0;
413 virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) = 0;
414
415 /* Light API */
416
417 enum LightType {
418 LIGHT_DIRECTIONAL,
419 LIGHT_OMNI,
420 LIGHT_SPOT
421 };
422
423 enum LightParam {
424 LIGHT_PARAM_ENERGY,
425 LIGHT_PARAM_INDIRECT_ENERGY,
426 LIGHT_PARAM_VOLUMETRIC_FOG_ENERGY,
427 LIGHT_PARAM_SPECULAR,
428 LIGHT_PARAM_RANGE,
429 LIGHT_PARAM_SIZE,
430 LIGHT_PARAM_ATTENUATION,
431 LIGHT_PARAM_SPOT_ANGLE,
432 LIGHT_PARAM_SPOT_ATTENUATION,
433 LIGHT_PARAM_SHADOW_MAX_DISTANCE,
434 LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
435 LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
436 LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
437 LIGHT_PARAM_SHADOW_FADE_START,
438 LIGHT_PARAM_SHADOW_NORMAL_BIAS,
439 LIGHT_PARAM_SHADOW_BIAS,
440 LIGHT_PARAM_SHADOW_PANCAKE_SIZE,
441 LIGHT_PARAM_SHADOW_OPACITY,
442 LIGHT_PARAM_SHADOW_BLUR,
443 LIGHT_PARAM_TRANSMITTANCE_BIAS,
444 LIGHT_PARAM_INTENSITY,
445 LIGHT_PARAM_MAX
446 };
447
448 virtual RID directional_light_create() = 0;
449 virtual RID omni_light_create() = 0;
450 virtual RID spot_light_create() = 0;
451
452 virtual void light_set_color(RID p_light, const Color &p_color) = 0;
453 virtual void light_set_param(RID p_light, LightParam p_param, float p_value) = 0;
454 virtual void light_set_shadow(RID p_light, bool p_enabled) = 0;
455 virtual void light_set_projector(RID p_light, RID p_texture) = 0;
456 virtual void light_set_negative(RID p_light, bool p_enable) = 0;
457 virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
458 virtual void light_set_distance_fade(RID p_light, bool p_enabled, float p_begin, float p_shadow, float p_length) = 0;
459 virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
460
461 enum LightBakeMode {
462 LIGHT_BAKE_DISABLED,
463 LIGHT_BAKE_STATIC,
464 LIGHT_BAKE_DYNAMIC,
465 };
466
467 virtual void light_set_bake_mode(RID p_light, LightBakeMode p_bake_mode) = 0;
468 virtual void light_set_max_sdfgi_cascade(RID p_light, uint32_t p_cascade) = 0;
469
470 // Omni light
471 enum LightOmniShadowMode {
472 LIGHT_OMNI_SHADOW_DUAL_PARABOLOID,
473 LIGHT_OMNI_SHADOW_CUBE,
474 };
475
476 virtual void light_omni_set_shadow_mode(RID p_light, LightOmniShadowMode p_mode) = 0;
477
478 // Directional light
479 enum LightDirectionalShadowMode {
480 LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL,
481 LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS,
482 LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS,
483 };
484
485 enum LightDirectionalSkyMode {
486 LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_AND_SKY,
487 LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_ONLY,
488 LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY,
489 };
490
491 virtual void light_directional_set_shadow_mode(RID p_light, LightDirectionalShadowMode p_mode) = 0;
492 virtual void light_directional_set_blend_splits(RID p_light, bool p_enable) = 0;
493 virtual void light_directional_set_sky_mode(RID p_light, LightDirectionalSkyMode p_mode) = 0;
494
495 // Shadow atlas
496
497 virtual RID shadow_atlas_create() = 0;
498 virtual void shadow_atlas_set_size(RID p_atlas, int p_size, bool p_use_16_bits = true) = 0;
499 virtual void shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) = 0;
500
501 virtual void directional_shadow_atlas_set_size(int p_size, bool p_16_bits = true) = 0;
502
503 enum ShadowQuality {
504 SHADOW_QUALITY_HARD,
505 SHADOW_QUALITY_SOFT_VERY_LOW,
506 SHADOW_QUALITY_SOFT_LOW,
507 SHADOW_QUALITY_SOFT_MEDIUM,
508 SHADOW_QUALITY_SOFT_HIGH,
509 SHADOW_QUALITY_SOFT_ULTRA,
510 SHADOW_QUALITY_MAX
511 };
512
513 virtual void positional_soft_shadow_filter_set_quality(ShadowQuality p_quality) = 0;
514 virtual void directional_soft_shadow_filter_set_quality(ShadowQuality p_quality) = 0;
515
516 enum LightProjectorFilter {
517 LIGHT_PROJECTOR_FILTER_NEAREST,
518 LIGHT_PROJECTOR_FILTER_LINEAR,
519 LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS,
520 LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS,
521 LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS_ANISOTROPIC,
522 LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS_ANISOTROPIC,
523 };
524
525 virtual void light_projectors_set_filter(LightProjectorFilter p_filter) = 0;
526
527 /* PROBE API */
528
529 virtual RID reflection_probe_create() = 0;
530
531 enum ReflectionProbeUpdateMode {
532 REFLECTION_PROBE_UPDATE_ONCE,
533 REFLECTION_PROBE_UPDATE_ALWAYS,
534 };
535
536 virtual void reflection_probe_set_update_mode(RID p_probe, ReflectionProbeUpdateMode p_mode) = 0;
537 virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity) = 0;
538
539 enum ReflectionProbeAmbientMode {
540 REFLECTION_PROBE_AMBIENT_DISABLED,
541 REFLECTION_PROBE_AMBIENT_ENVIRONMENT,
542 REFLECTION_PROBE_AMBIENT_COLOR,
543 };
544
545 virtual void reflection_probe_set_ambient_mode(RID p_probe, ReflectionProbeAmbientMode p_mode) = 0;
546 virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) = 0;
547 virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) = 0;
548 virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
549 virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) = 0;
550 virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
551 virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
552 virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
553 virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) = 0;
554 virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
555 virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution) = 0;
556 virtual void reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_pixels) = 0;
557
558 /* DECAL API */
559
560 enum DecalTexture {
561 DECAL_TEXTURE_ALBEDO,
562 DECAL_TEXTURE_NORMAL,
563 DECAL_TEXTURE_ORM,
564 DECAL_TEXTURE_EMISSION,
565 DECAL_TEXTURE_MAX
566 };
567
568 virtual RID decal_create() = 0;
569 virtual void decal_set_size(RID p_decal, const Vector3 &p_size) = 0;
570 virtual void decal_set_texture(RID p_decal, DecalTexture p_type, RID p_texture) = 0;
571 virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0;
572 virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0;
573 virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) = 0;
574 virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) = 0;
575 virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) = 0;
576 virtual void decal_set_fade(RID p_decal, float p_above, float p_below) = 0;
577 virtual void decal_set_normal_fade(RID p_decal, float p_fade) = 0;
578
579 enum DecalFilter {
580 DECAL_FILTER_NEAREST,
581 DECAL_FILTER_LINEAR,
582 DECAL_FILTER_NEAREST_MIPMAPS,
583 DECAL_FILTER_LINEAR_MIPMAPS,
584 DECAL_FILTER_NEAREST_MIPMAPS_ANISOTROPIC,
585 DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC,
586 };
587
588 virtual void decals_set_filter(DecalFilter p_quality) = 0;
589
590 /* VOXEL GI API */
591
592 virtual RID voxel_gi_create() = 0;
593
594 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;
595
596 virtual AABB voxel_gi_get_bounds(RID p_voxel_gi) const = 0;
597 virtual Vector3i voxel_gi_get_octree_size(RID p_voxel_gi) const = 0;
598 virtual Vector<uint8_t> voxel_gi_get_octree_cells(RID p_voxel_gi) const = 0;
599 virtual Vector<uint8_t> voxel_gi_get_data_cells(RID p_voxel_gi) const = 0;
600 virtual Vector<uint8_t> voxel_gi_get_distance_field(RID p_voxel_gi) const = 0;
601 virtual Vector<int> voxel_gi_get_level_counts(RID p_voxel_gi) const = 0;
602 virtual Transform3D voxel_gi_get_to_cell_xform(RID p_voxel_gi) const = 0;
603
604 virtual void voxel_gi_set_dynamic_range(RID p_voxel_gi, float p_range) = 0;
605 virtual void voxel_gi_set_propagation(RID p_voxel_gi, float p_range) = 0;
606 virtual void voxel_gi_set_energy(RID p_voxel_gi, float p_energy) = 0;
607 virtual void voxel_gi_set_baked_exposure_normalization(RID p_voxel_gi, float p_baked_exposure) = 0;
608 virtual void voxel_gi_set_bias(RID p_voxel_gi, float p_bias) = 0;
609 virtual void voxel_gi_set_normal_bias(RID p_voxel_gi, float p_range) = 0;
610 virtual void voxel_gi_set_interior(RID p_voxel_gi, bool p_enable) = 0;
611 virtual void voxel_gi_set_use_two_bounces(RID p_voxel_gi, bool p_enable) = 0;
612
613 enum VoxelGIQuality {
614 VOXEL_GI_QUALITY_LOW,
615 VOXEL_GI_QUALITY_HIGH,
616 };
617
618 virtual void voxel_gi_set_quality(VoxelGIQuality) = 0;
619
620 /* LIGHTMAP */
621
622 virtual RID lightmap_create() = 0;
623
624 virtual void lightmap_set_textures(RID p_lightmap, RID p_light, bool p_uses_spherical_haromics) = 0;
625 virtual void lightmap_set_probe_bounds(RID p_lightmap, const AABB &p_bounds) = 0;
626 virtual void lightmap_set_probe_interior(RID p_lightmap, bool p_interior) = 0;
627 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;
628 virtual void lightmap_set_baked_exposure_normalization(RID p_lightmap, float p_exposure) = 0;
629 virtual PackedVector3Array lightmap_get_probe_capture_points(RID p_lightmap) const = 0;
630 virtual PackedColorArray lightmap_get_probe_capture_sh(RID p_lightmap) const = 0;
631 virtual PackedInt32Array lightmap_get_probe_capture_tetrahedra(RID p_lightmap) const = 0;
632 virtual PackedInt32Array lightmap_get_probe_capture_bsp_tree(RID p_lightmap) const = 0;
633
634 virtual void lightmap_set_probe_capture_update_speed(float p_speed) = 0;
635
636 /* PARTICLES API */
637
638 virtual RID particles_create() = 0;
639
640 enum ParticlesMode {
641 PARTICLES_MODE_2D,
642 PARTICLES_MODE_3D
643 };
644 virtual void particles_set_mode(RID p_particles, ParticlesMode p_mode) = 0;
645
646 virtual void particles_set_emitting(RID p_particles, bool p_enable) = 0;
647 virtual bool particles_get_emitting(RID p_particles) = 0;
648 virtual void particles_set_amount(RID p_particles, int p_amount) = 0;
649 virtual void particles_set_lifetime(RID p_particles, double p_lifetime) = 0;
650 virtual void particles_set_one_shot(RID p_particles, bool p_one_shot) = 0;
651 virtual void particles_set_pre_process_time(RID p_particles, double p_time) = 0;
652 virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0;
653 virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0;
654 virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) = 0;
655 virtual void particles_set_speed_scale(RID p_particles, double p_scale) = 0;
656 virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0;
657 virtual void particles_set_process_material(RID p_particles, RID p_material) = 0;
658 virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0;
659 virtual void particles_set_interpolate(RID p_particles, bool p_enable) = 0;
660 virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0;
661 virtual void particles_set_collision_base_size(RID p_particles, float p_size) = 0;
662
663 enum ParticlesTransformAlign {
664 PARTICLES_TRANSFORM_ALIGN_DISABLED,
665 PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD,
666 PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY,
667 PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY,
668 };
669
670 virtual void particles_set_transform_align(RID p_particles, ParticlesTransformAlign p_transform_align) = 0;
671
672 virtual void particles_set_trails(RID p_particles, bool p_enable, float p_length_sec) = 0;
673 virtual void particles_set_trail_bind_poses(RID p_particles, const Vector<Transform3D> &p_bind_poses) = 0;
674
675 virtual bool particles_is_inactive(RID p_particles) = 0;
676 virtual void particles_request_process(RID p_particles) = 0;
677 virtual void particles_restart(RID p_particles) = 0;
678
679 virtual void particles_set_subemitter(RID p_particles, RID p_subemitter_particles) = 0;
680
681 enum ParticlesEmitFlags {
682 PARTICLES_EMIT_FLAG_POSITION = 1,
683 PARTICLES_EMIT_FLAG_ROTATION_SCALE = 2,
684 PARTICLES_EMIT_FLAG_VELOCITY = 4,
685 PARTICLES_EMIT_FLAG_COLOR = 8,
686 PARTICLES_EMIT_FLAG_CUSTOM = 16
687 };
688
689 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;
690
691 enum ParticlesDrawOrder {
692 PARTICLES_DRAW_ORDER_INDEX,
693 PARTICLES_DRAW_ORDER_LIFETIME,
694 PARTICLES_DRAW_ORDER_REVERSE_LIFETIME,
695 PARTICLES_DRAW_ORDER_VIEW_DEPTH,
696 };
697
698 virtual void particles_set_draw_order(RID p_particles, ParticlesDrawOrder p_order) = 0;
699
700 virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0;
701 virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) = 0;
702
703 virtual AABB particles_get_current_aabb(RID p_particles) = 0;
704
705 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.
706
707 /* PARTICLES COLLISION API */
708
709 virtual RID particles_collision_create() = 0;
710
711 enum ParticlesCollisionType {
712 PARTICLES_COLLISION_TYPE_SPHERE_ATTRACT,
713 PARTICLES_COLLISION_TYPE_BOX_ATTRACT,
714 PARTICLES_COLLISION_TYPE_VECTOR_FIELD_ATTRACT,
715 PARTICLES_COLLISION_TYPE_SPHERE_COLLIDE,
716 PARTICLES_COLLISION_TYPE_BOX_COLLIDE,
717 PARTICLES_COLLISION_TYPE_SDF_COLLIDE,
718 PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE,
719 };
720
721 virtual void particles_collision_set_collision_type(RID p_particles_collision, ParticlesCollisionType p_type) = 0;
722 virtual void particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask) = 0;
723 virtual void particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) = 0; // For spheres.
724 virtual void particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents) = 0; // For non-spheres.
725 virtual void particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) = 0;
726 virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) = 0;
727 virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) = 0;
728 virtual void particles_collision_set_field_texture(RID p_particles_collision, RID p_texture) = 0; // For SDF and vector field, heightfield is dynamic.
729
730 virtual void particles_collision_height_field_update(RID p_particles_collision) = 0; // For SDF and vector field.
731
732 enum ParticlesCollisionHeightfieldResolution { // Longest axis resolution.
733 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_256,
734 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_512,
735 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_1024,
736 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_2048,
737 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_4096,
738 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_8192,
739 PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX,
740 };
741
742 virtual void particles_collision_set_height_field_resolution(RID p_particles_collision, ParticlesCollisionHeightfieldResolution p_resolution) = 0; // For SDF and vector field.
743
744 /* FOG VOLUME API */
745
746 virtual RID fog_volume_create() = 0;
747
748 enum FogVolumeShape {
749 FOG_VOLUME_SHAPE_ELLIPSOID,
750 FOG_VOLUME_SHAPE_CONE,
751 FOG_VOLUME_SHAPE_CYLINDER,
752 FOG_VOLUME_SHAPE_BOX,
753 FOG_VOLUME_SHAPE_WORLD,
754 FOG_VOLUME_SHAPE_MAX,
755 };
756
757 virtual void fog_volume_set_shape(RID p_fog_volume, FogVolumeShape p_shape) = 0;
758 virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) = 0;
759 virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) = 0;
760
761 /* VISIBILITY NOTIFIER API */
762
763 virtual RID visibility_notifier_create() = 0;
764 virtual void visibility_notifier_set_aabb(RID p_notifier, const AABB &p_aabb) = 0;
765 virtual void visibility_notifier_set_callbacks(RID p_notifier, const Callable &p_enter_callbable, const Callable &p_exit_callable) = 0;
766
767 /* OCCLUDER API */
768
769 virtual RID occluder_create() = 0;
770 virtual void occluder_set_mesh(RID p_occluder, const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices) = 0;
771
772 /* CAMERA API */
773
774 virtual RID camera_create() = 0;
775 virtual void camera_set_perspective(RID p_camera, float p_fovy_degrees, float p_z_near, float p_z_far) = 0;
776 virtual void camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) = 0;
777 virtual void camera_set_frustum(RID p_camera, float p_size, Vector2 p_offset, float p_z_near, float p_z_far) = 0;
778 virtual void camera_set_transform(RID p_camera, const Transform3D &p_transform) = 0;
779 virtual void camera_set_cull_mask(RID p_camera, uint32_t p_layers) = 0;
780 virtual void camera_set_environment(RID p_camera, RID p_env) = 0;
781 virtual void camera_set_camera_attributes(RID p_camera, RID p_camera_attributes) = 0;
782 virtual void camera_set_use_vertical_aspect(RID p_camera, bool p_enable) = 0;
783
784 /* VIEWPORT API */
785
786 enum CanvasItemTextureFilter {
787 CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, // Uses canvas item setting for draw command, uses global setting for canvas item.
788 CANVAS_ITEM_TEXTURE_FILTER_NEAREST,
789 CANVAS_ITEM_TEXTURE_FILTER_LINEAR,
790 CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS,
791 CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS,
792 CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC,
793 CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC,
794 CANVAS_ITEM_TEXTURE_FILTER_MAX
795 };
796
797 enum CanvasItemTextureRepeat {
798 CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, // Uses canvas item setting for draw command, uses global setting for canvas item.
799 CANVAS_ITEM_TEXTURE_REPEAT_DISABLED,
800 CANVAS_ITEM_TEXTURE_REPEAT_ENABLED,
801 CANVAS_ITEM_TEXTURE_REPEAT_MIRROR,
802 CANVAS_ITEM_TEXTURE_REPEAT_MAX,
803 };
804
805 virtual RID viewport_create() = 0;
806
807 enum ViewportScaling3DMode {
808 VIEWPORT_SCALING_3D_MODE_BILINEAR,
809 VIEWPORT_SCALING_3D_MODE_FSR,
810 VIEWPORT_SCALING_3D_MODE_MAX,
811 VIEWPORT_SCALING_3D_MODE_OFF = 255, // for internal use only
812 };
813
814 virtual void viewport_set_use_xr(RID p_viewport, bool p_use_xr) = 0;
815 virtual void viewport_set_size(RID p_viewport, int p_width, int p_height) = 0;
816 virtual void viewport_set_active(RID p_viewport, bool p_active) = 0;
817 virtual void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) = 0;
818 virtual void viewport_set_canvas_cull_mask(RID p_viewport, uint32_t p_canvas_cull_mask) = 0;
819
820 virtual void viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect = Rect2(), DisplayServer::WindowID p_screen = DisplayServer::MAIN_WINDOW_ID) = 0;
821 virtual void viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) = 0;
822
823 virtual void viewport_set_scaling_3d_mode(RID p_viewport, ViewportScaling3DMode p_scaling_3d_mode) = 0;
824 virtual void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale) = 0;
825 virtual void viewport_set_fsr_sharpness(RID p_viewport, float p_fsr_sharpness) = 0;
826 virtual void viewport_set_texture_mipmap_bias(RID p_viewport, float p_texture_mipmap_bias) = 0;
827
828 enum ViewportUpdateMode {
829 VIEWPORT_UPDATE_DISABLED,
830 VIEWPORT_UPDATE_ONCE, // Then goes to disabled, must be manually updated.
831 VIEWPORT_UPDATE_WHEN_VISIBLE, // Default
832 VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE,
833 VIEWPORT_UPDATE_ALWAYS
834 };
835
836 virtual void viewport_set_update_mode(RID p_viewport, ViewportUpdateMode p_mode) = 0;
837
838 enum ViewportClearMode {
839 VIEWPORT_CLEAR_ALWAYS,
840 VIEWPORT_CLEAR_NEVER,
841 VIEWPORT_CLEAR_ONLY_NEXT_FRAME
842 };
843
844 virtual void viewport_set_clear_mode(RID p_viewport, ViewportClearMode p_clear_mode) = 0;
845
846 virtual RID viewport_get_render_target(RID p_viewport) const = 0;
847 virtual RID viewport_get_texture(RID p_viewport) const = 0;
848
849 enum ViewportEnvironmentMode {
850 VIEWPORT_ENVIRONMENT_DISABLED,
851 VIEWPORT_ENVIRONMENT_ENABLED,
852 VIEWPORT_ENVIRONMENT_INHERIT,
853 VIEWPORT_ENVIRONMENT_MAX,
854 };
855
856 virtual void viewport_set_environment_mode(RID p_viewport, ViewportEnvironmentMode p_mode) = 0;
857 virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
858 virtual void viewport_set_disable_2d(RID p_viewport, bool p_disable) = 0;
859
860 virtual void viewport_attach_camera(RID p_viewport, RID p_camera) = 0;
861 virtual void viewport_set_scenario(RID p_viewport, RID p_scenario) = 0;
862 virtual void viewport_attach_canvas(RID p_viewport, RID p_canvas) = 0;
863 virtual void viewport_remove_canvas(RID p_viewport, RID p_canvas) = 0;
864 virtual void viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) = 0;
865 virtual void viewport_set_transparent_background(RID p_viewport, bool p_enabled) = 0;
866 virtual void viewport_set_use_hdr_2d(RID p_viewport, bool p_use_hdr) = 0;
867 virtual void viewport_set_snap_2d_transforms_to_pixel(RID p_viewport, bool p_enabled) = 0;
868 virtual void viewport_set_snap_2d_vertices_to_pixel(RID p_viewport, bool p_enabled) = 0;
869
870 virtual void viewport_set_default_canvas_item_texture_filter(RID p_viewport, CanvasItemTextureFilter p_filter) = 0;
871 virtual void viewport_set_default_canvas_item_texture_repeat(RID p_viewport, CanvasItemTextureRepeat p_repeat) = 0;
872
873 virtual void viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) = 0;
874 virtual void viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) = 0;
875
876 enum ViewportSDFOversize {
877 VIEWPORT_SDF_OVERSIZE_100_PERCENT,
878 VIEWPORT_SDF_OVERSIZE_120_PERCENT,
879 VIEWPORT_SDF_OVERSIZE_150_PERCENT,
880 VIEWPORT_SDF_OVERSIZE_200_PERCENT,
881 VIEWPORT_SDF_OVERSIZE_MAX
882 };
883
884 enum ViewportSDFScale {
885 VIEWPORT_SDF_SCALE_100_PERCENT,
886 VIEWPORT_SDF_SCALE_50_PERCENT,
887 VIEWPORT_SDF_SCALE_25_PERCENT,
888 VIEWPORT_SDF_SCALE_MAX
889 };
890
891 virtual void viewport_set_sdf_oversize_and_scale(RID p_viewport, ViewportSDFOversize p_oversize, ViewportSDFScale p_scale) = 0;
892
893 virtual void viewport_set_positional_shadow_atlas_size(RID p_viewport, int p_size, bool p_16_bits = true) = 0;
894 virtual void viewport_set_positional_shadow_atlas_quadrant_subdivision(RID p_viewport, int p_quadrant, int p_subdiv) = 0;
895
896 enum ViewportMSAA {
897 VIEWPORT_MSAA_DISABLED,
898 VIEWPORT_MSAA_2X,
899 VIEWPORT_MSAA_4X,
900 VIEWPORT_MSAA_8X,
901 VIEWPORT_MSAA_MAX,
902 };
903
904 virtual void viewport_set_msaa_3d(RID p_viewport, ViewportMSAA p_msaa) = 0;
905 virtual void viewport_set_msaa_2d(RID p_viewport, ViewportMSAA p_msaa) = 0;
906
907 enum ViewportScreenSpaceAA {
908 VIEWPORT_SCREEN_SPACE_AA_DISABLED,
909 VIEWPORT_SCREEN_SPACE_AA_FXAA,
910 VIEWPORT_SCREEN_SPACE_AA_MAX,
911 };
912
913 virtual void viewport_set_screen_space_aa(RID p_viewport, ViewportScreenSpaceAA p_mode) = 0;
914
915 virtual void viewport_set_use_taa(RID p_viewport, bool p_use_taa) = 0;
916
917 virtual void viewport_set_use_debanding(RID p_viewport, bool p_use_debanding) = 0;
918
919 virtual void viewport_set_mesh_lod_threshold(RID p_viewport, float p_pixels) = 0;
920
921 virtual void viewport_set_use_occlusion_culling(RID p_viewport, bool p_use_occlusion_culling) = 0;
922 virtual void viewport_set_occlusion_rays_per_thread(int p_rays_per_thread) = 0;
923
924 enum ViewportOcclusionCullingBuildQuality {
925 VIEWPORT_OCCLUSION_BUILD_QUALITY_LOW = 0,
926 VIEWPORT_OCCLUSION_BUILD_QUALITY_MEDIUM = 1,
927 VIEWPORT_OCCLUSION_BUILD_QUALITY_HIGH = 2,
928 };
929
930 virtual void viewport_set_occlusion_culling_build_quality(ViewportOcclusionCullingBuildQuality p_quality) = 0;
931
932 enum ViewportRenderInfo {
933 VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME,
934 VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME,
935 VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME,
936 VIEWPORT_RENDER_INFO_MAX,
937 };
938
939 enum ViewportRenderInfoType {
940 VIEWPORT_RENDER_INFO_TYPE_VISIBLE,
941 VIEWPORT_RENDER_INFO_TYPE_SHADOW,
942 VIEWPORT_RENDER_INFO_TYPE_MAX
943 };
944
945 virtual int viewport_get_render_info(RID p_viewport, ViewportRenderInfoType p_type, ViewportRenderInfo p_info) = 0;
946
947 enum ViewportDebugDraw {
948 VIEWPORT_DEBUG_DRAW_DISABLED,
949 VIEWPORT_DEBUG_DRAW_UNSHADED,
950 VIEWPORT_DEBUG_DRAW_LIGHTING,
951 VIEWPORT_DEBUG_DRAW_OVERDRAW,
952 VIEWPORT_DEBUG_DRAW_WIREFRAME,
953 VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER,
954 VIEWPORT_DEBUG_DRAW_VOXEL_GI_ALBEDO,
955 VIEWPORT_DEBUG_DRAW_VOXEL_GI_LIGHTING,
956 VIEWPORT_DEBUG_DRAW_VOXEL_GI_EMISSION,
957 VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS,
958 VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS,
959 VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE,
960 VIEWPORT_DEBUG_DRAW_SSAO,
961 VIEWPORT_DEBUG_DRAW_SSIL,
962 VIEWPORT_DEBUG_DRAW_PSSM_SPLITS,
963 VIEWPORT_DEBUG_DRAW_DECAL_ATLAS,
964 VIEWPORT_DEBUG_DRAW_SDFGI,
965 VIEWPORT_DEBUG_DRAW_SDFGI_PROBES,
966 VIEWPORT_DEBUG_DRAW_GI_BUFFER,
967 VIEWPORT_DEBUG_DRAW_DISABLE_LOD,
968 VIEWPORT_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS,
969 VIEWPORT_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS,
970 VIEWPORT_DEBUG_DRAW_CLUSTER_DECALS,
971 VIEWPORT_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES,
972 VIEWPORT_DEBUG_DRAW_OCCLUDERS,
973 VIEWPORT_DEBUG_DRAW_MOTION_VECTORS,
974 };
975
976 virtual void viewport_set_debug_draw(RID p_viewport, ViewportDebugDraw p_draw) = 0;
977
978 virtual void viewport_set_measure_render_time(RID p_viewport, bool p_enable) = 0;
979 virtual double viewport_get_measured_render_time_cpu(RID p_viewport) const = 0;
980 virtual double viewport_get_measured_render_time_gpu(RID p_viewport) const = 0;
981
982 virtual RID viewport_find_from_screen_attachment(DisplayServer::WindowID p_id = DisplayServer::MAIN_WINDOW_ID) const = 0;
983
984 enum ViewportVRSMode {
985 VIEWPORT_VRS_DISABLED,
986 VIEWPORT_VRS_TEXTURE,
987 VIEWPORT_VRS_XR,
988 VIEWPORT_VRS_MAX,
989 };
990
991 virtual void viewport_set_vrs_mode(RID p_viewport, ViewportVRSMode p_mode) = 0;
992 virtual void viewport_set_vrs_texture(RID p_viewport, RID p_texture) = 0;
993
994 /* SKY API */
995
996 enum SkyMode {
997 SKY_MODE_AUTOMATIC,
998 SKY_MODE_QUALITY,
999 SKY_MODE_INCREMENTAL,
1000 SKY_MODE_REALTIME
1001 };
1002
1003 virtual RID sky_create() = 0;
1004 virtual void sky_set_radiance_size(RID p_sky, int p_radiance_size) = 0;
1005 virtual void sky_set_mode(RID p_sky, SkyMode p_mode) = 0;
1006 virtual void sky_set_material(RID p_sky, RID p_material) = 0;
1007 virtual Ref<Image> sky_bake_panorama(RID p_sky, float p_energy, bool p_bake_irradiance, const Size2i &p_size) = 0;
1008
1009 /* ENVIRONMENT API */
1010
1011 virtual RID environment_create() = 0;
1012
1013 enum EnvironmentBG {
1014 ENV_BG_CLEAR_COLOR,
1015 ENV_BG_COLOR,
1016 ENV_BG_SKY,
1017 ENV_BG_CANVAS,
1018 ENV_BG_KEEP,
1019 ENV_BG_CAMERA_FEED,
1020 ENV_BG_MAX
1021 };
1022
1023 enum EnvironmentAmbientSource {
1024 ENV_AMBIENT_SOURCE_BG,
1025 ENV_AMBIENT_SOURCE_DISABLED,
1026 ENV_AMBIENT_SOURCE_COLOR,
1027 ENV_AMBIENT_SOURCE_SKY,
1028 };
1029
1030 enum EnvironmentReflectionSource {
1031 ENV_REFLECTION_SOURCE_BG,
1032 ENV_REFLECTION_SOURCE_DISABLED,
1033 ENV_REFLECTION_SOURCE_SKY,
1034 };
1035
1036 virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0;
1037 virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
1038 virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
1039 virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
1040 virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
1041 virtual void environment_set_bg_energy(RID p_env, float p_multiplier, float p_exposure_value) = 0;
1042 virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
1043 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;
1044
1045 enum EnvironmentGlowBlendMode {
1046 ENV_GLOW_BLEND_MODE_ADDITIVE,
1047 ENV_GLOW_BLEND_MODE_SCREEN,
1048 ENV_GLOW_BLEND_MODE_SOFTLIGHT,
1049 ENV_GLOW_BLEND_MODE_REPLACE,
1050 ENV_GLOW_BLEND_MODE_MIX,
1051 };
1052
1053 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;
1054
1055 virtual void environment_glow_set_use_bicubic_upscale(bool p_enable) = 0;
1056
1057 enum EnvironmentToneMapper {
1058 ENV_TONE_MAPPER_LINEAR,
1059 ENV_TONE_MAPPER_REINHARD,
1060 ENV_TONE_MAPPER_FILMIC,
1061 ENV_TONE_MAPPER_ACES
1062 };
1063
1064 virtual void environment_set_tonemap(RID p_env, EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white) = 0;
1065 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;
1066
1067 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;
1068
1069 enum EnvironmentSSRRoughnessQuality {
1070 ENV_SSR_ROUGHNESS_QUALITY_DISABLED,
1071 ENV_SSR_ROUGHNESS_QUALITY_LOW,
1072 ENV_SSR_ROUGHNESS_QUALITY_MEDIUM,
1073 ENV_SSR_ROUGHNESS_QUALITY_HIGH,
1074 };
1075
1076 virtual void environment_set_ssr_roughness_quality(EnvironmentSSRRoughnessQuality p_quality) = 0;
1077
1078 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;
1079
1080 enum EnvironmentSSAOQuality {
1081 ENV_SSAO_QUALITY_VERY_LOW,
1082 ENV_SSAO_QUALITY_LOW,
1083 ENV_SSAO_QUALITY_MEDIUM,
1084 ENV_SSAO_QUALITY_HIGH,
1085 ENV_SSAO_QUALITY_ULTRA,
1086 };
1087
1088 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;
1089
1090 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;
1091
1092 enum EnvironmentSSILQuality {
1093 ENV_SSIL_QUALITY_VERY_LOW,
1094 ENV_SSIL_QUALITY_LOW,
1095 ENV_SSIL_QUALITY_MEDIUM,
1096 ENV_SSIL_QUALITY_HIGH,
1097 ENV_SSIL_QUALITY_ULTRA,
1098 };
1099
1100 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;
1101
1102 enum EnvironmentSDFGIYScale {
1103 ENV_SDFGI_Y_SCALE_50_PERCENT,
1104 ENV_SDFGI_Y_SCALE_75_PERCENT,
1105 ENV_SDFGI_Y_SCALE_100_PERCENT,
1106 };
1107
1108 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;
1109
1110 enum EnvironmentSDFGIRayCount {
1111 ENV_SDFGI_RAY_COUNT_4,
1112 ENV_SDFGI_RAY_COUNT_8,
1113 ENV_SDFGI_RAY_COUNT_16,
1114 ENV_SDFGI_RAY_COUNT_32,
1115 ENV_SDFGI_RAY_COUNT_64,
1116 ENV_SDFGI_RAY_COUNT_96,
1117 ENV_SDFGI_RAY_COUNT_128,
1118 ENV_SDFGI_RAY_COUNT_MAX,
1119 };
1120
1121 virtual void environment_set_sdfgi_ray_count(EnvironmentSDFGIRayCount p_ray_count) = 0;
1122
1123 enum EnvironmentSDFGIFramesToConverge {
1124 ENV_SDFGI_CONVERGE_IN_5_FRAMES,
1125 ENV_SDFGI_CONVERGE_IN_10_FRAMES,
1126 ENV_SDFGI_CONVERGE_IN_15_FRAMES,
1127 ENV_SDFGI_CONVERGE_IN_20_FRAMES,
1128 ENV_SDFGI_CONVERGE_IN_25_FRAMES,
1129 ENV_SDFGI_CONVERGE_IN_30_FRAMES,
1130 ENV_SDFGI_CONVERGE_MAX
1131 };
1132
1133 virtual void environment_set_sdfgi_frames_to_converge(EnvironmentSDFGIFramesToConverge p_frames) = 0;
1134
1135 enum EnvironmentSDFGIFramesToUpdateLight {
1136 ENV_SDFGI_UPDATE_LIGHT_IN_1_FRAME,
1137 ENV_SDFGI_UPDATE_LIGHT_IN_2_FRAMES,
1138 ENV_SDFGI_UPDATE_LIGHT_IN_4_FRAMES,
1139 ENV_SDFGI_UPDATE_LIGHT_IN_8_FRAMES,
1140 ENV_SDFGI_UPDATE_LIGHT_IN_16_FRAMES,
1141 ENV_SDFGI_UPDATE_LIGHT_MAX,
1142 };
1143
1144 virtual void environment_set_sdfgi_frames_to_update_light(EnvironmentSDFGIFramesToUpdateLight p_update) = 0;
1145
1146 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;
1147
1148 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;
1149 virtual void environment_set_volumetric_fog_volume_size(int p_size, int p_depth) = 0;
1150 virtual void environment_set_volumetric_fog_filter_active(bool p_enable) = 0;
1151
1152 virtual Ref<Image> environment_bake_panorama(RID p_env, bool p_bake_irradiance, const Size2i &p_size) = 0;
1153
1154 virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_limit) = 0;
1155
1156 enum SubSurfaceScatteringQuality {
1157 SUB_SURFACE_SCATTERING_QUALITY_DISABLED,
1158 SUB_SURFACE_SCATTERING_QUALITY_LOW,
1159 SUB_SURFACE_SCATTERING_QUALITY_MEDIUM,
1160 SUB_SURFACE_SCATTERING_QUALITY_HIGH,
1161 };
1162
1163 virtual void sub_surface_scattering_set_quality(SubSurfaceScatteringQuality p_quality) = 0;
1164 virtual void sub_surface_scattering_set_scale(float p_scale, float p_depth_scale) = 0;
1165
1166 /* CAMERA EFFECTS */
1167
1168 virtual RID camera_attributes_create() = 0;
1169
1170 enum DOFBlurQuality {
1171 DOF_BLUR_QUALITY_VERY_LOW,
1172 DOF_BLUR_QUALITY_LOW,
1173 DOF_BLUR_QUALITY_MEDIUM,
1174 DOF_BLUR_QUALITY_HIGH,
1175 };
1176
1177 virtual void camera_attributes_set_dof_blur_quality(DOFBlurQuality p_quality, bool p_use_jitter) = 0;
1178
1179 enum DOFBokehShape {
1180 DOF_BOKEH_BOX,
1181 DOF_BOKEH_HEXAGON,
1182 DOF_BOKEH_CIRCLE
1183 };
1184
1185 virtual void camera_attributes_set_dof_blur_bokeh_shape(DOFBokehShape p_shape) = 0;
1186
1187 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;
1188 virtual void camera_attributes_set_exposure(RID p_camera_attributes, float p_multiplier, float p_exposure_normalization) = 0;
1189 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;
1190
1191 /* SCENARIO API */
1192
1193 virtual RID scenario_create() = 0;
1194
1195 virtual void scenario_set_environment(RID p_scenario, RID p_environment) = 0;
1196 virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment) = 0;
1197 virtual void scenario_set_camera_attributes(RID p_scenario, RID p_camera_attributes) = 0;
1198
1199 /* INSTANCING API */
1200
1201 enum InstanceType {
1202 INSTANCE_NONE,
1203 INSTANCE_MESH,
1204 INSTANCE_MULTIMESH,
1205 INSTANCE_PARTICLES,
1206 INSTANCE_PARTICLES_COLLISION,
1207 INSTANCE_LIGHT,
1208 INSTANCE_REFLECTION_PROBE,
1209 INSTANCE_DECAL,
1210 INSTANCE_VOXEL_GI,
1211 INSTANCE_LIGHTMAP,
1212 INSTANCE_OCCLUDER,
1213 INSTANCE_VISIBLITY_NOTIFIER,
1214 INSTANCE_FOG_VOLUME,
1215 INSTANCE_MAX,
1216
1217 INSTANCE_GEOMETRY_MASK = (1 << INSTANCE_MESH) | (1 << INSTANCE_MULTIMESH) | (1 << INSTANCE_PARTICLES)
1218 };
1219
1220 virtual RID instance_create2(RID p_base, RID p_scenario);
1221
1222 virtual RID instance_create() = 0;
1223
1224 virtual void instance_set_base(RID p_instance, RID p_base) = 0;
1225 virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0;
1226 virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask) = 0;
1227 virtual void instance_set_pivot_data(RID p_instance, float p_sorting_offset, bool p_use_aabb_center) = 0;
1228 virtual void instance_set_transform(RID p_instance, const Transform3D &p_transform) = 0;
1229 virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id) = 0;
1230 virtual void instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) = 0;
1231 virtual void instance_set_surface_override_material(RID p_instance, int p_surface, RID p_material) = 0;
1232 virtual void instance_set_visible(RID p_instance, bool p_visible) = 0;
1233
1234 virtual void instance_set_custom_aabb(RID p_instance, AABB aabb) = 0;
1235
1236 virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton) = 0;
1237
1238 virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
1239 virtual void instance_set_visibility_parent(RID p_instance, RID p_parent_instance) = 0;
1240
1241 virtual void instance_set_ignore_culling(RID p_instance, bool p_enabled) = 0;
1242
1243 // Don't use these in a game!
1244 virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const = 0;
1245 virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const = 0;
1246 virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0;
1247
1248 PackedInt64Array _instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario = RID()) const;
1249 PackedInt64Array _instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
1250 PackedInt64Array _instances_cull_convex_bind(const TypedArray<Plane> &p_convex, RID p_scenario = RID()) const;
1251
1252 enum InstanceFlags {
1253 INSTANCE_FLAG_USE_BAKED_LIGHT,
1254 INSTANCE_FLAG_USE_DYNAMIC_GI,
1255 INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE,
1256 INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING,
1257 INSTANCE_FLAG_MAX
1258 };
1259
1260 enum ShadowCastingSetting {
1261 SHADOW_CASTING_SETTING_OFF,
1262 SHADOW_CASTING_SETTING_ON,
1263 SHADOW_CASTING_SETTING_DOUBLE_SIDED,
1264 SHADOW_CASTING_SETTING_SHADOWS_ONLY,
1265 };
1266
1267 enum VisibilityRangeFadeMode {
1268 VISIBILITY_RANGE_FADE_DISABLED,
1269 VISIBILITY_RANGE_FADE_SELF,
1270 VISIBILITY_RANGE_FADE_DEPENDENCIES,
1271 };
1272
1273 virtual void instance_geometry_set_flag(RID p_instance, InstanceFlags p_flags, bool p_enabled) = 0;
1274 virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
1275 virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
1276 virtual void instance_geometry_set_material_overlay(RID p_instance, RID p_material) = 0;
1277 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;
1278 virtual void instance_geometry_set_lightmap(RID p_instance, RID p_lightmap, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice) = 0;
1279 virtual void instance_geometry_set_lod_bias(RID p_instance, float p_lod_bias) = 0;
1280 virtual void instance_geometry_set_transparency(RID p_instance, float p_transparency) = 0;
1281
1282 virtual void instance_geometry_set_shader_parameter(RID p_instance, const StringName &, const Variant &p_value) = 0;
1283 virtual Variant instance_geometry_get_shader_parameter(RID p_instance, const StringName &) const = 0;
1284 virtual Variant instance_geometry_get_shader_parameter_default_value(RID p_instance, const StringName &) const = 0;
1285 virtual void instance_geometry_get_shader_parameter_list(RID p_instance, List<PropertyInfo> *p_parameters) const = 0;
1286
1287 /* Bake 3D objects */
1288
1289 enum BakeChannels {
1290 BAKE_CHANNEL_ALBEDO_ALPHA,
1291 BAKE_CHANNEL_NORMAL,
1292 BAKE_CHANNEL_ORM,
1293 BAKE_CHANNEL_EMISSION
1294 };
1295
1296 virtual TypedArray<Image> bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size) = 0;
1297
1298 /* CANVAS (2D) */
1299
1300 virtual RID canvas_create() = 0;
1301 virtual void canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring) = 0;
1302 virtual void canvas_set_modulate(RID p_canvas, const Color &p_color) = 0;
1303 virtual void canvas_set_parent(RID p_canvas, RID p_parent, float p_scale) = 0;
1304
1305 virtual void canvas_set_disable_scale(bool p_disable) = 0;
1306
1307 /* CANVAS TEXTURE */
1308 virtual RID canvas_texture_create() = 0;
1309
1310 enum CanvasTextureChannel {
1311 CANVAS_TEXTURE_CHANNEL_DIFFUSE,
1312 CANVAS_TEXTURE_CHANNEL_NORMAL,
1313 CANVAS_TEXTURE_CHANNEL_SPECULAR,
1314 };
1315 virtual void canvas_texture_set_channel(RID p_canvas_texture, CanvasTextureChannel p_channel, RID p_texture) = 0;
1316 virtual void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess) = 0;
1317
1318 // Takes effect only for new draw commands.
1319 virtual void canvas_texture_set_texture_filter(RID p_canvas_texture, CanvasItemTextureFilter p_filter) = 0;
1320 virtual void canvas_texture_set_texture_repeat(RID p_canvas_texture, CanvasItemTextureRepeat p_repeat) = 0;
1321
1322 /* CANVAS ITEM */
1323
1324 virtual RID canvas_item_create() = 0;
1325 virtual void canvas_item_set_parent(RID p_item, RID p_parent) = 0;
1326
1327 virtual void canvas_item_set_default_texture_filter(RID p_item, CanvasItemTextureFilter p_filter) = 0;
1328 virtual void canvas_item_set_default_texture_repeat(RID p_item, CanvasItemTextureRepeat p_repeat) = 0;
1329
1330 virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0;
1331 virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0;
1332
1333 virtual void canvas_item_set_update_when_visible(RID p_item, bool p_update) = 0;
1334
1335 virtual void canvas_item_set_transform(RID p_item, const Transform2D &p_transform) = 0;
1336 virtual void canvas_item_set_clip(RID p_item, bool p_clip) = 0;
1337 virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable) = 0;
1338 virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect = Rect2()) = 0;
1339 virtual void canvas_item_set_modulate(RID p_item, const Color &p_color) = 0;
1340 virtual void canvas_item_set_self_modulate(RID p_item, const Color &p_color) = 0;
1341 virtual void canvas_item_set_visibility_layer(RID p_item, uint32_t p_visibility_layer) = 0;
1342
1343 virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable) = 0;
1344
1345 enum NinePatchAxisMode {
1346 NINE_PATCH_STRETCH,
1347 NINE_PATCH_TILE,
1348 NINE_PATCH_TILE_FIT,
1349 };
1350
1351 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;
1352 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;
1353 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;
1354 virtual void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) = 0;
1355 virtual void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) = 0;
1356 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;
1357 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;
1358 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;
1359 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;
1360 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;
1361 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) = 0;
1362 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;
1363 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;
1364 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;
1365 virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID()) = 0;
1366 virtual void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture) = 0;
1367 virtual void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) = 0;
1368 virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore) = 0;
1369 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;
1370
1371 virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) = 0;
1372 virtual void canvas_item_set_z_index(RID p_item, int p_z) = 0;
1373 virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) = 0;
1374 virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) = 0;
1375
1376 virtual void canvas_item_attach_skeleton(RID p_item, RID p_skeleton) = 0;
1377
1378 virtual void canvas_item_clear(RID p_item) = 0;
1379 virtual void canvas_item_set_draw_index(RID p_item, int p_index) = 0;
1380
1381 virtual void canvas_item_set_material(RID p_item, RID p_material) = 0;
1382
1383 virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable) = 0;
1384
1385 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;
1386
1387 enum CanvasGroupMode {
1388 CANVAS_GROUP_MODE_DISABLED,
1389 CANVAS_GROUP_MODE_CLIP_ONLY,
1390 CANVAS_GROUP_MODE_CLIP_AND_DRAW,
1391 CANVAS_GROUP_MODE_TRANSPARENT,
1392 };
1393
1394 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;
1395
1396 /* CANVAS LIGHT */
1397 virtual RID canvas_light_create() = 0;
1398
1399 enum CanvasLightMode {
1400 CANVAS_LIGHT_MODE_POINT,
1401 CANVAS_LIGHT_MODE_DIRECTIONAL,
1402 };
1403
1404 virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode) = 0;
1405
1406 virtual void canvas_light_attach_to_canvas(RID p_light, RID p_canvas) = 0;
1407 virtual void canvas_light_set_enabled(RID p_light, bool p_enabled) = 0;
1408 virtual void canvas_light_set_transform(RID p_light, const Transform2D &p_transform) = 0;
1409 virtual void canvas_light_set_color(RID p_light, const Color &p_color) = 0;
1410 virtual void canvas_light_set_height(RID p_light, float p_height) = 0;
1411 virtual void canvas_light_set_energy(RID p_light, float p_energy) = 0;
1412 virtual void canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) = 0;
1413 virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) = 0;
1414 virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask) = 0;
1415 virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) = 0;
1416
1417 virtual void canvas_light_set_directional_distance(RID p_light, float p_distance) = 0;
1418
1419 virtual void canvas_light_set_texture_scale(RID p_light, float p_scale) = 0;
1420 virtual void canvas_light_set_texture(RID p_light, RID p_texture) = 0;
1421 virtual void canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) = 0;
1422
1423 enum CanvasLightBlendMode {
1424 CANVAS_LIGHT_BLEND_MODE_ADD,
1425 CANVAS_LIGHT_BLEND_MODE_SUB,
1426 CANVAS_LIGHT_BLEND_MODE_MIX,
1427 };
1428
1429 virtual void canvas_light_set_blend_mode(RID p_light, CanvasLightBlendMode p_mode) = 0;
1430
1431 enum CanvasLightShadowFilter {
1432 CANVAS_LIGHT_FILTER_NONE,
1433 CANVAS_LIGHT_FILTER_PCF5,
1434 CANVAS_LIGHT_FILTER_PCF13,
1435 CANVAS_LIGHT_FILTER_MAX
1436 };
1437
1438 virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) = 0;
1439 virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter) = 0;
1440 virtual void canvas_light_set_shadow_color(RID p_light, const Color &p_color) = 0;
1441 virtual void canvas_light_set_shadow_smooth(RID p_light, float p_smooth) = 0;
1442
1443 /* CANVAS LIGHT OCCLUDER */
1444
1445 virtual RID canvas_light_occluder_create() = 0;
1446 virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) = 0;
1447 virtual void canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) = 0;
1448 virtual void canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) = 0;
1449 virtual void canvas_light_occluder_set_as_sdf_collision(RID p_occluder, bool p_enable) = 0;
1450 virtual void canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) = 0;
1451 virtual void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) = 0;
1452
1453 /* CANVAS LIGHT OCCLUDER POLYGON */
1454
1455 virtual RID canvas_occluder_polygon_create() = 0;
1456 virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) = 0;
1457
1458 enum CanvasOccluderPolygonCullMode {
1459 CANVAS_OCCLUDER_POLYGON_CULL_DISABLED,
1460 CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE,
1461 CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE,
1462 };
1463
1464 virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, CanvasOccluderPolygonCullMode p_mode) = 0;
1465
1466 virtual void canvas_set_shadow_texture_size(int p_size) = 0;
1467
1468 /* GLOBAL SHADER UNIFORMS */
1469
1470 enum GlobalShaderParameterType {
1471 GLOBAL_VAR_TYPE_BOOL,
1472 GLOBAL_VAR_TYPE_BVEC2,
1473 GLOBAL_VAR_TYPE_BVEC3,
1474 GLOBAL_VAR_TYPE_BVEC4,
1475 GLOBAL_VAR_TYPE_INT,
1476 GLOBAL_VAR_TYPE_IVEC2,
1477 GLOBAL_VAR_TYPE_IVEC3,
1478 GLOBAL_VAR_TYPE_IVEC4,
1479 GLOBAL_VAR_TYPE_RECT2I,
1480 GLOBAL_VAR_TYPE_UINT,
1481 GLOBAL_VAR_TYPE_UVEC2,
1482 GLOBAL_VAR_TYPE_UVEC3,
1483 GLOBAL_VAR_TYPE_UVEC4,
1484 GLOBAL_VAR_TYPE_FLOAT,
1485 GLOBAL_VAR_TYPE_VEC2,
1486 GLOBAL_VAR_TYPE_VEC3,
1487 GLOBAL_VAR_TYPE_VEC4,
1488 GLOBAL_VAR_TYPE_COLOR,
1489 GLOBAL_VAR_TYPE_RECT2,
1490 GLOBAL_VAR_TYPE_MAT2,
1491 GLOBAL_VAR_TYPE_MAT3,
1492 GLOBAL_VAR_TYPE_MAT4,
1493 GLOBAL_VAR_TYPE_TRANSFORM_2D,
1494 GLOBAL_VAR_TYPE_TRANSFORM,
1495 GLOBAL_VAR_TYPE_SAMPLER2D,
1496 GLOBAL_VAR_TYPE_SAMPLER2DARRAY,
1497 GLOBAL_VAR_TYPE_SAMPLER3D,
1498 GLOBAL_VAR_TYPE_SAMPLERCUBE,
1499 GLOBAL_VAR_TYPE_MAX
1500 };
1501
1502 virtual void global_shader_parameter_add(const StringName &p_name, GlobalShaderParameterType p_type, const Variant &p_value) = 0;
1503 virtual void global_shader_parameter_remove(const StringName &p_name) = 0;
1504 virtual Vector<StringName> global_shader_parameter_get_list() const = 0;
1505
1506 virtual void global_shader_parameter_set(const StringName &p_name, const Variant &p_value) = 0;
1507 virtual void global_shader_parameter_set_override(const StringName &p_name, const Variant &p_value) = 0;
1508
1509 virtual Variant global_shader_parameter_get(const StringName &p_name) const = 0;
1510 virtual GlobalShaderParameterType global_shader_parameter_get_type(const StringName &p_name) const = 0;
1511
1512 virtual void global_shader_parameters_load_settings(bool p_load_textures) = 0;
1513 virtual void global_shader_parameters_clear() = 0;
1514
1515 static int global_shader_uniform_type_get_shader_datatype(GlobalShaderParameterType p_type);
1516
1517 /* FREE */
1518
1519 virtual void free(RID p_rid) = 0; // Free RIDs associated with the rendering server.
1520
1521 /* EVENT QUEUING */
1522
1523 virtual void request_frame_drawn_callback(const Callable &p_callable) = 0;
1524
1525 virtual void draw(bool p_swap_buffers = true, double frame_step = 0.0) = 0;
1526 virtual void sync() = 0;
1527 virtual bool has_changed() const = 0;
1528 virtual void init();
1529 virtual void finish() = 0;
1530
1531 /* STATUS INFORMATION */
1532
1533 enum RenderingInfo {
1534 RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME,
1535 RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME,
1536 RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME,
1537 RENDERING_INFO_TEXTURE_MEM_USED,
1538 RENDERING_INFO_BUFFER_MEM_USED,
1539 RENDERING_INFO_VIDEO_MEM_USED,
1540 RENDERING_INFO_MAX
1541 };
1542
1543 virtual uint64_t get_rendering_info(RenderingInfo p_info) = 0;
1544 virtual String get_video_adapter_name() const = 0;
1545 virtual String get_video_adapter_vendor() const = 0;
1546 virtual RenderingDevice::DeviceType get_video_adapter_type() const = 0;
1547 virtual String get_video_adapter_api_version() const = 0;
1548
1549 struct FrameProfileArea {
1550 String name;
1551 double gpu_msec;
1552 double cpu_msec;
1553 };
1554
1555 virtual void set_frame_profiling_enabled(bool p_enable) = 0;
1556 virtual Vector<FrameProfileArea> get_frame_profile() = 0;
1557 virtual uint64_t get_frame_profile_frame() = 0;
1558
1559 virtual double get_frame_setup_time_cpu() const = 0;
1560
1561 virtual void gi_set_use_half_resolution(bool p_enable) = 0;
1562
1563 /* TESTING */
1564
1565 virtual RID get_test_cube() = 0;
1566
1567 virtual RID get_test_texture();
1568 virtual RID get_white_texture();
1569
1570 virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) = 0;
1571
1572 virtual RID make_sphere_mesh(int p_lats, int p_lons, real_t p_radius);
1573
1574 virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data);
1575 virtual void mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes);
1576
1577 virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0;
1578 virtual Color get_default_clear_color() = 0;
1579 virtual void set_default_clear_color(const Color &p_color) = 0;
1580
1581 enum Features {
1582 FEATURE_SHADERS,
1583 FEATURE_MULTITHREADED,
1584 };
1585
1586 virtual bool has_feature(Features p_feature) const = 0;
1587
1588 virtual bool has_os_feature(const String &p_feature) const = 0;
1589
1590 virtual void set_debug_generate_wireframes(bool p_generate) = 0;
1591
1592 virtual void call_set_vsync_mode(DisplayServer::VSyncMode p_mode, DisplayServer::WindowID p_window) = 0;
1593
1594 virtual bool is_low_end() const = 0;
1595
1596 virtual void set_print_gpu_profile(bool p_enable) = 0;
1597
1598 virtual Size2i get_maximum_viewport_size() const = 0;
1599
1600 RenderingDevice *get_rendering_device() const;
1601 RenderingDevice *create_local_rendering_device() const;
1602
1603 bool is_render_loop_enabled() const;
1604 void set_render_loop_enabled(bool p_enabled);
1605
1606 virtual void call_on_render_thread(const Callable &p_callable) = 0;
1607
1608 RenderingServer();
1609 virtual ~RenderingServer();
1610
1611private:
1612 // Binder helpers
1613 RID _texture_2d_layered_create(const TypedArray<Image> &p_layers, TextureLayeredType p_layered_type);
1614 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);
1615 void _texture_3d_update(RID p_texture, const TypedArray<Image> &p_data);
1616 TypedArray<Image> _texture_3d_get(RID p_texture) const;
1617 TypedArray<Dictionary> _shader_get_shader_parameter_list(RID p_shader) const;
1618 RID _mesh_create_from_surfaces(const TypedArray<Dictionary> &p_surfaces, int p_blend_shape_count);
1619 void _mesh_add_surface(RID p_mesh, const Dictionary &p_surface);
1620 Dictionary _mesh_get_surface(RID p_mesh, int p_idx);
1621 TypedArray<Dictionary> _instance_geometry_get_shader_parameter_list(RID p_instance) const;
1622 TypedArray<Image> _bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size);
1623 void _particles_set_trail_bind_poses(RID p_particles, const TypedArray<Transform3D> &p_bind_poses);
1624};
1625
1626// Make variant understand the enums.
1627VARIANT_ENUM_CAST(RenderingServer::TextureLayeredType);
1628VARIANT_ENUM_CAST(RenderingServer::CubeMapLayer);
1629VARIANT_ENUM_CAST(RenderingServer::ShaderMode);
1630VARIANT_ENUM_CAST(RenderingServer::ArrayType);
1631VARIANT_BITFIELD_CAST(RenderingServer::ArrayFormat);
1632VARIANT_ENUM_CAST(RenderingServer::ArrayCustomFormat);
1633VARIANT_ENUM_CAST(RenderingServer::PrimitiveType);
1634VARIANT_ENUM_CAST(RenderingServer::BlendShapeMode);
1635VARIANT_ENUM_CAST(RenderingServer::MultimeshTransformFormat);
1636VARIANT_ENUM_CAST(RenderingServer::LightType);
1637VARIANT_ENUM_CAST(RenderingServer::LightParam);
1638VARIANT_ENUM_CAST(RenderingServer::LightBakeMode);
1639VARIANT_ENUM_CAST(RenderingServer::LightOmniShadowMode);
1640VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowMode);
1641VARIANT_ENUM_CAST(RenderingServer::LightDirectionalSkyMode);
1642VARIANT_ENUM_CAST(RenderingServer::LightProjectorFilter);
1643VARIANT_ENUM_CAST(RenderingServer::ReflectionProbeUpdateMode);
1644VARIANT_ENUM_CAST(RenderingServer::ReflectionProbeAmbientMode);
1645VARIANT_ENUM_CAST(RenderingServer::VoxelGIQuality);
1646VARIANT_ENUM_CAST(RenderingServer::DecalTexture);
1647VARIANT_ENUM_CAST(RenderingServer::DecalFilter);
1648VARIANT_ENUM_CAST(RenderingServer::ParticlesMode);
1649VARIANT_ENUM_CAST(RenderingServer::ParticlesTransformAlign);
1650VARIANT_ENUM_CAST(RenderingServer::ParticlesDrawOrder);
1651VARIANT_ENUM_CAST(RenderingServer::ParticlesEmitFlags);
1652VARIANT_ENUM_CAST(RenderingServer::ParticlesCollisionType);
1653VARIANT_ENUM_CAST(RenderingServer::ParticlesCollisionHeightfieldResolution);
1654VARIANT_ENUM_CAST(RenderingServer::FogVolumeShape);
1655VARIANT_ENUM_CAST(RenderingServer::ViewportScaling3DMode);
1656VARIANT_ENUM_CAST(RenderingServer::ViewportUpdateMode);
1657VARIANT_ENUM_CAST(RenderingServer::ViewportClearMode);
1658VARIANT_ENUM_CAST(RenderingServer::ViewportEnvironmentMode);
1659VARIANT_ENUM_CAST(RenderingServer::ViewportMSAA);
1660VARIANT_ENUM_CAST(RenderingServer::ViewportScreenSpaceAA);
1661VARIANT_ENUM_CAST(RenderingServer::ViewportRenderInfo);
1662VARIANT_ENUM_CAST(RenderingServer::ViewportRenderInfoType);
1663VARIANT_ENUM_CAST(RenderingServer::ViewportDebugDraw);
1664VARIANT_ENUM_CAST(RenderingServer::ViewportOcclusionCullingBuildQuality);
1665VARIANT_ENUM_CAST(RenderingServer::ViewportSDFOversize);
1666VARIANT_ENUM_CAST(RenderingServer::ViewportSDFScale);
1667VARIANT_ENUM_CAST(RenderingServer::ViewportVRSMode);
1668VARIANT_ENUM_CAST(RenderingServer::SkyMode);
1669VARIANT_ENUM_CAST(RenderingServer::EnvironmentBG);
1670VARIANT_ENUM_CAST(RenderingServer::EnvironmentAmbientSource);
1671VARIANT_ENUM_CAST(RenderingServer::EnvironmentReflectionSource);
1672VARIANT_ENUM_CAST(RenderingServer::EnvironmentGlowBlendMode);
1673VARIANT_ENUM_CAST(RenderingServer::EnvironmentToneMapper);
1674VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSRRoughnessQuality);
1675VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSAOQuality);
1676VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSILQuality);
1677VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIFramesToConverge);
1678VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIRayCount);
1679VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIFramesToUpdateLight);
1680VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIYScale);
1681VARIANT_ENUM_CAST(RenderingServer::SubSurfaceScatteringQuality);
1682VARIANT_ENUM_CAST(RenderingServer::DOFBlurQuality);
1683VARIANT_ENUM_CAST(RenderingServer::DOFBokehShape);
1684VARIANT_ENUM_CAST(RenderingServer::ShadowQuality);
1685VARIANT_ENUM_CAST(RenderingServer::InstanceType);
1686VARIANT_ENUM_CAST(RenderingServer::InstanceFlags);
1687VARIANT_ENUM_CAST(RenderingServer::ShadowCastingSetting);
1688VARIANT_ENUM_CAST(RenderingServer::VisibilityRangeFadeMode);
1689VARIANT_ENUM_CAST(RenderingServer::NinePatchAxisMode);
1690VARIANT_ENUM_CAST(RenderingServer::CanvasItemTextureFilter);
1691VARIANT_ENUM_CAST(RenderingServer::CanvasItemTextureRepeat);
1692VARIANT_ENUM_CAST(RenderingServer::CanvasGroupMode);
1693VARIANT_ENUM_CAST(RenderingServer::CanvasLightMode);
1694VARIANT_ENUM_CAST(RenderingServer::CanvasLightBlendMode);
1695VARIANT_ENUM_CAST(RenderingServer::CanvasLightShadowFilter);
1696VARIANT_ENUM_CAST(RenderingServer::CanvasOccluderPolygonCullMode);
1697VARIANT_ENUM_CAST(RenderingServer::GlobalShaderParameterType);
1698VARIANT_ENUM_CAST(RenderingServer::RenderingInfo);
1699VARIANT_ENUM_CAST(RenderingServer::Features);
1700VARIANT_ENUM_CAST(RenderingServer::CanvasTextureChannel);
1701VARIANT_ENUM_CAST(RenderingServer::BakeChannels);
1702
1703// Alias to make it easier to use.
1704#define RS RenderingServer
1705
1706#endif // RENDERING_SERVER_H
1707