visual_server_wrap_mt.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 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_WRAP_MT_H
  31. #define VISUAL_SERVER_WRAP_MT_H
  32. #include "command_queue_mt.h"
  33. #include "os/thread.h"
  34. #include "servers/visual_server.h"
  35. /**
  36. @author Juan Linietsky <[email protected]>
  37. */
  38. class VisualServerWrapMT : public VisualServer {
  39. // the real visual server
  40. mutable VisualServer *visual_server;
  41. mutable CommandQueueMT command_queue;
  42. static void _thread_callback(void *_instance);
  43. void thread_loop();
  44. Thread::ID server_thread;
  45. volatile bool exit;
  46. Thread *thread;
  47. volatile bool draw_thread_up;
  48. bool create_thread;
  49. Mutex *draw_mutex;
  50. int draw_pending;
  51. void thread_draw();
  52. void thread_flush();
  53. void thread_exit();
  54. Mutex *alloc_mutex;
  55. int texture_pool_max_size;
  56. List<RID> texture_id_pool;
  57. int mesh_pool_max_size;
  58. List<RID> mesh_id_pool;
  59. //#define DEBUG_SYNC
  60. #ifdef DEBUG_SYNC
  61. #define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
  62. #else
  63. #define SYNC_DEBUG
  64. #endif
  65. public:
  66. #define ServerName VisualServer
  67. #define ServerNameWrapMT VisualServerWrapMT
  68. #define server_name visual_server
  69. #include "servers/server_wrap_mt_common.h"
  70. //FUNC0R(RID,texture_create);
  71. FUNCRID(texture);
  72. FUNC5(texture_allocate, RID, int, int, Image::Format, uint32_t);
  73. FUNC3(texture_set_data, RID, const Image &, CubeMapSide);
  74. FUNC2RC(Image, texture_get_data, RID, CubeMapSide);
  75. FUNC2(texture_set_flags, RID, uint32_t);
  76. FUNC1RC(Image::Format, texture_get_format, RID);
  77. FUNC1RC(uint32_t, texture_get_flags, RID);
  78. FUNC1RC(uint32_t, texture_get_width, RID);
  79. FUNC1RC(uint32_t, texture_get_height, RID);
  80. FUNC3(texture_set_size_override, RID, int, int);
  81. FUNC1RC(bool, texture_can_stream, RID);
  82. FUNC3C(texture_set_reload_hook, RID, ObjectID, const StringName &);
  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. virtual void texture_debug_usage(List<TextureInfo> *r_info) {
  87. //pass directly, should lock the server anyway
  88. visual_server->texture_debug_usage(r_info);
  89. }
  90. /* SHADER API */
  91. FUNC1R(RID, shader_create, ShaderMode);
  92. FUNC2(shader_set_mode, RID, ShaderMode);
  93. FUNC1RC(ShaderMode, shader_get_mode, RID);
  94. FUNC7(shader_set_code, RID, const String &, const String &, const String &, int, int, int);
  95. FUNC1RC(String, shader_get_vertex_code, RID);
  96. FUNC1RC(String, shader_get_fragment_code, RID);
  97. FUNC1RC(String, shader_get_light_code, RID);
  98. FUNC2SC(shader_get_param_list, RID, List<PropertyInfo> *);
  99. FUNC3(shader_set_default_texture_param, RID, const StringName &, RID);
  100. FUNC2RC(RID, shader_get_default_texture_param, RID, const StringName &);
  101. /*virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) {
  102. if (Thread::get_caller_ID()!=server_thread) {
  103. command_queue.push_and_sync( visual_server, &VisualServer::shader_get_param_list,p_shader,p_param_list);
  104. } else {
  105. visual_server->m_type(p1, p2, p3, p4, p5);
  106. }
  107. }*/
  108. // virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list);
  109. /* COMMON MATERIAL API */
  110. FUNC0R(RID, material_create);
  111. FUNC2(material_set_shader, RID, RID);
  112. FUNC1RC(RID, material_get_shader, RID);
  113. FUNC3(material_set_param, RID, const StringName &, const Variant &);
  114. FUNC2RC(Variant, material_get_param, RID, const StringName &);
  115. FUNC3(material_set_flag, RID, MaterialFlag, bool);
  116. FUNC2RC(bool, material_get_flag, RID, MaterialFlag);
  117. FUNC2(material_set_depth_draw_mode, RID, MaterialDepthDrawMode);
  118. FUNC1RC(MaterialDepthDrawMode, material_get_depth_draw_mode, RID);
  119. FUNC2(material_set_blend_mode, RID, MaterialBlendMode);
  120. FUNC1RC(MaterialBlendMode, material_get_blend_mode, RID);
  121. FUNC2(material_set_line_width, RID, float);
  122. FUNC1RC(float, material_get_line_width, RID);
  123. /* FIXED MATERIAL */
  124. FUNC0R(RID, fixed_material_create);
  125. FUNC3(fixed_material_set_flag, RID, FixedMaterialFlags, bool);
  126. FUNC2RC(bool, fixed_material_get_flag, RID, FixedMaterialFlags);
  127. FUNC3(fixed_material_set_param, RID, FixedMaterialParam, const Variant &);
  128. FUNC2RC(Variant, fixed_material_get_param, RID, FixedMaterialParam);
  129. FUNC3(fixed_material_set_texture, RID, FixedMaterialParam, RID);
  130. FUNC2RC(RID, fixed_material_get_texture, RID, FixedMaterialParam);
  131. FUNC3(fixed_material_set_texcoord_mode, RID, FixedMaterialParam, FixedMaterialTexCoordMode);
  132. FUNC2RC(FixedMaterialTexCoordMode, fixed_material_get_texcoord_mode, RID, FixedMaterialParam);
  133. FUNC2(fixed_material_set_light_shader, RID, FixedMaterialLightShader);
  134. FUNC1RC(FixedMaterialLightShader, fixed_material_get_light_shader, RID);
  135. FUNC2(fixed_material_set_uv_transform, RID, const Transform &);
  136. FUNC1RC(Transform, fixed_material_get_uv_transform, RID);
  137. FUNC2(fixed_material_set_point_size, RID, float);
  138. FUNC1RC(float, fixed_material_get_point_size, RID);
  139. /* SURFACE API */
  140. FUNCRID(mesh);
  141. FUNC2(mesh_set_morph_target_count, RID, int);
  142. FUNC1RC(int, mesh_get_morph_target_count, RID);
  143. FUNC2(mesh_set_morph_target_mode, RID, MorphTargetMode);
  144. FUNC1RC(MorphTargetMode, mesh_get_morph_target_mode, RID);
  145. FUNC2(mesh_add_custom_surface, RID, const Variant &); //this is used by each platform in a different way
  146. FUNC5(mesh_add_surface, RID, PrimitiveType, const Array &, const Array &, bool);
  147. FUNC2RC(Array, mesh_get_surface_arrays, RID, int);
  148. FUNC2RC(Array, mesh_get_surface_morph_arrays, RID, int);
  149. FUNC4(mesh_surface_set_material, RID, int, RID, bool);
  150. FUNC2RC(RID, mesh_surface_get_material, RID, int);
  151. FUNC2RC(int, mesh_surface_get_array_len, RID, int);
  152. FUNC2RC(int, mesh_surface_get_array_index_len, RID, int);
  153. FUNC2RC(uint32_t, mesh_surface_get_format, RID, int);
  154. FUNC2RC(PrimitiveType, mesh_surface_get_primitive_type, RID, int);
  155. FUNC2(mesh_remove_surface, RID, int);
  156. FUNC1RC(int, mesh_get_surface_count, RID);
  157. FUNC1(mesh_clear, RID);
  158. FUNC2(mesh_set_custom_aabb, RID, const AABB &);
  159. FUNC1RC(AABB, mesh_get_custom_aabb, RID);
  160. /* MULTIMESH API */
  161. FUNC0R(RID, multimesh_create);
  162. FUNC2(multimesh_set_instance_count, RID, int);
  163. FUNC1RC(int, multimesh_get_instance_count, RID);
  164. FUNC2(multimesh_set_mesh, RID, RID);
  165. FUNC2(multimesh_set_aabb, RID, const AABB &);
  166. FUNC3(multimesh_instance_set_transform, RID, int, const Transform &);
  167. FUNC3(multimesh_instance_set_color, RID, int, const Color &);
  168. FUNC1RC(RID, multimesh_get_mesh, RID);
  169. FUNC2RC(AABB, multimesh_get_aabb, RID, const AABB &);
  170. FUNC2RC(Transform, multimesh_instance_get_transform, RID, int);
  171. FUNC2RC(Color, multimesh_instance_get_color, RID, int);
  172. FUNC2(multimesh_set_visible_instances, RID, int);
  173. FUNC1RC(int, multimesh_get_visible_instances, RID);
  174. /* IMMEDIATE API */
  175. FUNC0R(RID, immediate_create);
  176. FUNC3(immediate_begin, RID, PrimitiveType, RID);
  177. FUNC2(immediate_vertex, RID, const Vector3 &);
  178. FUNC2(immediate_normal, RID, const Vector3 &);
  179. FUNC2(immediate_tangent, RID, const Plane &);
  180. FUNC2(immediate_color, RID, const Color &);
  181. FUNC2(immediate_uv, RID, const Vector2 &);
  182. FUNC2(immediate_uv2, RID, const Vector2 &);
  183. FUNC1(immediate_end, RID);
  184. FUNC1(immediate_clear, RID);
  185. FUNC2(immediate_set_material, RID, RID);
  186. FUNC1RC(RID, immediate_get_material, RID);
  187. /* PARTICLES API */
  188. FUNC0R(RID, particles_create);
  189. FUNC2(particles_set_amount, RID, int);
  190. FUNC1RC(int, particles_get_amount, RID);
  191. FUNC2(particles_set_emitting, RID, bool);
  192. FUNC1RC(bool, particles_is_emitting, RID);
  193. FUNC2(particles_set_visibility_aabb, RID, const AABB &);
  194. FUNC1RC(AABB, particles_get_visibility_aabb, RID);
  195. FUNC2(particles_set_emission_half_extents, RID, const Vector3 &);
  196. FUNC1RC(Vector3, particles_get_emission_half_extents, RID);
  197. FUNC2(particles_set_emission_base_velocity, RID, const Vector3 &);
  198. FUNC1RC(Vector3, particles_get_emission_base_velocity, RID);
  199. FUNC2(particles_set_emission_points, RID, const DVector<Vector3> &);
  200. FUNC1RC(DVector<Vector3>, particles_get_emission_points, RID);
  201. FUNC2(particles_set_gravity_normal, RID, const Vector3 &);
  202. FUNC1RC(Vector3, particles_get_gravity_normal, RID);
  203. FUNC3(particles_set_variable, RID, ParticleVariable, float);
  204. FUNC2RC(float, particles_get_variable, RID, ParticleVariable);
  205. FUNC3(particles_set_randomness, RID, ParticleVariable, float);
  206. FUNC2RC(float, particles_get_randomness, RID, ParticleVariable);
  207. FUNC3(particles_set_color_phase_pos, RID, int, float);
  208. FUNC2RC(float, particles_get_color_phase_pos, RID, int);
  209. FUNC2(particles_set_color_phases, RID, int);
  210. FUNC1RC(int, particles_get_color_phases, RID);
  211. FUNC3(particles_set_color_phase_color, RID, int, const Color &);
  212. FUNC2RC(Color, particles_get_color_phase_color, RID, int);
  213. FUNC2(particles_set_attractors, RID, int);
  214. FUNC1RC(int, particles_get_attractors, RID);
  215. FUNC3(particles_set_attractor_pos, RID, int, const Vector3 &);
  216. FUNC2RC(Vector3, particles_get_attractor_pos, RID, int);
  217. FUNC3(particles_set_attractor_strength, RID, int, float);
  218. FUNC2RC(float, particles_get_attractor_strength, RID, int);
  219. FUNC3(particles_set_material, RID, RID, bool);
  220. FUNC1RC(RID, particles_get_material, RID);
  221. FUNC2(particles_set_height_from_velocity, RID, bool);
  222. FUNC1RC(bool, particles_has_height_from_velocity, RID);
  223. FUNC2(particles_set_use_local_coordinates, RID, bool);
  224. FUNC1RC(bool, particles_is_using_local_coordinates, RID);
  225. /* Light API */
  226. FUNC1R(RID, light_create, LightType);
  227. FUNC1RC(LightType, light_get_type, RID);
  228. FUNC3(light_set_color, RID, LightColor, const Color &);
  229. FUNC2RC(Color, light_get_color, RID, LightColor);
  230. FUNC2(light_set_shadow, RID, bool);
  231. FUNC1RC(bool, light_has_shadow, RID);
  232. FUNC2(light_set_volumetric, RID, bool);
  233. FUNC1RC(bool, light_is_volumetric, RID);
  234. FUNC2(light_set_projector, RID, RID);
  235. FUNC1RC(RID, light_get_projector, RID);
  236. FUNC3(light_set_param, RID, LightParam, float);
  237. FUNC2RC(float, light_get_param, RID, LightParam);
  238. FUNC2(light_set_operator, RID, LightOp);
  239. FUNC1RC(LightOp, light_get_operator, RID);
  240. FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode);
  241. FUNC1RC(LightOmniShadowMode, light_omni_get_shadow_mode, RID);
  242. FUNC2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode);
  243. FUNC1RC(LightDirectionalShadowMode, light_directional_get_shadow_mode, RID);
  244. FUNC3(light_directional_set_shadow_param, RID, LightDirectionalShadowParam, float);
  245. FUNC2RC(float, light_directional_get_shadow_param, RID, LightDirectionalShadowParam);
  246. /* SKELETON API */
  247. FUNC0R(RID, skeleton_create);
  248. FUNC2(skeleton_resize, RID, int);
  249. FUNC1RC(int, skeleton_get_bone_count, RID);
  250. FUNC3(skeleton_bone_set_transform, RID, int, const Transform &);
  251. FUNC2R(Transform, skeleton_bone_get_transform, RID, int);
  252. /* ROOM API */
  253. FUNC0R(RID, room_create);
  254. FUNC2(room_set_bounds, RID, const BSP_Tree &);
  255. FUNC1RC(BSP_Tree, room_get_bounds, RID);
  256. /* PORTAL API */
  257. FUNC0R(RID, portal_create);
  258. FUNC2(portal_set_shape, RID, const Vector<Point2> &);
  259. FUNC1RC(Vector<Point2>, portal_get_shape, RID);
  260. FUNC2(portal_set_enabled, RID, bool);
  261. FUNC1RC(bool, portal_is_enabled, RID);
  262. FUNC2(portal_set_disable_distance, RID, float);
  263. FUNC1RC(float, portal_get_disable_distance, RID);
  264. FUNC2(portal_set_disabled_color, RID, const Color &);
  265. FUNC1RC(Color, portal_get_disabled_color, RID);
  266. FUNC2(portal_set_connect_range, RID, float);
  267. FUNC1RC(float, portal_get_connect_range, RID);
  268. FUNC0R(RID, baked_light_create);
  269. FUNC2(baked_light_set_mode, RID, BakedLightMode);
  270. FUNC1RC(BakedLightMode, baked_light_get_mode, RID);
  271. FUNC2(baked_light_set_octree, RID, DVector<uint8_t>);
  272. FUNC1RC(DVector<uint8_t>, baked_light_get_octree, RID);
  273. FUNC2(baked_light_set_light, RID, DVector<uint8_t>);
  274. FUNC1RC(DVector<uint8_t>, baked_light_get_light, RID);
  275. FUNC2(baked_light_set_sampler_octree, RID, const DVector<int> &);
  276. FUNC1RC(DVector<int>, baked_light_get_sampler_octree, RID);
  277. FUNC2(baked_light_set_lightmap_multiplier, RID, float);
  278. FUNC1RC(float, baked_light_get_lightmap_multiplier, RID);
  279. FUNC3(baked_light_add_lightmap, RID, RID, int);
  280. FUNC1(baked_light_clear_lightmaps, RID);
  281. FUNC2(baked_light_set_realtime_color_enabled, RID, const bool);
  282. FUNC1RC(bool, baked_light_get_realtime_color_enabled, RID);
  283. FUNC2(baked_light_set_realtime_color, RID, const Color &);
  284. FUNC1RC(Color, baked_light_get_realtime_color, RID);
  285. FUNC2(baked_light_set_realtime_energy, RID, const float);
  286. FUNC1RC(float, baked_light_get_realtime_energy, RID);
  287. FUNC0R(RID, baked_light_sampler_create);
  288. FUNC3(baked_light_sampler_set_param, RID, BakedLightSamplerParam, float);
  289. FUNC2RC(float, baked_light_sampler_get_param, RID, BakedLightSamplerParam);
  290. FUNC2(baked_light_sampler_set_resolution, RID, int);
  291. FUNC1RC(int, baked_light_sampler_get_resolution, RID);
  292. /* CAMERA API */
  293. FUNC0R(RID, camera_create);
  294. FUNC4(camera_set_perspective, RID, float, float, float);
  295. FUNC4(camera_set_orthogonal, RID, float, float, float);
  296. FUNC2(camera_set_transform, RID, const Transform &);
  297. FUNC2(camera_set_visible_layers, RID, uint32_t);
  298. FUNC1RC(uint32_t, camera_get_visible_layers, RID);
  299. FUNC2(camera_set_environment, RID, RID);
  300. FUNC1RC(RID, camera_get_environment, RID);
  301. FUNC2(camera_set_use_vertical_aspect, RID, bool);
  302. FUNC2RC(bool, camera_is_using_vertical_aspect, RID, bool);
  303. /* VIEWPORT API */
  304. FUNC0R(RID, viewport_create);
  305. FUNC2(viewport_attach_to_screen, RID, int);
  306. FUNC1(viewport_detach, RID);
  307. FUNC2(viewport_set_as_render_target, RID, bool);
  308. FUNC2(viewport_set_render_target_update_mode, RID, RenderTargetUpdateMode);
  309. FUNC1RC(RenderTargetUpdateMode, viewport_get_render_target_update_mode, RID);
  310. FUNC1RC(RID, viewport_get_render_target_texture, RID);
  311. FUNC2(viewport_set_render_target_vflip, RID, bool);
  312. FUNC1RC(bool, viewport_get_render_target_vflip, RID);
  313. FUNC2(viewport_set_render_target_to_screen_rect, RID, const Rect2 &);
  314. FUNC2(viewport_set_render_target_clear_on_new_frame, RID, bool);
  315. FUNC1RC(bool, viewport_get_render_target_clear_on_new_frame, RID);
  316. FUNC1(viewport_render_target_clear, RID);
  317. FUNC1(viewport_queue_screen_capture, RID);
  318. FUNC1RC(Image, viewport_get_screen_capture, RID);
  319. FUNC2(viewport_set_rect, RID, const ViewportRect &);
  320. FUNC1RC(ViewportRect, viewport_get_rect, RID);
  321. FUNC2(viewport_set_hide_scenario, RID, bool);
  322. FUNC2(viewport_set_hide_canvas, RID, bool);
  323. FUNC2(viewport_attach_camera, RID, RID);
  324. FUNC2(viewport_set_scenario, RID, RID);
  325. FUNC2(viewport_set_disable_environment, RID, bool);
  326. FUNC1RC(RID, viewport_get_attached_camera, RID);
  327. FUNC1RC(RID, viewport_get_scenario, RID);
  328. FUNC2(viewport_attach_canvas, RID, RID);
  329. FUNC2(viewport_remove_canvas, RID, RID);
  330. FUNC3(viewport_set_canvas_transform, RID, RID, const Matrix32 &);
  331. FUNC2RC(Matrix32, viewport_get_canvas_transform, RID, RID);
  332. FUNC2(viewport_set_global_canvas_transform, RID, const Matrix32 &);
  333. FUNC1RC(Matrix32, viewport_get_global_canvas_transform, RID);
  334. FUNC3(viewport_set_canvas_layer, RID, RID, int);
  335. FUNC2(viewport_set_transparent_background, RID, bool);
  336. FUNC1RC(bool, viewport_has_transparent_background, RID);
  337. /* ENVIRONMENT API */
  338. FUNC0R(RID, environment_create);
  339. FUNC2(environment_set_background, RID, EnvironmentBG);
  340. FUNC1RC(EnvironmentBG, environment_get_background, RID);
  341. FUNC3(environment_set_background_param, RID, EnvironmentBGParam, const Variant &);
  342. FUNC2RC(Variant, environment_get_background_param, RID, EnvironmentBGParam);
  343. FUNC3(environment_set_enable_fx, RID, EnvironmentFx, bool);
  344. FUNC2RC(bool, environment_is_fx_enabled, RID, EnvironmentFx);
  345. FUNC3(environment_fx_set_param, RID, EnvironmentFxParam, const Variant &);
  346. FUNC2RC(Variant, environment_fx_get_param, RID, EnvironmentFxParam);
  347. /* SCENARIO API */
  348. FUNC0R(RID, scenario_create);
  349. FUNC2(scenario_set_debug, RID, ScenarioDebugMode);
  350. FUNC2(scenario_set_environment, RID, RID);
  351. FUNC2RC(RID, scenario_get_environment, RID, RID);
  352. FUNC2(scenario_set_fallback_environment, RID, RID);
  353. /* INSTANCING API */
  354. FUNC0R(RID, instance_create);
  355. FUNC2(instance_set_base, RID, RID);
  356. FUNC1RC(RID, instance_get_base, RID);
  357. FUNC2(instance_set_scenario, RID, RID);
  358. FUNC1RC(RID, instance_get_scenario, RID);
  359. FUNC2(instance_set_layer_mask, RID, uint32_t);
  360. FUNC1RC(uint32_t, instance_get_layer_mask, RID);
  361. FUNC1RC(AABB, instance_get_base_aabb, RID);
  362. FUNC2(instance_attach_object_instance_ID, RID, uint32_t);
  363. FUNC1RC(uint32_t, instance_get_object_instance_ID, RID);
  364. FUNC2(instance_attach_skeleton, RID, RID);
  365. FUNC1RC(RID, instance_get_skeleton, RID);
  366. FUNC3(instance_set_morph_target_weight, RID, int, float);
  367. FUNC2RC(float, instance_get_morph_target_weight, RID, int);
  368. FUNC3(instance_set_surface_material, RID, int, RID);
  369. FUNC2(instance_set_transform, RID, const Transform &);
  370. FUNC1RC(Transform, instance_get_transform, RID);
  371. FUNC2(instance_set_exterior, RID, bool);
  372. FUNC1RC(bool, instance_is_exterior, RID);
  373. FUNC2(instance_set_room, RID, RID);
  374. FUNC1RC(RID, instance_get_room, RID);
  375. FUNC2(instance_set_extra_visibility_margin, RID, real_t);
  376. FUNC1RC(real_t, instance_get_extra_visibility_margin, RID);
  377. FUNC2RC(Vector<RID>, instances_cull_aabb, const AABB &, RID);
  378. FUNC3RC(Vector<RID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID);
  379. FUNC2RC(Vector<RID>, instances_cull_convex, const Vector<Plane> &, RID);
  380. FUNC3(instance_geometry_set_flag, RID, InstanceFlags, bool);
  381. FUNC2RC(bool, instance_geometry_get_flag, RID, InstanceFlags);
  382. FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting);
  383. FUNC1RC(ShadowCastingSetting, instance_geometry_get_cast_shadows_setting, RID);
  384. FUNC2(instance_geometry_set_material_override, RID, RID);
  385. FUNC1RC(RID, instance_geometry_get_material_override, RID);
  386. FUNC3(instance_geometry_set_draw_range, RID, float, float);
  387. FUNC1RC(float, instance_geometry_get_draw_range_max, RID);
  388. FUNC1RC(float, instance_geometry_get_draw_range_min, RID);
  389. FUNC2(instance_geometry_set_baked_light, RID, RID);
  390. FUNC1RC(RID, instance_geometry_get_baked_light, RID);
  391. FUNC2(instance_geometry_set_baked_light_sampler, RID, RID);
  392. FUNC1RC(RID, instance_geometry_get_baked_light_sampler, RID);
  393. FUNC2(instance_geometry_set_baked_light_texture_index, RID, int);
  394. FUNC1RC(int, instance_geometry_get_baked_light_texture_index, RID);
  395. FUNC2(instance_light_set_enabled, RID, bool);
  396. FUNC1RC(bool, instance_light_is_enabled, RID);
  397. /* CANVAS (2D) */
  398. FUNC0R(RID, canvas_create);
  399. FUNC3(canvas_set_item_mirroring, RID, RID, const Point2 &);
  400. FUNC2RC(Point2, canvas_get_item_mirroring, RID, RID);
  401. FUNC2(canvas_set_modulate, RID, const Color &);
  402. FUNC0R(RID, canvas_item_create);
  403. FUNC2(canvas_item_set_parent, RID, RID);
  404. FUNC1RC(RID, canvas_item_get_parent, RID);
  405. FUNC2(canvas_item_set_visible, RID, bool);
  406. FUNC1RC(bool, canvas_item_is_visible, RID);
  407. FUNC2(canvas_item_set_blend_mode, RID, MaterialBlendMode);
  408. FUNC2(canvas_item_set_light_mask, RID, int);
  409. //FUNC(canvas_item_set_rect,RID, const Rect2& p_rect);
  410. FUNC2(canvas_item_set_transform, RID, const Matrix32 &);
  411. FUNC2(canvas_item_set_clip, RID, bool);
  412. FUNC2(canvas_item_set_distance_field_mode, RID, bool);
  413. FUNC3(canvas_item_set_custom_rect, RID, bool, const Rect2 &);
  414. FUNC2(canvas_item_set_opacity, RID, float);
  415. FUNC2RC(float, canvas_item_get_opacity, RID, float);
  416. FUNC2(canvas_item_set_on_top, RID, bool);
  417. FUNC1RC(bool, canvas_item_is_on_top, RID);
  418. FUNC2(canvas_item_set_self_opacity, RID, float);
  419. FUNC2RC(float, canvas_item_get_self_opacity, RID, float);
  420. FUNC2(canvas_item_attach_viewport, RID, RID);
  421. FUNC5(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float);
  422. FUNC3(canvas_item_add_rect, RID, const Rect2 &, const Color &);
  423. FUNC4(canvas_item_add_circle, RID, const Point2 &, float, const Color &);
  424. FUNC6(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool);
  425. FUNC6(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool);
  426. FUNC8(canvas_item_add_style_box, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, bool, const Color &);
  427. FUNC6(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float);
  428. FUNC5(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID);
  429. FUNC7(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int);
  430. FUNC7(canvas_item_add_triangle_array_ptr, RID, int, const int *, const Point2 *, const Color *, const Point2 *, RID);
  431. FUNC2(canvas_item_add_set_transform, RID, const Matrix32 &);
  432. FUNC2(canvas_item_add_set_blend_mode, RID, MaterialBlendMode);
  433. FUNC2(canvas_item_add_clip_ignore, RID, bool);
  434. FUNC2(canvas_item_set_sort_children_by_y, RID, bool);
  435. FUNC2(canvas_item_set_z, RID, int);
  436. FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool);
  437. FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &);
  438. FUNC2(canvas_item_set_material, RID, RID);
  439. FUNC2(canvas_item_set_use_parent_material, RID, bool);
  440. FUNC1(canvas_item_clear, RID);
  441. FUNC1(canvas_item_raise, RID);
  442. /* CANVAS LIGHT */
  443. FUNC0R(RID, canvas_light_create);
  444. FUNC2(canvas_light_attach_to_canvas, RID, RID);
  445. FUNC2(canvas_light_set_enabled, RID, bool);
  446. FUNC2(canvas_light_set_transform, RID, const Matrix32 &);
  447. FUNC2(canvas_light_set_scale, RID, float);
  448. FUNC2(canvas_light_set_texture, RID, RID);
  449. FUNC2(canvas_light_set_texture_offset, RID, const Vector2 &);
  450. FUNC2(canvas_light_set_color, RID, const Color &);
  451. FUNC2(canvas_light_set_height, RID, float);
  452. FUNC2(canvas_light_set_energy, RID, float);
  453. FUNC3(canvas_light_set_layer_range, RID, int, int);
  454. FUNC3(canvas_light_set_z_range, RID, int, int);
  455. FUNC2(canvas_light_set_item_mask, RID, int);
  456. FUNC2(canvas_light_set_item_shadow_mask, RID, int);
  457. FUNC2(canvas_light_set_mode, RID, CanvasLightMode);
  458. FUNC2(canvas_light_set_shadow_enabled, RID, bool);
  459. FUNC2(canvas_light_set_shadow_buffer_size, RID, int);
  460. FUNC2(canvas_light_set_shadow_esm_multiplier, RID, float);
  461. FUNC2(canvas_light_set_shadow_color, RID, const Color &);
  462. /* CANVAS OCCLUDER */
  463. FUNC0R(RID, canvas_light_occluder_create);
  464. FUNC2(canvas_light_occluder_attach_to_canvas, RID, RID);
  465. FUNC2(canvas_light_occluder_set_enabled, RID, bool);
  466. FUNC2(canvas_light_occluder_set_polygon, RID, RID);
  467. FUNC2(canvas_light_occluder_set_transform, RID, const Matrix32 &);
  468. FUNC2(canvas_light_occluder_set_light_mask, RID, int);
  469. FUNC0R(RID, canvas_occluder_polygon_create);
  470. FUNC3(canvas_occluder_polygon_set_shape, RID, const DVector<Vector2> &, bool);
  471. FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const DVector<Vector2> &);
  472. FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode);
  473. /* CANVAS MATERIAL */
  474. FUNC0R(RID, canvas_item_material_create);
  475. FUNC2(canvas_item_material_set_shader, RID, RID);
  476. FUNC3(canvas_item_material_set_shader_param, RID, const StringName &, const Variant &);
  477. FUNC2RC(Variant, canvas_item_material_get_shader_param, RID, const StringName &);
  478. FUNC2(canvas_item_material_set_shading_mode, RID, CanvasItemShadingMode);
  479. /* BLACK BARS */
  480. FUNC4(black_bars_set_margins, int, int, int, int);
  481. FUNC4(black_bars_set_images, RID, RID, RID, RID);
  482. /* FREE */
  483. FUNC1(free, RID);
  484. /* CUSTOM SHADE MODEL */
  485. FUNC2(custom_shade_model_set_shader, int, RID);
  486. FUNC1RC(RID, custom_shade_model_get_shader, int);
  487. FUNC2(custom_shade_model_set_name, int, const String &);
  488. FUNC1RC(String, custom_shade_model_get_name, int);
  489. FUNC2(custom_shade_model_set_param_info, int, const List<PropertyInfo> &);
  490. FUNC2SC(custom_shade_model_get_param_info, int, List<PropertyInfo> *);
  491. /* EVENT QUEUING */
  492. virtual void init();
  493. virtual void finish();
  494. virtual void draw();
  495. virtual void sync();
  496. FUNC0RC(bool, has_changed);
  497. /* RENDER INFO */
  498. FUNC1R(int, get_render_info, RenderInfo);
  499. virtual bool has_feature(Features p_feature) const { return visual_server->has_feature(p_feature); }
  500. FUNC3(set_boot_image, const Image &, const Color &, bool);
  501. FUNC1(set_default_clear_color, const Color &);
  502. FUNC0RC(Color, get_default_clear_color);
  503. FUNC1(set_time_scale, float);
  504. FUNC0R(RID, get_test_cube);
  505. VisualServerWrapMT(VisualServer *p_contained, bool p_create_thread);
  506. ~VisualServerWrapMT();
  507. #undef ServerName
  508. #undef ServerNameWrapMT
  509. #undef server_name
  510. };
  511. #ifdef DEBUG_SYNC
  512. #undef DEBUG_SYNC
  513. #endif
  514. #undef SYNC_DEBUG
  515. #endif