diff options
Diffstat (limited to 'servers/visual/visual_server_raster.h')
-rw-r--r-- | servers/visual/visual_server_raster.h | 956 |
1 files changed, 413 insertions, 543 deletions
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 1f22e31ab0..5c8105681a 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,12 +34,17 @@ #include "servers/visual/rasterizer.h" #include "allocators.h" #include "octree.h" - +#include "visual_server_global.h" +#include "visual_server_viewport.h" +#include "visual_server_canvas.h" +#include "visual_server_scene.h" /** @author Juan Linietsky <reduzio@gmail.com> */ + + class VisualServerRaster : public VisualServer { @@ -57,6 +62,12 @@ class VisualServerRaster : public VisualServer { }; + int changes; + bool draw_extra_frame; + RID test_cube; + + + #if 0 struct Room { bool occlude_exterior; @@ -92,8 +103,8 @@ class VisualServerRaster : public VisualServer { struct BakedLight { Rasterizer::BakedLightData data; - DVector<int> sampler; - AABB octree_aabb; + PoolVector<int> sampler; + Rect3 octree_aabb; Size2i octree_tex_size; Size2i light_tex_size; @@ -131,7 +142,7 @@ class VisualServerRaster : public VisualServer { Transform transform; - Camera() { + Camera() { visible_layers=0xFFFFFFFF; fov=60; @@ -140,8 +151,8 @@ class VisualServerRaster : public VisualServer { size=1.0; vaspect=false; - } - }; + } + }; struct Instance; @@ -166,8 +177,8 @@ class VisualServerRaster : public VisualServer { RID base_rid; - AABB aabb; - AABB transformed_aabb; + Rect3 aabb; + Rect3 transformed_aabb; uint32_t object_ID; bool visible; bool visible_in_all_rooms; @@ -374,97 +385,6 @@ class VisualServerRaster : public VisualServer { mutable RID_Owner<Rasterizer::CanvasItemMaterial> canvas_item_material_owner; - struct CanvasItem : public Rasterizer::CanvasItem { - - - RID parent; // canvas it belongs to - List<CanvasItem*>::Element *E; - RID viewport; - int z; - bool z_relative; - bool sort_y; - float opacity; - float self_opacity; - bool use_parent_material; - - - Vector<CanvasItem*> child_items; - - - CanvasItem() { - E=NULL; - z=0; - opacity=1; - self_opacity=1; - sort_y=false; - use_parent_material=false; - z_relative=true; - } - }; - - - struct CanvasItemPtrSort { - - _FORCE_INLINE_ bool operator()(const CanvasItem* p_left,const CanvasItem* p_right) const { - - return p_left->xform.elements[2].y < p_right->xform.elements[2].y; - } - }; - - struct CanvasLightOccluder; - - struct CanvasLightOccluderPolygon { - - bool active; - Rect2 aabb; - CanvasOccluderPolygonCullMode cull_mode; - RID occluder; - Set<Rasterizer::CanvasLightOccluderInstance*> owners; - - CanvasLightOccluderPolygon() { active=false; cull_mode=CANVAS_OCCLUDER_POLYGON_CULL_DISABLED; } - }; - - - RID_Owner<CanvasLightOccluderPolygon> canvas_light_occluder_polygon_owner; - - RID_Owner<Rasterizer::CanvasLightOccluderInstance> canvas_light_occluder_owner; - - struct CanvasLight; - - struct Canvas { - - Set<RID> viewports; - struct ChildItem { - - Point2 mirror; - CanvasItem *item; - }; - - Set<Rasterizer::CanvasLight*> lights; - Set<Rasterizer::CanvasLightOccluderInstance*> occluders; - - Vector<ChildItem> child_items; - Color modulate; - - int find_item(CanvasItem *p_item) { - for(int i=0;i<child_items.size();i++) { - if (child_items[i].item==p_item) - return i; - } - return -1; - } - void erase_item(CanvasItem *p_item) { - int idx=find_item(p_item); - if (idx>=0) - child_items.remove(idx); - } - - Canvas() { modulate=Color(1,1,1,1); } - - }; - - - RID_Owner<Rasterizer::CanvasLight> canvas_light_owner; struct Viewport { @@ -508,11 +428,11 @@ class VisualServerRaster : public VisualServer { struct CanvasData { Canvas *canvas; - Matrix32 transform; + Transform2D transform; int layer; }; - Matrix32 global_transform; + Transform2D global_transform; Map<RID,CanvasData> canvas_map; @@ -531,7 +451,7 @@ class VisualServerRaster : public VisualServer { float min,max; float z_near,z_far; - void add_aabb(const AABB& p_aabb) { + void add_aabb(const Rect3& p_aabb) { } @@ -634,9 +554,9 @@ class VisualServerRaster : public VisualServer { void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario); void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario); static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect); - void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights); - void _render_canvas_item(CanvasItem *p_canvas_item, const Matrix32& 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); - void _render_canvas(Canvas *p_canvas, const Matrix32 &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights); + 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); + 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); + void _render_canvas(Canvas *p_canvas, const Transform2D &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights); void _light_mask_canvas_items(int p_z,Rasterizer::CanvasItem *p_canvas_item,Rasterizer::CanvasLight *p_masked_lights); Vector<Vector3> _camera_generate_endpoints(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max); @@ -658,636 +578,586 @@ class VisualServerRaster : public VisualServer { Rasterizer *rasterizer; -public: - - virtual RID texture_create(); - virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=TEXTURE_FLAGS_DEFAULT); - virtual void texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side=CUBEMAP_LEFT); - virtual Image texture_get_data(RID p_texture,CubeMapSide p_cube_side=CUBEMAP_LEFT) const; - virtual void texture_set_flags(RID p_texture,uint32_t p_flags) ; - virtual uint32_t texture_get_flags(RID p_texture) const; - virtual Image::Format texture_get_format(RID p_texture) const; - virtual uint32_t texture_get_width(RID p_texture) const; - virtual uint32_t texture_get_height(RID p_texture) const; - virtual void texture_set_size_override(RID p_texture,int p_width, int p_height); - virtual bool texture_can_stream(RID p_texture) const; - virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const; - - virtual void texture_set_path(RID p_texture,const String& p_path); - virtual String texture_get_path(RID p_texture) const; - - virtual void texture_debug_usage(List<TextureInfo> *r_info); - - virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable); - - - /* SHADER API */ - - virtual RID shader_create(ShaderMode p_mode=SHADER_MATERIAL); - - virtual void shader_set_mode(RID p_shader,ShaderMode p_mode); - virtual ShaderMode shader_get_mode(RID p_shader) const; - - virtual void shader_set_code(RID p_shader, const String& p_vertex, const String& p_fragment,const String& p_light,int p_vertex_ofs=0,int p_fragment_ofs=0,int p_light_ofs=0); - virtual String shader_get_vertex_code(RID p_shader) const; - virtual String shader_get_fragment_code(RID p_shader) const; - virtual String shader_get_light_code(RID p_shader) const; - - virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const; - - virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture); - virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const; +#endif - /* COMMON MATERIAL API */ +public: - virtual RID material_create(); +#define DISPLAY_CHANGED changes++; - virtual void material_set_shader(RID p_shader_material, RID p_shader); - virtual RID material_get_shader(RID p_shader_material) const; +#define BIND0R(m_r,m_name) m_r m_name() { return BINDBASE->m_name(); } +#define BIND1R(m_r,m_name,m_type1) m_r m_name(m_type1 arg1) { return BINDBASE->m_name(arg1); } +#define BIND1RC(m_r,m_name,m_type1) m_r m_name(m_type1 arg1) const { return BINDBASE->m_name(arg1); } +#define BIND2RC(m_r,m_name,m_type1,m_type2) m_r m_name(m_type1 arg1,m_type2 arg2) const { return BINDBASE->m_name(arg1,arg2); } +#define BIND3RC(m_r,m_name,m_type1,m_type2,m_type3) m_r m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3) const { return BINDBASE->m_name(arg1,arg2,arg3); } +#define BIND4RC(m_r,m_name,m_type1,m_type2,m_type3,m_type4) 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); } - virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); - virtual Variant material_get_param(RID p_material, const StringName& p_param) const; +#define BIND1(m_name,m_type1) void m_name(m_type1 arg1) { DISPLAY_CHANGED BINDBASE->m_name(arg1); } +#define BIND2(m_name,m_type1,m_type2) void m_name(m_type1 arg1,m_type2 arg2) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2); } +#define BIND2C(m_name,m_type1,m_type2) void m_name(m_type1 arg1,m_type2 arg2) const { BINDBASE->m_name(arg1,arg2); } +#define BIND3(m_name,m_type1,m_type2,m_type3) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3); } +#define BIND4(m_name,m_type1,m_type2,m_type3,m_type4) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4); } +#define BIND5(m_name,m_type1,m_type2,m_type3,m_type4,m_type5) 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); } +#define BIND6(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6) 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); } +#define BIND7(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7) 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); } +#define BIND8(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8) 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); } +#define BIND9(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8,m_type9) 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); } +#define BIND10(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8,m_type9,m_type10) 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); } - virtual void material_set_flag(RID p_material, MaterialFlag p_flag,bool p_enabled); - virtual bool material_get_flag(RID p_material,MaterialFlag p_flag) const; +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::storage - virtual void material_set_depth_draw_mode(RID p_material, MaterialDepthDrawMode p_mode); - virtual MaterialDepthDrawMode material_get_depth_draw_mode(RID p_material) const; + /* TEXTURE API */ - virtual void material_set_blend_mode(RID p_material,MaterialBlendMode p_mode); - virtual MaterialBlendMode material_get_blend_mode(RID p_material) const; - virtual void material_set_line_width(RID p_material,float p_line_width); - virtual float material_get_line_width(RID p_material) const; + BIND0R(RID,texture_create) + BIND5(texture_allocate,RID,int,int,Image::Format,uint32_t) + BIND3(texture_set_data,RID,const Image&,CubeMapSide) + BIND2RC(Image,texture_get_data,RID,CubeMapSide) + BIND2(texture_set_flags,RID,uint32_t) + BIND1RC(uint32_t,texture_get_flags,RID) + BIND1RC(Image::Format,texture_get_format,RID) + BIND1RC(uint32_t,texture_get_width,RID) + BIND1RC(uint32_t,texture_get_height,RID) + BIND3(texture_set_size_override,RID,int,int) + BIND2RC(RID,texture_create_radiance_cubemap,RID,int) - /* FIXED MATERIAL */ - virtual RID fixed_material_create(); + BIND2(texture_set_path,RID,const String&) + BIND1RC(String,texture_get_path,RID) + BIND1(texture_set_shrink_all_x2_on_set_data,bool) + BIND1(texture_debug_usage,List<TextureInfo>*) - virtual void fixed_material_set_flag(RID p_material, FixedMaterialFlags p_flag, bool p_enabled); - virtual bool fixed_material_get_flag(RID p_material, FixedMaterialFlags p_flag) const; + BIND1(textures_keep_original,bool) - virtual void fixed_material_set_param(RID p_material, FixedMaterialParam p_parameter, const Variant& p_value); - virtual Variant fixed_material_get_param(RID p_material,FixedMaterialParam p_parameter) const; + /* SKYBOX API */ - virtual void fixed_material_set_texture(RID p_material,FixedMaterialParam p_parameter, RID p_texture); - virtual RID fixed_material_get_texture(RID p_material,FixedMaterialParam p_parameter) const; + BIND0R(RID,skybox_create) + BIND3(skybox_set_texture,RID,RID,int) - virtual void fixed_material_set_texcoord_mode(RID p_material,FixedMaterialParam p_parameter, FixedMaterialTexCoordMode p_mode); - virtual FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,FixedMaterialParam p_parameter) const; + /* SHADER API */ + BIND1R(RID,shader_create,ShaderMode) - virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform); - virtual Transform fixed_material_get_uv_transform(RID p_material) const; - virtual void fixed_material_set_light_shader(RID p_material,FixedMaterialLightShader p_shader); - virtual FixedMaterialLightShader fixed_material_get_light_shader(RID p_material) const; + BIND2(shader_set_mode,RID,ShaderMode) + BIND1RC(ShaderMode,shader_get_mode,RID) - virtual void fixed_material_set_point_size(RID p_material,float p_size); - virtual float fixed_material_get_point_size(RID p_material) const; + BIND2(shader_set_code,RID,const String&) + BIND1RC(String,shader_get_code,RID) - /* SURFACE API */ - virtual RID mesh_create(); + BIND2C(shader_get_param_list,RID, List<PropertyInfo> *) - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); - virtual int mesh_get_morph_target_count(RID p_mesh) const; + BIND3(shader_set_default_texture_param,RID,const StringName&,RID) + BIND2RC(RID,shader_get_default_texture_param,RID,const StringName&) - virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode); - virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; - virtual void mesh_add_custom_surface(RID p_mesh,const Variant& p_dat); //this is used by each platform in a different way + /* COMMON MATERIAL API */ - virtual void mesh_add_surface(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),bool p_alpha_sort=false); - virtual Array mesh_get_surface_arrays(RID p_mesh,int p_surface) const; - virtual Array mesh_get_surface_morph_arrays(RID p_mesh,int p_surface) const; + BIND0R(RID,material_create) - virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned=false); - virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; + BIND2(material_set_shader,RID,RID) + BIND1RC(RID,material_get_shader,RID) - virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const; - virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const; - virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; - virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; + BIND3(material_set_param,RID, const StringName&, const Variant& ) + BIND2RC(Variant,material_get_param,RID, const StringName& ) - virtual void mesh_remove_surface(RID p_mesh,int p_index); - virtual int mesh_get_surface_count(RID p_mesh) const; + BIND2(material_set_line_width,RID, float ) - virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); - virtual AABB mesh_get_custom_aabb(RID p_mesh) const; - virtual void mesh_clear(RID p_mesh); - /* MULTIMESH API */ + /* MESH API */ - virtual RID multimesh_create(); - virtual void multimesh_set_instance_count(RID p_multimesh,int p_count); - virtual int multimesh_get_instance_count(RID p_multimesh) const; + BIND0R(RID,mesh_create) - virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); - virtual void multimesh_set_aabb(RID p_multimesh,const AABB& p_aabb); - virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); - virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); + 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>& ) - virtual RID multimesh_get_mesh(RID p_multimesh) const; - virtual AABB multimesh_get_aabb(RID p_multimesh,const AABB& p_aabb) const; - virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; - virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const; + BIND2(mesh_set_blend_shape_count,RID,int) + BIND1RC(int,mesh_get_blend_shape_count,RID) - virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); - virtual int multimesh_get_visible_instances(RID p_multimesh) const; - /* IMMEDIATE API */ + BIND2(mesh_set_blend_shape_mode,RID,BlendShapeMode) + BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode,RID ) - virtual RID immediate_create(); - virtual void immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture=RID()); - virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); - virtual void immediate_normal(RID p_immediate,const Vector3& p_normal); - virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent); - virtual void immediate_color(RID p_immediate,const Color& p_color); - virtual void immediate_uv(RID p_immediate, const Vector2& p_uv); - virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv); - virtual void immediate_end(RID p_immediate); - virtual void immediate_clear(RID p_immediate); - virtual void immediate_set_material(RID p_immediate,RID p_material); - virtual RID immediate_get_material(RID p_immediate) const; + BIND3(mesh_surface_set_material,RID, int , RID ) + BIND2RC(RID,mesh_surface_get_material,RID, int ) + BIND2RC(int,mesh_surface_get_array_len,RID,int) + BIND2RC(int,mesh_surface_get_array_index_len,RID,int) - /* PARTICLES API */ + BIND2RC(PoolVector<uint8_t>,mesh_surface_get_array,RID,int) + BIND2RC(PoolVector<uint8_t>,mesh_surface_get_index_array,RID, int) - virtual RID particles_create(); + BIND2RC(uint32_t,mesh_surface_get_format,RID,int) + BIND2RC(PrimitiveType,mesh_surface_get_primitive_type,RID,int) - virtual void particles_set_amount(RID p_particles, int p_amount); - virtual int particles_get_amount(RID p_particles) const; + BIND2RC(Rect3,mesh_surface_get_aabb,RID,int) + BIND2RC(Vector<PoolVector<uint8_t> >,mesh_surface_get_blend_shapes,RID,int) + BIND2RC(Vector<Rect3>,mesh_surface_get_skeleton_aabb,RID,int) - virtual void particles_set_emitting(RID p_particles, bool p_emitting); - virtual bool particles_is_emitting(RID p_particles) const; + BIND2(mesh_remove_surface,RID,int) + BIND1RC(int,mesh_get_surface_count,RID) - virtual void particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility); - virtual AABB particles_get_visibility_aabb(RID p_particles) const; + BIND2(mesh_set_custom_aabb,RID,const Rect3&) + BIND1RC(Rect3,mesh_get_custom_aabb,RID) - virtual void particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents); - virtual Vector3 particles_get_emission_half_extents(RID p_particles) const; + BIND1(mesh_clear,RID) - virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity); - virtual Vector3 particles_get_emission_base_velocity(RID p_particles) const; - - virtual void particles_set_emission_points(RID p_particles, const DVector<Vector3>& p_points); - virtual DVector<Vector3> particles_get_emission_points(RID p_particles) const; - - virtual void particles_set_gravity_normal(RID p_particles, const Vector3& p_normal); - virtual Vector3 particles_get_gravity_normal(RID p_particles) const; + /* MULTIMESH API */ - virtual void particles_set_variable(RID p_particles, ParticleVariable p_variable,float p_value); - virtual float particles_get_variable(RID p_particles, ParticleVariable p_variable) const; - virtual void particles_set_randomness(RID p_particles, ParticleVariable p_variable,float p_randomness); - virtual float particles_get_randomness(RID p_particles, ParticleVariable p_variable) const; + BIND0R(RID,multimesh_create) - virtual void particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos); - virtual float particles_get_color_phase_pos(RID p_particles, int p_phase) const; + BIND4(multimesh_allocate,RID,int,MultimeshTransformFormat,MultimeshColorFormat) + BIND1RC(int,multimesh_get_instance_count,RID) - virtual void particles_set_color_phases(RID p_particles, int p_phases); - virtual int particles_get_color_phases(RID p_particles) const; + BIND2(multimesh_set_mesh,RID,RID) + BIND3(multimesh_instance_set_transform,RID,int,const Transform&) + BIND3(multimesh_instance_set_transform_2d,RID,int,const Transform2D& ) + BIND3(multimesh_instance_set_color,RID,int,const Color&) - virtual void particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_color); - virtual Color particles_get_color_phase_color(RID p_particles, int p_phase) const; + BIND1RC(RID,multimesh_get_mesh,RID) + BIND1RC(Rect3,multimesh_get_aabb,RID) - virtual void particles_set_attractors(RID p_particles, int p_attractors); - virtual int particles_get_attractors(RID p_particles) const; + BIND2RC(Transform,multimesh_instance_get_transform,RID,int ) + BIND2RC(Transform2D,multimesh_instance_get_transform_2d,RID,int) + BIND2RC(Color,multimesh_instance_get_color,RID,int) - virtual void particles_set_attractor_pos(RID p_particles, int p_attractor, const Vector3& p_pos); - virtual Vector3 particles_get_attractor_pos(RID p_particles,int p_attractor) const; + BIND2(multimesh_set_visible_instances,RID,int) + BIND1RC(int,multimesh_get_visible_instances,RID) - virtual void particles_set_attractor_strength(RID p_particles, int p_attractor, float p_force); - virtual float particles_get_attractor_strength(RID p_particles,int p_attractor) const; - virtual void particles_set_material(RID p_particles, RID p_material,bool p_owned=false); - virtual RID particles_get_material(RID p_particles) const; + /* IMMEDIATE API */ - virtual void particles_set_height_from_velocity(RID p_particles, bool p_enable); - virtual bool particles_has_height_from_velocity(RID p_particles) const; + BIND0R(RID,immediate_create) + BIND3(immediate_begin,RID,PrimitiveType,RID) + BIND2(immediate_vertex,RID,const Vector3&) + BIND2(immediate_normal,RID,const Vector3&) + BIND2(immediate_tangent,RID,const Plane&) + BIND2(immediate_color,RID,const Color&) + BIND2(immediate_uv,RID,const Vector2& ) + BIND2(immediate_uv2,RID,const Vector2&) + BIND1(immediate_end,RID) + BIND1(immediate_clear,RID) + BIND2(immediate_set_material,RID ,RID ) + BIND1RC(RID,immediate_get_material,RID) - virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable); - virtual bool particles_is_using_local_coordinates(RID p_particles) const; + /* SKELETON API */ + BIND0R(RID,skeleton_create) + BIND3(skeleton_allocate,RID,int,bool) + BIND1RC(int,skeleton_get_bone_count,RID) + BIND3(skeleton_bone_set_transform,RID,int,const Transform&) + BIND2RC(Transform,skeleton_bone_get_transform,RID,int) + BIND3(skeleton_bone_set_transform_2d,RID,int, const Transform2D& ) + BIND2RC(Transform2D,skeleton_bone_get_transform_2d,RID,int) /* Light API */ - virtual RID light_create(LightType p_type); - virtual LightType light_get_type(RID p_light) const; - - virtual void light_set_color(RID p_light,LightColor p_type, const Color& p_color); - virtual Color light_get_color(RID p_light,LightColor p_type) const; - + BIND1R(RID,light_create,LightType) - virtual void light_set_shadow(RID p_light,bool p_enabled); - virtual bool light_has_shadow(RID p_light) const; + BIND2(light_set_color,RID,const Color&) + BIND3(light_set_param,RID ,LightParam ,float ) + BIND2(light_set_shadow,RID ,bool ) + BIND2(light_set_shadow_color,RID ,const Color& ) + BIND2(light_set_projector,RID,RID ) + BIND2(light_set_negative,RID,bool ) + BIND2(light_set_cull_mask,RID ,uint32_t ) - virtual void light_set_volumetric(RID p_light,bool p_enabled); - virtual bool light_is_volumetric(RID p_light) const; + BIND2(light_omni_set_shadow_mode,RID,LightOmniShadowMode) + BIND2(light_omni_set_shadow_detail,RID,LightOmniShadowDetail) - virtual void light_set_projector(RID p_light,RID p_texture); - virtual RID light_get_projector(RID p_light) const; + BIND2(light_directional_set_shadow_mode,RID,LightDirectionalShadowMode) + BIND2(light_directional_set_blend_splits,RID,bool) - virtual void light_set_param(RID p_light, LightParam p_var, float p_value); - virtual float light_get_param(RID p_light, LightParam p_var) const; + /* PROBE API */ - virtual void light_set_operator(RID p_light,LightOp p_op); - virtual LightOp light_get_operator(RID p_light) const; + BIND0R(RID,reflection_probe_create) - virtual void light_omni_set_shadow_mode(RID p_light,LightOmniShadowMode p_mode); - virtual LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) const; - - virtual void light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode); - virtual LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) const; - virtual void light_directional_set_shadow_param(RID p_light,LightDirectionalShadowParam p_param, float p_value); - virtual float light_directional_get_shadow_param(RID p_light,LightDirectionalShadowParam p_param) const; - - - /* SKELETON API */ - - virtual RID skeleton_create(); - virtual void skeleton_resize(RID p_skeleton,int p_bones); - virtual int skeleton_get_bone_count(RID p_skeleton) const; - virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); + BIND2(reflection_probe_set_update_mode,RID, ReflectionProbeUpdateMode ) + BIND2(reflection_probe_set_intensity,RID, float ) + BIND2(reflection_probe_set_interior_ambient,RID, const Color& ) + BIND2(reflection_probe_set_interior_ambient_energy,RID, float ) + BIND2(reflection_probe_set_interior_ambient_probe_contribution,RID, float ) + BIND2(reflection_probe_set_max_distance,RID, float ) + BIND2(reflection_probe_set_extents,RID, const Vector3& ) + BIND2(reflection_probe_set_origin_offset,RID, const Vector3& ) + BIND2(reflection_probe_set_as_interior,RID, bool ) + BIND2(reflection_probe_set_enable_box_projection,RID, bool ) + BIND2(reflection_probe_set_enable_shadows,RID, bool ) + BIND2(reflection_probe_set_cull_mask,RID, uint32_t ) /* ROOM API */ - virtual RID room_create(); - virtual void room_set_bounds(RID p_room, const BSP_Tree& p_bounds); - virtual BSP_Tree room_get_bounds(RID p_room) const; + BIND0R(RID,room_create) + BIND4(room_add_bounds,RID, const PoolVector<Vector2>& ,float ,const Transform& ) + BIND1(room_clear_bounds,RID) /* PORTAL API */ - virtual RID portal_create(); - virtual void portal_set_shape(RID p_portal, const Vector<Point2>& p_shape); - virtual Vector<Point2> portal_get_shape(RID p_portal) const; - virtual void portal_set_enabled(RID p_portal, bool p_enabled); - virtual bool portal_is_enabled(RID p_portal) const; - virtual void portal_set_disable_distance(RID p_portal, float p_distance); - virtual float portal_get_disable_distance(RID p_portal) const; - virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); - virtual Color portal_get_disabled_color(RID p_portal) const; - virtual void portal_set_connect_range(RID p_portal, float p_range); - virtual float portal_get_connect_range(RID p_portal) const; + // portals are only (x/y) points, forming a convex shape, which its clockwise + // order points outside. (z is 0); - /* BAKED LIGHT */ + BIND0R(RID,portal_create) + BIND2(portal_set_shape,RID , const Vector<Point2>& ) + BIND2(portal_set_enabled,RID , bool ) + BIND2(portal_set_disable_distance,RID , float ) + BIND2(portal_set_disabled_color,RID , const Color& ) - virtual RID baked_light_create(); + /* BAKED LIGHT API */ - virtual void baked_light_set_mode(RID p_baked_light,BakedLightMode p_mode); - virtual BakedLightMode baked_light_get_mode(RID p_baked_light) const; + BIND0R(RID, gi_probe_create) - virtual void baked_light_set_octree(RID p_baked_light,const DVector<uint8_t> p_octree); - virtual DVector<uint8_t> baked_light_get_octree(RID p_baked_light) const; + BIND2(gi_probe_set_bounds,RID,const Rect3&) + BIND1RC(Rect3,gi_probe_get_bounds,RID) - virtual void baked_light_set_light(RID p_baked_light,const DVector<uint8_t> p_light); - virtual DVector<uint8_t> baked_light_get_light(RID p_baked_light) const; + BIND2(gi_probe_set_cell_size,RID,float) + BIND1RC(float,gi_probe_get_cell_size,RID) - virtual void baked_light_set_sampler_octree(RID p_baked_light,const DVector<int> &p_sampler); - virtual DVector<int> baked_light_get_sampler_octree(RID p_baked_light) const; + BIND2(gi_probe_set_to_cell_xform,RID,const Transform&) + BIND1RC(Transform,gi_probe_get_to_cell_xform,RID) - virtual void baked_light_set_lightmap_multiplier(RID p_baked_light,float p_multiplier); - virtual float baked_light_get_lightmap_multiplier(RID p_baked_light) const; + BIND2(gi_probe_set_dynamic_range,RID,int) + BIND1RC(int,gi_probe_get_dynamic_range,RID) - virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id); - virtual void baked_light_clear_lightmaps(RID p_baked_light); + BIND2(gi_probe_set_energy,RID,float) + BIND1RC(float,gi_probe_get_energy,RID) - virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled); - virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const; + BIND2(gi_probe_set_interior,RID,bool) + BIND1RC(bool,gi_probe_is_interior,RID) - virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color); - virtual Color baked_light_get_realtime_color(RID p_baked_light) const; + BIND2(gi_probe_set_compress,RID,bool) + BIND1RC(bool,gi_probe_is_compressed,RID) - virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy); - virtual float baked_light_get_realtime_energy(RID p_baked_light) const; + BIND2(gi_probe_set_dynamic_data,RID,const PoolVector<int>& ) + BIND1RC( PoolVector<int>,gi_probe_get_dynamic_data,RID) - /* BAKED LIGHT SAMPLER */ + /* PARTICLES */ - virtual RID baked_light_sampler_create(); + BIND0R(RID, particles_create) - virtual void baked_light_sampler_set_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param,float p_value); - virtual float baked_light_sampler_get_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param) const; + BIND2(particles_set_emitting,RID,bool) + BIND2(particles_set_amount,RID,int ) + BIND2(particles_set_lifetime,RID,float ) + BIND2(particles_set_pre_process_time,RID,float ) + BIND2(particles_set_explosiveness_ratio,RID,float ) + BIND2(particles_set_randomness_ratio,RID,float ) + BIND2(particles_set_custom_aabb,RID,const Rect3& ) + BIND2(particles_set_gravity,RID,const Vector3& ) + BIND2(particles_set_use_local_coordinates,RID,bool ) + BIND2(particles_set_process_material,RID,RID ) - virtual void baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution); - virtual int baked_light_sampler_get_resolution(RID p_baked_light_sampler) const; + BIND2(particles_set_emission_shape,RID,VS::ParticlesEmissionShape ) + BIND2(particles_set_emission_sphere_radius,RID,float ) + BIND2(particles_set_emission_box_extents,RID,const Vector3& ) + BIND2(particles_set_emission_points,RID,const PoolVector<Vector3>& ) - /* CAMERA API */ - virtual RID camera_create(); - virtual void camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far); - virtual void camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far); - virtual void camera_set_transform(RID p_camera,const Transform& p_transform); + BIND2(particles_set_draw_order,RID,VS::ParticlesDrawOrder ) - virtual void camera_set_visible_layers(RID p_camera,uint32_t p_layers); - virtual uint32_t camera_get_visible_layers(RID p_camera) const; + BIND2(particles_set_draw_passes,RID,int ) + BIND3(particles_set_draw_pass_material,RID,int , RID ) + BIND3(particles_set_draw_pass_mesh,RID,int , RID ) - virtual void camera_set_environment(RID p_camera,RID p_env); - virtual RID camera_get_environment(RID p_camera) const; + BIND1R(Rect3,particles_get_current_aabb,RID); - virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable); - virtual bool camera_is_using_vertical_aspect(RID p_camera,bool p_enable) const; - /* VIEWPORT API */ +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::scene - virtual RID viewport_create(); - - virtual void viewport_attach_to_screen(RID p_viewport,int p_screen=0); - virtual void viewport_detach(RID p_viewport); + /* CAMERA API */ - virtual void viewport_set_as_render_target(RID p_viewport,bool p_enable); - virtual void viewport_set_render_target_update_mode(RID p_viewport,RenderTargetUpdateMode p_mode); - virtual RenderTargetUpdateMode viewport_get_render_target_update_mode(RID p_viewport) const; - virtual RID viewport_get_render_target_texture(RID p_viewport) const; - virtual void viewport_set_render_target_vflip(RID p_viewport,bool p_enable); - virtual bool viewport_get_render_target_vflip(RID p_viewport) const; - virtual void viewport_set_render_target_clear_on_new_frame(RID p_viewport,bool p_enable); - virtual bool viewport_get_render_target_clear_on_new_frame(RID p_viewport) const; - virtual void viewport_render_target_clear(RID p_viewport); - virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect); + BIND0R(RID, camera_create) + BIND4(camera_set_perspective,RID,float, float , float ) + BIND4(camera_set_orthogonal,RID,float , float , float ) + BIND2(camera_set_transform,RID,const Transform&) + BIND2(camera_set_cull_mask,RID,uint32_t ) + BIND2(camera_set_environment,RID ,RID ) + BIND2(camera_set_use_vertical_aspect,RID,bool) - virtual void viewport_queue_screen_capture(RID p_viewport); - virtual Image viewport_get_screen_capture(RID p_viewport) const; +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::viewport - virtual void viewport_set_rect(RID p_viewport,const ViewportRect& p_rect); - virtual ViewportRect viewport_get_rect(RID p_viewport) const; + /* VIEWPORT TARGET API */ - virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide); - virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide); - virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable); - virtual void viewport_attach_camera(RID p_viewport,RID p_camera); - virtual void viewport_set_scenario(RID p_viewport,RID p_scenario); + BIND0R(RID,viewport_create) - virtual RID viewport_get_attached_camera(RID p_viewport) const; - virtual RID viewport_get_scenario(RID p_viewport) const; - virtual void viewport_attach_canvas(RID p_viewport,RID p_canvas); - virtual void viewport_remove_canvas(RID p_viewport,RID p_canvas); - virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset); - virtual Matrix32 viewport_get_canvas_transform(RID p_viewport,RID p_canvas) const; - virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform); - virtual Matrix32 viewport_get_global_canvas_transform(RID p_viewport) const; - virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer); - virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled); - virtual bool viewport_has_transparent_background(RID p_viewport) const; + BIND3(viewport_set_size,RID,int ,int ) + BIND2(viewport_set_active,RID ,bool ) + BIND2(viewport_set_parent_viewport,RID,RID) - /* ENVIRONMENT API */ + BIND2(viewport_set_clear_mode,RID,ViewportClearMode ) - virtual RID environment_create(); + BIND3(viewport_attach_to_screen,RID ,const Rect2& ,int ) + BIND1(viewport_detach,RID) - virtual void environment_set_background(RID p_env,EnvironmentBG p_bg); - virtual EnvironmentBG environment_get_background(RID p_env) const; + BIND2(viewport_set_update_mode,RID,ViewportUpdateMode ) + BIND2(viewport_set_vflip,RID,bool) - virtual void environment_set_background_param(RID p_env,EnvironmentBGParam p_param, const Variant& p_value); - virtual Variant environment_get_background_param(RID p_env,EnvironmentBGParam p_param) const; - virtual void environment_set_enable_fx(RID p_env,EnvironmentFx p_effect,bool p_enabled); - virtual bool environment_is_fx_enabled(RID p_env,EnvironmentFx p_effect) const; + BIND1RC(RID,viewport_get_texture,RID ) + BIND2(viewport_set_hide_scenario,RID,bool ) + BIND2(viewport_set_hide_canvas,RID,bool ) + BIND2(viewport_set_disable_environment,RID,bool ) + BIND2(viewport_set_disable_3d,RID,bool ) - virtual void environment_fx_set_param(RID p_env,EnvironmentFxParam p_effect,const Variant& p_param); - virtual Variant environment_fx_get_param(RID p_env,EnvironmentFxParam p_effect) const; + BIND2(viewport_attach_camera,RID,RID ) + BIND2(viewport_set_scenario,RID,RID ) + BIND2(viewport_attach_canvas,RID,RID ) + BIND2(viewport_remove_canvas,RID,RID ) + BIND3(viewport_set_canvas_transform,RID ,RID ,const Transform2D& ) + BIND2(viewport_set_transparent_background,RID ,bool ) - /* SCENARIO API */ + BIND2(viewport_set_global_canvas_transform,RID,const Transform2D& ) + BIND3(viewport_set_canvas_layer,RID ,RID ,int ) + BIND2(viewport_set_shadow_atlas_size,RID ,int ) + BIND3(viewport_set_shadow_atlas_quadrant_subdivision,RID ,int, int ) + BIND2(viewport_set_msaa,RID ,ViewportMSAA ) + BIND2(viewport_set_hdr,RID ,bool ) - virtual RID scenario_create(); - virtual void scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode); - virtual void scenario_set_environment(RID p_scenario, RID p_environment); - virtual RID scenario_get_environment(RID p_scenario, RID p_environment) const; - virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment); + /* ENVIRONMENT API */ +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::scene_render + BIND0R(RID,environment_create) - /* INSTANCING API */ + BIND2(environment_set_background,RID ,EnvironmentBG ) + BIND2(environment_set_skybox,RID,RID ) + BIND2(environment_set_skybox_scale,RID,float) + BIND2(environment_set_bg_color,RID,const Color& ) + BIND2(environment_set_bg_energy,RID,float ) + BIND2(environment_set_canvas_max_layer,RID,int ) + BIND4(environment_set_ambient_light,RID,const Color& ,float,float ) + BIND8(environment_set_ssr,RID,bool,int,float,float,float,bool,bool ) + BIND10(environment_set_ssao,RID ,bool , float , float , float,float,float , float ,const Color &,bool ) - virtual RID instance_create(); - virtual void instance_set_base(RID p_instance, RID p_base); - virtual RID instance_get_base(RID p_instance) const; - virtual void instance_set_scenario(RID p_instance, RID p_scenario); - virtual RID instance_get_scenario(RID p_instance) const; + BIND6(environment_set_dof_blur_near,RID,bool ,float,float,float,EnvironmentDOFBlurQuality) + BIND6(environment_set_dof_blur_far,RID,bool ,float,float,float,EnvironmentDOFBlurQuality) + BIND10(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode,float,float,bool ) + BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) - virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask); - virtual uint32_t instance_get_layer_mask(RID p_instance) const; + BIND9(environment_set_tonemap,RID,EnvironmentToneMapper, float ,float ,bool, float ,float ,float,float ) - virtual AABB instance_get_base_aabb(RID p_instance) const; + BIND6(environment_set_adjustment,RID,bool ,float ,float ,float ,RID ) - virtual void instance_attach_object_instance_ID(RID p_instance,uint32_t p_ID); - virtual uint32_t instance_get_object_instance_ID(RID p_instance) const; - virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton); - virtual RID instance_get_skeleton(RID p_instance) const; + /* SCENARIO API */ - virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); - virtual float instance_get_morph_target_weight(RID p_instance,int p_shape) const; - virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); +#undef BINDBASE +#define BINDBASE VSG::scene + BIND0R(RID,scenario_create) - virtual void instance_set_transform(RID p_instance, const Transform& p_transform); - virtual Transform instance_get_transform(RID p_instance) const; + BIND2(scenario_set_debug,RID,ScenarioDebugMode ) + BIND2(scenario_set_environment,RID, RID ) + BIND3(scenario_set_reflection_atlas_size,RID, int,int ) + BIND2(scenario_set_fallback_environment,RID, RID ) - virtual void instance_set_exterior( RID p_instance, bool p_enabled ); - virtual bool instance_is_exterior( RID p_instance) const; - virtual void instance_set_room( RID p_instance, RID p_room ); - virtual RID instance_get_room( RID p_instance ) const ; + /* INSTANCING API */ + // from can be mesh, light, area and portal so far. + BIND0R(RID,instance_create) - virtual void instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ); - virtual real_t instance_get_extra_visibility_margin( RID p_instance ) const; + BIND2(instance_set_base,RID, RID ) // from can be mesh, light, poly, area and portal so far. + BIND2(instance_set_scenario,RID, RID ) // from can be mesh, light, poly, area and portal so far. + BIND2(instance_set_layer_mask,RID, uint32_t ) + BIND2(instance_set_transform,RID, const Transform& ) + BIND2(instance_attach_object_instance_ID,RID,ObjectID ) + BIND3(instance_set_blend_shape_weight,RID,int , float ) + BIND3(instance_set_surface_material,RID,int , RID ) + BIND2(instance_set_visible,RID ,bool) - virtual Vector<RID> instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const; - virtual Vector<RID> instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const; - virtual Vector<RID> instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario=RID()) const; - virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled); - virtual bool instance_geometry_get_flag(RID p_instance,InstanceFlags p_flags) const; + BIND2(instance_attach_skeleton,RID,RID ) + BIND2(instance_set_exterior, RID, bool ) + BIND2(instance_set_room, RID, RID ) - virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting); - virtual VS::ShadowCastingSetting instance_geometry_get_cast_shadows_setting(RID p_instance) const; + BIND2(instance_set_extra_visibility_margin, RID, real_t ) - virtual void instance_geometry_set_material_override(RID p_instance, RID p_material); - virtual RID instance_geometry_get_material_override(RID p_instance) const; + // don't use these in a game! + BIND2RC(Vector<ObjectID>,instances_cull_aabb,const Rect3& , RID) + BIND3RC(Vector<ObjectID>,instances_cull_ray,const Vector3& , const Vector3& , RID ) + BIND2RC(Vector<ObjectID>,instances_cull_convex,const Vector<Plane>& , RID) - virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max); - virtual float instance_geometry_get_draw_range_max(RID p_instance) const; - virtual float instance_geometry_get_draw_range_min(RID p_instance) const; - virtual void instance_geometry_set_baked_light(RID p_instance,RID p_baked_light); - virtual RID instance_geometry_get_baked_light(RID p_instance) const; + BIND3(instance_geometry_set_flag,RID,InstanceFlags ,bool ) + BIND2(instance_geometry_set_cast_shadows_setting,RID, ShadowCastingSetting ) + BIND2(instance_geometry_set_material_override,RID, RID ) - virtual void instance_geometry_set_baked_light_sampler(RID p_instance,RID p_baked_light_sampler); - virtual RID instance_geometry_get_baked_light_sampler(RID p_instance) const; - virtual void instance_geometry_set_baked_light_texture_index(RID p_instance,int p_tex_id); - virtual int instance_geometry_get_baked_light_texture_index(RID p_instance) const; + BIND5(instance_geometry_set_draw_range,RID,float ,float ,float ,float ) + BIND2(instance_geometry_set_as_instance_lod,RID,RID ) - virtual void instance_light_set_enabled(RID p_instance,bool p_enabled); - virtual bool instance_light_is_enabled(RID p_instance) const; +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::canvas /* CANVAS (2D) */ - virtual RID canvas_create(); - virtual void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring); - virtual Point2 canvas_get_item_mirroring(RID p_canvas,RID p_item) const; - virtual void canvas_set_modulate(RID p_canvas,const Color& p_color); - - - virtual RID canvas_item_create(); + BIND0R(RID,canvas_create) + BIND3(canvas_set_item_mirroring,RID ,RID ,const Point2& ) + BIND2(canvas_set_modulate,RID,const Color&) - virtual void canvas_item_set_parent(RID p_item,RID p_parent_item); - virtual RID canvas_item_get_parent(RID p_canvas_item) const; - virtual void canvas_item_set_visible(RID p_item,bool p_visible); - virtual bool canvas_item_is_visible(RID p_item) const; + BIND0R(RID,canvas_item_create) + BIND2(canvas_item_set_parent,RID ,RID) - virtual void canvas_item_set_blend_mode(RID p_canvas_item,MaterialBlendMode p_blend); - virtual void canvas_item_set_light_mask(RID p_canvas_item,int p_mask); + BIND2(canvas_item_set_visible,RID,bool ) + BIND2(canvas_item_set_light_mask,RID,int ) + BIND2(canvas_item_set_transform,RID, const Transform2D& ) + BIND2(canvas_item_set_clip,RID, bool ) + BIND2(canvas_item_set_distance_field_mode,RID, bool ) + BIND3(canvas_item_set_custom_rect,RID, bool ,const Rect2& ) + BIND2(canvas_item_set_modulate,RID, const Color& ) + BIND2(canvas_item_set_self_modulate,RID, const Color& ) + BIND2(canvas_item_set_draw_behind_parent,RID, bool ) - //virtual void canvas_item_set_rect(RID p_item, const Rect2& p_rect); - virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform); - virtual void canvas_item_set_clip(RID p_item, bool p_clip); - virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable); - virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2()); - virtual void canvas_item_set_opacity(RID p_item, float p_opacity); - virtual float canvas_item_get_opacity(RID p_item, float p_opacity) const; - virtual void canvas_item_set_on_top(RID p_item, bool p_on_top); - virtual bool canvas_item_is_on_top(RID p_item) const; - virtual void canvas_item_set_self_opacity(RID p_item, float p_self_opacity); - virtual float canvas_item_get_self_opacity(RID p_item, float p_self_opacity) const; + BIND6(canvas_item_add_line,RID, const Point2& , const Point2& ,const Color& ,float ,bool ) + BIND3(canvas_item_add_rect,RID, const Rect2& , const Color& ) + BIND4(canvas_item_add_circle,RID, const Point2& , float ,const Color& ) + BIND6(canvas_item_add_texture_rect,RID, const Rect2& , RID ,bool ,const Color& ,bool ) + BIND6(canvas_item_add_texture_rect_region,RID, const Rect2& , RID ,const Rect2& ,const Color& ,bool ) + BIND10(canvas_item_add_nine_patch,RID, const Rect2& , const Rect2& , RID ,const Vector2& , const Vector2& ,NinePatchAxisMode , NinePatchAxisMode,bool ,const Color& ) + BIND6(canvas_item_add_primitive,RID, const Vector<Point2>& , const Vector<Color>& ,const Vector<Point2>& , RID ,float ) + BIND5(canvas_item_add_polygon,RID, const Vector<Point2>& , const Vector<Color>& ,const Vector<Point2>& , RID ) + BIND7(canvas_item_add_triangle_array,RID, const Vector<int>& , const Vector<Point2>& , const Vector<Color>& ,const Vector<Point2>& , RID , int) + BIND3(canvas_item_add_mesh,RID, const RID& ,RID ) + BIND3(canvas_item_add_multimesh,RID, RID ,RID ) + BIND2(canvas_item_add_set_transform,RID,const Transform2D& ) + BIND2(canvas_item_add_clip_ignore,RID, bool ) + BIND2(canvas_item_set_sort_children_by_y,RID, bool ) + BIND2(canvas_item_set_z,RID, int ) + BIND2(canvas_item_set_z_as_relative_to_parent,RID, bool ) + BIND3(canvas_item_set_copy_to_backbuffer,RID, bool ,const Rect2& ) - virtual void canvas_item_attach_viewport(RID p_item, RID p_viewport); + BIND1(canvas_item_clear,RID ) + BIND2(canvas_item_set_draw_index,RID,int) - virtual void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to, const Color& p_color, float p_width=1.0, bool p_antialiased=false); - virtual void canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color); - virtual void canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color); - virtual void canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile=false,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); - virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); - virtual void canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright, bool p_draw_center=true,const Color& p_modulate=Color(1,1,1)); - virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs, RID p_texture,float p_width=1.0); - virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs=Vector<Point2>(), RID p_texture=RID()); - virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int>& p_indices, const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs=Vector<Point2>(), RID p_texture=RID(), int p_count=-1); - virtual void canvas_item_add_triangle_array_ptr(RID p_item, int p_count, const int* p_indices, const Point2* p_points, const Color* p_colors,const Point2* p_uvs=NULL, RID p_texture=RID()); - virtual void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform); - virtual void canvas_item_add_set_blend_mode(RID p_item, MaterialBlendMode p_blend); - virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); - virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable); - virtual void canvas_item_set_z(RID p_item, int p_z); - virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable); - virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect); + BIND2(canvas_item_set_material,RID, RID ) - virtual void canvas_item_set_material(RID p_item, RID p_material); - virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable); + BIND2(canvas_item_set_use_parent_material,RID, bool ) - virtual RID canvas_light_create(); - virtual void canvas_light_attach_to_canvas(RID p_light,RID p_canvas); - virtual void canvas_light_set_enabled(RID p_light, bool p_enabled); - virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform); - virtual void canvas_light_set_scale(RID p_light, float p_scale); - virtual void canvas_light_set_texture(RID p_light, RID p_texture); - virtual void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset); - virtual void canvas_light_set_color(RID p_light, const Color& p_color); - virtual void canvas_light_set_height(RID p_light, float p_height); - virtual void canvas_light_set_energy(RID p_light, float p_energy); - virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z); - virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer); - virtual void canvas_light_set_item_mask(RID p_light, int p_mask); - virtual void canvas_light_set_item_shadow_mask(RID p_light, int p_mask); - virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode); - virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled); - virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size); - virtual void canvas_light_set_shadow_esm_multiplier(RID p_light, float p_multiplier); - virtual void canvas_light_set_shadow_color(RID p_light, const Color& p_color); + BIND0R(RID,canvas_light_create) + BIND2(canvas_light_attach_to_canvas,RID,RID ) + BIND2(canvas_light_set_enabled,RID, bool ) + BIND2(canvas_light_set_scale,RID, float ) + BIND2(canvas_light_set_transform,RID, const Transform2D& ) + BIND2(canvas_light_set_texture,RID, RID ) + BIND2(canvas_light_set_texture_offset,RID, const Vector2& ) + BIND2(canvas_light_set_color,RID, const Color& ) + BIND2(canvas_light_set_height,RID, float ) + BIND2(canvas_light_set_energy,RID, float ) + BIND3(canvas_light_set_z_range,RID, int ,int ) + BIND3(canvas_light_set_layer_range,RID, int ,int ) + BIND2(canvas_light_set_item_cull_mask,RID, int ) + BIND2(canvas_light_set_item_shadow_cull_mask,RID, int ) + BIND2(canvas_light_set_mode,RID, CanvasLightMode ) + BIND2(canvas_light_set_shadow_enabled,RID, bool ) + BIND2(canvas_light_set_shadow_buffer_size,RID, int ) + BIND2(canvas_light_set_shadow_gradient_length,RID, float ) + BIND2(canvas_light_set_shadow_filter,RID, CanvasLightShadowFilter ) + BIND2(canvas_light_set_shadow_color,RID, const Color& ) - virtual RID canvas_light_occluder_create(); - virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas); - virtual void canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled); - virtual void canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon); - virtual void canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform); - virtual void canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask); - virtual RID canvas_occluder_polygon_create(); - virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector<Vector2>& p_shape,bool p_close); - virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector<Vector2>& p_shape); - virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode); + BIND0R(RID,canvas_light_occluder_create) + BIND2(canvas_light_occluder_attach_to_canvas,RID,RID ) + BIND2(canvas_light_occluder_set_enabled,RID,bool ) + BIND2(canvas_light_occluder_set_polygon,RID,RID ) + BIND2(canvas_light_occluder_set_transform,RID,const Transform2D& ) + BIND2(canvas_light_occluder_set_light_mask,RID,int ) + BIND0R(RID,canvas_occluder_polygon_create) + BIND3(canvas_occluder_polygon_set_shape,RID,const PoolVector<Vector2>& ,bool) + BIND2(canvas_occluder_polygon_set_shape_as_lines,RID ,const PoolVector<Vector2>&) - virtual void canvas_item_clear(RID p_item); - virtual void canvas_item_raise(RID p_item); - - /* CANVAS ITEM MATERIAL */ - - virtual RID canvas_item_material_create(); - virtual void canvas_item_material_set_shader(RID p_material, RID p_shader); - virtual void canvas_item_material_set_shader_param(RID p_material, const StringName& p_param, const Variant& p_value); - virtual Variant canvas_item_material_get_shader_param(RID p_material, const StringName& p_param) const; - virtual void canvas_item_material_set_shading_mode(RID p_material, CanvasItemShadingMode p_mode); + BIND2(canvas_occluder_polygon_set_cull_mode,RID,CanvasOccluderPolygonCullMode) /* CURSOR */ virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0); // radians - virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset, int p_cursor=0, const Rect2 &p_region=Rect2()); + virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset = Point2(0, 0), int p_cursor=0, const Rect2 &p_region=Rect2()); virtual void cursor_set_visible(bool p_visible, int p_cursor = 0); virtual void cursor_set_pos(const Point2& p_pos, int p_cursor = 0); /* BLACK BARS */ + virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom); virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom); - /* FREE */ - - virtual void free( RID p_rid ); - /* CUSTOM SHADE MODEL */ + /* FREE */ - virtual void custom_shade_model_set_shader(int p_model, RID p_shader); - virtual RID custom_shade_model_get_shader(int p_model) const; - virtual void custom_shade_model_set_name(int p_model, const String& p_name); - virtual String custom_shade_model_get_name(int p_model) const; - virtual void custom_shade_model_set_param_info(int p_model, const List<PropertyInfo>& p_info); - virtual void custom_shade_model_get_param_info(int p_model, List<PropertyInfo>* p_info) const; + virtual void free( RID p_rid ); ///< free RIDs associated with the visual server /* EVENT QUEUING */ virtual void draw(); virtual void sync(); - + virtual bool has_changed() const; virtual void init(); virtual void finish(); - virtual bool has_changed() const; + /* STATUS INFORMATION */ - /* RENDER INFO */ virtual int get_render_info(RenderInfo p_info); - virtual bool has_feature(Features p_feature) const; - RID get_test_cube(); + virtual RID get_test_cube(); - virtual void set_boot_image(const Image& p_image, const Color& p_color, bool p_scale); + + /* TESTING */ + + virtual void set_boot_image(const Image& p_image, const Color& p_color,bool p_scale); virtual void set_default_clear_color(const Color& p_color); - virtual Color get_default_clear_color() const; - VisualServerRaster(Rasterizer *p_rasterizer); + virtual bool has_feature(Features p_feature) const; + + + VisualServerRaster(); ~VisualServerRaster(); +#undef DISPLAY_CHANGED + +#undef BIND0R +#undef BIND1RC +#undef BIND2RC +#undef BIND3RC +#undef BIND4RC + +#undef BIND1 +#undef BIND2 +#undef BIND3 +#undef BIND4 +#undef BIND5 +#undef BIND6 +#undef BIND7 +#undef BIND8 +#undef BIND9 +#undef BIND10 + }; #endif |