rendering_server.h 84 KB

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