visual_server_raster.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  1. /*************************************************************************/
  2. /* visual_server_raster.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2017 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_RASTER_H
  31. #define VISUAL_SERVER_RASTER_H
  32. #include "allocators.h"
  33. #include "octree.h"
  34. #include "servers/visual/rasterizer.h"
  35. #include "servers/visual_server.h"
  36. #include "visual_server_canvas.h"
  37. #include "visual_server_global.h"
  38. #include "visual_server_scene.h"
  39. #include "visual_server_viewport.h"
  40. /**
  41. @author Juan Linietsky <reduzio@gmail.com>
  42. */
  43. class VisualServerRaster : public VisualServer {
  44. enum {
  45. MAX_INSTANCE_CULL = 8192,
  46. MAX_INSTANCE_LIGHTS = 4,
  47. LIGHT_CACHE_DIRTY = -1,
  48. MAX_LIGHTS_CULLED = 256,
  49. MAX_ROOM_CULL = 32,
  50. MAX_EXTERIOR_PORTALS = 128,
  51. MAX_LIGHT_SAMPLERS = 256,
  52. INSTANCE_ROOMLESS_MASK = (1 << 20)
  53. };
  54. static int changes;
  55. bool draw_extra_frame;
  56. RID test_cube;
  57. int black_margin[4];
  58. RID black_image[4];
  59. struct FrameDrawnCallbacks {
  60. ObjectID object;
  61. StringName method;
  62. Variant param;
  63. };
  64. List<FrameDrawnCallbacks> frame_drawn_callbacks;
  65. // FIXME: Kept as reference for future implementation
  66. #if 0
  67. struct Room {
  68. bool occlude_exterior;
  69. BSP_Tree bounds;
  70. Room() { occlude_exterior=true; }
  71. };
  72. BalloonAllocator<> octree_allocator;
  73. struct OctreeAllocator {
  74. static BalloonAllocator<> *allocator;
  75. _FORCE_INLINE_ static void *alloc(size_t p_size) { return allocator->alloc(p_size); }
  76. _FORCE_INLINE_ static void free(void *p_ptr) { return allocator->free(p_ptr); }
  77. };
  78. struct Portal {
  79. bool enabled;
  80. float disable_distance;
  81. Color disable_color;
  82. float connect_range;
  83. Vector<Point2> shape;
  84. Rect2 bounds;
  85. Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; }
  86. };
  87. struct BakedLight {
  88. Rasterizer::BakedLightData data;
  89. PoolVector<int> sampler;
  90. Rect3 octree_aabb;
  91. Size2i octree_tex_size;
  92. Size2i light_tex_size;
  93. };
  94. struct BakedLightSampler {
  95. float params[BAKED_LIGHT_SAMPLER_MAX];
  96. int resolution;
  97. Vector<Vector3> dp_cache;
  98. BakedLightSampler() {
  99. params[BAKED_LIGHT_SAMPLER_STRENGTH]=1.0;
  100. params[BAKED_LIGHT_SAMPLER_ATTENUATION]=1.0;
  101. params[BAKED_LIGHT_SAMPLER_RADIUS]=1.0;
  102. params[BAKED_LIGHT_SAMPLER_DETAIL_RATIO]=0.1;
  103. resolution=16;
  104. }
  105. };
  106. void _update_baked_light_sampler_dp_cache(BakedLightSampler * blsamp);
  107. struct Camera {
  108. enum Type {
  109. PERSPECTIVE,
  110. ORTHOGONAL
  111. };
  112. Type type;
  113. float fov;
  114. float znear,zfar;
  115. float size;
  116. uint32_t visible_layers;
  117. bool vaspect;
  118. RID env;
  119. Transform transform;
  120. Camera() {
  121. visible_layers=0xFFFFFFFF;
  122. fov=60;
  123. type=PERSPECTIVE;
  124. znear=0.1; zfar=100;
  125. size=1.0;
  126. vaspect=false;
  127. }
  128. };
  129. struct Instance;
  130. typedef Set<Instance*,Comparator<Instance*>,OctreeAllocator> InstanceSet;
  131. struct Scenario;
  132. struct Instance {
  133. enum {
  134. MAX_LIGHTS=4
  135. };
  136. RID self;
  137. OctreeElementID octree_id;
  138. Scenario *scenario;
  139. bool update;
  140. bool update_aabb;
  141. bool update_materials;
  142. Instance *update_next;
  143. InstanceType base_type;
  144. RID base_rid;
  145. Rect3 aabb;
  146. Rect3 transformed_aabb;
  147. uint32_t object_ID;
  148. bool visible;
  149. bool visible_in_all_rooms;
  150. uint32_t layer_mask;
  151. float draw_range_begin;
  152. float draw_range_end;
  153. float extra_margin;
  154. Rasterizer::InstanceData data;
  155. Set<Instance*> auto_rooms;
  156. Set<Instance*> valid_auto_rooms;
  157. Instance *room;
  158. List<Instance*>::Element *RE;
  159. Instance *baked_light;
  160. List<Instance*>::Element *BLE;
  161. Instance *sampled_light;
  162. bool exterior;
  163. uint64_t last_render_pass;
  164. uint64_t last_frame_pass;
  165. uint64_t version; // changes to this, and changes to base increase version
  166. InstanceSet lights;
  167. bool light_cache_dirty;
  168. struct RoomInfo {
  169. Transform affine_inverse;
  170. Room *room;
  171. List<Instance*> owned_geometry_instances;
  172. List<Instance*> owned_portal_instances;
  173. List<Instance*> owned_room_instances;
  174. List<Instance*> owned_light_instances; //not used, but just for the sake of it
  175. Set<Instance*> disconnected_child_portals;
  176. Set<Instance*> owned_autoroom_geometry;
  177. uint64_t last_visited_pass;
  178. RoomInfo() { last_visited_pass=0; }
  179. };
  180. struct PortalInfo {
  181. Portal *portal;
  182. Set<Instance*> candidate_set;
  183. Instance *connected;
  184. uint64_t last_visited_pass;
  185. Plane plane_cache;
  186. Vector<Vector3> transformed_point_cache;
  187. PortalInfo() { connected=NULL; last_visited_pass=0;}
  188. };
  189. struct LightInfo {
  190. RID instance;
  191. int light_set_index;
  192. uint64_t last_version;
  193. uint64_t last_add_pass;
  194. List<RID>::Element *D; // directional light in scenario
  195. InstanceSet affected;
  196. bool enabled;
  197. float dtc; //distance to camera, used for sorting
  198. LightInfo() {
  199. D=NULL;
  200. light_set_index=-1;
  201. last_add_pass=0;
  202. enabled=true;
  203. }
  204. };
  205. struct BakedLightInfo {
  206. BakedLight *baked_light;
  207. Transform affine_inverse;
  208. List<Instance*> owned_instances;
  209. };
  210. struct BakedLightSamplerInfo {
  211. Set<Instance*> baked_lights;
  212. Set<Instance*> owned_instances;
  213. BakedLightSampler *sampler;
  214. int resolution;
  215. Vector<Color> light_buffer;
  216. RID sampled_light;
  217. uint64_t last_pass;
  218. Transform xform; // viewspace normal to lightspace, might not use one.
  219. BakedLightSamplerInfo() {
  220. sampler=NULL;
  221. last_pass=0;
  222. resolution=0;
  223. }
  224. };
  225. struct ParticlesInfo {
  226. RID instance;
  227. };
  228. RoomInfo *room_info;
  229. LightInfo *light_info;
  230. ParticlesInfo *particles_info;
  231. PortalInfo * portal_info;
  232. BakedLightInfo * baked_light_info;
  233. BakedLightSamplerInfo * baked_light_sampler_info;
  234. Instance() {
  235. octree_id=0;
  236. update_next=0;
  237. object_ID=0;
  238. last_render_pass=0;
  239. last_frame_pass=0;
  240. light_info=0;
  241. particles_info=0;
  242. update_next=NULL;
  243. update=false;
  244. visible=true;
  245. data.cast_shadows=SHADOW_CASTING_SETTING_ON;
  246. data.receive_shadows=true;
  247. data.depth_scale=false;
  248. data.billboard=false;
  249. data.billboard_y=false;
  250. data.baked_light=NULL;
  251. data.baked_light_octree_xform=NULL;
  252. data.baked_lightmap_id=-1;
  253. version=1;
  254. room_info=NULL;
  255. room=NULL;
  256. RE=NULL;
  257. portal_info=NULL;
  258. exterior=false;
  259. layer_mask=1;
  260. draw_range_begin=0;
  261. draw_range_end=0;
  262. extra_margin=0;
  263. visible_in_all_rooms=false;
  264. update_aabb=false;
  265. update_materials=false;
  266. baked_light=NULL;
  267. baked_light_info=NULL;
  268. baked_light_sampler_info=NULL;
  269. sampled_light=NULL;
  270. BLE=NULL;
  271. light_cache_dirty=true;
  272. }
  273. ~Instance() {
  274. if (light_info)
  275. memdelete(light_info);
  276. if (particles_info)
  277. memdelete(particles_info);
  278. if (room_info)
  279. memdelete(room_info);
  280. if (portal_info)
  281. memdelete(portal_info);
  282. if (baked_light_info)
  283. memdelete(baked_light_info);
  284. };
  285. };
  286. struct _InstanceLightsort {
  287. bool operator()(const Instance* p_A, const Instance* p_B) const { return p_A->light_info->dtc < p_B->light_info->dtc; }
  288. };
  289. struct Scenario {
  290. ScenarioDebugMode debug;
  291. RID self;
  292. // well wtf, balloon allocator is slower?
  293. typedef ::Octree<Instance,true> Octree;
  294. Octree octree;
  295. List<RID> directional_lights;
  296. RID environment;
  297. RID fallback_environment;
  298. Instance *dirty_instances;
  299. Scenario() { dirty_instances=NULL; debug=SCENARIO_DEBUG_DISABLED; }
  300. };
  301. mutable RID_Owner<Rasterizer::ShaderMaterial> canvas_item_material_owner;
  302. struct Viewport {
  303. RID self;
  304. RID parent;
  305. VisualServer::ViewportRect rect;
  306. RID camera;
  307. RID scenario;
  308. RID viewport_data;
  309. RenderTargetUpdateMode render_target_update_mode;
  310. RID render_target;
  311. RID render_target_texture;
  312. Rect2 rt_to_screen_rect;
  313. bool hide_scenario;
  314. bool hide_canvas;
  315. bool transparent_bg;
  316. bool queue_capture;
  317. bool render_target_vflip;
  318. bool render_target_clear_on_new_frame;
  319. bool render_target_clear;
  320. bool disable_environment;
  321. Image capture;
  322. bool rendered_in_prev_frame;
  323. struct CanvasKey {
  324. int layer;
  325. RID canvas;
  326. bool operator<(const CanvasKey& p_canvas) const { if (layer==p_canvas.layer) return canvas < p_canvas.canvas; return layer<p_canvas.layer; }
  327. CanvasKey() { layer=0; }
  328. CanvasKey(const RID& p_canvas, int p_layer) { canvas=p_canvas; layer=p_layer; }
  329. };
  330. struct CanvasData {
  331. Canvas *canvas;
  332. Transform2D transform;
  333. int layer;
  334. };
  335. Transform2D global_transform;
  336. Map<RID,CanvasData> canvas_map;
  337. SelfList<Viewport> update_list;
  338. Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true; disable_environment=false; }
  339. };
  340. SelfList<Viewport>::List viewport_update_list;
  341. Map<RID,int> screen_viewports;
  342. struct CullRange {
  343. Plane nearp;
  344. float min,max;
  345. float z_near,z_far;
  346. void add_aabb(const Rect3& p_aabb) {
  347. }
  348. };
  349. struct Cursor {
  350. Point2 pos;
  351. float rot;
  352. RID texture;
  353. Point2 center;
  354. bool visible;
  355. Rect2 region;
  356. Cursor() {
  357. rot = 0;
  358. visible = false;
  359. region = Rect2();
  360. };
  361. };
  362. Rect2 canvas_clip;
  363. Color clear_color;
  364. Cursor cursors[MAX_CURSORS];
  365. RID default_cursor_texture;
  366. static void* instance_pair(void *p_self, OctreeElementID,Instance *p_A,int, OctreeElementID,Instance *p_B,int);
  367. static void instance_unpair(void *p_self, OctreeElementID,Instance *p_A,int, OctreeElementID,Instance *p_B,int,void*);
  368. Instance *instance_cull_result[MAX_INSTANCE_CULL];
  369. Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps
  370. Instance *light_cull_result[MAX_LIGHTS_CULLED];
  371. int light_cull_count;
  372. Instance *exterior_portal_cull_result[MAX_EXTERIOR_PORTALS];
  373. int exterior_portal_cull_count;
  374. bool exterior_visited;
  375. Instance *light_sampler_cull_result[MAX_LIGHT_SAMPLERS];
  376. int light_samplers_culled;
  377. Instance *room_cull_result[MAX_ROOM_CULL];
  378. int room_cull_count;
  379. bool room_cull_enabled;
  380. bool light_discard_enabled;
  381. bool shadows_enabled;
  382. int black_margin[4];
  383. RID black_image[4];
  384. Vector<Vector3> aabb_random_points;
  385. Vector<Vector3> transformed_aabb_random_points;
  386. void _instance_validate_autorooms(Instance *p_geometry);
  387. void _portal_disconnect(Instance *p_portal,bool p_cleanup=false);
  388. void _portal_attempt_connect(Instance *p_portal);
  389. void _dependency_queue_update(RID p_rid, bool p_update_aabb=false, bool p_update_materials=false);
  390. _FORCE_INLINE_ void _instance_queue_update(Instance *p_instance,bool p_update_aabb=false,bool p_update_materials=false);
  391. void _update_instances();
  392. void _update_instance_aabb(Instance *p_instance);
  393. void _update_instance(Instance *p_instance);
  394. void _free_attached_instances(RID p_rid,bool p_free_scenario=false);
  395. void _clean_up_owner(RID_OwnerBase *p_owner,String p_type);
  396. Instance *instance_update_list;
  397. //RID default_scenario;
  398. //RID default_viewport;
  399. RID test_cube;
  400. mutable RID_Owner<Room> room_owner;
  401. mutable RID_Owner<Portal> portal_owner;
  402. mutable RID_Owner<BakedLight> baked_light_owner;
  403. mutable RID_Owner<BakedLightSampler> baked_light_sampler_owner;
  404. mutable RID_Owner<Camera> camera_owner;
  405. mutable RID_Owner<Viewport> viewport_owner;
  406. mutable RID_Owner<Scenario> scenario_owner;
  407. mutable RID_Owner<Instance> instance_owner;
  408. mutable RID_Owner<Canvas> canvas_owner;
  409. mutable RID_Owner<CanvasItem> canvas_item_owner;
  410. Map< RID, Set<RID> > instance_dependency_map;
  411. Map< RID, Set<Instance*> > skeleton_dependency_map;
  412. ViewportRect viewport_rect;
  413. _FORCE_INLINE_ void _instance_draw(Instance *p_instance);
  414. bool _test_portal_cull(Camera *p_camera, Instance *p_portal_from, Instance *p_portal_to);
  415. void _cull_portal(Camera *p_camera, Instance *p_portal,Instance *p_from_portal);
  416. void _cull_room(Camera *p_camera, Instance *p_room,Instance *p_from_portal=NULL);
  417. void _process_sampled_light(const Transform &p_camera, Instance *p_sampled_light, bool p_linear_colorspace);
  418. void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
  419. void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
  420. static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect);
  421. void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights);
  422. void _render_canvas_item(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, float p_opacity, int p_z, Rasterizer::CanvasItem **z_list, Rasterizer::CanvasItem **z_last_list, CanvasItem *p_canvas_clip, CanvasItem *p_material_owner);
  423. void _render_canvas(Canvas *p_canvas, const Transform2D &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights);
  424. void _light_mask_canvas_items(int p_z,Rasterizer::CanvasItem *p_canvas_item,Rasterizer::CanvasLight *p_masked_lights);
  425. Vector<Vector3> _camera_generate_endpoints(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max);
  426. Vector<Plane> _camera_generate_orthogonal_planes(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max);
  427. void _light_instance_update_lispsm_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range);
  428. void _light_instance_update_pssm_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range);
  429. void _light_instance_update_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range);
  430. uint64_t render_pass;
  431. int changes;
  432. bool draw_extra_frame;
  433. void _draw_viewport_camera(Viewport *p_viewport, bool p_ignore_camera);
  434. void _draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h);
  435. void _draw_viewports();
  436. void _draw_cursors_and_margins();
  437. Rasterizer *rasterizer;
  438. #endif
  439. void _draw_margins();
  440. static void _changes_changed() {}
  441. public:
  442. //if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
  443. //#define DEBUG_CHANGES
  444. #ifdef DEBUG_CHANGES
  445. _FORCE_INLINE_ static void redraw_request() {
  446. changes++;
  447. _changes_changed();
  448. }
  449. #define DISPLAY_CHANGED \
  450. changes++; \
  451. _changes_changed();
  452. #else
  453. _FORCE_INLINE_ static void redraw_request() { changes++; }
  454. #define DISPLAY_CHANGED \
  455. changes++;
  456. #endif
  457. // print_line(String("CHANGED: ") + __FUNCTION__);
  458. #define BIND0R(m_r, m_name) \
  459. m_r m_name() { return BINDBASE->m_name(); }
  460. #define BIND1R(m_r, m_name, m_type1) \
  461. m_r m_name(m_type1 arg1) { return BINDBASE->m_name(arg1); }
  462. #define BIND1RC(m_r, m_name, m_type1) \
  463. m_r m_name(m_type1 arg1) const { return BINDBASE->m_name(arg1); }
  464. #define BIND2R(m_r, m_name, m_type1, m_type2) \
  465. m_r m_name(m_type1 arg1, m_type2 arg2) { return BINDBASE->m_name(arg1, arg2); }
  466. #define BIND2RC(m_r, m_name, m_type1, m_type2) \
  467. m_r m_name(m_type1 arg1, m_type2 arg2) const { return BINDBASE->m_name(arg1, arg2); }
  468. #define BIND3RC(m_r, m_name, m_type1, m_type2, m_type3) \
  469. m_r m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3) const { return BINDBASE->m_name(arg1, arg2, arg3); }
  470. #define BIND4RC(m_r, m_name, m_type1, m_type2, m_type3, m_type4) \
  471. m_r m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4) const { return BINDBASE->m_name(arg1, arg2, arg3, arg4); }
  472. #define BIND1(m_name, m_type1) \
  473. void m_name(m_type1 arg1) { DISPLAY_CHANGED BINDBASE->m_name(arg1); }
  474. #define BIND2(m_name, m_type1, m_type2) \
  475. void m_name(m_type1 arg1, m_type2 arg2) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2); }
  476. #define BIND2C(m_name, m_type1, m_type2) \
  477. void m_name(m_type1 arg1, m_type2 arg2) const { BINDBASE->m_name(arg1, arg2); }
  478. #define BIND3(m_name, m_type1, m_type2, m_type3) \
  479. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3); }
  480. #define BIND4(m_name, m_type1, m_type2, m_type3, m_type4) \
  481. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4); }
  482. #define BIND5(m_name, m_type1, m_type2, m_type3, m_type4, m_type5) \
  483. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5); }
  484. #define BIND6(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
  485. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6); }
  486. #define BIND7(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7) \
  487. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7); }
  488. #define BIND8(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8) \
  489. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); }
  490. #define BIND9(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9) \
  491. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); }
  492. #define BIND10(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10) \
  493. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); }
  494. #define BIND11(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \
  495. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); }
  496. #define BIND12(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
  497. void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); }
  498. //from now on, calls forwarded to this singleton
  499. #define BINDBASE VSG::storage
  500. /* TEXTURE API */
  501. BIND0R(RID, texture_create)
  502. BIND5(texture_allocate, RID, int, int, Image::Format, uint32_t)
  503. BIND3(texture_set_data, RID, const Ref<Image> &, CubeMapSide)
  504. BIND2RC(Ref<Image>, texture_get_data, RID, CubeMapSide)
  505. BIND2(texture_set_flags, RID, uint32_t)
  506. BIND1RC(uint32_t, texture_get_flags, RID)
  507. BIND1RC(Image::Format, texture_get_format, RID)
  508. BIND1RC(uint32_t, texture_get_texid, RID)
  509. BIND1RC(uint32_t, texture_get_width, RID)
  510. BIND1RC(uint32_t, texture_get_height, RID)
  511. BIND3(texture_set_size_override, RID, int, int)
  512. BIND3(texture_set_detect_3d_callback, RID, TextureDetectCallback, void *)
  513. BIND3(texture_set_detect_srgb_callback, RID, TextureDetectCallback, void *)
  514. BIND3(texture_set_detect_normal_callback, RID, TextureDetectCallback, void *)
  515. BIND2(texture_set_path, RID, const String &)
  516. BIND1RC(String, texture_get_path, RID)
  517. BIND1(texture_set_shrink_all_x2_on_set_data, bool)
  518. BIND1(texture_debug_usage, List<TextureInfo> *)
  519. BIND1(textures_keep_original, bool)
  520. /* SKY API */
  521. BIND0R(RID, sky_create)
  522. BIND3(sky_set_texture, RID, RID, int)
  523. /* SHADER API */
  524. BIND0R(RID, shader_create)
  525. BIND2(shader_set_code, RID, const String &)
  526. BIND1RC(String, shader_get_code, RID)
  527. BIND2C(shader_get_param_list, RID, List<PropertyInfo> *)
  528. BIND3(shader_set_default_texture_param, RID, const StringName &, RID)
  529. BIND2RC(RID, shader_get_default_texture_param, RID, const StringName &)
  530. /* COMMON MATERIAL API */
  531. BIND0R(RID, material_create)
  532. BIND2(material_set_shader, RID, RID)
  533. BIND1RC(RID, material_get_shader, RID)
  534. BIND3(material_set_param, RID, const StringName &, const Variant &)
  535. BIND2RC(Variant, material_get_param, RID, const StringName &)
  536. BIND2(material_set_render_priority, RID, int)
  537. BIND2(material_set_line_width, RID, float)
  538. BIND2(material_set_next_pass, RID, RID)
  539. /* MESH API */
  540. BIND0R(RID, mesh_create)
  541. BIND10(mesh_add_surface, RID, uint32_t, PrimitiveType, const PoolVector<uint8_t> &, int, const PoolVector<uint8_t> &, int, const Rect3 &, const Vector<PoolVector<uint8_t> > &, const Vector<Rect3> &)
  542. BIND2(mesh_set_blend_shape_count, RID, int)
  543. BIND1RC(int, mesh_get_blend_shape_count, RID)
  544. BIND2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
  545. BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
  546. BIND3(mesh_surface_set_material, RID, int, RID)
  547. BIND2RC(RID, mesh_surface_get_material, RID, int)
  548. BIND2RC(int, mesh_surface_get_array_len, RID, int)
  549. BIND2RC(int, mesh_surface_get_array_index_len, RID, int)
  550. BIND2RC(PoolVector<uint8_t>, mesh_surface_get_array, RID, int)
  551. BIND2RC(PoolVector<uint8_t>, mesh_surface_get_index_array, RID, int)
  552. BIND2RC(uint32_t, mesh_surface_get_format, RID, int)
  553. BIND2RC(PrimitiveType, mesh_surface_get_primitive_type, RID, int)
  554. BIND2RC(Rect3, mesh_surface_get_aabb, RID, int)
  555. BIND2RC(Vector<PoolVector<uint8_t> >, mesh_surface_get_blend_shapes, RID, int)
  556. BIND2RC(Vector<Rect3>, mesh_surface_get_skeleton_aabb, RID, int)
  557. BIND2(mesh_remove_surface, RID, int)
  558. BIND1RC(int, mesh_get_surface_count, RID)
  559. BIND2(mesh_set_custom_aabb, RID, const Rect3 &)
  560. BIND1RC(Rect3, mesh_get_custom_aabb, RID)
  561. BIND1(mesh_clear, RID)
  562. /* MULTIMESH API */
  563. BIND0R(RID, multimesh_create)
  564. BIND4(multimesh_allocate, RID, int, MultimeshTransformFormat, MultimeshColorFormat)
  565. BIND1RC(int, multimesh_get_instance_count, RID)
  566. BIND2(multimesh_set_mesh, RID, RID)
  567. BIND3(multimesh_instance_set_transform, RID, int, const Transform &)
  568. BIND3(multimesh_instance_set_transform_2d, RID, int, const Transform2D &)
  569. BIND3(multimesh_instance_set_color, RID, int, const Color &)
  570. BIND1RC(RID, multimesh_get_mesh, RID)
  571. BIND1RC(Rect3, multimesh_get_aabb, RID)
  572. BIND2RC(Transform, multimesh_instance_get_transform, RID, int)
  573. BIND2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int)
  574. BIND2RC(Color, multimesh_instance_get_color, RID, int)
  575. BIND2(multimesh_set_visible_instances, RID, int)
  576. BIND1RC(int, multimesh_get_visible_instances, RID)
  577. /* IMMEDIATE API */
  578. BIND0R(RID, immediate_create)
  579. BIND3(immediate_begin, RID, PrimitiveType, RID)
  580. BIND2(immediate_vertex, RID, const Vector3 &)
  581. BIND2(immediate_normal, RID, const Vector3 &)
  582. BIND2(immediate_tangent, RID, const Plane &)
  583. BIND2(immediate_color, RID, const Color &)
  584. BIND2(immediate_uv, RID, const Vector2 &)
  585. BIND2(immediate_uv2, RID, const Vector2 &)
  586. BIND1(immediate_end, RID)
  587. BIND1(immediate_clear, RID)
  588. BIND2(immediate_set_material, RID, RID)
  589. BIND1RC(RID, immediate_get_material, RID)
  590. /* SKELETON API */
  591. BIND0R(RID, skeleton_create)
  592. BIND3(skeleton_allocate, RID, int, bool)
  593. BIND1RC(int, skeleton_get_bone_count, RID)
  594. BIND3(skeleton_bone_set_transform, RID, int, const Transform &)
  595. BIND2RC(Transform, skeleton_bone_get_transform, RID, int)
  596. BIND3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
  597. BIND2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
  598. /* Light API */
  599. BIND1R(RID, light_create, LightType)
  600. BIND2(light_set_color, RID, const Color &)
  601. BIND3(light_set_param, RID, LightParam, float)
  602. BIND2(light_set_shadow, RID, bool)
  603. BIND2(light_set_shadow_color, RID, const Color &)
  604. BIND2(light_set_projector, RID, RID)
  605. BIND2(light_set_negative, RID, bool)
  606. BIND2(light_set_cull_mask, RID, uint32_t)
  607. BIND2(light_set_reverse_cull_face_mode, RID, bool)
  608. BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
  609. BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
  610. BIND2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode)
  611. BIND2(light_directional_set_blend_splits, RID, bool)
  612. BIND2(light_directional_set_shadow_depth_range_mode, RID, LightDirectionalShadowDepthRangeMode)
  613. /* PROBE API */
  614. BIND0R(RID, reflection_probe_create)
  615. BIND2(reflection_probe_set_update_mode, RID, ReflectionProbeUpdateMode)
  616. BIND2(reflection_probe_set_intensity, RID, float)
  617. BIND2(reflection_probe_set_interior_ambient, RID, const Color &)
  618. BIND2(reflection_probe_set_interior_ambient_energy, RID, float)
  619. BIND2(reflection_probe_set_interior_ambient_probe_contribution, RID, float)
  620. BIND2(reflection_probe_set_max_distance, RID, float)
  621. BIND2(reflection_probe_set_extents, RID, const Vector3 &)
  622. BIND2(reflection_probe_set_origin_offset, RID, const Vector3 &)
  623. BIND2(reflection_probe_set_as_interior, RID, bool)
  624. BIND2(reflection_probe_set_enable_box_projection, RID, bool)
  625. BIND2(reflection_probe_set_enable_shadows, RID, bool)
  626. BIND2(reflection_probe_set_cull_mask, RID, uint32_t)
  627. /* BAKED LIGHT API */
  628. BIND0R(RID, gi_probe_create)
  629. BIND2(gi_probe_set_bounds, RID, const Rect3 &)
  630. BIND1RC(Rect3, gi_probe_get_bounds, RID)
  631. BIND2(gi_probe_set_cell_size, RID, float)
  632. BIND1RC(float, gi_probe_get_cell_size, RID)
  633. BIND2(gi_probe_set_to_cell_xform, RID, const Transform &)
  634. BIND1RC(Transform, gi_probe_get_to_cell_xform, RID)
  635. BIND2(gi_probe_set_dynamic_range, RID, int)
  636. BIND1RC(int, gi_probe_get_dynamic_range, RID)
  637. BIND2(gi_probe_set_energy, RID, float)
  638. BIND1RC(float, gi_probe_get_energy, RID)
  639. BIND2(gi_probe_set_bias, RID, float)
  640. BIND1RC(float, gi_probe_get_bias, RID)
  641. BIND2(gi_probe_set_normal_bias, RID, float)
  642. BIND1RC(float, gi_probe_get_normal_bias, RID)
  643. BIND2(gi_probe_set_propagation, RID, float)
  644. BIND1RC(float, gi_probe_get_propagation, RID)
  645. BIND2(gi_probe_set_interior, RID, bool)
  646. BIND1RC(bool, gi_probe_is_interior, RID)
  647. BIND2(gi_probe_set_compress, RID, bool)
  648. BIND1RC(bool, gi_probe_is_compressed, RID)
  649. BIND2(gi_probe_set_dynamic_data, RID, const PoolVector<int> &)
  650. BIND1RC(PoolVector<int>, gi_probe_get_dynamic_data, RID)
  651. /* PARTICLES */
  652. BIND0R(RID, particles_create)
  653. BIND2(particles_set_emitting, RID, bool)
  654. BIND2(particles_set_amount, RID, int)
  655. BIND2(particles_set_lifetime, RID, float)
  656. BIND2(particles_set_one_shot, RID, bool)
  657. BIND2(particles_set_pre_process_time, RID, float)
  658. BIND2(particles_set_explosiveness_ratio, RID, float)
  659. BIND2(particles_set_randomness_ratio, RID, float)
  660. BIND2(particles_set_custom_aabb, RID, const Rect3 &)
  661. BIND2(particles_set_speed_scale, RID, float)
  662. BIND2(particles_set_use_local_coordinates, RID, bool)
  663. BIND2(particles_set_process_material, RID, RID)
  664. BIND2(particles_set_fixed_fps, RID, int)
  665. BIND2(particles_set_fractional_delta, RID, bool)
  666. BIND1(particles_restart, RID)
  667. BIND2(particles_set_draw_order, RID, VS::ParticlesDrawOrder)
  668. BIND2(particles_set_draw_passes, RID, int)
  669. BIND3(particles_set_draw_pass_mesh, RID, int, RID)
  670. BIND1R(Rect3, particles_get_current_aabb, RID)
  671. BIND2(particles_set_emission_transform, RID, const Transform &)
  672. #undef BINDBASE
  673. //from now on, calls forwarded to this singleton
  674. #define BINDBASE VSG::scene
  675. /* CAMERA API */
  676. BIND0R(RID, camera_create)
  677. BIND4(camera_set_perspective, RID, float, float, float)
  678. BIND4(camera_set_orthogonal, RID, float, float, float)
  679. BIND2(camera_set_transform, RID, const Transform &)
  680. BIND2(camera_set_cull_mask, RID, uint32_t)
  681. BIND2(camera_set_environment, RID, RID)
  682. BIND2(camera_set_use_vertical_aspect, RID, bool)
  683. #undef BINDBASE
  684. //from now on, calls forwarded to this singleton
  685. #define BINDBASE VSG::viewport
  686. /* VIEWPORT TARGET API */
  687. BIND0R(RID, viewport_create)
  688. BIND2(viewport_set_use_arvr, RID, bool)
  689. BIND3(viewport_set_size, RID, int, int)
  690. BIND2(viewport_set_active, RID, bool)
  691. BIND2(viewport_set_parent_viewport, RID, RID)
  692. BIND2(viewport_set_clear_mode, RID, ViewportClearMode)
  693. BIND3(viewport_attach_to_screen, RID, const Rect2 &, int)
  694. BIND1(viewport_detach, RID)
  695. BIND2(viewport_set_update_mode, RID, ViewportUpdateMode)
  696. BIND2(viewport_set_vflip, RID, bool)
  697. BIND1RC(RID, viewport_get_texture, RID)
  698. BIND2(viewport_set_hide_scenario, RID, bool)
  699. BIND2(viewport_set_hide_canvas, RID, bool)
  700. BIND2(viewport_set_disable_environment, RID, bool)
  701. BIND2(viewport_set_disable_3d, RID, bool)
  702. BIND2(viewport_attach_camera, RID, RID)
  703. BIND2(viewport_set_scenario, RID, RID)
  704. BIND2(viewport_attach_canvas, RID, RID)
  705. BIND2(viewport_remove_canvas, RID, RID)
  706. BIND3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
  707. BIND2(viewport_set_transparent_background, RID, bool)
  708. BIND2(viewport_set_global_canvas_transform, RID, const Transform2D &)
  709. BIND3(viewport_set_canvas_layer, RID, RID, int)
  710. BIND2(viewport_set_shadow_atlas_size, RID, int)
  711. BIND3(viewport_set_shadow_atlas_quadrant_subdivision, RID, int, int)
  712. BIND2(viewport_set_msaa, RID, ViewportMSAA)
  713. BIND2(viewport_set_hdr, RID, bool)
  714. BIND2(viewport_set_usage, RID, ViewportUsage)
  715. BIND2R(int, viewport_get_render_info, RID, ViewportRenderInfo)
  716. BIND2(viewport_set_debug_draw, RID, ViewportDebugDraw)
  717. /* ENVIRONMENT API */
  718. #undef BINDBASE
  719. //from now on, calls forwarded to this singleton
  720. #define BINDBASE VSG::scene_render
  721. BIND0R(RID, environment_create)
  722. BIND2(environment_set_background, RID, EnvironmentBG)
  723. BIND2(environment_set_sky, RID, RID)
  724. BIND2(environment_set_sky_custom_fov, RID, float)
  725. BIND2(environment_set_bg_color, RID, const Color &)
  726. BIND2(environment_set_bg_energy, RID, float)
  727. BIND2(environment_set_canvas_max_layer, RID, int)
  728. BIND4(environment_set_ambient_light, RID, const Color &, float, float)
  729. BIND7(environment_set_ssr, RID, bool, int, float, float, float, bool)
  730. BIND12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
  731. BIND6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
  732. BIND6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
  733. BIND10(environment_set_glow, RID, bool, int, float, float, float, EnvironmentGlowBlendMode, float, float, bool)
  734. BIND9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float)
  735. BIND6(environment_set_adjustment, RID, bool, float, float, float, RID)
  736. BIND5(environment_set_fog, RID, bool, const Color &, const Color &, float)
  737. BIND6(environment_set_fog_depth, RID, bool, float, float, bool, float)
  738. BIND5(environment_set_fog_height, RID, bool, float, float, float)
  739. /* SCENARIO API */
  740. #undef BINDBASE
  741. #define BINDBASE VSG::scene
  742. BIND0R(RID, scenario_create)
  743. BIND2(scenario_set_debug, RID, ScenarioDebugMode)
  744. BIND2(scenario_set_environment, RID, RID)
  745. BIND3(scenario_set_reflection_atlas_size, RID, int, int)
  746. BIND2(scenario_set_fallback_environment, RID, RID)
  747. /* INSTANCING API */
  748. // from can be mesh, light, area and portal so far.
  749. BIND0R(RID, instance_create)
  750. BIND2(instance_set_base, RID, RID) // from can be mesh, light, poly, area and portal so far.
  751. BIND2(instance_set_scenario, RID, RID) // from can be mesh, light, poly, area and portal so far.
  752. BIND2(instance_set_layer_mask, RID, uint32_t)
  753. BIND2(instance_set_transform, RID, const Transform &)
  754. BIND2(instance_attach_object_instance_id, RID, ObjectID)
  755. BIND3(instance_set_blend_shape_weight, RID, int, float)
  756. BIND3(instance_set_surface_material, RID, int, RID)
  757. BIND2(instance_set_visible, RID, bool)
  758. BIND2(instance_attach_skeleton, RID, RID)
  759. BIND2(instance_set_exterior, RID, bool)
  760. BIND2(instance_set_extra_visibility_margin, RID, real_t)
  761. // don't use these in a game!
  762. BIND2RC(Vector<ObjectID>, instances_cull_aabb, const Rect3 &, RID)
  763. BIND3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID)
  764. BIND2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID)
  765. BIND3(instance_geometry_set_flag, RID, InstanceFlags, bool)
  766. BIND2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting)
  767. BIND2(instance_geometry_set_material_override, RID, RID)
  768. BIND5(instance_geometry_set_draw_range, RID, float, float, float, float)
  769. BIND2(instance_geometry_set_as_instance_lod, RID, RID)
  770. #undef BINDBASE
  771. //from now on, calls forwarded to this singleton
  772. #define BINDBASE VSG::canvas
  773. /* CANVAS (2D) */
  774. BIND0R(RID, canvas_create)
  775. BIND3(canvas_set_item_mirroring, RID, RID, const Point2 &)
  776. BIND2(canvas_set_modulate, RID, const Color &)
  777. BIND0R(RID, canvas_item_create)
  778. BIND2(canvas_item_set_parent, RID, RID)
  779. BIND2(canvas_item_set_visible, RID, bool)
  780. BIND2(canvas_item_set_light_mask, RID, int)
  781. BIND2(canvas_item_set_transform, RID, const Transform2D &)
  782. BIND2(canvas_item_set_clip, RID, bool)
  783. BIND2(canvas_item_set_distance_field_mode, RID, bool)
  784. BIND3(canvas_item_set_custom_rect, RID, bool, const Rect2 &)
  785. BIND2(canvas_item_set_modulate, RID, const Color &)
  786. BIND2(canvas_item_set_self_modulate, RID, const Color &)
  787. BIND2(canvas_item_set_draw_behind_parent, RID, bool)
  788. BIND6(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float, bool)
  789. BIND5(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool)
  790. BIND3(canvas_item_add_rect, RID, const Rect2 &, const Color &)
  791. BIND4(canvas_item_add_circle, RID, const Point2 &, float, const Color &)
  792. BIND7(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool, RID)
  793. BIND8(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, bool)
  794. BIND11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
  795. BIND7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
  796. BIND7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
  797. BIND8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
  798. BIND3(canvas_item_add_mesh, RID, const RID &, RID)
  799. BIND3(canvas_item_add_multimesh, RID, RID, RID)
  800. BIND6(canvas_item_add_particles, RID, RID, RID, RID, int, int)
  801. BIND2(canvas_item_add_set_transform, RID, const Transform2D &)
  802. BIND2(canvas_item_add_clip_ignore, RID, bool)
  803. BIND2(canvas_item_set_sort_children_by_y, RID, bool)
  804. BIND2(canvas_item_set_z, RID, int)
  805. BIND2(canvas_item_set_z_as_relative_to_parent, RID, bool)
  806. BIND3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &)
  807. BIND1(canvas_item_clear, RID)
  808. BIND2(canvas_item_set_draw_index, RID, int)
  809. BIND2(canvas_item_set_material, RID, RID)
  810. BIND2(canvas_item_set_use_parent_material, RID, bool)
  811. BIND0R(RID, canvas_light_create)
  812. BIND2(canvas_light_attach_to_canvas, RID, RID)
  813. BIND2(canvas_light_set_enabled, RID, bool)
  814. BIND2(canvas_light_set_scale, RID, float)
  815. BIND2(canvas_light_set_transform, RID, const Transform2D &)
  816. BIND2(canvas_light_set_texture, RID, RID)
  817. BIND2(canvas_light_set_texture_offset, RID, const Vector2 &)
  818. BIND2(canvas_light_set_color, RID, const Color &)
  819. BIND2(canvas_light_set_height, RID, float)
  820. BIND2(canvas_light_set_energy, RID, float)
  821. BIND3(canvas_light_set_z_range, RID, int, int)
  822. BIND3(canvas_light_set_layer_range, RID, int, int)
  823. BIND2(canvas_light_set_item_cull_mask, RID, int)
  824. BIND2(canvas_light_set_item_shadow_cull_mask, RID, int)
  825. BIND2(canvas_light_set_mode, RID, CanvasLightMode)
  826. BIND2(canvas_light_set_shadow_enabled, RID, bool)
  827. BIND2(canvas_light_set_shadow_buffer_size, RID, int)
  828. BIND2(canvas_light_set_shadow_gradient_length, RID, float)
  829. BIND2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
  830. BIND2(canvas_light_set_shadow_color, RID, const Color &)
  831. BIND2(canvas_light_set_shadow_smooth, RID, float)
  832. BIND0R(RID, canvas_light_occluder_create)
  833. BIND2(canvas_light_occluder_attach_to_canvas, RID, RID)
  834. BIND2(canvas_light_occluder_set_enabled, RID, bool)
  835. BIND2(canvas_light_occluder_set_polygon, RID, RID)
  836. BIND2(canvas_light_occluder_set_transform, RID, const Transform2D &)
  837. BIND2(canvas_light_occluder_set_light_mask, RID, int)
  838. BIND0R(RID, canvas_occluder_polygon_create)
  839. BIND3(canvas_occluder_polygon_set_shape, RID, const PoolVector<Vector2> &, bool)
  840. BIND2(canvas_occluder_polygon_set_shape_as_lines, RID, const PoolVector<Vector2> &)
  841. BIND2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
  842. /* BLACK BARS */
  843. virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom);
  844. virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom);
  845. /* FREE */
  846. virtual void free(RID p_rid); ///< free RIDs associated with the visual server
  847. /* EVENT QUEUING */
  848. virtual void request_frame_drawn_callback(Object *p_where, const StringName &p_method, const Variant &p_userdata);
  849. virtual void draw();
  850. virtual void sync();
  851. virtual bool has_changed() const;
  852. virtual void init();
  853. virtual void finish();
  854. /* STATUS INFORMATION */
  855. virtual int get_render_info(RenderInfo p_info);
  856. virtual RID get_test_cube();
  857. /* TESTING */
  858. virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale);
  859. virtual void set_default_clear_color(const Color &p_color);
  860. virtual bool has_feature(Features p_feature) const;
  861. virtual bool has_os_feature(const String &p_feature) const;
  862. virtual void set_debug_generate_wireframes(bool p_generate);
  863. VisualServerRaster();
  864. ~VisualServerRaster();
  865. #undef DISPLAY_CHANGED
  866. #undef BIND0R
  867. #undef BIND1RC
  868. #undef BIND2RC
  869. #undef BIND3RC
  870. #undef BIND4RC
  871. #undef BIND1
  872. #undef BIND2
  873. #undef BIND3
  874. #undef BIND4
  875. #undef BIND5
  876. #undef BIND6
  877. #undef BIND7
  878. #undef BIND8
  879. #undef BIND9
  880. #undef BIND10
  881. };
  882. #endif