visual_server_wrap_mt.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. /**************************************************************************/
  2. /* visual_server_wrap_mt.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 VISUAL_SERVER_WRAP_MT_H
  31. #define VISUAL_SERVER_WRAP_MT_H
  32. #include "core/command_queue_mt.h"
  33. #include "core/os/thread.h"
  34. #include "core/safe_refcount.h"
  35. #include "servers/visual_server.h"
  36. class VisualServerWrapMT : public VisualServer {
  37. // the real visual server
  38. mutable VisualServer *visual_server;
  39. mutable CommandQueueMT command_queue;
  40. static void _thread_callback(void *_instance);
  41. void thread_loop();
  42. Thread::ID server_thread;
  43. SafeFlag exit;
  44. Thread thread;
  45. SafeFlag draw_thread_up;
  46. bool create_thread;
  47. void thread_draw(bool p_swap_buffers, double frame_step);
  48. void thread_flush();
  49. void thread_exit();
  50. Mutex alloc_mutex;
  51. int pool_max_size;
  52. //#define DEBUG_SYNC
  53. static VisualServerWrapMT *singleton_mt;
  54. #ifdef DEBUG_SYNC
  55. #define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
  56. #else
  57. #define SYNC_DEBUG
  58. #endif
  59. public:
  60. #define ServerName VisualServer
  61. #define ServerNameWrapMT VisualServerWrapMT
  62. #define server_name visual_server
  63. #include "servers/server_wrap_mt_common.h"
  64. /* EVENT QUEUING */
  65. FUNCRID(texture)
  66. FUNC7(texture_allocate, RID, int, int, int, Image::Format, TextureType, uint32_t)
  67. FUNC3(texture_set_data, RID, const Ref<Image> &, int)
  68. FUNC10(texture_set_data_partial, RID, const Ref<Image> &, int, int, int, int, int, int, int, int)
  69. FUNC2RC(Ref<Image>, texture_get_data, RID, int)
  70. FUNC2(texture_set_flags, RID, uint32_t)
  71. FUNC1RC(uint32_t, texture_get_flags, RID)
  72. FUNC1RC(Image::Format, texture_get_format, RID)
  73. FUNC1RC(TextureType, texture_get_type, RID)
  74. FUNC1RC(uint32_t, texture_get_texid, RID)
  75. FUNC1RC(uint32_t, texture_get_width, RID)
  76. FUNC1RC(uint32_t, texture_get_height, RID)
  77. FUNC1RC(uint32_t, texture_get_depth, RID)
  78. FUNC4(texture_set_size_override, RID, int, int, int)
  79. FUNC2(texture_bind, RID, uint32_t)
  80. FUNC3(texture_set_detect_3d_callback, RID, TextureDetectCallback, void *)
  81. FUNC3(texture_set_detect_srgb_callback, RID, TextureDetectCallback, void *)
  82. FUNC3(texture_set_detect_normal_callback, RID, TextureDetectCallback, void *)
  83. FUNC2(texture_set_path, RID, const String &)
  84. FUNC1RC(String, texture_get_path, RID)
  85. FUNC1(texture_set_shrink_all_x2_on_set_data, bool)
  86. FUNC1S(texture_debug_usage, List<TextureInfo> *)
  87. FUNC1(textures_keep_original, bool)
  88. FUNC2(texture_set_proxy, RID, RID)
  89. FUNC2(texture_set_force_redraw_if_visible, RID, bool)
  90. /* SKY API */
  91. FUNCRID(sky)
  92. FUNC3(sky_set_texture, RID, RID, int)
  93. /* SHADER API */
  94. FUNCRID(shader)
  95. FUNC2(shader_set_code, RID, const String &)
  96. FUNC1RC(String, shader_get_code, RID)
  97. FUNC2SC(shader_get_param_list, RID, List<PropertyInfo> *)
  98. FUNC3(shader_set_default_texture_param, RID, const StringName &, RID)
  99. FUNC2RC(RID, shader_get_default_texture_param, RID, const StringName &)
  100. FUNC2(shader_add_custom_define, RID, const String &)
  101. FUNC2SC(shader_get_custom_defines, RID, Vector<String> *)
  102. FUNC2(shader_remove_custom_define, RID, const String &)
  103. FUNC1(set_shader_async_hidden_forbidden, bool)
  104. /* COMMON MATERIAL API */
  105. FUNCRID(material)
  106. FUNC2(material_set_shader, RID, RID)
  107. FUNC1RC(RID, material_get_shader, RID)
  108. FUNC3(material_set_param, RID, const StringName &, const Variant &)
  109. FUNC2RC(Variant, material_get_param, RID, const StringName &)
  110. FUNC2RC(Variant, material_get_param_default, RID, const StringName &)
  111. FUNC2(material_set_render_priority, RID, int)
  112. FUNC2(material_set_line_width, RID, float)
  113. FUNC2(material_set_next_pass, RID, RID)
  114. /* MESH API */
  115. FUNCRID(mesh)
  116. FUNC10(mesh_add_surface, RID, uint32_t, PrimitiveType, const PoolVector<uint8_t> &, int, const PoolVector<uint8_t> &, int, const AABB &, const Vector<PoolVector<uint8_t>> &, const Vector<AABB> &)
  117. FUNC2(mesh_set_blend_shape_count, RID, int)
  118. FUNC1RC(int, mesh_get_blend_shape_count, RID)
  119. FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
  120. FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
  121. FUNC4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &)
  122. FUNC3(mesh_surface_set_material, RID, int, RID)
  123. FUNC2RC(RID, mesh_surface_get_material, RID, int)
  124. FUNC2RC(int, mesh_surface_get_array_len, RID, int)
  125. FUNC2RC(int, mesh_surface_get_array_index_len, RID, int)
  126. FUNC2RC(PoolVector<uint8_t>, mesh_surface_get_array, RID, int)
  127. FUNC2RC(PoolVector<uint8_t>, mesh_surface_get_index_array, RID, int)
  128. FUNC2RC(uint32_t, mesh_surface_get_format, RID, int)
  129. FUNC2RC(PrimitiveType, mesh_surface_get_primitive_type, RID, int)
  130. FUNC2RC(AABB, mesh_surface_get_aabb, RID, int)
  131. FUNC2RC(Vector<PoolVector<uint8_t>>, mesh_surface_get_blend_shapes, RID, int)
  132. FUNC2RC(Vector<AABB>, mesh_surface_get_skeleton_aabb, RID, int)
  133. FUNC2(mesh_remove_surface, RID, int)
  134. FUNC1RC(int, mesh_get_surface_count, RID)
  135. FUNC2(mesh_set_custom_aabb, RID, const AABB &)
  136. FUNC1RC(AABB, mesh_get_custom_aabb, RID)
  137. FUNC1(mesh_clear, RID)
  138. /* MULTIMESH API */
  139. FUNCRID(multimesh)
  140. FUNC5(multimesh_allocate, RID, int, MultimeshTransformFormat, MultimeshColorFormat, MultimeshCustomDataFormat)
  141. FUNC1RC(int, multimesh_get_instance_count, RID)
  142. FUNC2(multimesh_set_mesh, RID, RID)
  143. FUNC3(multimesh_instance_set_transform, RID, int, const Transform &)
  144. FUNC3(multimesh_instance_set_transform_2d, RID, int, const Transform2D &)
  145. FUNC3(multimesh_instance_set_color, RID, int, const Color &)
  146. FUNC3(multimesh_instance_set_custom_data, RID, int, const Color &)
  147. FUNC1RC(RID, multimesh_get_mesh, RID)
  148. FUNC1RC(AABB, multimesh_get_aabb, RID)
  149. FUNC2RC(Transform, multimesh_instance_get_transform, RID, int)
  150. FUNC2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int)
  151. FUNC2RC(Color, multimesh_instance_get_color, RID, int)
  152. FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int)
  153. FUNC2(multimesh_set_as_bulk_array, RID, const PoolVector<float> &)
  154. FUNC3(multimesh_set_as_bulk_array_interpolated, RID, const PoolVector<float> &, const PoolVector<float> &)
  155. FUNC2(multimesh_set_physics_interpolated, RID, bool)
  156. FUNC2(multimesh_set_physics_interpolation_quality, RID, MultimeshPhysicsInterpolationQuality)
  157. FUNC2(multimesh_instance_reset_physics_interpolation, RID, int)
  158. FUNC2(multimesh_set_visible_instances, RID, int)
  159. FUNC1RC(int, multimesh_get_visible_instances, RID)
  160. /* IMMEDIATE API */
  161. FUNCRID(immediate)
  162. FUNC3(immediate_begin, RID, PrimitiveType, RID)
  163. FUNC2(immediate_vertex, RID, const Vector3 &)
  164. FUNC2(immediate_normal, RID, const Vector3 &)
  165. FUNC2(immediate_tangent, RID, const Plane &)
  166. FUNC2(immediate_color, RID, const Color &)
  167. FUNC2(immediate_uv, RID, const Vector2 &)
  168. FUNC2(immediate_uv2, RID, const Vector2 &)
  169. FUNC1(immediate_end, RID)
  170. FUNC1(immediate_clear, RID)
  171. FUNC2(immediate_set_material, RID, RID)
  172. FUNC1RC(RID, immediate_get_material, RID)
  173. /* SKELETON API */
  174. FUNCRID(skeleton)
  175. FUNC3(skeleton_allocate, RID, int, bool)
  176. FUNC1RC(int, skeleton_get_bone_count, RID)
  177. FUNC3(skeleton_bone_set_transform, RID, int, const Transform &)
  178. FUNC2RC(Transform, skeleton_bone_get_transform, RID, int)
  179. FUNC3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
  180. FUNC2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
  181. FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &)
  182. /* Light API */
  183. FUNCRID(directional_light)
  184. FUNCRID(omni_light)
  185. FUNCRID(spot_light)
  186. FUNC2(light_set_color, RID, const Color &)
  187. FUNC3(light_set_param, RID, LightParam, float)
  188. FUNC2(light_set_shadow, RID, bool)
  189. FUNC2(light_set_shadow_color, RID, const Color &)
  190. FUNC2(light_set_projector, RID, RID)
  191. FUNC2(light_set_negative, RID, bool)
  192. FUNC2(light_set_cull_mask, RID, uint32_t)
  193. FUNC2(light_set_reverse_cull_face_mode, RID, bool)
  194. FUNC2(light_set_use_gi, RID, bool)
  195. FUNC2(light_set_bake_mode, RID, LightBakeMode)
  196. FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
  197. FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
  198. FUNC2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode)
  199. FUNC2(light_directional_set_blend_splits, RID, bool)
  200. FUNC2(light_directional_set_shadow_depth_range_mode, RID, LightDirectionalShadowDepthRangeMode)
  201. /* PROBE API */
  202. FUNCRID(reflection_probe)
  203. FUNC2(reflection_probe_set_update_mode, RID, ReflectionProbeUpdateMode)
  204. FUNC2(reflection_probe_set_intensity, RID, float)
  205. FUNC2(reflection_probe_set_interior_ambient, RID, const Color &)
  206. FUNC2(reflection_probe_set_interior_ambient_energy, RID, float)
  207. FUNC2(reflection_probe_set_interior_ambient_probe_contribution, RID, float)
  208. FUNC2(reflection_probe_set_max_distance, RID, float)
  209. FUNC2(reflection_probe_set_extents, RID, const Vector3 &)
  210. FUNC2(reflection_probe_set_origin_offset, RID, const Vector3 &)
  211. FUNC2(reflection_probe_set_as_interior, RID, bool)
  212. FUNC2(reflection_probe_set_enable_box_projection, RID, bool)
  213. FUNC2(reflection_probe_set_enable_shadows, RID, bool)
  214. FUNC2(reflection_probe_set_cull_mask, RID, uint32_t)
  215. FUNC2(reflection_probe_set_resolution, RID, int)
  216. /* BAKED LIGHT API */
  217. FUNCRID(gi_probe)
  218. FUNC2(gi_probe_set_bounds, RID, const AABB &)
  219. FUNC1RC(AABB, gi_probe_get_bounds, RID)
  220. FUNC2(gi_probe_set_cell_size, RID, float)
  221. FUNC1RC(float, gi_probe_get_cell_size, RID)
  222. FUNC2(gi_probe_set_to_cell_xform, RID, const Transform &)
  223. FUNC1RC(Transform, gi_probe_get_to_cell_xform, RID)
  224. FUNC2(gi_probe_set_dynamic_range, RID, int)
  225. FUNC1RC(int, gi_probe_get_dynamic_range, RID)
  226. FUNC2(gi_probe_set_energy, RID, float)
  227. FUNC1RC(float, gi_probe_get_energy, RID)
  228. FUNC2(gi_probe_set_bias, RID, float)
  229. FUNC1RC(float, gi_probe_get_bias, RID)
  230. FUNC2(gi_probe_set_normal_bias, RID, float)
  231. FUNC1RC(float, gi_probe_get_normal_bias, RID)
  232. FUNC2(gi_probe_set_propagation, RID, float)
  233. FUNC1RC(float, gi_probe_get_propagation, RID)
  234. FUNC2(gi_probe_set_interior, RID, bool)
  235. FUNC1RC(bool, gi_probe_is_interior, RID)
  236. FUNC2(gi_probe_set_compress, RID, bool)
  237. FUNC1RC(bool, gi_probe_is_compressed, RID)
  238. FUNC2(gi_probe_set_dynamic_data, RID, const PoolVector<int> &)
  239. FUNC1RC(PoolVector<int>, gi_probe_get_dynamic_data, RID)
  240. /* LIGHTMAP CAPTURE */
  241. FUNCRID(lightmap_capture)
  242. FUNC2(lightmap_capture_set_bounds, RID, const AABB &)
  243. FUNC1RC(AABB, lightmap_capture_get_bounds, RID)
  244. FUNC2(lightmap_capture_set_octree, RID, const PoolVector<uint8_t> &)
  245. FUNC1RC(PoolVector<uint8_t>, lightmap_capture_get_octree, RID)
  246. FUNC2(lightmap_capture_set_octree_cell_transform, RID, const Transform &)
  247. FUNC1RC(Transform, lightmap_capture_get_octree_cell_transform, RID)
  248. FUNC2(lightmap_capture_set_octree_cell_subdiv, RID, int)
  249. FUNC1RC(int, lightmap_capture_get_octree_cell_subdiv, RID)
  250. FUNC2(lightmap_capture_set_energy, RID, float)
  251. FUNC1RC(float, lightmap_capture_get_energy, RID)
  252. FUNC2(lightmap_capture_set_interior, RID, bool)
  253. FUNC1RC(bool, lightmap_capture_is_interior, RID)
  254. /* PARTICLES */
  255. FUNCRID(particles)
  256. FUNC2(particles_set_emitting, RID, bool)
  257. FUNC1R(bool, particles_get_emitting, RID)
  258. FUNC2(particles_set_amount, RID, int)
  259. FUNC2(particles_set_lifetime, RID, float)
  260. FUNC2(particles_set_one_shot, RID, bool)
  261. FUNC2(particles_set_pre_process_time, RID, float)
  262. FUNC2(particles_set_explosiveness_ratio, RID, float)
  263. FUNC2(particles_set_randomness_ratio, RID, float)
  264. FUNC2(particles_set_custom_aabb, RID, const AABB &)
  265. FUNC2(particles_set_speed_scale, RID, float)
  266. FUNC2(particles_set_use_local_coordinates, RID, bool)
  267. FUNC2(particles_set_process_material, RID, RID)
  268. FUNC2(particles_set_fixed_fps, RID, int)
  269. FUNC2(particles_set_fractional_delta, RID, bool)
  270. FUNC1R(bool, particles_is_inactive, RID)
  271. FUNC1(particles_request_process, RID)
  272. FUNC1(particles_restart, RID)
  273. FUNC2(particles_set_draw_order, RID, VS::ParticlesDrawOrder)
  274. FUNC2(particles_set_draw_passes, RID, int)
  275. FUNC3(particles_set_draw_pass_mesh, RID, int, RID)
  276. FUNC2(particles_set_emission_transform, RID, const Transform &)
  277. FUNC1R(AABB, particles_get_current_aabb, RID)
  278. /* CAMERA API */
  279. FUNCRID(camera)
  280. FUNC4(camera_set_perspective, RID, float, float, float)
  281. FUNC4(camera_set_orthogonal, RID, float, float, float)
  282. FUNC5(camera_set_frustum, RID, float, Vector2, float, float)
  283. FUNC2(camera_set_transform, RID, const Transform &)
  284. FUNC2(camera_set_cull_mask, RID, uint32_t)
  285. FUNC2(camera_set_environment, RID, RID)
  286. FUNC2(camera_set_use_vertical_aspect, RID, bool)
  287. /* VIEWPORT TARGET API */
  288. FUNCRID(viewport)
  289. FUNC2(viewport_set_use_arvr, RID, bool)
  290. FUNC3(viewport_set_size, RID, int, int)
  291. FUNC2(viewport_set_active, RID, bool)
  292. FUNC2(viewport_set_parent_viewport, RID, RID)
  293. FUNC2(viewport_set_clear_mode, RID, ViewportClearMode)
  294. FUNC3(viewport_attach_to_screen, RID, const Rect2 &, int)
  295. FUNC2(viewport_set_render_direct_to_screen, RID, bool)
  296. FUNC1(viewport_detach, RID)
  297. FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
  298. FUNC2(viewport_set_vflip, RID, bool)
  299. FUNC1RC(RID, viewport_get_texture, RID)
  300. FUNC2(viewport_set_hide_scenario, RID, bool)
  301. FUNC2(viewport_set_hide_canvas, RID, bool)
  302. FUNC2(viewport_set_disable_environment, RID, bool)
  303. FUNC2(viewport_set_disable_3d, RID, bool)
  304. FUNC2(viewport_set_keep_3d_linear, RID, bool)
  305. FUNC2(viewport_attach_camera, RID, RID)
  306. FUNC2(viewport_set_scenario, RID, RID)
  307. FUNC2(viewport_attach_canvas, RID, RID)
  308. FUNC2(viewport_remove_canvas, RID, RID)
  309. FUNC3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
  310. FUNC2(viewport_set_transparent_background, RID, bool)
  311. FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &)
  312. FUNC4(viewport_set_canvas_stacking, RID, RID, int, int)
  313. FUNC2(viewport_set_shadow_atlas_size, RID, int)
  314. FUNC3(viewport_set_shadow_atlas_quadrant_subdivision, RID, int, int)
  315. FUNC2(viewport_set_msaa, RID, ViewportMSAA)
  316. FUNC2(viewport_set_use_fxaa, RID, bool)
  317. FUNC2(viewport_set_use_debanding, RID, bool)
  318. FUNC2(viewport_set_sharpen_intensity, RID, float)
  319. FUNC2(viewport_set_hdr, RID, bool)
  320. FUNC2(viewport_set_use_32_bpc_depth, RID, bool)
  321. FUNC2(viewport_set_usage, RID, ViewportUsage)
  322. //this passes directly to avoid stalling, but it's pretty dangerous, so don't call after freeing a viewport
  323. virtual int viewport_get_render_info(RID p_viewport, ViewportRenderInfo p_info) {
  324. return visual_server->viewport_get_render_info(p_viewport, p_info);
  325. }
  326. FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
  327. /* ENVIRONMENT API */
  328. FUNCRID(environment)
  329. FUNC2(environment_set_background, RID, EnvironmentBG)
  330. FUNC2(environment_set_sky, RID, RID)
  331. FUNC2(environment_set_sky_custom_fov, RID, float)
  332. FUNC2(environment_set_sky_orientation, RID, const Basis &)
  333. FUNC2(environment_set_bg_color, RID, const Color &)
  334. FUNC2(environment_set_bg_energy, RID, float)
  335. FUNC2(environment_set_canvas_max_layer, RID, int)
  336. FUNC4(environment_set_ambient_light, RID, const Color &, float, float)
  337. FUNC2(environment_set_camera_feed_id, RID, int)
  338. FUNC7(environment_set_ssr, RID, bool, int, float, float, float, bool)
  339. FUNC13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
  340. FUNC6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
  341. FUNC6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
  342. FUNC12(environment_set_glow, RID, bool, int, float, float, float, EnvironmentGlowBlendMode, float, float, float, bool, bool)
  343. FUNC3(environment_set_glow_map, RID, float, RID)
  344. FUNC9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float)
  345. FUNC6(environment_set_adjustment, RID, bool, float, float, float, RID)
  346. FUNC5(environment_set_fog, RID, bool, const Color &, const Color &, float)
  347. FUNC7(environment_set_fog_depth, RID, bool, float, float, float, bool, float)
  348. FUNC5(environment_set_fog_height, RID, bool, float, float, float)
  349. /* SCENARIO API */
  350. FUNCRID(scenario)
  351. FUNC2(scenario_set_debug, RID, ScenarioDebugMode)
  352. FUNC2(scenario_set_environment, RID, RID)
  353. FUNC3(scenario_set_reflection_atlas_size, RID, int, int)
  354. FUNC2(scenario_set_fallback_environment, RID, RID)
  355. /* INSTANCING API */
  356. FUNCRID(instance)
  357. FUNC2(instance_set_base, RID, RID)
  358. FUNC2(instance_set_scenario, RID, RID)
  359. FUNC2(instance_set_layer_mask, RID, uint32_t)
  360. FUNC3(instance_set_pivot_data, RID, float, bool)
  361. FUNC2(instance_set_transform, RID, const Transform &)
  362. FUNC2(instance_set_interpolated, RID, bool)
  363. FUNC1(instance_reset_physics_interpolation, RID)
  364. FUNC2(instance_attach_object_instance_id, RID, ObjectID)
  365. FUNC3(instance_set_blend_shape_weight, RID, int, float)
  366. FUNC3(instance_set_surface_material, RID, int, RID)
  367. FUNC2(instance_set_visible, RID, bool)
  368. FUNC5(instance_set_use_lightmap, RID, RID, RID, int, const Rect2 &)
  369. FUNC2(instance_set_custom_aabb, RID, AABB)
  370. FUNC2(instance_attach_skeleton, RID, RID)
  371. FUNC2(instance_set_exterior, RID, bool)
  372. FUNC2(instance_set_extra_visibility_margin, RID, real_t)
  373. /* PORTALS API */
  374. FUNC2(instance_set_portal_mode, RID, InstancePortalMode)
  375. FUNCRID(ghost)
  376. FUNC4(ghost_set_scenario, RID, RID, ObjectID, const AABB &)
  377. FUNC2(ghost_update, RID, const AABB &)
  378. FUNCRID(portal)
  379. FUNC2(portal_set_scenario, RID, RID)
  380. FUNC3(portal_set_geometry, RID, const Vector<Vector3> &, real_t)
  381. FUNC4(portal_link, RID, RID, RID, bool)
  382. FUNC2(portal_set_active, RID, bool)
  383. /* ROOMGROUPS API */
  384. FUNCRID(roomgroup)
  385. FUNC2(roomgroup_prepare, RID, ObjectID)
  386. FUNC2(roomgroup_set_scenario, RID, RID)
  387. FUNC2(roomgroup_add_room, RID, RID)
  388. /* OCCLUDERS API */
  389. FUNCRID(occluder_instance)
  390. FUNC2(occluder_instance_set_scenario, RID, RID)
  391. FUNC2(occluder_instance_link_resource, RID, RID)
  392. FUNC2(occluder_instance_set_transform, RID, const Transform &)
  393. FUNC2(occluder_instance_set_active, RID, bool)
  394. FUNCRID(occluder_resource)
  395. FUNC2(occluder_resource_prepare, RID, OccluderType)
  396. FUNC2(occluder_resource_spheres_update, RID, const Vector<Plane> &)
  397. FUNC2(occluder_resource_mesh_update, RID, const Geometry::OccluderMeshData &)
  398. FUNC1(set_use_occlusion_culling, bool)
  399. FUNC1RC(Geometry::MeshData, occlusion_debug_get_current_polys, RID)
  400. /* ROOMS API */
  401. FUNCRID(room)
  402. FUNC2(room_set_scenario, RID, RID)
  403. FUNC4(room_add_instance, RID, RID, const AABB &, const Vector<Vector3> &)
  404. FUNC3(room_add_ghost, RID, ObjectID, const AABB &)
  405. FUNC5(room_set_bound, RID, ObjectID, const Vector<Plane> &, const AABB &, const Vector<Vector3> &)
  406. FUNC2(room_prepare, RID, int32_t)
  407. FUNC1(rooms_and_portals_clear, RID)
  408. FUNC2(rooms_unload, RID, String)
  409. FUNC8(rooms_finalize, RID, bool, bool, bool, bool, String, bool, bool)
  410. FUNC4(rooms_override_camera, RID, bool, const Vector3 &, const Vector<Plane> *)
  411. FUNC2(rooms_set_active, RID, bool)
  412. FUNC3(rooms_set_params, RID, int, real_t)
  413. FUNC3(rooms_set_debug_feature, RID, RoomsDebugFeature, bool)
  414. FUNC2(rooms_update_gameplay_monitor, RID, const Vector<Vector3> &)
  415. // don't use this in a game
  416. FUNC1RC(bool, rooms_is_loaded, RID)
  417. // Callbacks
  418. FUNC1(callbacks_register, VisualServerCallbacks *)
  419. // don't use these in a game!
  420. FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID)
  421. FUNC3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID)
  422. FUNC2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID)
  423. FUNC3(instance_geometry_set_flag, RID, InstanceFlags, bool)
  424. FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting)
  425. FUNC2(instance_geometry_set_material_override, RID, RID)
  426. FUNC2(instance_geometry_set_material_overlay, RID, RID)
  427. /* CANVAS (2D) */
  428. FUNCRID(canvas)
  429. FUNC3(canvas_set_item_mirroring, RID, RID, const Point2 &)
  430. FUNC2(canvas_set_modulate, RID, const Color &)
  431. FUNC3(canvas_set_parent, RID, RID, float)
  432. FUNC1(canvas_set_disable_scale, bool)
  433. FUNCRID(canvas_item)
  434. FUNC2(canvas_item_set_parent, RID, RID)
  435. FUNC2(canvas_item_set_name, RID, String)
  436. FUNC2(canvas_item_set_visible, RID, bool)
  437. FUNC2(canvas_item_set_light_mask, RID, int)
  438. FUNC2(canvas_item_set_update_when_visible, RID, bool)
  439. FUNC2(canvas_item_set_transform, RID, const Transform2D &)
  440. FUNC2(canvas_item_set_clip, RID, bool)
  441. FUNC2(canvas_item_set_distance_field_mode, RID, bool)
  442. FUNC3(canvas_item_set_custom_rect, RID, bool, const Rect2 &)
  443. FUNC2(canvas_item_set_modulate, RID, const Color &)
  444. FUNC2(canvas_item_set_self_modulate, RID, const Color &)
  445. FUNC2(canvas_item_set_draw_behind_parent, RID, bool)
  446. FUNC2(canvas_item_set_use_identity_transform, RID, bool)
  447. FUNC6(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float, bool)
  448. FUNC5(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool)
  449. FUNC5(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool)
  450. FUNC3(canvas_item_add_rect, RID, const Rect2 &, const Color &)
  451. FUNC4(canvas_item_add_circle, RID, const Point2 &, float, const Color &)
  452. FUNC7(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool, RID)
  453. FUNC8(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, bool)
  454. FUNC7(canvas_item_add_texture_multirect_region, RID, const Vector<Rect2> &, RID, const Vector<Rect2> &, const Color &, uint32_t, RID)
  455. FUNC11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
  456. FUNC7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
  457. FUNC7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
  458. FUNC12(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID, bool, bool)
  459. FUNC6(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID, RID)
  460. FUNC4(canvas_item_add_multimesh, RID, RID, RID, RID)
  461. FUNC4(canvas_item_add_particles, RID, RID, RID, RID)
  462. FUNC2(canvas_item_add_set_transform, RID, const Transform2D &)
  463. FUNC2(canvas_item_add_clip_ignore, RID, bool)
  464. FUNC2(canvas_item_set_sort_children_by_y, RID, bool)
  465. FUNC2(canvas_item_set_z_index, RID, int)
  466. FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool)
  467. FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &)
  468. FUNC1(canvas_item_clear, RID)
  469. FUNC2(canvas_item_set_draw_index, RID, int)
  470. FUNC2(canvas_item_set_material, RID, RID)
  471. FUNC2(canvas_item_set_use_parent_material, RID, bool)
  472. FUNC2(canvas_item_attach_skeleton, RID, RID)
  473. FUNC2(canvas_item_set_skeleton_relative_xform, RID, Transform2D)
  474. FUNC1R(Rect2, _debug_canvas_item_get_rect, RID)
  475. FUNC1R(Rect2, _debug_canvas_item_get_local_bound, RID)
  476. FUNC2(canvas_item_set_interpolated, RID, bool)
  477. FUNC1(canvas_item_reset_physics_interpolation, RID)
  478. FUNC2(canvas_item_transform_physics_interpolation, RID, const Transform2D &)
  479. FUNC0R(RID, canvas_light_create)
  480. FUNC2(canvas_light_attach_to_canvas, RID, RID)
  481. FUNC2(canvas_light_set_enabled, RID, bool)
  482. FUNC2(canvas_light_set_scale, RID, float)
  483. FUNC2(canvas_light_set_transform, RID, const Transform2D &)
  484. FUNC2(canvas_light_set_texture, RID, RID)
  485. FUNC2(canvas_light_set_texture_offset, RID, const Vector2 &)
  486. FUNC2(canvas_light_set_color, RID, const Color &)
  487. FUNC2(canvas_light_set_height, RID, float)
  488. FUNC2(canvas_light_set_energy, RID, float)
  489. FUNC3(canvas_light_set_z_range, RID, int, int)
  490. FUNC3(canvas_light_set_layer_range, RID, int, int)
  491. FUNC2(canvas_light_set_item_cull_mask, RID, int)
  492. FUNC2(canvas_light_set_item_shadow_cull_mask, RID, int)
  493. FUNC2(canvas_light_set_mode, RID, CanvasLightMode)
  494. FUNC2(canvas_light_set_shadow_enabled, RID, bool)
  495. FUNC2(canvas_light_set_shadow_buffer_size, RID, int)
  496. FUNC2(canvas_light_set_shadow_gradient_length, RID, float)
  497. FUNC2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
  498. FUNC2(canvas_light_set_shadow_color, RID, const Color &)
  499. FUNC2(canvas_light_set_shadow_smooth, RID, float)
  500. FUNC2(canvas_light_set_interpolated, RID, bool)
  501. FUNC1(canvas_light_reset_physics_interpolation, RID)
  502. FUNC2(canvas_light_transform_physics_interpolation, RID, const Transform2D &)
  503. FUNCRID(canvas_light_occluder)
  504. FUNC2(canvas_light_occluder_attach_to_canvas, RID, RID)
  505. FUNC2(canvas_light_occluder_set_enabled, RID, bool)
  506. FUNC2(canvas_light_occluder_set_polygon, RID, RID)
  507. FUNC2(canvas_light_occluder_set_transform, RID, const Transform2D &)
  508. FUNC2(canvas_light_occluder_set_light_mask, RID, int)
  509. FUNC2(canvas_light_occluder_set_interpolated, RID, bool)
  510. FUNC1(canvas_light_occluder_reset_physics_interpolation, RID)
  511. FUNC2(canvas_light_occluder_transform_physics_interpolation, RID, const Transform2D &)
  512. FUNCRID(canvas_occluder_polygon)
  513. FUNC3(canvas_occluder_polygon_set_shape, RID, const PoolVector<Vector2> &, bool)
  514. FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const PoolVector<Vector2> &)
  515. FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
  516. /* BLACK BARS */
  517. FUNC4(black_bars_set_margins, int, int, int, int)
  518. FUNC4(black_bars_set_images, RID, RID, RID, RID)
  519. /* FREE */
  520. FUNC1(free, RID)
  521. /* EVENT QUEUING */
  522. FUNC3(request_frame_drawn_callback, Object *, const StringName &, const Variant &)
  523. virtual void init();
  524. virtual void finish();
  525. virtual void tick();
  526. virtual void pre_draw(bool p_will_draw);
  527. virtual void draw(bool p_swap_buffers, double frame_step);
  528. virtual void sync();
  529. FUNC1RC(bool, has_changed, ChangedPriority)
  530. virtual void set_physics_interpolation_enabled(bool p_enabled);
  531. /* RENDER INFO */
  532. //this passes directly to avoid stalling
  533. virtual uint64_t get_render_info(RenderInfo p_info) {
  534. return visual_server->get_render_info(p_info);
  535. }
  536. virtual String get_video_adapter_name() const {
  537. return visual_server->get_video_adapter_name();
  538. }
  539. virtual String get_video_adapter_vendor() const {
  540. return visual_server->get_video_adapter_vendor();
  541. }
  542. FUNC4(set_boot_image, const Ref<Image> &, const Color &, bool, bool)
  543. FUNC1(set_default_clear_color, const Color &)
  544. FUNC1(set_shader_time_scale, float)
  545. FUNC0R(RID, get_test_cube)
  546. FUNC1(set_debug_generate_wireframes, bool)
  547. virtual bool has_feature(Features p_feature) const { return visual_server->has_feature(p_feature); }
  548. virtual bool has_os_feature(const String &p_feature) const { return visual_server->has_os_feature(p_feature); }
  549. FUNC1(call_set_use_vsync, bool)
  550. static void set_use_vsync_callback(bool p_enable);
  551. virtual bool is_low_end() const {
  552. return visual_server->is_low_end();
  553. }
  554. VisualServerWrapMT(VisualServer *p_contained, bool p_create_thread);
  555. ~VisualServerWrapMT();
  556. #undef ServerName
  557. #undef ServerNameWrapMT
  558. #undef server_name
  559. };
  560. #ifdef DEBUG_SYNC
  561. #undef DEBUG_SYNC
  562. #endif
  563. #undef SYNC_DEBUG
  564. #endif // VISUAL_SERVER_WRAP_MT_H