summaryrefslogtreecommitdiff
path: root/servers/visual_server.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-10-03 16:33:42 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-10-03 21:35:16 +0200
commit22d83bc9f655d5ae7a1b49709c4c1b663725daf5 (patch)
treea817195c08d4713a70ca014a3f63f5937934fe36 /servers/visual_server.h
parent78d97b060a6873a454e710380cb9ef1bde5e4c65 (diff)
Begining of GLES3 renderer:
-Most 2D drawing is implemented -Missing shaders -Missing all 3D -Editor needs to be set on update always to be used, otherwise it does not refresh -Large parts of editor not working
Diffstat (limited to 'servers/visual_server.h')
-rw-r--r--servers/visual_server.h758
1 files changed, 175 insertions, 583 deletions
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 2f3d8371f6..918b0b102e 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -50,8 +50,6 @@ class VisualServer : public Object {
DVector<String> _shader_get_param_list(RID p_shader) const;
void _camera_set_orthogonal(RID p_camera,float p_size,float p_z_near,float p_z_far);
- void _viewport_set_rect(RID p_viewport,const Rect2& p_rect);
- Rect2 _viewport_get_rect(RID p_viewport) const;
void _canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector<float>& p_margins, const Color& p_modulate=Color(1,1,1));
protected:
RID _make_test_cube();
@@ -68,26 +66,12 @@ public:
static VisualServer *get_singleton();
static VisualServer *create();
- enum MipMapPolicy {
-
- MIPMAPS_ENABLED,
- MIPMAPS_ENABLED_FOR_PO2,
- MIPMAPS_DISABLED
- };
-
-
- virtual void set_mipmap_policy(MipMapPolicy p_policy);
- virtual MipMapPolicy get_mipmap_policy() const;
-
enum {
NO_INDEX_ARRAY=-1,
- CUSTOM_ARRAY_SIZE=8,
ARRAY_WEIGHTS_SIZE=4,
- MAX_PARTICLE_COLOR_PHASES=4,
- MAX_PARTICLE_ATTRACTORS=4,
CANVAS_ITEM_Z_MIN=-4096,
CANVAS_ITEM_Z_MAX=4096,
@@ -106,7 +90,7 @@ public:
TEXTURE_FLAG_CONVERT_TO_LINEAR=16,
TEXTURE_FLAG_MIRRORED_REPEAT=32, /// Repeat texture, with alternate sections mirrored
TEXTURE_FLAG_CUBEMAP=2048,
- TEXTURE_FLAG_VIDEO_SURFACE=4096,
+ TEXTURE_FLAG_USED_FOR_STREAMING=4096,
TEXTURE_FLAGS_DEFAULT=TEXTURE_FLAG_REPEAT|TEXTURE_FLAG_MIPMAPS|TEXTURE_FLAG_FILTER
};
@@ -132,8 +116,6 @@ public:
virtual uint32_t texture_get_width(RID p_texture) const=0;
virtual uint32_t texture_get_height(RID p_texture) const=0;
virtual void texture_set_size_override(RID p_texture,int p_width, int p_height)=0;
- virtual bool texture_can_stream(RID p_texture) const=0;
- virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const=0;
virtual void texture_set_path(RID p_texture,const String& p_path)=0;
virtual String texture_get_path(RID p_texture) const=0;
@@ -155,21 +137,19 @@ public:
enum ShaderMode {
- SHADER_MATERIAL,
+ SHADER_SPATIAL,
SHADER_CANVAS_ITEM,
- SHADER_POST_PROCESS,
+ SHADER_LIGHT,
};
- virtual RID shader_create(ShaderMode p_mode=SHADER_MATERIAL)=0;
+ virtual RID shader_create(ShaderMode p_mode=SHADER_SPATIAL)=0;
virtual void shader_set_mode(RID p_shader,ShaderMode p_mode)=0;
virtual ShaderMode shader_get_mode(RID p_shader) const=0;
- 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)=0;
- virtual String shader_get_fragment_code(RID p_shader) const=0;
- virtual String shader_get_vertex_code(RID p_shader) const=0;
- virtual String shader_get_light_code(RID p_shader) const=0;
+ virtual void shader_set_code(RID p_shader, const String& p_code)=0;
+ virtual String shader_get_code(RID p_shader) const=0;
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const=0;
virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture)=0;
@@ -186,114 +166,6 @@ public:
virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0;
virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0;
- enum MaterialFlag {
- MATERIAL_FLAG_VISIBLE,
- MATERIAL_FLAG_DOUBLE_SIDED,
- MATERIAL_FLAG_INVERT_FACES, ///< Invert front/back of the object
- MATERIAL_FLAG_UNSHADED,
- MATERIAL_FLAG_ONTOP,
- MATERIAL_FLAG_LIGHTMAP_ON_UV2,
- MATERIAL_FLAG_COLOR_ARRAY_SRGB,
- MATERIAL_FLAG_MAX,
- };
-
- virtual void material_set_flag(RID p_material, MaterialFlag p_flag,bool p_enabled)=0;
- virtual bool material_get_flag(RID p_material,MaterialFlag p_flag) const=0;
-
- enum MaterialDepthDrawMode {
- MATERIAL_DEPTH_DRAW_ALWAYS,
- MATERIAL_DEPTH_DRAW_OPAQUE_ONLY,
- MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA,
- MATERIAL_DEPTH_DRAW_NEVER
- };
-
- virtual void material_set_depth_draw_mode(RID p_material, MaterialDepthDrawMode p_mode)=0;
- virtual MaterialDepthDrawMode material_get_depth_draw_mode(RID p_material) const=0;
-
- enum MaterialBlendMode {
- MATERIAL_BLEND_MODE_MIX, //default
- MATERIAL_BLEND_MODE_ADD,
- MATERIAL_BLEND_MODE_SUB,
- MATERIAL_BLEND_MODE_MUL,
- MATERIAL_BLEND_MODE_PREMULT_ALPHA
- };
-
-
- virtual void material_set_blend_mode(RID p_material,MaterialBlendMode p_mode)=0;
- virtual MaterialBlendMode material_get_blend_mode(RID p_material) const=0;
-
- virtual void material_set_line_width(RID p_material,float p_line_width)=0;
- virtual float material_get_line_width(RID p_material) const=0;
-
-
- //fixed material api
-
- virtual RID fixed_material_create()=0;
-
- enum FixedMaterialParam {
-
- FIXED_MATERIAL_PARAM_DIFFUSE,
- FIXED_MATERIAL_PARAM_DETAIL,
- FIXED_MATERIAL_PARAM_SPECULAR,
- FIXED_MATERIAL_PARAM_EMISSION,
- FIXED_MATERIAL_PARAM_SPECULAR_EXP,
- FIXED_MATERIAL_PARAM_GLOW,
- FIXED_MATERIAL_PARAM_NORMAL,
- FIXED_MATERIAL_PARAM_SHADE_PARAM,
- FIXED_MATERIAL_PARAM_MAX
- };
-
- enum FixedMaterialTexCoordMode {
-
- FIXED_MATERIAL_TEXCOORD_UV,
- FIXED_MATERIAL_TEXCOORD_UV_TRANSFORM,
- FIXED_MATERIAL_TEXCOORD_UV2,
- FIXED_MATERIAL_TEXCOORD_SPHERE
- };
-
- enum FixedMaterialFlags {
-
- FIXED_MATERIAL_FLAG_USE_ALPHA,
- FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,
- FIXED_MATERIAL_FLAG_USE_POINT_SIZE,
- FIXED_MATERIAL_FLAG_DISCARD_ALPHA,
- FIXED_MATERIAL_FLAG_USE_XY_NORMALMAP,
- FIXED_MATERIAL_FLAG_MAX,
- };
-
-
- virtual void fixed_material_set_flag(RID p_material, FixedMaterialFlags p_flag, bool p_enabled)=0;
- virtual bool fixed_material_get_flag(RID p_material, FixedMaterialFlags p_flag) const=0;
-
- virtual void fixed_material_set_param(RID p_material, FixedMaterialParam p_parameter, const Variant& p_value)=0;
- virtual Variant fixed_material_get_param(RID p_material,FixedMaterialParam p_parameter) const=0;
-
- virtual void fixed_material_set_texture(RID p_material,FixedMaterialParam p_parameter, RID p_texture)=0;
- virtual RID fixed_material_get_texture(RID p_material,FixedMaterialParam p_parameter) const=0;
-
-
- enum FixedMaterialLightShader {
-
- FIXED_MATERIAL_LIGHT_SHADER_LAMBERT,
- FIXED_MATERIAL_LIGHT_SHADER_WRAP,
- FIXED_MATERIAL_LIGHT_SHADER_VELVET,
- FIXED_MATERIAL_LIGHT_SHADER_TOON,
-
- };
-
-
- virtual void fixed_material_set_light_shader(RID p_material,FixedMaterialLightShader p_shader)=0;
- virtual FixedMaterialLightShader fixed_material_get_light_shader(RID p_material) const=0;
-
- virtual void fixed_material_set_texcoord_mode(RID p_material,FixedMaterialParam p_parameter, FixedMaterialTexCoordMode p_mode)=0;
- virtual FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,FixedMaterialParam p_parameter) const=0;
-
- virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform)=0;
- virtual Transform fixed_material_get_uv_transform(RID p_material) const=0;
-
- virtual void fixed_material_set_point_size(RID p_material,float p_size)=0;
- virtual float fixed_material_get_point_size(RID p_material) const=0;
-
/* MESH API */
enum ArrayType {
@@ -321,8 +193,25 @@ public:
ARRAY_FORMAT_BONES=1<<ARRAY_BONES,
ARRAY_FORMAT_WEIGHTS=1<<ARRAY_WEIGHTS,
ARRAY_FORMAT_INDEX=1<<ARRAY_INDEX,
+
+ ARRAY_COMPRESS_BASE=(ARRAY_INDEX+1),
+ ARRAY_COMPRESS_VERTEX=1<<(ARRAY_VERTEX+ARRAY_COMPRESS_BASE), // mandatory
+ ARRAY_COMPRESS_NORMAL=1<<(ARRAY_NORMAL+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_TANGENT=1<<(ARRAY_TANGENT+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_COLOR=1<<(ARRAY_COLOR+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_TEX_UV=1<<(ARRAY_TEX_UV+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_TEX_UV2=1<<(ARRAY_TEX_UV2+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_BONES=1<<(ARRAY_BONES+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_WEIGHTS=1<<(ARRAY_WEIGHTS+ARRAY_COMPRESS_BASE),
+ ARRAY_COMPRESS_INDEX=1<<(ARRAY_INDEX+ARRAY_COMPRESS_BASE),
+
+ ARRAY_FLAG_USE_2D_VERTICES=ARRAY_COMPRESS_INDEX<<1,
+
+ ARRAY_COMPRESS_DEFAULT=ARRAY_COMPRESS_VERTEX|ARRAY_COMPRESS_NORMAL|ARRAY_COMPRESS_TANGENT|ARRAY_COMPRESS_COLOR|ARRAY_COMPRESS_TEX_UV|ARRAY_COMPRESS_TEX_UV2|ARRAY_COMPRESS_BONES|ARRAY_COMPRESS_WEIGHTS|ARRAY_COMPRESS_INDEX
+
};
+
enum PrimitiveType {
PRIMITIVE_POINTS=0,
PRIMITIVE_LINES=1,
@@ -336,12 +225,10 @@ public:
virtual RID mesh_create()=0;
- 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)=0;
- virtual Array mesh_get_surface_arrays(RID p_mesh,int p_surface) const=0;
- virtual Array mesh_get_surface_morph_arrays(RID p_mesh,int p_surface) const=0;
+ virtual void mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),uint32_t p_compress_format=ARRAY_COMPRESS_DEFAULT);
+ virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const Vector<DVector<uint8_t> >& p_blend_shapes=Vector<DVector<uint8_t> >())=0;
- virtual void mesh_add_custom_surface(RID p_mesh,const Variant& p_dat)=0; //this is used by each platform in a different way
virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0;
virtual int mesh_get_morph_target_count(RID p_mesh) const=0;
@@ -353,11 +240,16 @@ public:
virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode)=0;
virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0;
- virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned=false)=0;
+ virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0;
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0;
virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const=0;
virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const=0;
+
+ virtual DVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const=0;
+ virtual DVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0;
+
+
virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0;
virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0;
@@ -371,30 +263,47 @@ public:
/* MULTIMESH API */
+
virtual RID multimesh_create()=0;
- virtual void multimesh_set_instance_count(RID p_multimesh,int p_count)=0;
+ enum MultimeshTransformFormat {
+ MULTIMESH_TRANSFORM_NONE,
+ MULTIMESH_TRANSFORM_2D,
+ MULTIMESH_TRANSFORM_3D,
+ };
+
+ enum MultimeshColorFormat {
+ MULTIMESH_COLOR_NONE,
+ MULTIMESH_COLOR_8BIT,
+ MULTIMESH_COLOR_FLOAT,
+ };
+
+ virtual void multimesh_allocate(RID p_multimesh,int p_instances,MultimeshTransformFormat p_transform_format,MultimeshColorFormat p_color_format,bool p_gen_aabb=true)=0;
virtual int multimesh_get_instance_count(RID p_multimesh) const=0;
virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh)=0;
- virtual void multimesh_set_aabb(RID p_multimesh,const AABB& p_aabb)=0;
+ virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb)=0;
virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform)=0;
+ virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform)=0;
virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0;
virtual RID multimesh_get_mesh(RID p_multimesh) const=0;
- virtual AABB multimesh_get_aabb(RID p_multimesh,const AABB& p_aabb) const=0;;
+ virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const=0;
virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0;
+ virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0;
virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const=0;
virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible)=0;
virtual int multimesh_get_visible_instances(RID p_multimesh) const=0;
+
/* IMMEDIATE API */
virtual RID immediate_create()=0;
virtual void immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture=RID())=0;
virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex)=0;
+ virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex)=0;
virtual void immediate_normal(RID p_immediate,const Vector3& p_normal)=0;
virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent)=0;
virtual void immediate_color(RID p_immediate,const Color& p_color)=0;
@@ -405,82 +314,15 @@ public:
virtual void immediate_set_material(RID p_immediate,RID p_material)=0;
virtual RID immediate_get_material(RID p_immediate) const=0;
+ /* SKELETON API */
- /* PARTICLES API */
-
- virtual RID particles_create()=0;
-
- enum ParticleVariable {
- PARTICLE_LIFETIME,
- PARTICLE_SPREAD,
- PARTICLE_GRAVITY,
- PARTICLE_LINEAR_VELOCITY,
- PARTICLE_ANGULAR_VELOCITY,
- PARTICLE_LINEAR_ACCELERATION,
- PARTICLE_RADIAL_ACCELERATION,
- PARTICLE_TANGENTIAL_ACCELERATION,
- PARTICLE_DAMPING,
- PARTICLE_INITIAL_SIZE,
- PARTICLE_FINAL_SIZE,
- PARTICLE_INITIAL_ANGLE,
- PARTICLE_HEIGHT,
- PARTICLE_HEIGHT_SPEED_SCALE,
- PARTICLE_VAR_MAX
- };
-
- virtual void particles_set_amount(RID p_particles, int p_amount)=0;
- virtual int particles_get_amount(RID p_particles) const=0;
-
- virtual void particles_set_emitting(RID p_particles, bool p_emitting)=0;
- virtual bool particles_is_emitting(RID p_particles) const=0;
-
- virtual void particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility)=0;
- virtual AABB particles_get_visibility_aabb(RID p_particles) const=0;
-
- virtual void particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents)=0;
- virtual Vector3 particles_get_emission_half_extents(RID p_particles) const=0;
-
- virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity)=0;
- virtual Vector3 particles_get_emission_base_velocity(RID p_particles) const=0;
-
- virtual void particles_set_emission_points(RID p_particles, const DVector<Vector3>& p_points)=0;
- virtual DVector<Vector3> particles_get_emission_points(RID p_particles) const=0;
-
- virtual void particles_set_gravity_normal(RID p_particles, const Vector3& p_normal)=0;
- virtual Vector3 particles_get_gravity_normal(RID p_particles) const=0;
-
- virtual void particles_set_variable(RID p_particles, ParticleVariable p_variable,float p_value)=0;
- virtual float particles_get_variable(RID p_particles, ParticleVariable p_variable) const=0;
-
- virtual void particles_set_randomness(RID p_particles, ParticleVariable p_variable,float p_randomness)=0;
- virtual float particles_get_randomness(RID p_particles, ParticleVariable p_variable) const=0;
-
- virtual void particles_set_color_phases(RID p_particles, int p_phases)=0;
- virtual int particles_get_color_phases(RID p_particles) const=0;
-
- virtual void particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos)=0;
- virtual float particles_get_color_phase_pos(RID p_particles, int p_phase) const=0;
-
- virtual void particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_color)=0;
- virtual Color particles_get_color_phase_color(RID p_particles, int p_phase) const=0;
-
- virtual void particles_set_attractors(RID p_particles, int p_attractors)=0;
- virtual int particles_get_attractors(RID p_particles) const=0;
-
- virtual void particles_set_attractor_pos(RID p_particles, int p_attractor, const Vector3& p_pos)=0;
- virtual Vector3 particles_get_attractor_pos(RID p_particles,int p_attractor) const=0;
-
- virtual void particles_set_attractor_strength(RID p_particles, int p_attractor, float p_force)=0;
- virtual float particles_get_attractor_strength(RID p_particles,int p_attractor) const=0;
-
- virtual void particles_set_material(RID p_particles, RID p_material,bool p_owned=false)=0;
- virtual RID particles_get_material(RID p_particles) const=0;
-
- virtual void particles_set_height_from_velocity(RID p_particles, bool p_enable)=0;
- virtual bool particles_has_height_from_velocity(RID p_particles) const=0;
-
- virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable)=0;
- virtual bool particles_is_using_local_coordinates(RID p_particles) const=0;
+ virtual RID skeleton_create()=0;
+ virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false)=0;
+ virtual int skeleton_get_bone_count(RID p_skeleton) const=0;
+ virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0;
+ virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0;
+ virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0;
+ virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)=0;
/* Light API */
@@ -490,62 +332,36 @@ public:
LIGHT_SPOT
};
- enum LightColor {
- LIGHT_COLOR_DIFFUSE,
- LIGHT_COLOR_SPECULAR
- };
-
enum LightParam {
- LIGHT_PARAM_SPOT_ATTENUATION,
- LIGHT_PARAM_SPOT_ANGLE,
- LIGHT_PARAM_RADIUS,
LIGHT_PARAM_ENERGY,
- LIGHT_PARAM_ATTENUATION,
- LIGHT_PARAM_SHADOW_DARKENING,
- LIGHT_PARAM_SHADOW_Z_OFFSET,
- LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE,
- LIGHT_PARAM_SHADOW_ESM_MULTIPLIER,
- LIGHT_PARAM_SHADOW_BLUR_PASSES,
+ LIGHT_PARAM_SPECULAR,
+ LIGHT_PARAM_RANGE,
+ LIGHT_PARAM_SPOT_ANGLE,
+ LIGHT_PARAM_SHADOW_MAX_DISTANCE,
+ LIGHT_PARAM_SHADOW_DARKNESS,
+ LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
+ LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
+ LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
+ LIGHT_PARAM_SHADOW_SPLIT_4_OFFSET,
+ LIGHT_PARAM_SHADOW_NORMAL_BIAS,
+ LIGHT_PARAM_SHADOW_BIAS_1,
+ LIGHT_PARAM_SHADOW_BIAS_2,
+ LIGHT_PARAM_SHADOW_BIAS_3,
+ LIGHT_PARAM_SHADOW_BIAS_4,
LIGHT_PARAM_MAX
};
virtual RID light_create(LightType p_type)=0;
- virtual LightType light_get_type(RID p_light) const=0;
-
- virtual void light_set_color(RID p_light,LightColor p_type, const Color& p_color)=0;
- virtual Color light_get_color(RID p_light,LightColor p_type) const=0;
+ virtual void light_set_color(RID p_light,const Color& p_color)=0;
+ virtual void light_set_param(RID p_light,LightParam p_param,float p_value)=0;
virtual void light_set_shadow(RID p_light,bool p_enabled)=0;
- virtual bool light_has_shadow(RID p_light) const=0;
-
- virtual void light_set_volumetric(RID p_light,bool p_enabled)=0;
- virtual bool light_is_volumetric(RID p_light) const=0;
-
virtual void light_set_projector(RID p_light,RID p_texture)=0;
- virtual RID light_get_projector(RID p_light) const=0;
-
- virtual void light_set_param(RID p_light, LightParam p_var, float p_value)=0;
- virtual float light_get_param(RID p_light, LightParam p_var) const=0;
-
- enum LightOp {
-
- LIGHT_OPERATOR_ADD,
- LIGHT_OPERATOR_SUB
- };
-
- virtual void light_set_operator(RID p_light,LightOp p_op)=0;
- virtual LightOp light_get_operator(RID p_light) const=0;
-
- // omni light
- enum LightOmniShadowMode {
- LIGHT_OMNI_SHADOW_DEFAULT,
- LIGHT_OMNI_SHADOW_DUAL_PARABOLOID,
- LIGHT_OMNI_SHADOW_CUBEMAP
- };
-
- virtual void light_omni_set_shadow_mode(RID p_light,LightOmniShadowMode p_mode)=0;
- virtual LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) const=0;
+ virtual void light_set_attenuation_texure(RID p_light,RID p_texture)=0;
+ virtual void light_set_negative(RID p_light,bool p_enable)=0;
+ virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0;
+ virtual void light_set_shader(RID p_light,RID p_shader)=0;
// directional light
enum LightDirectionalShadowMode {
@@ -556,33 +372,27 @@ public:
};
virtual void light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode)=0;
- virtual LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) const=0;
-
- enum LightDirectionalShadowParam {
-
- LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE,
- LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_SPLIT_WEIGHT,
- LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_ZOFFSET_SCALE,
- };
- virtual void light_directional_set_shadow_param(RID p_light,LightDirectionalShadowParam p_param, float p_value)=0;
- virtual float light_directional_get_shadow_param(RID p_light,LightDirectionalShadowParam p_param) const=0;
+ /* PROBE API */
- //@TODO fallof model and all that stuff
+ virtual RID reflection_probe_create()=0;
- /* SKELETON API */
+ virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity)=0;
+ virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far)=0;
+ virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance)=0;
+ virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents)=0;
+ virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset)=0;
+ virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable)=0;
+ virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution)=0;
+ virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide)=0;
+ virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers)=0;
- virtual RID skeleton_create()=0;
- virtual void skeleton_resize(RID p_skeleton,int p_bones)=0;
- virtual int skeleton_get_bone_count(RID p_skeleton) const=0;
- virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0;
- virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0;
/* ROOM API */
virtual RID room_create()=0;
- virtual void room_set_bounds(RID p_room, const BSP_Tree& p_bounds)=0;
- virtual BSP_Tree room_get_bounds(RID p_room) const=0;
+ virtual void room_add_bounds(RID p_room, const DVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform)=0;
+ virtual void room_clear_bounds()=0;
/* PORTAL API */
@@ -591,144 +401,55 @@ public:
virtual RID portal_create()=0;
virtual void portal_set_shape(RID p_portal, const Vector<Point2>& p_shape)=0;
- virtual Vector<Point2> portal_get_shape(RID p_portal) const=0;
virtual void portal_set_enabled(RID p_portal, bool p_enabled)=0;
- virtual bool portal_is_enabled(RID p_portal) const=0;
virtual void portal_set_disable_distance(RID p_portal, float p_distance)=0;
- virtual float portal_get_disable_distance(RID p_portal) const=0;
virtual void portal_set_disabled_color(RID p_portal, const Color& p_color)=0;
- virtual Color portal_get_disabled_color(RID p_portal) const=0;
- virtual void portal_set_connect_range(RID p_portal, float p_range) =0;
- virtual float portal_get_connect_range(RID p_portal) const =0;
-
/* BAKED LIGHT API */
- virtual RID baked_light_create()=0;
- enum BakedLightMode {
- BAKED_LIGHT_OCTREE,
- BAKED_LIGHT_LIGHTMAPS
- };
-
- virtual void baked_light_set_mode(RID p_baked_light,BakedLightMode p_mode)=0;
- virtual BakedLightMode baked_light_get_mode(RID p_baked_light) const=0;
-
- virtual void baked_light_set_octree(RID p_baked_light,const DVector<uint8_t> p_octree)=0;
- virtual DVector<uint8_t> baked_light_get_octree(RID p_baked_light) const=0;
-
- virtual void baked_light_set_light(RID p_baked_light,const DVector<uint8_t> p_light)=0;
- virtual DVector<uint8_t> baked_light_get_light(RID p_baked_light) const=0;
-
- virtual void baked_light_set_sampler_octree(RID p_baked_light,const DVector<int> &p_sampler)=0;
- virtual DVector<int> baked_light_get_sampler_octree(RID p_baked_light) const=0;
-
- virtual void baked_light_set_lightmap_multiplier(RID p_baked_light,float p_multiplier)=0;
- virtual float baked_light_get_lightmap_multiplier(RID p_baked_light) const=0;
-
- virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id)=0;
- virtual void baked_light_clear_lightmaps(RID p_baked_light)=0;
-
- virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled)=0;
- virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const=0;
-
- virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color)=0;
- virtual Color baked_light_get_realtime_color(RID p_baked_light) const=0;
-
- virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy) = 0;
- virtual float baked_light_get_realtime_energy(RID p_baked_light) const = 0;
-
- /* BAKED LIGHT SAMPLER */
-
- virtual RID baked_light_sampler_create()=0;
-
- enum BakedLightSamplerParam {
- BAKED_LIGHT_SAMPLER_RADIUS,
- BAKED_LIGHT_SAMPLER_STRENGTH,
- BAKED_LIGHT_SAMPLER_ATTENUATION,
- BAKED_LIGHT_SAMPLER_DETAIL_RATIO,
- BAKED_LIGHT_SAMPLER_MAX
- };
-
- virtual void baked_light_sampler_set_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param,float p_value)=0;
- virtual float baked_light_sampler_get_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param) const=0;
-
- virtual void baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution)=0;
- virtual int baked_light_sampler_get_resolution(RID p_baked_light_sampler) const=0;
-
/* CAMERA API */
virtual RID camera_create()=0;
virtual void camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far)=0;
virtual void camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far)=0;
virtual void camera_set_transform(RID p_camera,const Transform& p_transform)=0;
-
- virtual void camera_set_visible_layers(RID p_camera,uint32_t p_layers)=0;
- virtual uint32_t camera_get_visible_layers(RID p_camera) const=0;
-
+ virtual void camera_set_cull_mask(RID p_camera,uint32_t p_layers)=0;
virtual void camera_set_environment(RID p_camera,RID p_env)=0;
- virtual RID camera_get_environment(RID p_camera) const=0;
-
virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable)=0;
- virtual bool camera_is_using_vertical_aspect(RID p_camera,bool p_enable) const=0;
-/*
- virtual void camera_add_layer(RID p_camera);
- virtual void camera_layer_move_up(RID p_camera,int p_layer);
- virtual void camera_layer_move_down(RID p_camera,int p_layer);
- virtual void camera_layer_set_mask(RID p_camera,int p_layer,int p_mask);
- virtual int camera_layer_get_mask(RID p_camera,int p_layer) const;
- enum CameraLayerFlag {
-
- FLAG_CLEAR_DEPTH,
- FLAG_CLEAR_COLOR,
- FLAG_IGNORE_FOG,
- };
- virtual void camera_layer_set_flag(RID p_camera,int p_layer,bool p_enable);
- virtual bool camera_layer_get_flag(RID p_camera,int p_layer) const;
-
-*/
-
-
- /* VIEWPORT API */
+ /* VIEWPORT TARGET API */
virtual RID viewport_create()=0;
- virtual void viewport_attach_to_screen(RID p_viewport,int p_screen=0)=0;
+ virtual void viewport_set_size(RID p_viewport,int p_width,int p_height)=0;
+ virtual void viewport_set_active(RID p_viewport,bool p_active)=0;
+
+ virtual void viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect=Rect2(),int p_screen=0)=0;
virtual void viewport_detach(RID p_viewport)=0;
- virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect)=0;
- enum RenderTargetUpdateMode {
- RENDER_TARGET_UPDATE_DISABLED,
- RENDER_TARGET_UPDATE_ONCE, //then goes to disabled
- RENDER_TARGET_UPDATE_WHEN_VISIBLE, // default
- RENDER_TARGET_UPDATE_ALWAYS
+ enum ViewportUpdateMode {
+ VIEWPORT_UPDATE_DISABLED,
+ VIEWPORT_UPDATE_ONCE, //then goes to disabled, must be manually updated
+ VIEWPORT_UPDATE_WHEN_VISIBLE, // default
+ VIEWPORT_UPDATE_ALWAYS
};
- virtual void viewport_set_as_render_target(RID p_viewport,bool p_enable)=0;
- virtual void viewport_set_render_target_update_mode(RID p_viewport,RenderTargetUpdateMode p_mode)=0;
- virtual RenderTargetUpdateMode viewport_get_render_target_update_mode(RID p_viewport) const=0;
- virtual RID viewport_get_render_target_texture(RID p_viewport) const=0;
- virtual void viewport_set_render_target_vflip(RID p_viewport,bool p_enable)=0;
- virtual bool viewport_get_render_target_vflip(RID p_viewport) const=0;
- virtual void viewport_set_render_target_clear_on_new_frame(RID p_viewport,bool p_enable)=0;
- virtual bool viewport_get_render_target_clear_on_new_frame(RID p_viewport) const=0;
- virtual void viewport_render_target_clear(RID p_viewport)=0;
-
- virtual void viewport_queue_screen_capture(RID p_viewport)=0;
- virtual Image viewport_get_screen_capture(RID p_viewport) const=0;
-
+ virtual void viewport_set_update_mode(RID p_viewport,ViewportUpdateMode p_mode)=0;
+ virtual void viewport_set_vflip(RID p_viewport,bool p_enable)=0;
+ enum ViewportClearMode {
- struct ViewportRect {
-
- int x,y,width,height;
- ViewportRect() { x=y=width=height=0; }
+ VIEWPORT_CLEAR_ALWAYS,
+ VIWEPORT_CLEAR_NEVER,
+ VIEWPORT_CLEAR_ONLY_NEXT_FRAME
};
- virtual void viewport_set_rect(RID p_viewport,const ViewportRect& p_rect)=0;
- virtual ViewportRect viewport_get_rect(RID p_viewport) const=0;
+ virtual void viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode)=0;
+
+ virtual RID viewport_get_texture(RID p_viewport) const=0;
+ virtual Image viewport_capture(RID p_viewport) const=0;
virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide)=0;
virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide)=0;
@@ -736,22 +457,15 @@ public:
virtual void viewport_attach_camera(RID p_viewport,RID p_camera)=0;
virtual void viewport_set_scenario(RID p_viewport,RID p_scenario)=0;
- virtual RID viewport_get_attached_camera(RID p_viewport) const=0;
- virtual RID viewport_get_scenario(RID p_viewport) const=0;
virtual void viewport_attach_canvas(RID p_viewport,RID p_canvas)=0;
virtual void viewport_remove_canvas(RID p_viewport,RID p_canvas)=0;
virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset)=0;
- virtual Matrix32 viewport_get_canvas_transform(RID p_viewport,RID p_canvas) const=0;
virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled)=0;
- virtual bool viewport_has_transparent_background(RID p_viewport) const=0;
-
virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform)=0;
- virtual Matrix32 viewport_get_global_canvas_transform(RID p_viewport) const=0;
virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer)=0;
-
/* ENVIRONMENT API */
virtual RID environment_create()=0;
@@ -759,103 +473,48 @@ public:
enum EnvironmentBG {
ENV_BG_KEEP,
- ENV_BG_DEFAULT_COLOR,
ENV_BG_COLOR,
- ENV_BG_TEXTURE,
- ENV_BG_CUBEMAP,
+ ENV_BG_SKYBOX,
ENV_BG_CANVAS,
ENV_BG_MAX
};
virtual void environment_set_background(RID p_env,EnvironmentBG p_bg)=0;
- virtual EnvironmentBG environment_get_background(RID p_env) const=0;
-
- enum EnvironmentBGParam {
-
- ENV_BG_PARAM_CANVAS_MAX_LAYER,
- ENV_BG_PARAM_COLOR,
- ENV_BG_PARAM_TEXTURE,
- ENV_BG_PARAM_CUBEMAP,
- ENV_BG_PARAM_ENERGY,
- ENV_BG_PARAM_SCALE,
- ENV_BG_PARAM_GLOW,
- ENV_BG_PARAM_MAX
- };
+ virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0)=0;
+ virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0;
+ virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0;
+ virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0)=0;
+ //set default SSAO options
+ //set default SSR options
+ //set default SSSSS options
- virtual void environment_set_background_param(RID p_env,EnvironmentBGParam p_param, const Variant& p_value)=0;
- virtual Variant environment_get_background_param(RID p_env,EnvironmentBGParam p_param) const=0;
-
- enum EnvironmentFx {
- ENV_FX_AMBIENT_LIGHT,
- ENV_FX_FXAA,
- ENV_FX_GLOW,
- ENV_FX_DOF_BLUR,
- ENV_FX_HDR,
- ENV_FX_FOG,
- ENV_FX_BCS,
- ENV_FX_SRGB,
- ENV_FX_MAX
- };
-
-
-
- virtual void environment_set_enable_fx(RID p_env,EnvironmentFx p_effect,bool p_enabled)=0;
- virtual bool environment_is_fx_enabled(RID p_env,EnvironmentFx p_mode) const=0;
-
- enum EnvironmentFxBlurBlendMode {
- ENV_FX_BLUR_BLEND_MODE_ADDITIVE,
- ENV_FX_BLUR_BLEND_MODE_SCREEN,
- ENV_FX_BLUR_BLEND_MODE_SOFTLIGHT,
+ enum EnvironmentGlowBlendMode {
+ GLOW_BLEND_MODE_ADDITIVE,
+ GLOW_BLEND_MODE_SCREEN,
+ GLOW_BLEND_MODE_SOFTLIGHT,
+ GLOW_BLEND_MODE_DISABLED,
};
+ virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode)=0;
+ virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0;
- enum EnvironmentFxHDRToneMapper {
- ENV_FX_HDR_TONE_MAPPER_LINEAR,
- ENV_FX_HDR_TONE_MAPPER_LOG,
- ENV_FX_HDR_TONE_MAPPER_REINHARDT,
- ENV_FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE,
- };
- enum EnvironmentFxParam {
- ENV_FX_PARAM_AMBIENT_LIGHT_COLOR,
- ENV_FX_PARAM_AMBIENT_LIGHT_ENERGY,
- ENV_FX_PARAM_GLOW_BLUR_PASSES,
- ENV_FX_PARAM_GLOW_BLUR_SCALE,
- ENV_FX_PARAM_GLOW_BLUR_STRENGTH,
- ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE,
- ENV_FX_PARAM_GLOW_BLOOM,
- ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD,
- ENV_FX_PARAM_DOF_BLUR_PASSES,
- ENV_FX_PARAM_DOF_BLUR_BEGIN,
- ENV_FX_PARAM_DOF_BLUR_RANGE,
- ENV_FX_PARAM_HDR_TONEMAPPER,
- ENV_FX_PARAM_HDR_EXPOSURE,
- ENV_FX_PARAM_HDR_WHITE,
- ENV_FX_PARAM_HDR_GLOW_TRESHOLD,
- ENV_FX_PARAM_HDR_GLOW_SCALE,
- ENV_FX_PARAM_HDR_MIN_LUMINANCE,
- ENV_FX_PARAM_HDR_MAX_LUMINANCE,
- ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED,
- ENV_FX_PARAM_FOG_BEGIN,
- ENV_FX_PARAM_FOG_BEGIN_COLOR,
- ENV_FX_PARAM_FOG_END_COLOR,
- ENV_FX_PARAM_FOG_ATTENUATION,
- ENV_FX_PARAM_FOG_BG,
- ENV_FX_PARAM_BCS_BRIGHTNESS,
- ENV_FX_PARAM_BCS_CONTRAST,
- ENV_FX_PARAM_BCS_SATURATION,
- ENV_FX_PARAM_MAX
+ enum EnvironmentToneMapper {
+ ENV_TONE_MAPPER_LINEAR,
+ ENV_TONE_MAPPER_REINHARDT,
+ ENV_TONE_MAPPER_FILMIC
};
- virtual void environment_fx_set_param(RID p_env,EnvironmentFxParam p_effect,const Variant& p_param)=0;
- virtual Variant environment_fx_get_param(RID p_env,EnvironmentFxParam p_effect) const=0;
+ virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper)=0;
+ virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0;
+ virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0;
+ virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0;
+ virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0;
/* SCENARIO API */
-
-
virtual RID scenario_create()=0;
enum ScenarioDebugMode {
@@ -881,14 +540,14 @@ public:
INSTANCE_MESH,
INSTANCE_MULTIMESH,
INSTANCE_IMMEDIATE,
- INSTANCE_PARTICLES,
INSTANCE_LIGHT,
+ INSTANCE_REFLECTION_PROBE,
INSTANCE_ROOM,
INSTANCE_PORTAL,
- INSTANCE_BAKED_LIGHT,
- INSTANCE_BAKED_LIGHT_SAMPLER,
+ /*INSTANCE_BAKED_LIGHT,
+ INSTANCE_BAKED_LIGHT_SAMPLER,*/
- INSTANCE_GEOMETRY_MASK=(1<<INSTANCE_MESH)|(1<<INSTANCE_MULTIMESH)|(1<<INSTANCE_IMMEDIATE)|(1<<INSTANCE_PARTICLES)
+ INSTANCE_GEOMETRY_MASK=(1<<INSTANCE_MESH)|(1<<INSTANCE_MULTIMESH)|(1<<INSTANCE_IMMEDIATE)
};
@@ -899,51 +558,29 @@ public:
virtual RID instance_create()=0; // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_base(RID p_instance, RID p_base)=0; // from can be mesh, light, poly, area and portal so far.
- virtual RID instance_get_base(RID p_instance) const=0;
-
virtual void instance_set_scenario(RID p_instance, RID p_scenario)=0; // from can be mesh, light, poly, area and portal so far.
- virtual RID instance_get_scenario(RID p_instance) const=0;
-
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask)=0;
- virtual uint32_t instance_get_layer_mask(RID p_instance) const=0;
-
- virtual AABB instance_get_base_aabb(RID p_instance) const=0;
-
virtual void instance_set_transform(RID p_instance, const Transform& p_transform)=0;
- virtual Transform instance_get_transform(RID p_instance) const=0;
-
-
- virtual void instance_attach_object_instance_ID(RID p_instance,uint32_t p_ID)=0;
- virtual uint32_t instance_get_object_instance_ID(RID p_instance) const=0;
-
+ virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID)=0;
virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight)=0;
- virtual float instance_get_morph_target_weight(RID p_instance,int p_shape) const=0;
-
virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material)=0;
virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton)=0;
- virtual RID instance_get_skeleton(RID p_instance) const=0;
-
virtual void instance_set_exterior( RID p_instance, bool p_enabled )=0;
- virtual bool instance_is_exterior( RID p_instance) const=0;
-
virtual void instance_set_room( RID p_instance, RID p_room )=0;
- virtual RID instance_get_room( RID p_instance ) const =0;
virtual void instance_set_extra_visibility_margin( RID p_instance, real_t p_margin )=0;
- virtual real_t instance_get_extra_visibility_margin( RID p_instance ) const =0;
// don't use these in a game!
- virtual Vector<RID> instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const=0;
- virtual Vector<RID> instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const=0;
- virtual Vector<RID> instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario=RID()) const=0;
+ virtual Vector<ObjectID> instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const=0;
+ virtual Vector<ObjectID> instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const=0;
+ virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario=RID()) const=0;
enum InstanceFlags {
INSTANCE_FLAG_VISIBLE,
INSTANCE_FLAG_BILLBOARD,
INSTANCE_FLAG_BILLBOARD_FIX_Y,
INSTANCE_FLAG_CAST_SHADOW,
- INSTANCE_FLAG_RECEIVE_SHADOWS,
INSTANCE_FLAG_DEPH_SCALE,
INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
INSTANCE_FLAG_USE_BAKED_LIGHT,
@@ -958,80 +595,53 @@ public:
};
virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled)=0;
- virtual bool instance_geometry_get_flag(RID p_instance,InstanceFlags p_flags) const=0;
-
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
- virtual ShadowCastingSetting instance_geometry_get_cast_shadows_setting(RID p_instance) const = 0;
-
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material)=0;
- virtual RID instance_geometry_get_material_override(RID p_instance) const=0;
-
- virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max)=0;
- virtual float instance_geometry_get_draw_range_max(RID p_instance) const=0;
- virtual float instance_geometry_get_draw_range_min(RID p_instance) const=0;
-
- virtual void instance_geometry_set_baked_light(RID p_instance,RID p_baked_light)=0;
- virtual RID instance_geometry_get_baked_light(RID p_instance) const=0;
- virtual void instance_geometry_set_baked_light_sampler(RID p_instance,RID p_baked_light_sampler)=0;
- virtual RID instance_geometry_get_baked_light_sampler(RID p_instance) const=0;
- virtual void instance_geometry_set_baked_light_texture_index(RID p_instance,int p_tex_id)=0;
- virtual int instance_geometry_get_baked_light_texture_index(RID p_instance) const=0;
-
-
- virtual void instance_light_set_enabled(RID p_instance,bool p_enabled)=0;
- virtual bool instance_light_is_enabled(RID p_instance) const=0;
+ virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin)=0;
+ virtual void instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance)=0;
/* CANVAS (2D) */
virtual RID canvas_create()=0;
virtual void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring)=0;
- virtual Point2 canvas_get_item_mirroring(RID p_canvas,RID p_item) const=0;
virtual void canvas_set_modulate(RID p_canvas,const Color& p_color)=0;
-
virtual RID canvas_item_create()=0;
virtual void canvas_item_set_parent(RID p_item,RID p_parent)=0;
- virtual RID canvas_item_get_parent(RID p_canvas_item) const=0;
virtual void canvas_item_set_visible(RID p_item,bool p_visible)=0;
- virtual bool canvas_item_is_visible(RID p_item) const=0;
-
virtual void canvas_item_set_light_mask(RID p_item,int p_mask)=0;
- virtual void canvas_item_set_blend_mode(RID p_canvas_item,MaterialBlendMode p_blend)=0;
-
- virtual void canvas_item_attach_viewport(RID p_item, RID p_viewport)=0;
-
- //virtual void canvas_item_set_rect(RID p_item, const Rect2& p_rect)=0;
-
virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform)=0;
virtual void canvas_item_set_clip(RID p_item, bool p_clip)=0;
virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable)=0;
virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2())=0;
- virtual void canvas_item_set_opacity(RID p_item, float p_opacity)=0;
- virtual float canvas_item_get_opacity(RID p_item, float p_opacity) const=0;
+ virtual void canvas_item_set_modulate(RID p_item, const Color& p_color)=0;
+ virtual void canvas_item_set_self_modulate(RID p_item, const Color& p_color)=0;
- virtual void canvas_item_set_self_opacity(RID p_item, float p_self_opacity)=0;
- virtual float canvas_item_get_self_opacity(RID p_item, float p_self_opacity) const=0;
+ virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable)=0;
- virtual void canvas_item_set_on_top(RID p_item, bool p_on_top)=0;
- virtual bool canvas_item_is_on_top(RID p_item) const=0;
+ enum NinePatchAxisMode {
+ NINE_PATCH_STRETCH,
+ NINE_PATCH_TILE,
+ NINE_PATCH_TILE_FIT,
+ };
virtual void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width=1.0,bool p_antialiased=false)=0;
virtual void canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color)=0;
virtual void canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color)=0;
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)=0;
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)=0;
- 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))=0;
+ virtual void canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,NinePatchAxisMode p_x_axis_mode=NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode=NINE_PATCH_STRETCH,bool p_draw_center=true,const Color& p_modulate=Color(1,1,1))=0;
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)=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())=0;
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)=0;
- 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())=0;
+ virtual void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID())=0;
+ virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID())=0;
virtual void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform)=0;
- virtual void canvas_item_add_set_blend_mode(RID p_item, MaterialBlendMode p_blend)=0;
virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore)=0;
virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable)=0;
virtual void canvas_item_set_z(RID p_item, int p_z)=0;
@@ -1039,7 +649,7 @@ public:
virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect)=0;
virtual void canvas_item_clear(RID p_item)=0;
- virtual void canvas_item_raise(RID p_item)=0;
+ virtual void canvas_item_set_draw_index(RID p_item,int p_index)=0;
virtual void canvas_item_set_material(RID p_item, RID p_material)=0;
@@ -1057,8 +667,8 @@ public:
virtual void canvas_light_set_energy(RID p_light, float p_energy)=0;
virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z)=0;
virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer)=0;
- virtual void canvas_light_set_item_mask(RID p_light, int p_mask)=0;
- virtual void canvas_light_set_item_shadow_mask(RID p_light, int p_mask)=0;
+ virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask)=0;
+ virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask)=0;
enum CanvasLightMode {
CANVAS_LIGHT_MODE_ADD,
@@ -1068,9 +678,20 @@ public:
};
virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode)=0;
+
+
+ enum CanvasLightShadowFilter {
+ CANVAS_LIGHT_FILTER_NONE,
+ CANVAS_LIGHT_FILTER_PCF3,
+ CANVAS_LIGHT_FILTER_PCF5,
+ CANVAS_LIGHT_FILTER_PCF9,
+ CANVAS_LIGHT_FILTER_PCF13,
+ };
+
virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled)=0;
virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size)=0;
- virtual void canvas_light_set_shadow_esm_multiplier(RID p_light, float p_multiplier)=0;
+ virtual void canvas_light_set_shadow_gradient_length(RID p_light, float p_length)=0;
+ virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter)=0;
virtual void canvas_light_set_shadow_color(RID p_light, const Color& p_color)=0;
@@ -1085,6 +706,7 @@ public:
virtual RID canvas_occluder_polygon_create()=0;
virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector<Vector2>& p_shape,bool p_closed)=0;
virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector<Vector2>& p_shape)=0;
+
enum CanvasOccluderPolygonCullMode {
CANVAS_OCCLUDER_POLYGON_CULL_DISABLED,
CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE,
@@ -1092,21 +714,6 @@ public:
};
virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode)=0;
- /* CANVAS ITEM MATERIAL */
-
- virtual RID canvas_item_material_create()=0;
- virtual void canvas_item_material_set_shader(RID p_material, RID p_shader)=0;
- virtual void canvas_item_material_set_shader_param(RID p_material, const StringName& p_param, const Variant& p_value)=0;
- virtual Variant canvas_item_material_get_shader_param(RID p_material, const StringName& p_param) const=0;
-
-
- enum CanvasItemShadingMode {
- CANVAS_ITEM_SHADING_NORMAL,
- CANVAS_ITEM_SHADING_UNSHADED,
- CANVAS_ITEM_SHADING_ONLY_LIGHT,
- };
-
- virtual void canvas_item_material_set_shading_mode(RID p_material, CanvasItemShadingMode p_mode)=0;
/* CURSOR */
virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0)=0; // radians
@@ -1125,15 +732,6 @@ public:
virtual void free( RID p_rid )=0; ///< free RIDs associated with the visual server
- /* CUSTOM SHADING */
-
- virtual void custom_shade_model_set_shader(int p_model, RID p_shader)=0;
- virtual RID custom_shade_model_get_shader(int p_model) const=0;
- virtual void custom_shade_model_set_name(int p_model, const String& p_name)=0;
- virtual String custom_shade_model_get_name(int p_model) const=0;
- virtual void custom_shade_model_set_param_info(int p_model, const List<PropertyInfo>& p_info)=0;
- virtual void custom_shade_model_get_param_info(int p_model, List<PropertyInfo>* p_info) const=0;
-
/* EVENT QUEUING */
virtual void draw()=0;
@@ -1166,7 +764,6 @@ public:
RID material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_alpha,bool p_opaque_prepass);
-
/* TESTING */
virtual RID get_test_cube()=0;
@@ -1185,7 +782,6 @@ public:
enum Features {
FEATURE_SHADERS,
FEATURE_MULTITHREADED,
- FEATURE_NEEDS_RELOAD_HOOK,
};
virtual bool has_feature(Features p_feature) const=0;
@@ -1200,19 +796,15 @@ public:
VARIANT_ENUM_CAST( VisualServer::CubeMapSide );
VARIANT_ENUM_CAST( VisualServer::TextureFlags );
VARIANT_ENUM_CAST( VisualServer::ShaderMode );
-VARIANT_ENUM_CAST( VisualServer::MaterialFlag );
-VARIANT_ENUM_CAST( VisualServer::MaterialBlendMode );
-VARIANT_ENUM_CAST( VisualServer::ParticleVariable );
VARIANT_ENUM_CAST( VisualServer::ArrayType );
VARIANT_ENUM_CAST( VisualServer::ArrayFormat );
VARIANT_ENUM_CAST( VisualServer::PrimitiveType );
VARIANT_ENUM_CAST( VisualServer::LightType );
-VARIANT_ENUM_CAST( VisualServer::LightColor );
VARIANT_ENUM_CAST( VisualServer::LightParam );
VARIANT_ENUM_CAST( VisualServer::ScenarioDebugMode );
VARIANT_ENUM_CAST( VisualServer::InstanceType );
VARIANT_ENUM_CAST( VisualServer::RenderInfo );
-VARIANT_ENUM_CAST( VisualServer::MipMapPolicy );
+
//typedef VisualServer VS; // makes it easier to use
#define VS VisualServer