visual_server.h 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213
  1. /*************************************************************************/
  2. /* visual_server.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  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 VISUAL_SERVER_H
  31. #define VISUAL_SERVER_H
  32. #include "core/image.h"
  33. #include "core/math/bsp_tree.h"
  34. #include "core/math/geometry.h"
  35. #include "core/math/transform_2d.h"
  36. #include "core/object.h"
  37. #include "core/rid.h"
  38. #include "core/variant.h"
  39. class VisualServerCallbacks;
  40. class VisualServer : public Object {
  41. GDCLASS(VisualServer, Object);
  42. static VisualServer *singleton;
  43. int mm_policy;
  44. bool render_loop_enabled = true;
  45. void _camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far);
  46. void _canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate = Color(1, 1, 1));
  47. Array _get_array_from_surface(uint32_t p_format, PoolVector<uint8_t> p_vertex_data, int p_vertex_len, PoolVector<uint8_t> p_index_data, int p_index_len) const;
  48. protected:
  49. RID _make_test_cube();
  50. void _free_internal_rids();
  51. RID test_texture;
  52. RID white_texture;
  53. RID test_material;
  54. Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t *p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb);
  55. static VisualServer *(*create_func)();
  56. static void _bind_methods();
  57. public:
  58. static VisualServer *get_singleton();
  59. static VisualServer *create();
  60. static Vector2 norm_to_oct(const Vector3 v);
  61. static Vector2 tangent_to_oct(const Vector3 v, const float sign, const bool high_precision);
  62. static Vector3 oct_to_norm(const Vector2 v);
  63. static Vector3 oct_to_tangent(const Vector2 v, float *out_sign);
  64. enum {
  65. NO_INDEX_ARRAY = -1,
  66. ARRAY_WEIGHTS_SIZE = 4,
  67. CANVAS_ITEM_Z_MIN = -4096,
  68. CANVAS_ITEM_Z_MAX = 4096,
  69. MAX_GLOW_LEVELS = 7,
  70. MAX_CURSORS = 8,
  71. };
  72. /* TEXTURE API */
  73. enum TextureFlags : unsigned int { // unsigned to stop sanitizer complaining about bit operations on ints
  74. TEXTURE_FLAG_MIPMAPS = 1, /// Enable automatic mipmap generation - when available
  75. TEXTURE_FLAG_REPEAT = 2, /// Repeat texture (Tiling), otherwise Clamping
  76. TEXTURE_FLAG_FILTER = 4, /// Create texture with linear (or available) filter
  77. TEXTURE_FLAG_ANISOTROPIC_FILTER = 8,
  78. TEXTURE_FLAG_CONVERT_TO_LINEAR = 16,
  79. TEXTURE_FLAG_MIRRORED_REPEAT = 32, /// Repeat texture, with alternate sections mirrored
  80. TEXTURE_FLAG_USED_FOR_STREAMING = 2048,
  81. TEXTURE_FLAGS_DEFAULT = TEXTURE_FLAG_REPEAT | TEXTURE_FLAG_MIPMAPS | TEXTURE_FLAG_FILTER
  82. };
  83. enum TextureType {
  84. TEXTURE_TYPE_2D,
  85. TEXTURE_TYPE_EXTERNAL,
  86. TEXTURE_TYPE_CUBEMAP,
  87. TEXTURE_TYPE_2D_ARRAY,
  88. TEXTURE_TYPE_3D,
  89. };
  90. enum CubeMapSide {
  91. CUBEMAP_LEFT,
  92. CUBEMAP_RIGHT,
  93. CUBEMAP_BOTTOM,
  94. CUBEMAP_TOP,
  95. CUBEMAP_FRONT,
  96. CUBEMAP_BACK
  97. };
  98. virtual RID texture_create() = 0;
  99. RID texture_create_from_image(const Ref<Image> &p_image, uint32_t p_flags = TEXTURE_FLAGS_DEFAULT); // helper
  100. virtual void texture_allocate(RID p_texture,
  101. int p_width,
  102. int p_height,
  103. int p_depth_3d,
  104. Image::Format p_format,
  105. TextureType p_type,
  106. uint32_t p_flags = TEXTURE_FLAGS_DEFAULT) = 0;
  107. virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) = 0;
  108. virtual void texture_set_data_partial(RID p_texture,
  109. const Ref<Image> &p_image,
  110. int src_x, int src_y,
  111. int src_w, int src_h,
  112. int dst_x, int dst_y,
  113. int p_dst_mip,
  114. int p_layer = 0) = 0;
  115. virtual Ref<Image> texture_get_data(RID p_texture, int p_layer = 0) const = 0;
  116. virtual void texture_set_flags(RID p_texture, uint32_t p_flags) = 0;
  117. virtual uint32_t texture_get_flags(RID p_texture) const = 0;
  118. virtual Image::Format texture_get_format(RID p_texture) const = 0;
  119. virtual TextureType texture_get_type(RID p_texture) const = 0;
  120. virtual uint32_t texture_get_texid(RID p_texture) const = 0;
  121. virtual uint32_t texture_get_width(RID p_texture) const = 0;
  122. virtual uint32_t texture_get_height(RID p_texture) const = 0;
  123. virtual uint32_t texture_get_depth(RID p_texture) const = 0;
  124. virtual void texture_set_size_override(RID p_texture, int p_width, int p_height, int p_depth_3d) = 0;
  125. virtual void texture_bind(RID p_texture, uint32_t p_texture_no) = 0;
  126. virtual void texture_set_path(RID p_texture, const String &p_path) = 0;
  127. virtual String texture_get_path(RID p_texture) const = 0;
  128. virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable) = 0;
  129. typedef void (*TextureDetectCallback)(void *);
  130. virtual void texture_set_detect_3d_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
  131. virtual void texture_set_detect_srgb_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
  132. virtual void texture_set_detect_normal_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
  133. struct TextureInfo {
  134. RID texture;
  135. uint32_t width;
  136. uint32_t height;
  137. uint32_t depth;
  138. Image::Format format;
  139. int bytes;
  140. String path;
  141. };
  142. virtual void texture_debug_usage(List<TextureInfo> *r_info) = 0;
  143. Array _texture_debug_usage_bind();
  144. virtual void textures_keep_original(bool p_enable) = 0;
  145. virtual void texture_set_proxy(RID p_proxy, RID p_base) = 0;
  146. virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) = 0;
  147. /* SKY API */
  148. virtual RID sky_create() = 0;
  149. virtual void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) = 0;
  150. /* SHADER API */
  151. enum ShaderMode {
  152. SHADER_SPATIAL,
  153. SHADER_CANVAS_ITEM,
  154. SHADER_PARTICLES,
  155. SHADER_MAX
  156. };
  157. virtual RID shader_create() = 0;
  158. virtual void shader_set_code(RID p_shader, const String &p_code) = 0;
  159. virtual String shader_get_code(RID p_shader) const = 0;
  160. virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const = 0;
  161. Array _shader_get_param_list_bind(RID p_shader) const;
  162. virtual void shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture) = 0;
  163. virtual RID shader_get_default_texture_param(RID p_shader, const StringName &p_name) const = 0;
  164. virtual void shader_add_custom_define(RID p_shader, const String &p_define) = 0;
  165. virtual void shader_get_custom_defines(RID p_shader, Vector<String> *p_defines) const = 0;
  166. virtual void shader_remove_custom_define(RID p_shader, const String &p_define) = 0;
  167. /* COMMON MATERIAL API */
  168. enum {
  169. MATERIAL_RENDER_PRIORITY_MIN = -128,
  170. MATERIAL_RENDER_PRIORITY_MAX = 127,
  171. };
  172. virtual RID material_create() = 0;
  173. virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0;
  174. virtual RID material_get_shader(RID p_shader_material) const = 0;
  175. virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
  176. virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
  177. virtual Variant material_get_param_default(RID p_material, const StringName &p_param) const = 0;
  178. virtual void material_set_render_priority(RID p_material, int priority) = 0;
  179. virtual void material_set_line_width(RID p_material, float p_width) = 0;
  180. virtual void material_set_next_pass(RID p_material, RID p_next_material) = 0;
  181. /* MESH API */
  182. enum ArrayType {
  183. ARRAY_VERTEX = 0,
  184. ARRAY_NORMAL = 1,
  185. ARRAY_TANGENT = 2,
  186. ARRAY_COLOR = 3,
  187. ARRAY_TEX_UV = 4,
  188. ARRAY_TEX_UV2 = 5,
  189. ARRAY_BONES = 6,
  190. ARRAY_WEIGHTS = 7,
  191. ARRAY_INDEX = 8,
  192. ARRAY_MAX = 9
  193. };
  194. enum ArrayFormat {
  195. /* ARRAY FORMAT FLAGS */
  196. ARRAY_FORMAT_VERTEX = 1 << ARRAY_VERTEX, // mandatory
  197. ARRAY_FORMAT_NORMAL = 1 << ARRAY_NORMAL,
  198. ARRAY_FORMAT_TANGENT = 1 << ARRAY_TANGENT,
  199. ARRAY_FORMAT_COLOR = 1 << ARRAY_COLOR,
  200. ARRAY_FORMAT_TEX_UV = 1 << ARRAY_TEX_UV,
  201. ARRAY_FORMAT_TEX_UV2 = 1 << ARRAY_TEX_UV2,
  202. ARRAY_FORMAT_BONES = 1 << ARRAY_BONES,
  203. ARRAY_FORMAT_WEIGHTS = 1 << ARRAY_WEIGHTS,
  204. ARRAY_FORMAT_INDEX = 1 << ARRAY_INDEX,
  205. ARRAY_COMPRESS_BASE = (ARRAY_INDEX + 1),
  206. ARRAY_COMPRESS_VERTEX = 1 << (ARRAY_VERTEX + ARRAY_COMPRESS_BASE), // mandatory
  207. ARRAY_COMPRESS_NORMAL = 1 << (ARRAY_NORMAL + ARRAY_COMPRESS_BASE),
  208. ARRAY_COMPRESS_TANGENT = 1 << (ARRAY_TANGENT + ARRAY_COMPRESS_BASE),
  209. ARRAY_COMPRESS_COLOR = 1 << (ARRAY_COLOR + ARRAY_COMPRESS_BASE),
  210. ARRAY_COMPRESS_TEX_UV = 1 << (ARRAY_TEX_UV + ARRAY_COMPRESS_BASE),
  211. ARRAY_COMPRESS_TEX_UV2 = 1 << (ARRAY_TEX_UV2 + ARRAY_COMPRESS_BASE),
  212. ARRAY_COMPRESS_BONES = 1 << (ARRAY_BONES + ARRAY_COMPRESS_BASE),
  213. ARRAY_COMPRESS_WEIGHTS = 1 << (ARRAY_WEIGHTS + ARRAY_COMPRESS_BASE),
  214. ARRAY_COMPRESS_INDEX = 1 << (ARRAY_INDEX + ARRAY_COMPRESS_BASE),
  215. ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1,
  216. ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
  217. ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3,
  218. ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION = ARRAY_COMPRESS_INDEX << 4,
  219. ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS | ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION
  220. };
  221. enum PrimitiveType {
  222. PRIMITIVE_POINTS = 0,
  223. PRIMITIVE_LINES = 1,
  224. PRIMITIVE_LINE_STRIP = 2,
  225. PRIMITIVE_LINE_LOOP = 3,
  226. PRIMITIVE_TRIANGLES = 4,
  227. PRIMITIVE_TRIANGLE_STRIP = 5,
  228. PRIMITIVE_TRIANGLE_FAN = 6,
  229. PRIMITIVE_MAX = 7,
  230. };
  231. virtual RID mesh_create() = 0;
  232. virtual uint32_t mesh_surface_get_format_offset(uint32_t p_format, int p_vertex_len, int p_index_len, int p_array_index) const;
  233. virtual uint32_t mesh_surface_get_format_stride(uint32_t p_format, int p_vertex_len, int p_index_len, int p_array_index) const;
  234. /// Returns stride
  235. virtual void mesh_surface_make_offsets_from_format(uint32_t p_format, int p_vertex_len, int p_index_len, uint32_t *r_offsets, uint32_t *r_strides) const;
  236. virtual void mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_compress_format = ARRAY_COMPRESS_DEFAULT);
  237. virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t>> &p_blend_shapes = Vector<PoolVector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) = 0;
  238. virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount) = 0;
  239. virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0;
  240. enum BlendShapeMode {
  241. BLEND_SHAPE_MODE_NORMALIZED,
  242. BLEND_SHAPE_MODE_RELATIVE,
  243. };
  244. virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0;
  245. virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
  246. virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0;
  247. virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0;
  248. virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0;
  249. virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const = 0;
  250. virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const = 0;
  251. virtual PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const = 0;
  252. virtual PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const = 0;
  253. virtual Array mesh_surface_get_arrays(RID p_mesh, int p_surface) const;
  254. virtual Array mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const;
  255. virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const = 0;
  256. virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const = 0;
  257. virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const = 0;
  258. virtual Vector<PoolVector<uint8_t>> mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const = 0;
  259. virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const = 0;
  260. Array _mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surface) const;
  261. virtual void mesh_remove_surface(RID p_mesh, int p_index) = 0;
  262. virtual int mesh_get_surface_count(RID p_mesh) const = 0;
  263. virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0;
  264. virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0;
  265. virtual void mesh_clear(RID p_mesh) = 0;
  266. /* MULTIMESH API */
  267. virtual RID multimesh_create() = 0;
  268. enum MultimeshTransformFormat {
  269. MULTIMESH_TRANSFORM_2D,
  270. MULTIMESH_TRANSFORM_3D,
  271. };
  272. enum MultimeshColorFormat {
  273. MULTIMESH_COLOR_NONE,
  274. MULTIMESH_COLOR_8BIT,
  275. MULTIMESH_COLOR_FLOAT,
  276. MULTIMESH_COLOR_MAX,
  277. };
  278. enum MultimeshCustomDataFormat {
  279. MULTIMESH_CUSTOM_DATA_NONE,
  280. MULTIMESH_CUSTOM_DATA_8BIT,
  281. MULTIMESH_CUSTOM_DATA_FLOAT,
  282. MULTIMESH_CUSTOM_DATA_MAX,
  283. };
  284. virtual void multimesh_allocate(RID p_multimesh, int p_instances, MultimeshTransformFormat p_transform_format, MultimeshColorFormat p_color_format, MultimeshCustomDataFormat p_data_format = MULTIMESH_CUSTOM_DATA_NONE) = 0;
  285. virtual int multimesh_get_instance_count(RID p_multimesh) const = 0;
  286. virtual void multimesh_set_mesh(RID p_multimesh, RID p_mesh) = 0;
  287. virtual void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform) = 0;
  288. virtual void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) = 0;
  289. virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) = 0;
  290. virtual void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) = 0;
  291. virtual RID multimesh_get_mesh(RID p_multimesh) const = 0;
  292. virtual AABB multimesh_get_aabb(RID p_multimesh) const = 0;
  293. virtual Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const = 0;
  294. virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const = 0;
  295. virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0;
  296. virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0;
  297. virtual void multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array) = 0;
  298. virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0;
  299. virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0;
  300. /* IMMEDIATE API */
  301. virtual RID immediate_create() = 0;
  302. virtual void immediate_begin(RID p_immediate, PrimitiveType p_rimitive, RID p_texture = RID()) = 0;
  303. virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) = 0;
  304. virtual void immediate_vertex_2d(RID p_immediate, const Vector2 &p_vertex);
  305. virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal) = 0;
  306. virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent) = 0;
  307. virtual void immediate_color(RID p_immediate, const Color &p_color) = 0;
  308. virtual void immediate_uv(RID p_immediate, const Vector2 &tex_uv) = 0;
  309. virtual void immediate_uv2(RID p_immediate, const Vector2 &tex_uv) = 0;
  310. virtual void immediate_end(RID p_immediate) = 0;
  311. virtual void immediate_clear(RID p_immediate) = 0;
  312. virtual void immediate_set_material(RID p_immediate, RID p_material) = 0;
  313. virtual RID immediate_get_material(RID p_immediate) const = 0;
  314. /* SKELETON API */
  315. virtual RID skeleton_create() = 0;
  316. virtual void skeleton_allocate(RID p_skeleton, int p_bones, bool p_2d_skeleton = false) = 0;
  317. virtual int skeleton_get_bone_count(RID p_skeleton) const = 0;
  318. virtual void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform &p_transform) = 0;
  319. virtual Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const = 0;
  320. virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) = 0;
  321. virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const = 0;
  322. virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) = 0;
  323. /* Light API */
  324. enum LightType {
  325. LIGHT_DIRECTIONAL,
  326. LIGHT_OMNI,
  327. LIGHT_SPOT
  328. };
  329. enum LightParam {
  330. LIGHT_PARAM_ENERGY,
  331. LIGHT_PARAM_INDIRECT_ENERGY,
  332. LIGHT_PARAM_SIZE,
  333. LIGHT_PARAM_SPECULAR,
  334. LIGHT_PARAM_RANGE,
  335. LIGHT_PARAM_ATTENUATION,
  336. LIGHT_PARAM_SPOT_ANGLE,
  337. LIGHT_PARAM_SPOT_ATTENUATION,
  338. LIGHT_PARAM_CONTACT_SHADOW_SIZE,
  339. LIGHT_PARAM_SHADOW_MAX_DISTANCE,
  340. LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
  341. LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
  342. LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
  343. LIGHT_PARAM_SHADOW_NORMAL_BIAS,
  344. LIGHT_PARAM_SHADOW_BIAS,
  345. LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
  346. LIGHT_PARAM_MAX
  347. };
  348. virtual RID directional_light_create() = 0;
  349. virtual RID omni_light_create() = 0;
  350. virtual RID spot_light_create() = 0;
  351. virtual void light_set_color(RID p_light, const Color &p_color) = 0;
  352. virtual void light_set_param(RID p_light, LightParam p_param, float p_value) = 0;
  353. virtual void light_set_shadow(RID p_light, bool p_enabled) = 0;
  354. virtual void light_set_shadow_color(RID p_light, const Color &p_color) = 0;
  355. virtual void light_set_projector(RID p_light, RID p_texture) = 0;
  356. virtual void light_set_negative(RID p_light, bool p_enable) = 0;
  357. virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
  358. virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
  359. virtual void light_set_use_gi(RID p_light, bool p_enable) = 0;
  360. // bake mode
  361. enum LightBakeMode {
  362. LIGHT_BAKE_DISABLED,
  363. LIGHT_BAKE_INDIRECT,
  364. LIGHT_BAKE_ALL
  365. };
  366. virtual void light_set_bake_mode(RID p_light, LightBakeMode p_bake_mode) = 0;
  367. // omni light
  368. enum LightOmniShadowMode {
  369. LIGHT_OMNI_SHADOW_DUAL_PARABOLOID,
  370. LIGHT_OMNI_SHADOW_CUBE,
  371. };
  372. virtual void light_omni_set_shadow_mode(RID p_light, LightOmniShadowMode p_mode) = 0;
  373. // omni light
  374. enum LightOmniShadowDetail {
  375. LIGHT_OMNI_SHADOW_DETAIL_VERTICAL,
  376. LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL
  377. };
  378. virtual void light_omni_set_shadow_detail(RID p_light, LightOmniShadowDetail p_detail) = 0;
  379. // directional light
  380. enum LightDirectionalShadowMode {
  381. LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL,
  382. LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS,
  383. LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS
  384. };
  385. virtual void light_directional_set_shadow_mode(RID p_light, LightDirectionalShadowMode p_mode) = 0;
  386. virtual void light_directional_set_blend_splits(RID p_light, bool p_enable) = 0;
  387. enum LightDirectionalShadowDepthRangeMode {
  388. LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE,
  389. LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED,
  390. };
  391. virtual void light_directional_set_shadow_depth_range_mode(RID p_light, LightDirectionalShadowDepthRangeMode p_range_mode) = 0;
  392. /* PROBE API */
  393. virtual RID reflection_probe_create() = 0;
  394. enum ReflectionProbeUpdateMode {
  395. REFLECTION_PROBE_UPDATE_ONCE,
  396. REFLECTION_PROBE_UPDATE_ALWAYS,
  397. };
  398. virtual void reflection_probe_set_update_mode(RID p_probe, ReflectionProbeUpdateMode p_mode) = 0;
  399. virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity) = 0;
  400. virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_color) = 0;
  401. virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) = 0;
  402. virtual void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib) = 0;
  403. virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
  404. virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) = 0;
  405. virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
  406. virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
  407. virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
  408. virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) = 0;
  409. virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
  410. virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution) = 0;
  411. /* GI PROBE API */
  412. virtual RID gi_probe_create() = 0;
  413. virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) = 0;
  414. virtual AABB gi_probe_get_bounds(RID p_probe) const = 0;
  415. virtual void gi_probe_set_cell_size(RID p_probe, float p_range) = 0;
  416. virtual float gi_probe_get_cell_size(RID p_probe) const = 0;
  417. virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) = 0;
  418. virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const = 0;
  419. virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) = 0;
  420. virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const = 0;
  421. virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range) = 0;
  422. virtual int gi_probe_get_dynamic_range(RID p_probe) const = 0;
  423. virtual void gi_probe_set_energy(RID p_probe, float p_range) = 0;
  424. virtual float gi_probe_get_energy(RID p_probe) const = 0;
  425. virtual void gi_probe_set_bias(RID p_probe, float p_range) = 0;
  426. virtual float gi_probe_get_bias(RID p_probe) const = 0;
  427. virtual void gi_probe_set_normal_bias(RID p_probe, float p_range) = 0;
  428. virtual float gi_probe_get_normal_bias(RID p_probe) const = 0;
  429. virtual void gi_probe_set_propagation(RID p_probe, float p_range) = 0;
  430. virtual float gi_probe_get_propagation(RID p_probe) const = 0;
  431. virtual void gi_probe_set_interior(RID p_probe, bool p_enable) = 0;
  432. virtual bool gi_probe_is_interior(RID p_probe) const = 0;
  433. virtual void gi_probe_set_compress(RID p_probe, bool p_enable) = 0;
  434. virtual bool gi_probe_is_compressed(RID p_probe) const = 0;
  435. /* LIGHTMAP CAPTURE */
  436. virtual RID lightmap_capture_create() = 0;
  437. virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) = 0;
  438. virtual AABB lightmap_capture_get_bounds(RID p_capture) const = 0;
  439. virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) = 0;
  440. virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) = 0;
  441. virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const = 0;
  442. virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) = 0;
  443. virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const = 0;
  444. virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0;
  445. virtual void lightmap_capture_set_energy(RID p_capture, float p_energy) = 0;
  446. virtual float lightmap_capture_get_energy(RID p_capture) const = 0;
  447. virtual void lightmap_capture_set_interior(RID p_capture, bool p_interior) = 0;
  448. virtual bool lightmap_capture_is_interior(RID p_capture) const = 0;
  449. /* PARTICLES API */
  450. virtual RID particles_create() = 0;
  451. virtual void particles_set_emitting(RID p_particles, bool p_emitting) = 0;
  452. virtual bool particles_get_emitting(RID p_particles) = 0;
  453. virtual void particles_set_amount(RID p_particles, int p_amount) = 0;
  454. virtual void particles_set_lifetime(RID p_particles, float p_lifetime) = 0;
  455. virtual void particles_set_one_shot(RID p_particles, bool p_one_shot) = 0;
  456. virtual void particles_set_pre_process_time(RID p_particles, float p_time) = 0;
  457. virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0;
  458. virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0;
  459. virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) = 0;
  460. virtual void particles_set_speed_scale(RID p_particles, float p_scale) = 0;
  461. virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0;
  462. virtual void particles_set_process_material(RID p_particles, RID p_material) = 0;
  463. virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0;
  464. virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0;
  465. virtual bool particles_is_inactive(RID p_particles) = 0;
  466. virtual void particles_request_process(RID p_particles) = 0;
  467. virtual void particles_restart(RID p_particles) = 0;
  468. enum ParticlesDrawOrder {
  469. PARTICLES_DRAW_ORDER_INDEX,
  470. PARTICLES_DRAW_ORDER_LIFETIME,
  471. PARTICLES_DRAW_ORDER_VIEW_DEPTH,
  472. };
  473. virtual void particles_set_draw_order(RID p_particles, ParticlesDrawOrder p_order) = 0;
  474. virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0;
  475. virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) = 0;
  476. virtual AABB particles_get_current_aabb(RID p_particles) = 0;
  477. virtual void particles_set_emission_transform(RID p_particles, const Transform &p_transform) = 0; //this is only used for 2D, in 3D it's automatic
  478. /* CAMERA API */
  479. virtual RID camera_create() = 0;
  480. virtual void camera_set_perspective(RID p_camera, float p_fovy_degrees, float p_z_near, float p_z_far) = 0;
  481. virtual void camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) = 0;
  482. virtual void camera_set_frustum(RID p_camera, float p_size, Vector2 p_offset, float p_z_near, float p_z_far) = 0;
  483. virtual void camera_set_transform(RID p_camera, const Transform &p_transform) = 0;
  484. virtual void camera_set_cull_mask(RID p_camera, uint32_t p_layers) = 0;
  485. virtual void camera_set_environment(RID p_camera, RID p_env) = 0;
  486. virtual void camera_set_use_vertical_aspect(RID p_camera, bool p_enable) = 0;
  487. /*
  488. enum ParticlesCollisionMode {
  489. PARTICLES_COLLISION_NONE,
  490. PARTICLES_COLLISION_TEXTURE,
  491. PARTICLES_COLLISION_CUBEMAP,
  492. };
  493. virtual void particles_set_collision(RID p_particles,ParticlesCollisionMode p_mode,const Transform&, p_xform,const RID p_depth_tex,const RID p_normal_tex)=0;
  494. */
  495. /* VIEWPORT TARGET API */
  496. virtual RID viewport_create() = 0;
  497. virtual void viewport_set_use_arvr(RID p_viewport, bool p_use_arvr) = 0;
  498. virtual void viewport_set_size(RID p_viewport, int p_width, int p_height) = 0;
  499. virtual void viewport_set_active(RID p_viewport, bool p_active) = 0;
  500. virtual void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) = 0;
  501. virtual void viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect = Rect2(), int p_screen = 0) = 0;
  502. virtual void viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) = 0;
  503. virtual void viewport_detach(RID p_viewport) = 0;
  504. enum ViewportUpdateMode {
  505. VIEWPORT_UPDATE_DISABLED,
  506. VIEWPORT_UPDATE_ONCE, //then goes to disabled, must be manually updated
  507. VIEWPORT_UPDATE_WHEN_VISIBLE, // default
  508. VIEWPORT_UPDATE_ALWAYS
  509. };
  510. virtual void viewport_set_update_mode(RID p_viewport, ViewportUpdateMode p_mode) = 0;
  511. virtual void viewport_set_vflip(RID p_viewport, bool p_enable) = 0;
  512. enum ViewportClearMode {
  513. VIEWPORT_CLEAR_ALWAYS,
  514. VIEWPORT_CLEAR_NEVER,
  515. VIEWPORT_CLEAR_ONLY_NEXT_FRAME
  516. };
  517. virtual void viewport_set_clear_mode(RID p_viewport, ViewportClearMode p_clear_mode) = 0;
  518. virtual RID viewport_get_texture(RID p_viewport) const = 0;
  519. virtual void viewport_set_hide_scenario(RID p_viewport, bool p_hide) = 0;
  520. virtual void viewport_set_hide_canvas(RID p_viewport, bool p_hide) = 0;
  521. virtual void viewport_set_disable_environment(RID p_viewport, bool p_disable) = 0;
  522. virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
  523. virtual void viewport_set_keep_3d_linear(RID p_viewport, bool p_disable) = 0;
  524. virtual void viewport_attach_camera(RID p_viewport, RID p_camera) = 0;
  525. virtual void viewport_set_scenario(RID p_viewport, RID p_scenario) = 0;
  526. virtual void viewport_attach_canvas(RID p_viewport, RID p_canvas) = 0;
  527. virtual void viewport_remove_canvas(RID p_viewport, RID p_canvas) = 0;
  528. virtual void viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) = 0;
  529. virtual void viewport_set_transparent_background(RID p_viewport, bool p_enabled) = 0;
  530. virtual void viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) = 0;
  531. virtual void viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) = 0;
  532. virtual void viewport_set_shadow_atlas_size(RID p_viewport, int p_size) = 0;
  533. virtual void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport, int p_quadrant, int p_subdiv) = 0;
  534. enum ViewportMSAA {
  535. VIEWPORT_MSAA_DISABLED,
  536. VIEWPORT_MSAA_2X,
  537. VIEWPORT_MSAA_4X,
  538. VIEWPORT_MSAA_8X,
  539. VIEWPORT_MSAA_16X,
  540. VIEWPORT_MSAA_EXT_2X,
  541. VIEWPORT_MSAA_EXT_4X,
  542. };
  543. virtual void viewport_set_msaa(RID p_viewport, ViewportMSAA p_msaa) = 0;
  544. virtual void viewport_set_use_fxaa(RID p_viewport, bool p_fxaa) = 0;
  545. virtual void viewport_set_use_debanding(RID p_viewport, bool p_debanding) = 0;
  546. virtual void viewport_set_sharpen_intensity(RID p_viewport, float p_intensity) = 0;
  547. enum ViewportUsage {
  548. VIEWPORT_USAGE_2D,
  549. VIEWPORT_USAGE_2D_NO_SAMPLING,
  550. VIEWPORT_USAGE_3D,
  551. VIEWPORT_USAGE_3D_NO_EFFECTS,
  552. };
  553. virtual void viewport_set_hdr(RID p_viewport, bool p_enabled) = 0;
  554. virtual void viewport_set_usage(RID p_viewport, ViewportUsage p_usage) = 0;
  555. enum ViewportRenderInfo {
  556. VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME,
  557. VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME,
  558. VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME,
  559. VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME,
  560. VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME,
  561. VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME,
  562. VIEWPORT_RENDER_INFO_2D_ITEMS_IN_FRAME,
  563. VIEWPORT_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME,
  564. VIEWPORT_RENDER_INFO_MAX
  565. };
  566. virtual int viewport_get_render_info(RID p_viewport, ViewportRenderInfo p_info) = 0;
  567. enum ViewportDebugDraw {
  568. VIEWPORT_DEBUG_DRAW_DISABLED,
  569. VIEWPORT_DEBUG_DRAW_UNSHADED,
  570. VIEWPORT_DEBUG_DRAW_OVERDRAW,
  571. VIEWPORT_DEBUG_DRAW_WIREFRAME,
  572. };
  573. virtual void viewport_set_debug_draw(RID p_viewport, ViewportDebugDraw p_draw) = 0;
  574. /* ENVIRONMENT API */
  575. virtual RID environment_create() = 0;
  576. enum EnvironmentBG {
  577. ENV_BG_CLEAR_COLOR,
  578. ENV_BG_COLOR,
  579. ENV_BG_SKY,
  580. ENV_BG_COLOR_SKY,
  581. ENV_BG_CANVAS,
  582. ENV_BG_KEEP,
  583. ENV_BG_CAMERA_FEED,
  584. ENV_BG_MAX
  585. };
  586. virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0;
  587. virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
  588. virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
  589. virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
  590. virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
  591. virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
  592. virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
  593. virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) = 0;
  594. virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) = 0;
  595. //set default SSAO options
  596. //set default SSR options
  597. //set default SSSSS options
  598. enum EnvironmentDOFBlurQuality {
  599. ENV_DOF_BLUR_QUALITY_LOW,
  600. ENV_DOF_BLUR_QUALITY_MEDIUM,
  601. ENV_DOF_BLUR_QUALITY_HIGH,
  602. };
  603. virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, EnvironmentDOFBlurQuality p_quality) = 0;
  604. virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, EnvironmentDOFBlurQuality p_quality) = 0;
  605. enum EnvironmentGlowBlendMode {
  606. GLOW_BLEND_MODE_ADDITIVE,
  607. GLOW_BLEND_MODE_SCREEN,
  608. GLOW_BLEND_MODE_SOFTLIGHT,
  609. GLOW_BLEND_MODE_REPLACE,
  610. };
  611. virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale, bool p_high_quality) = 0;
  612. enum EnvironmentToneMapper {
  613. ENV_TONE_MAPPER_LINEAR,
  614. ENV_TONE_MAPPER_REINHARD,
  615. ENV_TONE_MAPPER_FILMIC,
  616. ENV_TONE_MAPPER_ACES,
  617. ENV_TONE_MAPPER_ACES_FITTED
  618. };
  619. virtual void environment_set_tonemap(RID p_env, EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_grey) = 0;
  620. virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0;
  621. 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, bool p_roughness) = 0;
  622. enum EnvironmentSSAOQuality {
  623. ENV_SSAO_QUALITY_LOW,
  624. ENV_SSAO_QUALITY_MEDIUM,
  625. ENV_SSAO_QUALITY_HIGH,
  626. };
  627. enum EnvironmentSSAOBlur {
  628. ENV_SSAO_BLUR_DISABLED,
  629. ENV_SSAO_BLUR_1x1,
  630. ENV_SSAO_BLUR_2x2,
  631. ENV_SSAO_BLUR_3x3,
  632. };
  633. virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
  634. virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0;
  635. virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0;
  636. virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) = 0;
  637. /* SCENARIO API */
  638. virtual RID scenario_create() = 0;
  639. enum ScenarioDebugMode {
  640. SCENARIO_DEBUG_DISABLED,
  641. SCENARIO_DEBUG_WIREFRAME,
  642. SCENARIO_DEBUG_OVERDRAW,
  643. SCENARIO_DEBUG_SHADELESS,
  644. };
  645. virtual void scenario_set_debug(RID p_scenario, ScenarioDebugMode p_debug_mode) = 0;
  646. virtual void scenario_set_environment(RID p_scenario, RID p_environment) = 0;
  647. virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_size, int p_subdiv) = 0;
  648. virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment) = 0;
  649. /* INSTANCING API */
  650. enum InstanceType {
  651. INSTANCE_NONE,
  652. INSTANCE_MESH,
  653. INSTANCE_MULTIMESH,
  654. INSTANCE_IMMEDIATE,
  655. INSTANCE_PARTICLES,
  656. INSTANCE_LIGHT,
  657. INSTANCE_REFLECTION_PROBE,
  658. INSTANCE_GI_PROBE,
  659. INSTANCE_LIGHTMAP_CAPTURE,
  660. INSTANCE_MAX,
  661. INSTANCE_GEOMETRY_MASK = (1 << INSTANCE_MESH) | (1 << INSTANCE_MULTIMESH) | (1 << INSTANCE_IMMEDIATE) | (1 << INSTANCE_PARTICLES)
  662. };
  663. virtual RID instance_create2(RID p_base, RID p_scenario);
  664. virtual RID instance_create() = 0;
  665. virtual void instance_set_base(RID p_instance, RID p_base) = 0;
  666. virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0;
  667. virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask) = 0;
  668. virtual void instance_set_transform(RID p_instance, const Transform &p_transform) = 0;
  669. virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id) = 0;
  670. virtual void instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) = 0;
  671. virtual void instance_set_surface_material(RID p_instance, int p_surface, RID p_material) = 0;
  672. virtual void instance_set_visible(RID p_instance, bool p_visible) = 0;
  673. virtual void instance_set_use_lightmap(RID p_instance, RID p_lightmap_instance, RID p_lightmap, int p_lightmap_slice, const Rect2 &p_lightmap_uv_rect) = 0;
  674. virtual void instance_set_custom_aabb(RID p_instance, AABB aabb) = 0;
  675. virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton) = 0;
  676. virtual void instance_set_exterior(RID p_instance, bool p_enabled) = 0;
  677. virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
  678. /* ROOMS AND PORTALS API */
  679. // Portals
  680. enum InstancePortalMode {
  681. INSTANCE_PORTAL_MODE_STATIC, // not moving within a room
  682. INSTANCE_PORTAL_MODE_DYNAMIC, // moving within room
  683. INSTANCE_PORTAL_MODE_ROAMING, // moving between rooms
  684. INSTANCE_PORTAL_MODE_GLOBAL, // frustum culled only
  685. INSTANCE_PORTAL_MODE_IGNORE, // don't show at all - e.g. manual bounds, hidden portals
  686. };
  687. virtual void instance_set_portal_mode(RID p_instance, InstancePortalMode p_mode) = 0;
  688. virtual RID ghost_create() = 0;
  689. virtual void ghost_set_scenario(RID p_ghost, RID p_scenario, ObjectID p_id, const AABB &p_aabb) = 0;
  690. virtual void ghost_update(RID p_ghost, const AABB &p_aabb) = 0;
  691. virtual RID portal_create() = 0;
  692. virtual void portal_set_scenario(RID p_portal, RID p_scenario) = 0;
  693. virtual void portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, real_t p_margin) = 0;
  694. virtual void portal_link(RID p_portal, RID p_room_from, RID p_room_to, bool p_two_way) = 0;
  695. virtual void portal_set_active(RID p_portal, bool p_active) = 0;
  696. // Roomgroups
  697. virtual RID roomgroup_create() = 0;
  698. virtual void roomgroup_prepare(RID p_roomgroup, ObjectID p_roomgroup_object_id) = 0;
  699. virtual void roomgroup_set_scenario(RID p_roomgroup, RID p_scenario) = 0;
  700. virtual void roomgroup_add_room(RID p_roomgroup, RID p_room) = 0;
  701. // Occluders
  702. enum OccluderType {
  703. OCCLUDER_TYPE_UNDEFINED,
  704. OCCLUDER_TYPE_SPHERE,
  705. OCCLUDER_TYPE_NUM_TYPES,
  706. };
  707. virtual RID occluder_create() = 0;
  708. virtual void occluder_set_scenario(RID p_occluder, RID p_scenario, VisualServer::OccluderType p_type) = 0;
  709. virtual void occluder_spheres_update(RID p_occluder, const Vector<Plane> &p_spheres) = 0;
  710. virtual void occluder_set_transform(RID p_occluder, const Transform &p_xform) = 0;
  711. virtual void occluder_set_active(RID p_occluder, bool p_active) = 0;
  712. virtual void set_use_occlusion_culling(bool p_enable) = 0;
  713. // Rooms
  714. enum RoomsDebugFeature {
  715. ROOMS_DEBUG_SPRAWL,
  716. };
  717. virtual RID room_create() = 0;
  718. virtual void room_set_scenario(RID p_room, RID p_scenario) = 0;
  719. virtual void room_add_instance(RID p_room, RID p_instance, const AABB &p_aabb, const Vector<Vector3> &p_object_pts) = 0;
  720. virtual void room_add_ghost(RID p_room, ObjectID p_object_id, const AABB &p_aabb) = 0;
  721. virtual void room_set_bound(RID p_room, ObjectID p_room_object_id, const Vector<Plane> &p_convex, const AABB &p_aabb, const Vector<Vector3> &p_verts) = 0;
  722. virtual void room_prepare(RID p_room, int32_t p_priority) = 0;
  723. virtual void rooms_and_portals_clear(RID p_scenario) = 0;
  724. virtual void rooms_unload(RID p_scenario, String p_reason) = 0;
  725. virtual void rooms_finalize(RID p_scenario, bool p_generate_pvs, bool p_cull_using_pvs, bool p_use_secondary_pvs, bool p_use_signals, String p_pvs_filename, bool p_use_simple_pvs, bool p_log_pvs_generation) = 0;
  726. virtual void rooms_override_camera(RID p_scenario, bool p_override, const Vector3 &p_point, const Vector<Plane> *p_convex) = 0;
  727. virtual void rooms_set_active(RID p_scenario, bool p_active) = 0;
  728. virtual void rooms_set_params(RID p_scenario, int p_portal_depth_limit, real_t p_roaming_expansion_margin) = 0;
  729. virtual void rooms_set_debug_feature(RID p_scenario, RoomsDebugFeature p_feature, bool p_active) = 0;
  730. virtual void rooms_update_gameplay_monitor(RID p_scenario, const Vector<Vector3> &p_camera_positions) = 0;
  731. // don't use this in a game!
  732. virtual bool rooms_is_loaded(RID p_scenario) const = 0;
  733. // callbacks are used to send messages back from the visual server to scene tree in thread friendly manner
  734. virtual void callbacks_register(VisualServerCallbacks *p_callbacks) = 0;
  735. // don't use these in a game!
  736. virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const = 0;
  737. virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const = 0;
  738. virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0;
  739. Array _instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario = RID()) const;
  740. Array _instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
  741. Array _instances_cull_convex_bind(const Array &p_convex, RID p_scenario = RID()) const;
  742. enum InstanceFlags {
  743. INSTANCE_FLAG_USE_BAKED_LIGHT,
  744. INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE,
  745. INSTANCE_FLAG_MAX
  746. };
  747. enum ShadowCastingSetting {
  748. SHADOW_CASTING_SETTING_OFF,
  749. SHADOW_CASTING_SETTING_ON,
  750. SHADOW_CASTING_SETTING_DOUBLE_SIDED,
  751. SHADOW_CASTING_SETTING_SHADOWS_ONLY,
  752. };
  753. virtual void instance_geometry_set_flag(RID p_instance, InstanceFlags p_flags, bool p_enabled) = 0;
  754. virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
  755. virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
  756. virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
  757. virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) = 0;
  758. /* CANVAS (2D) */
  759. virtual RID canvas_create() = 0;
  760. virtual void canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring) = 0;
  761. virtual void canvas_set_modulate(RID p_canvas, const Color &p_color) = 0;
  762. virtual void canvas_set_parent(RID p_canvas, RID p_parent, float p_scale) = 0;
  763. virtual void canvas_set_disable_scale(bool p_disable) = 0;
  764. virtual RID canvas_item_create() = 0;
  765. virtual void canvas_item_set_parent(RID p_item, RID p_parent) = 0;
  766. virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0;
  767. virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0;
  768. virtual void canvas_item_set_update_when_visible(RID p_item, bool p_update) = 0;
  769. virtual void canvas_item_set_transform(RID p_item, const Transform2D &p_transform) = 0;
  770. virtual void canvas_item_set_clip(RID p_item, bool p_clip) = 0;
  771. virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable) = 0;
  772. virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect = Rect2()) = 0;
  773. virtual void canvas_item_set_modulate(RID p_item, const Color &p_color) = 0;
  774. virtual void canvas_item_set_self_modulate(RID p_item, const Color &p_color) = 0;
  775. virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable) = 0;
  776. enum NinePatchAxisMode {
  777. NINE_PATCH_STRETCH,
  778. NINE_PATCH_TILE,
  779. NINE_PATCH_TILE_FIT,
  780. };
  781. 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;
  782. 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;
  783. 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;
  784. virtual void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) = 0;
  785. virtual void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) = 0;
  786. 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, RID p_normal_map = RID()) = 0;
  787. 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, RID p_normal_map = RID(), bool p_clip_uv = false) = 0;
  788. 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), RID p_normal_map = RID()) = 0;
  789. virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID()) = 0;
  790. 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(), RID p_normal_map = RID(), bool p_antialiased = false) = 0;
  791. 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, RID p_normal_map = RID(), bool p_antialiased = false, bool p_antialiasing_use_indices = false) = 0;
  792. 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(), RID p_normal_map = RID()) = 0;
  793. virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID()) = 0;
  794. virtual void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map) = 0;
  795. virtual void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) = 0;
  796. virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore) = 0;
  797. virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) = 0;
  798. virtual void canvas_item_set_z_index(RID p_item, int p_z) = 0;
  799. virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) = 0;
  800. virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) = 0;
  801. virtual void canvas_item_attach_skeleton(RID p_item, RID p_skeleton) = 0;
  802. virtual void canvas_item_clear(RID p_item) = 0;
  803. virtual void canvas_item_set_draw_index(RID p_item, int p_index) = 0;
  804. virtual void canvas_item_set_material(RID p_item, RID p_material) = 0;
  805. virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable) = 0;
  806. virtual RID canvas_light_create() = 0;
  807. virtual void canvas_light_attach_to_canvas(RID p_light, RID p_canvas) = 0;
  808. virtual void canvas_light_set_enabled(RID p_light, bool p_enabled) = 0;
  809. virtual void canvas_light_set_scale(RID p_light, float p_scale) = 0;
  810. virtual void canvas_light_set_transform(RID p_light, const Transform2D &p_transform) = 0;
  811. virtual void canvas_light_set_texture(RID p_light, RID p_texture) = 0;
  812. virtual void canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) = 0;
  813. virtual void canvas_light_set_color(RID p_light, const Color &p_color) = 0;
  814. virtual void canvas_light_set_height(RID p_light, float p_height) = 0;
  815. virtual void canvas_light_set_energy(RID p_light, float p_energy) = 0;
  816. virtual void canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) = 0;
  817. virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) = 0;
  818. virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask) = 0;
  819. virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) = 0;
  820. enum CanvasLightMode {
  821. CANVAS_LIGHT_MODE_ADD,
  822. CANVAS_LIGHT_MODE_SUB,
  823. CANVAS_LIGHT_MODE_MIX,
  824. CANVAS_LIGHT_MODE_MASK,
  825. };
  826. virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode) = 0;
  827. enum CanvasLightShadowFilter {
  828. CANVAS_LIGHT_FILTER_NONE,
  829. CANVAS_LIGHT_FILTER_PCF3,
  830. CANVAS_LIGHT_FILTER_PCF5,
  831. CANVAS_LIGHT_FILTER_PCF7,
  832. CANVAS_LIGHT_FILTER_PCF9,
  833. CANVAS_LIGHT_FILTER_PCF13,
  834. };
  835. virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) = 0;
  836. virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size) = 0;
  837. virtual void canvas_light_set_shadow_gradient_length(RID p_light, float p_length) = 0;
  838. virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter) = 0;
  839. virtual void canvas_light_set_shadow_color(RID p_light, const Color &p_color) = 0;
  840. virtual void canvas_light_set_shadow_smooth(RID p_light, float p_smooth) = 0;
  841. virtual RID canvas_light_occluder_create() = 0;
  842. virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) = 0;
  843. virtual void canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) = 0;
  844. virtual void canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) = 0;
  845. virtual void canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) = 0;
  846. virtual void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) = 0;
  847. virtual RID canvas_occluder_polygon_create() = 0;
  848. virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed) = 0;
  849. virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape) = 0;
  850. enum CanvasOccluderPolygonCullMode {
  851. CANVAS_OCCLUDER_POLYGON_CULL_DISABLED,
  852. CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE,
  853. CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE,
  854. };
  855. virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, CanvasOccluderPolygonCullMode p_mode) = 0;
  856. /* BLACK BARS */
  857. virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) = 0;
  858. virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) = 0;
  859. /* FREE */
  860. virtual void free(RID p_rid) = 0; ///< free RIDs associated with the visual server
  861. virtual void request_frame_drawn_callback(Object *p_where, const StringName &p_method, const Variant &p_userdata) = 0;
  862. /* EVENT QUEUING */
  863. virtual void draw(bool p_swap_buffers = true, double frame_step = 0.0) = 0;
  864. virtual void sync() = 0;
  865. virtual bool has_changed() const = 0;
  866. virtual void init() = 0;
  867. virtual void finish() = 0;
  868. /* STATUS INFORMATION */
  869. enum RenderInfo {
  870. INFO_OBJECTS_IN_FRAME,
  871. INFO_VERTICES_IN_FRAME,
  872. INFO_MATERIAL_CHANGES_IN_FRAME,
  873. INFO_SHADER_CHANGES_IN_FRAME,
  874. INFO_SURFACE_CHANGES_IN_FRAME,
  875. INFO_DRAW_CALLS_IN_FRAME,
  876. INFO_2D_ITEMS_IN_FRAME,
  877. INFO_2D_DRAW_CALLS_IN_FRAME,
  878. INFO_USAGE_VIDEO_MEM_TOTAL,
  879. INFO_VIDEO_MEM_USED,
  880. INFO_TEXTURE_MEM_USED,
  881. INFO_VERTEX_MEM_USED,
  882. };
  883. virtual uint64_t get_render_info(RenderInfo p_info) = 0;
  884. virtual String get_video_adapter_name() const = 0;
  885. virtual String get_video_adapter_vendor() const = 0;
  886. /* Materials for 2D on 3D */
  887. /* TESTING */
  888. virtual RID get_test_cube() = 0;
  889. virtual RID get_test_texture();
  890. virtual RID get_white_texture();
  891. virtual RID make_sphere_mesh(int p_lats, int p_lons, float p_radius);
  892. virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data);
  893. virtual void mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes);
  894. virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0;
  895. virtual void set_default_clear_color(const Color &p_color) = 0;
  896. virtual void set_shader_time_scale(float p_scale) = 0;
  897. enum Features {
  898. FEATURE_SHADERS,
  899. FEATURE_MULTITHREADED,
  900. };
  901. virtual bool has_feature(Features p_feature) const = 0;
  902. virtual bool has_os_feature(const String &p_feature) const = 0;
  903. virtual void set_debug_generate_wireframes(bool p_generate) = 0;
  904. virtual void call_set_use_vsync(bool p_enable) = 0;
  905. virtual bool is_low_end() const = 0;
  906. bool is_render_loop_enabled() const;
  907. void set_render_loop_enabled(bool p_enabled);
  908. VisualServer();
  909. virtual ~VisualServer();
  910. };
  911. // make variant understand the enums
  912. VARIANT_ENUM_CAST(VisualServer::CubeMapSide);
  913. VARIANT_ENUM_CAST(VisualServer::TextureFlags);
  914. VARIANT_ENUM_CAST(VisualServer::ShaderMode);
  915. VARIANT_ENUM_CAST(VisualServer::ArrayType);
  916. VARIANT_ENUM_CAST(VisualServer::ArrayFormat);
  917. VARIANT_ENUM_CAST(VisualServer::PrimitiveType);
  918. VARIANT_ENUM_CAST(VisualServer::BlendShapeMode);
  919. VARIANT_ENUM_CAST(VisualServer::LightType);
  920. VARIANT_ENUM_CAST(VisualServer::LightParam);
  921. VARIANT_ENUM_CAST(VisualServer::ViewportUpdateMode);
  922. VARIANT_ENUM_CAST(VisualServer::ViewportClearMode);
  923. VARIANT_ENUM_CAST(VisualServer::ViewportMSAA);
  924. VARIANT_ENUM_CAST(VisualServer::ViewportUsage);
  925. VARIANT_ENUM_CAST(VisualServer::ViewportRenderInfo);
  926. VARIANT_ENUM_CAST(VisualServer::ViewportDebugDraw);
  927. VARIANT_ENUM_CAST(VisualServer::ScenarioDebugMode);
  928. VARIANT_ENUM_CAST(VisualServer::InstanceType);
  929. VARIANT_ENUM_CAST(VisualServer::InstancePortalMode);
  930. VARIANT_ENUM_CAST(VisualServer::NinePatchAxisMode);
  931. VARIANT_ENUM_CAST(VisualServer::CanvasLightMode);
  932. VARIANT_ENUM_CAST(VisualServer::CanvasLightShadowFilter);
  933. VARIANT_ENUM_CAST(VisualServer::CanvasOccluderPolygonCullMode);
  934. VARIANT_ENUM_CAST(VisualServer::RenderInfo);
  935. VARIANT_ENUM_CAST(VisualServer::Features);
  936. VARIANT_ENUM_CAST(VisualServer::MultimeshTransformFormat);
  937. VARIANT_ENUM_CAST(VisualServer::MultimeshColorFormat);
  938. VARIANT_ENUM_CAST(VisualServer::MultimeshCustomDataFormat);
  939. VARIANT_ENUM_CAST(VisualServer::LightBakeMode);
  940. VARIANT_ENUM_CAST(VisualServer::LightOmniShadowMode);
  941. VARIANT_ENUM_CAST(VisualServer::LightOmniShadowDetail);
  942. VARIANT_ENUM_CAST(VisualServer::LightDirectionalShadowMode);
  943. VARIANT_ENUM_CAST(VisualServer::LightDirectionalShadowDepthRangeMode);
  944. VARIANT_ENUM_CAST(VisualServer::ReflectionProbeUpdateMode);
  945. VARIANT_ENUM_CAST(VisualServer::ParticlesDrawOrder);
  946. VARIANT_ENUM_CAST(VisualServer::EnvironmentBG);
  947. VARIANT_ENUM_CAST(VisualServer::EnvironmentDOFBlurQuality);
  948. VARIANT_ENUM_CAST(VisualServer::EnvironmentGlowBlendMode);
  949. VARIANT_ENUM_CAST(VisualServer::EnvironmentToneMapper);
  950. VARIANT_ENUM_CAST(VisualServer::EnvironmentSSAOQuality);
  951. VARIANT_ENUM_CAST(VisualServer::EnvironmentSSAOBlur);
  952. VARIANT_ENUM_CAST(VisualServer::InstanceFlags);
  953. VARIANT_ENUM_CAST(VisualServer::ShadowCastingSetting);
  954. VARIANT_ENUM_CAST(VisualServer::TextureType);
  955. //typedef VisualServer VS; // makes it easier to use
  956. #define VS VisualServer
  957. #endif