summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_gles2.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2/rasterizer_gles2.h')
-rw-r--r--drivers/gles2/rasterizer_gles2.h894
1 files changed, 427 insertions, 467 deletions
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index ddcd97ec4a..81e137dffd 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -35,14 +35,14 @@
#ifdef GLES2_ENABLED
+#include "camera_matrix.h"
#include "image.h"
-#include "rid.h"
-#include "servers/visual_server.h"
#include "list.h"
#include "map.h"
-#include "camera_matrix.h"
-#include "sort.h"
+#include "rid.h"
#include "self_list.h"
+#include "servers/visual_server.h"
+#include "sort.h"
#include "platform_config.h"
#ifndef GLES2_INCLUDE_H
@@ -51,12 +51,12 @@
#include GLES2_INCLUDE_H
#endif
-#include "drivers/gles2/shaders/material.glsl.h"
+#include "drivers/gles2/shader_compiler_gles2.h"
+#include "drivers/gles2/shaders/blur.glsl.h"
#include "drivers/gles2/shaders/canvas.glsl.h"
#include "drivers/gles2/shaders/canvas_shadow.glsl.h"
-#include "drivers/gles2/shaders/blur.glsl.h"
#include "drivers/gles2/shaders/copy.glsl.h"
-#include "drivers/gles2/shader_compiler_gles2.h"
+#include "drivers/gles2/shaders/material.glsl.h"
#include "servers/visual/particle_system_sw.h"
/**
@@ -66,13 +66,12 @@ class RasterizerGLES2 : public Rasterizer {
enum {
- MAX_SCENE_LIGHTS=2048,
- LIGHT_SPOT_BIT=0x80,
+ MAX_SCENE_LIGHTS = 2048,
+ LIGHT_SPOT_BIT = 0x80,
DEFAULT_SKINNED_BUFFER_SIZE = 2048, // 10k vertices
MAX_HW_LIGHTS = 1,
};
-
uint8_t *skinned_buffer;
int skinned_buffer_size;
bool pvr_supported;
@@ -112,7 +111,7 @@ class RasterizerGLES2 : public Rasterizer {
Vector<float> skel_default;
- Image _get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,GLenum& r_gl_internal_format,int &r_gl_components,bool &r_has_alpha_cache,bool &r_compressed);
+ Image _get_gl_image_and_format(const Image &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, int &r_gl_components, bool &r_has_alpha_cache, bool &r_compressed);
struct RenderTarget;
@@ -120,7 +119,7 @@ class RasterizerGLES2 : public Rasterizer {
String path;
uint32_t flags;
- int width,height;
+ int width, height;
int alloc_width, alloc_height;
Image::Format format;
@@ -149,30 +148,30 @@ class RasterizerGLES2 : public Rasterizer {
Texture() {
- ignore_mipmaps=false;
- render_target=NULL;
- flags=width=height=0;
- tex_id=0;
- data_size=0;
- format=Image::FORMAT_L8;
- gl_components_cache=0;
- format_has_alpha=false;
- has_alpha=false;
- active=false;
- disallow_mipmaps=false;
- compressed=false;
- total_data_size=0;
- target=GL_TEXTURE_2D;
- mipmaps=0;
-
- reloader=0;
+ ignore_mipmaps = false;
+ render_target = NULL;
+ flags = width = height = 0;
+ tex_id = 0;
+ data_size = 0;
+ format = Image::FORMAT_L8;
+ gl_components_cache = 0;
+ format_has_alpha = false;
+ has_alpha = false;
+ active = false;
+ disallow_mipmaps = false;
+ compressed = false;
+ total_data_size = 0;
+ target = GL_TEXTURE_2D;
+ mipmaps = 0;
+
+ reloader = 0;
}
~Texture() {
- if (tex_id!=0) {
+ if (tex_id != 0) {
- glDeleteTextures(1,&tex_id);
+ glDeleteTextures(1, &tex_id);
}
}
};
@@ -192,7 +191,6 @@ class RasterizerGLES2 : public Rasterizer {
uint32_t custom_code_id;
uint32_t version;
-
bool valid;
bool has_alpha;
bool can_zpass;
@@ -204,38 +202,37 @@ class RasterizerGLES2 : public Rasterizer {
bool uses_normal;
bool uses_texpixel_size;
- Map<StringName,ShaderLanguage::Uniform> uniforms;
+ Map<StringName, ShaderLanguage::Uniform> uniforms;
StringName first_texture;
- Map<StringName,RID> default_textures;
+ Map<StringName, RID> default_textures;
SelfList<Shader> dirty_list;
- Shader() : dirty_list(this) {
-
- valid=false;
- custom_code_id=0;
- has_alpha=false;
- version=1;
- vertex_line=0;
- fragment_line=0;
- light_line=0;
- can_zpass=true;
- has_texscreen=false;
- has_screen_uv=false;
- writes_vertex=false;
- uses_discard=false;
- uses_time=false;
- uses_normal=false;
+ Shader()
+ : dirty_list(this) {
+
+ valid = false;
+ custom_code_id = 0;
+ has_alpha = false;
+ version = 1;
+ vertex_line = 0;
+ fragment_line = 0;
+ light_line = 0;
+ can_zpass = true;
+ has_texscreen = false;
+ has_screen_uv = false;
+ writes_vertex = false;
+ uses_discard = false;
+ uses_time = false;
+ uses_normal = false;
}
-
-
};
mutable RID_Owner<Shader> shader_owner;
mutable SelfList<Shader>::List _shader_dirty_list;
- _FORCE_INLINE_ void _shader_make_dirty(Shader* p_shader);
- void _update_shader( Shader* p_shader) const;
+ _FORCE_INLINE_ void _shader_make_dirty(Shader *p_shader);
+ void _update_shader(Shader *p_shader) const;
struct Material {
@@ -256,37 +253,33 @@ class RasterizerGLES2 : public Rasterizer {
bool inuse;
bool istexture;
- Variant value;
+ Variant value;
int index;
};
- mutable Map<StringName,UniformData> shader_params;
+ mutable Map<StringName, UniformData> shader_params;
uint64_t last_pass;
-
Material() {
- for(int i=0;i<VS::MATERIAL_FLAG_MAX;i++)
- flags[i]=false;
- flags[VS::MATERIAL_FLAG_VISIBLE]=true;
+ for (int i = 0; i < VS::MATERIAL_FLAG_MAX; i++)
+ flags[i] = false;
+ flags[VS::MATERIAL_FLAG_VISIBLE] = true;
- line_width=1;
- has_alpha=false;
- depth_draw_mode=VS::MATERIAL_DEPTH_DRAW_OPAQUE_ONLY;
- blend_mode=VS::MATERIAL_BLEND_MODE_MIX;
+ line_width = 1;
+ has_alpha = false;
+ depth_draw_mode = VS::MATERIAL_DEPTH_DRAW_OPAQUE_ONLY;
+ blend_mode = VS::MATERIAL_BLEND_MODE_MIX;
last_pass = 0;
- shader_version=0;
- shader_cache=NULL;
-
+ shader_version = 0;
+ shader_cache = NULL;
}
};
_FORCE_INLINE_ void _update_material_shader_params(Material *p_material) const;
mutable RID_Owner<Material> material_owner;
-
-
struct Geometry {
enum Type {
@@ -302,8 +295,11 @@ class RasterizerGLES2 : public Rasterizer {
bool has_alpha;
bool material_owned;
- Geometry() { has_alpha=false; material_owned = false; }
- virtual ~Geometry() {};
+ Geometry() {
+ has_alpha = false;
+ material_owned = false;
+ }
+ virtual ~Geometry(){};
};
struct GeometryOwner {
@@ -317,11 +313,18 @@ class RasterizerGLES2 : public Rasterizer {
struct ArrayData {
- uint32_t ofs,size,datatype,count;
+ uint32_t ofs, size, datatype, count;
bool normalize;
bool bind;
- ArrayData() { ofs=0; size=0; count=0; datatype=0; normalize=0; bind=false;}
+ ArrayData() {
+ ofs = 0;
+ size = 0;
+ count = 0;
+ datatype = 0;
+ normalize = 0;
+ bind = false;
+ }
};
Mesh *mesh;
@@ -347,7 +350,7 @@ class RasterizerGLES2 : public Rasterizer {
uint8_t *array;
};
- MorphTarget* morph_targets_local;
+ MorphTarget *morph_targets_local;
int morph_target_count;
AABB aabb;
@@ -377,64 +380,60 @@ class RasterizerGLES2 : public Rasterizer {
Surface() {
+ array_len = 0;
+ local_stride = 0;
+ morph_format = 0;
+ type = GEOMETRY_SURFACE;
+ primitive = VS::PRIMITIVE_POINTS;
+ index_array_len = 0;
+ vertex_scale = 1.0;
+ uv_scale = 1.0;
+ uv2_scale = 1.0;
- array_len=0;
- local_stride=0;
- morph_format=0;
- type=GEOMETRY_SURFACE;
- primitive=VS::PRIMITIVE_POINTS;
- index_array_len=0;
- vertex_scale=1.0;
- uv_scale=1.0;
- uv2_scale=1.0;
+ alpha_sort = false;
- alpha_sort=false;
-
- format=0;
- stride=0;
- morph_targets_local=0;
- morph_target_count=0;
+ format = 0;
+ stride = 0;
+ morph_targets_local = 0;
+ morph_target_count = 0;
array_local = index_array_local = 0;
vertex_id = index_id = 0;
- active=false;
+ active = false;
//packed=false;
}
~Surface() {
-
}
};
-
struct Mesh {
bool active;
- Vector<Surface*> surfaces;
+ Vector<Surface *> surfaces;
int morph_target_count;
VS::MorphTargetMode morph_target_mode;
AABB custom_aabb;
mutable uint64_t last_pass;
Mesh() {
- morph_target_mode=VS::MORPH_MODE_NORMALIZED;
- morph_target_count=0;
- last_pass=0;
- active=false;
+ morph_target_mode = VS::MORPH_MODE_NORMALIZED;
+ morph_target_count = 0;
+ last_pass = 0;
+ active = false;
}
};
mutable RID_Owner<Mesh> mesh_owner;
- Error _surface_set_arrays(Surface *p_surface, uint8_t *p_mem,uint8_t *p_index_mem,const Array& p_arrays,bool p_main);
-
+ Error _surface_set_arrays(Surface *p_surface, uint8_t *p_mem, uint8_t *p_index_mem, const Array &p_arrays, bool p_main);
struct MultiMesh;
struct MultiMeshSurface : public Geometry {
Surface *surface;
- MultiMeshSurface() { type=GEOMETRY_MULTISURFACE; }
+ MultiMeshSurface() { type = GEOMETRY_MULTISURFACE; }
};
struct MultiMesh : public GeometryOwner {
@@ -444,28 +443,26 @@ class RasterizerGLES2 : public Rasterizer {
float matrix[16];
uint8_t color[4];
Element() {
- matrix[0]=1;
- matrix[1]=0;
- matrix[2]=0;
- matrix[3]=0;
-
- matrix[4]=0;
- matrix[5]=1;
- matrix[6]=0;
- matrix[7]=0;
-
- matrix[8]=0;
- matrix[9]=0;
- matrix[10]=1;
- matrix[11]=0;
-
- matrix[12]=0;
- matrix[13]=0;
- matrix[14]=0;
- matrix[15]=1;
+ matrix[0] = 1;
+ matrix[1] = 0;
+ matrix[2] = 0;
+ matrix[3] = 0;
+
+ matrix[4] = 0;
+ matrix[5] = 1;
+ matrix[6] = 0;
+ matrix[7] = 0;
+
+ matrix[8] = 0;
+ matrix[9] = 0;
+ matrix[10] = 1;
+ matrix[11] = 0;
+
+ matrix[12] = 0;
+ matrix[13] = 0;
+ matrix[14] = 0;
+ matrix[15] = 1;
};
-
-
};
AABB aabb;
@@ -482,12 +479,13 @@ class RasterizerGLES2 : public Rasterizer {
SelfList<MultiMesh> dirty_list;
- MultiMesh() : dirty_list(this) {
+ MultiMesh()
+ : dirty_list(this) {
- tw=1;
- th=1;
- tex_id=0;
- last_pass=0;
+ tw = 1;
+ th = 1;
+ tex_id = 0;
+ last_pass = 0;
visible = -1;
}
};
@@ -514,8 +512,10 @@ class RasterizerGLES2 : public Rasterizer {
int mask;
AABB aabb;
- Immediate() { type=GEOMETRY_IMMEDIATE; building=false;}
-
+ Immediate() {
+ type = GEOMETRY_IMMEDIATE;
+ building = false;
+ }
};
mutable RID_Owner<Immediate> immediate_owner;
@@ -525,8 +525,7 @@ class RasterizerGLES2 : public Rasterizer {
ParticleSystemSW data; // software particle system
Particles() {
- type=GEOMETRY_PARTICLES;
-
+ type = GEOMETRY_PARTICLES;
}
};
@@ -539,7 +538,7 @@ class RasterizerGLES2 : public Rasterizer {
ParticleSystemProcessSW particles_process;
Transform transform;
- ParticlesInstance() { }
+ ParticlesInstance() {}
};
mutable RID_Owner<ParticlesInstance> particles_instance_owner;
@@ -552,58 +551,52 @@ class RasterizerGLES2 : public Rasterizer {
float mtx[4][4]; //used
Bone() {
- for(int i=0;i<4;i++) {
- for(int j=0;j<4;j++) {
-
- mtx[i][j]=(i==j)?1:0;
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ mtx[i][j] = (i == j) ? 1 : 0;
}
}
-
}
- _ALWAYS_INLINE_ void transform_add_mul3(const float * p_src, float* r_dst, float p_weight) const {
+ _ALWAYS_INLINE_ void transform_add_mul3(const float *p_src, float *r_dst, float p_weight) const {
- r_dst[0]+=((mtx[0][0]*p_src[0] ) + ( mtx[1][0]*p_src[1] ) + ( mtx[2][0]*p_src[2] ) + mtx[3][0])*p_weight;
- r_dst[1]+=((mtx[0][1]*p_src[0] ) + ( mtx[1][1]*p_src[1] ) + ( mtx[2][1]*p_src[2] ) + mtx[3][1])*p_weight;
- r_dst[2]+=((mtx[0][2]*p_src[0] ) + ( mtx[1][2]*p_src[1] ) + ( mtx[2][2]*p_src[2] ) + mtx[3][2])*p_weight;
+ r_dst[0] += ((mtx[0][0] * p_src[0]) + (mtx[1][0] * p_src[1]) + (mtx[2][0] * p_src[2]) + mtx[3][0]) * p_weight;
+ r_dst[1] += ((mtx[0][1] * p_src[0]) + (mtx[1][1] * p_src[1]) + (mtx[2][1] * p_src[2]) + mtx[3][1]) * p_weight;
+ r_dst[2] += ((mtx[0][2] * p_src[0]) + (mtx[1][2] * p_src[1]) + (mtx[2][2] * p_src[2]) + mtx[3][2]) * p_weight;
}
- _ALWAYS_INLINE_ void transform3_add_mul3(const float * p_src, float* r_dst, float p_weight) const {
+ _ALWAYS_INLINE_ void transform3_add_mul3(const float *p_src, float *r_dst, float p_weight) const {
- r_dst[0]+=((mtx[0][0]*p_src[0] ) + ( mtx[1][0]*p_src[1] ) + ( mtx[2][0]*p_src[2] ) )*p_weight;
- r_dst[1]+=((mtx[0][1]*p_src[0] ) + ( mtx[1][1]*p_src[1] ) + ( mtx[2][1]*p_src[2] ) )*p_weight;
- r_dst[2]+=((mtx[0][2]*p_src[0] ) + ( mtx[1][2]*p_src[1] ) + ( mtx[2][2]*p_src[2] ) )*p_weight;
+ r_dst[0] += ((mtx[0][0] * p_src[0]) + (mtx[1][0] * p_src[1]) + (mtx[2][0] * p_src[2])) * p_weight;
+ r_dst[1] += ((mtx[0][1] * p_src[0]) + (mtx[1][1] * p_src[1]) + (mtx[2][1] * p_src[2])) * p_weight;
+ r_dst[2] += ((mtx[0][2] * p_src[0]) + (mtx[1][2] * p_src[1]) + (mtx[2][2] * p_src[2])) * p_weight;
}
- _ALWAYS_INLINE_ AABB transform_aabb(const AABB& p_aabb) const {
-
- float vertices[8][3]={
- {p_aabb.pos.x+p_aabb.size.x, p_aabb.pos.y+p_aabb.size.y, p_aabb.pos.z+p_aabb.size.z},
- {p_aabb.pos.x+p_aabb.size.x, p_aabb.pos.y+p_aabb.size.y, p_aabb.pos.z},
- {p_aabb.pos.x+p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z+p_aabb.size.z},
- {p_aabb.pos.x+p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z},
- {p_aabb.pos.x, p_aabb.pos.y+p_aabb.size.y, p_aabb.pos.z+p_aabb.size.z},
- {p_aabb.pos.x, p_aabb.pos.y+p_aabb.size.y, p_aabb.pos.z},
- {p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z+p_aabb.size.z},
- {p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z}
+ _ALWAYS_INLINE_ AABB transform_aabb(const AABB &p_aabb) const {
+
+ float vertices[8][3] = {
+ { p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z },
+ { p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z },
+ { p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z },
+ { p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z },
+ { p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z },
+ { p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z },
+ { p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z },
+ { p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z }
};
-
AABB ret;
-
-
- for (int i=0;i<8;i++) {
+ for (int i = 0; i < 8; i++) {
Vector3 xv(
- ((mtx[0][0]*vertices[i][0] ) + ( mtx[1][0]*vertices[i][1] ) + ( mtx[2][0]*vertices[i][2] ) + mtx[3][0] ),
- ((mtx[0][1]*vertices[i][0] ) + ( mtx[1][1]*vertices[i][1] ) + ( mtx[2][1]*vertices[i][2] ) + mtx[3][1] ),
- ((mtx[0][2]*vertices[i][0] ) + ( mtx[1][2]*vertices[i][1] ) + ( mtx[2][2]*vertices[i][2] ) + mtx[3][2] )
- );
+ ((mtx[0][0] * vertices[i][0]) + (mtx[1][0] * vertices[i][1]) + (mtx[2][0] * vertices[i][2]) + mtx[3][0]),
+ ((mtx[0][1] * vertices[i][0]) + (mtx[1][1] * vertices[i][1]) + (mtx[2][1] * vertices[i][2]) + mtx[3][1]),
+ ((mtx[0][2] * vertices[i][0]) + (mtx[1][2] * vertices[i][1]) + (mtx[2][2] * vertices[i][2]) + mtx[3][2]));
- if (i==0)
- ret.pos=xv;
+ if (i == 0)
+ ret.pos = xv;
else
ret.expand_to(xv);
}
@@ -618,16 +611,18 @@ class RasterizerGLES2 : public Rasterizer {
SelfList<Skeleton> dirty_list;
- Skeleton() : dirty_list(this) { tex_id=0; pixel_size=1.0; }
-
+ Skeleton()
+ : dirty_list(this) {
+ tex_id = 0;
+ pixel_size = 1.0;
+ }
};
mutable RID_Owner<Skeleton> skeleton_owner;
mutable SelfList<Skeleton>::List _skeleton_dirty_list;
-
- template<bool USE_NORMAL, bool USE_TANGENT,bool INPLACE>
- void _skeleton_xform(const uint8_t * p_src_array, int p_src_stride, uint8_t * p_dst_array, int p_dst_stride, int p_elements,const uint8_t *p_src_bones, const uint8_t *p_src_weights, const Skeleton::Bone *p_bone_xforms);
+ template <bool USE_NORMAL, bool USE_TANGENT, bool INPLACE>
+ void _skeleton_xform(const uint8_t *p_src_array, int p_src_stride, uint8_t *p_dst_array, int p_dst_stride, int p_elements, const uint8_t *p_src_bones, const uint8_t *p_src_weights, const Skeleton::Bone *p_bone_xforms);
struct Light {
@@ -642,36 +637,33 @@ class RasterizerGLES2 : public Rasterizer {
VS::LightDirectionalShadowMode directional_shadow_mode;
float directional_shadow_param[3];
-
Light() {
- vars[VS::LIGHT_PARAM_SPOT_ATTENUATION]=1;
- vars[VS::LIGHT_PARAM_SPOT_ANGLE]=45;
- vars[VS::LIGHT_PARAM_ATTENUATION]=1.0;
- vars[VS::LIGHT_PARAM_ENERGY]=1.0;
- vars[VS::LIGHT_PARAM_RADIUS]=1.0;
- vars[VS::LIGHT_PARAM_SHADOW_DARKENING]=0.0;
- vars[VS::LIGHT_PARAM_SHADOW_Z_OFFSET]=0.2;
- vars[VS::LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE]=1.4;
- vars[VS::LIGHT_PARAM_SHADOW_ESM_MULTIPLIER]=60.0;
- vars[VS::LIGHT_PARAM_SHADOW_BLUR_PASSES]=1;
- colors[VS::LIGHT_COLOR_DIFFUSE]=Color(1,1,1);
- colors[VS::LIGHT_COLOR_SPECULAR]=Color(1,1,1);
- shadow_enabled=false;
- volumetric_enabled=false;
-
- directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_SPLIT_WEIGHT]=0.5;
- directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE]=0;
- directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_ZOFFSET_SCALE]=2.0;
- omni_shadow_mode=VS::LIGHT_OMNI_SHADOW_DEFAULT;
- directional_shadow_mode=VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
+ vars[VS::LIGHT_PARAM_SPOT_ATTENUATION] = 1;
+ vars[VS::LIGHT_PARAM_SPOT_ANGLE] = 45;
+ vars[VS::LIGHT_PARAM_ATTENUATION] = 1.0;
+ vars[VS::LIGHT_PARAM_ENERGY] = 1.0;
+ vars[VS::LIGHT_PARAM_RADIUS] = 1.0;
+ vars[VS::LIGHT_PARAM_SHADOW_DARKENING] = 0.0;
+ vars[VS::LIGHT_PARAM_SHADOW_Z_OFFSET] = 0.2;
+ vars[VS::LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE] = 1.4;
+ vars[VS::LIGHT_PARAM_SHADOW_ESM_MULTIPLIER] = 60.0;
+ vars[VS::LIGHT_PARAM_SHADOW_BLUR_PASSES] = 1;
+ colors[VS::LIGHT_COLOR_DIFFUSE] = Color(1, 1, 1);
+ colors[VS::LIGHT_COLOR_SPECULAR] = Color(1, 1, 1);
+ shadow_enabled = false;
+ volumetric_enabled = false;
+
+ directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_SPLIT_WEIGHT] = 0.5;
+ directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE] = 0;
+ directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_ZOFFSET_SCALE] = 2.0;
+ omni_shadow_mode = VS::LIGHT_OMNI_SHADOW_DEFAULT;
+ directional_shadow_mode = VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
}
};
-
struct Environment {
-
VS::EnvironmentBG bg_mode;
Variant bg_param[VS::ENV_BG_PARAM_MAX];
bool fx_enabled[VS::ENV_FX_MAX];
@@ -679,54 +671,51 @@ class RasterizerGLES2 : public Rasterizer {
Environment() {
- bg_mode=VS::ENV_BG_DEFAULT_COLOR;
- bg_param[VS::ENV_BG_PARAM_COLOR]=Color(0,0,0);
- bg_param[VS::ENV_BG_PARAM_TEXTURE]=RID();
- bg_param[VS::ENV_BG_PARAM_CUBEMAP]=RID();
- bg_param[VS::ENV_BG_PARAM_ENERGY]=1.0;
- bg_param[VS::ENV_BG_PARAM_SCALE]=1.0;
- bg_param[VS::ENV_BG_PARAM_GLOW]=0.0;
- bg_param[VS::ENV_BG_PARAM_CANVAS_MAX_LAYER]=0;
-
- for(int i=0;i<VS::ENV_FX_MAX;i++)
- fx_enabled[i]=false;
-
- fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_PASSES]=1;
- fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_SCALE]=1.0;
- fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH]=1.0;
- fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE]=0;
- fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM]=0.0;
- fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD]=0.5;
- fx_param[VS::ENV_FX_PARAM_DOF_BLUR_PASSES]=1;
- fx_param[VS::ENV_FX_PARAM_DOF_BLUR_BEGIN]=100.0;
- fx_param[VS::ENV_FX_PARAM_DOF_BLUR_RANGE]=10.0;
- fx_param[VS::ENV_FX_PARAM_HDR_TONEMAPPER]=VS::ENV_FX_HDR_TONE_MAPPER_LINEAR;
- fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE]=0.4;
- fx_param[VS::ENV_FX_PARAM_HDR_WHITE]=1.0;
- fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD]=0.95;
- fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE]=0.2;
- fx_param[VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE]=0.4;
- fx_param[VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE]=8.0;
- fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED]=0.5;
- fx_param[VS::ENV_FX_PARAM_FOG_BEGIN]=100.0;
- fx_param[VS::ENV_FX_PARAM_FOG_ATTENUATION]=1.0;
- fx_param[VS::ENV_FX_PARAM_FOG_BEGIN_COLOR]=Color(0,0,0);
- fx_param[VS::ENV_FX_PARAM_FOG_END_COLOR]=Color(0,0,0);
- fx_param[VS::ENV_FX_PARAM_FOG_BG]=true;
- fx_param[VS::ENV_FX_PARAM_BCS_BRIGHTNESS]=1.0;
- fx_param[VS::ENV_FX_PARAM_BCS_CONTRAST]=1.0;
- fx_param[VS::ENV_FX_PARAM_BCS_SATURATION]=1.0;
-
+ bg_mode = VS::ENV_BG_DEFAULT_COLOR;
+ bg_param[VS::ENV_BG_PARAM_COLOR] = Color(0, 0, 0);
+ bg_param[VS::ENV_BG_PARAM_TEXTURE] = RID();
+ bg_param[VS::ENV_BG_PARAM_CUBEMAP] = RID();
+ bg_param[VS::ENV_BG_PARAM_ENERGY] = 1.0;
+ bg_param[VS::ENV_BG_PARAM_SCALE] = 1.0;
+ bg_param[VS::ENV_BG_PARAM_GLOW] = 0.0;
+ bg_param[VS::ENV_BG_PARAM_CANVAS_MAX_LAYER] = 0;
+
+ for (int i = 0; i < VS::ENV_FX_MAX; i++)
+ fx_enabled[i] = false;
+
+ fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_PASSES] = 1;
+ fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_SCALE] = 1.0;
+ fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH] = 1.0;
+ fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE] = 0;
+ fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM] = 0.0;
+ fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD] = 0.5;
+ fx_param[VS::ENV_FX_PARAM_DOF_BLUR_PASSES] = 1;
+ fx_param[VS::ENV_FX_PARAM_DOF_BLUR_BEGIN] = 100.0;
+ fx_param[VS::ENV_FX_PARAM_DOF_BLUR_RANGE] = 10.0;
+ fx_param[VS::ENV_FX_PARAM_HDR_TONEMAPPER] = VS::ENV_FX_HDR_TONE_MAPPER_LINEAR;
+ fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE] = 0.4;
+ fx_param[VS::ENV_FX_PARAM_HDR_WHITE] = 1.0;
+ fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD] = 0.95;
+ fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE] = 0.2;
+ fx_param[VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE] = 0.4;
+ fx_param[VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE] = 8.0;
+ fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED] = 0.5;
+ fx_param[VS::ENV_FX_PARAM_FOG_BEGIN] = 100.0;
+ fx_param[VS::ENV_FX_PARAM_FOG_ATTENUATION] = 1.0;
+ fx_param[VS::ENV_FX_PARAM_FOG_BEGIN_COLOR] = Color(0, 0, 0);
+ fx_param[VS::ENV_FX_PARAM_FOG_END_COLOR] = Color(0, 0, 0);
+ fx_param[VS::ENV_FX_PARAM_FOG_BG] = true;
+ fx_param[VS::ENV_FX_PARAM_BCS_BRIGHTNESS] = 1.0;
+ fx_param[VS::ENV_FX_PARAM_BCS_CONTRAST] = 1.0;
+ fx_param[VS::ENV_FX_PARAM_BCS_SATURATION] = 1.0;
}
-
};
mutable RID_Owner<Environment> environment_owner;
-
struct SampledLight {
- int w,h;
+ int w, h;
GLuint texture;
float multiplier;
bool is_float;
@@ -734,14 +723,16 @@ class RasterizerGLES2 : public Rasterizer {
mutable RID_Owner<SampledLight> sampled_light_owner;
-
struct ViewportData {
//1x1 fbo+texture for storing previous HDR value
GLuint lum_fbo;
GLuint lum_color;
- ViewportData() { lum_fbo=0; lum_color=0; }
+ ViewportData() {
+ lum_fbo = 0;
+ lum_color = 0;
+ }
};
mutable RID_Owner<ViewportData> viewport_data_owner;
@@ -753,15 +744,12 @@ class RasterizerGLES2 : public Rasterizer {
GLuint fbo;
GLuint color;
GLuint depth;
- int width,height;
+ int width, height;
uint64_t last_pass;
-
};
mutable RID_Owner<RenderTarget> render_target_owner;
-
-
struct ShadowBuffer;
struct LightInstance {
@@ -795,9 +783,7 @@ class RasterizerGLES2 : public Rasterizer {
CameraMatrix shadow_projection[4];
float shadow_split[4];
-
-
- ShadowBuffer* near_shadow_buffer;
+ ShadowBuffer *near_shadow_buffer;
void clear_shadow_buffers() {
@@ -807,13 +793,17 @@ class RasterizerGLES2 : public Rasterizer {
void clear_near_shadow_buffers() {
if (near_shadow_buffer) {
- near_shadow_buffer->owner=NULL;
- near_shadow_buffer=NULL;
+ near_shadow_buffer->owner = NULL;
+ near_shadow_buffer = NULL;
}
}
- LightInstance() { shadow_pass=0; last_pass=0; sort_key=0; near_shadow_buffer=NULL;}
-
+ LightInstance() {
+ shadow_pass = 0;
+ last_pass = 0;
+ sort_key = 0;
+ near_shadow_buffer = NULL;
+ }
};
mutable RID_Owner<Light> light_owner;
mutable RID_Owner<LightInstance> light_instance_owner;
@@ -841,22 +831,19 @@ class RasterizerGLES2 : public Rasterizer {
GLuint gui_quad_buffer;
GLuint indices_buffer;
-
-
struct RenderList {
enum {
- DEFAULT_MAX_ELEMENTS=4096,
- MAX_LIGHTS=4,
- SORT_FLAG_SKELETON=1,
- SORT_FLAG_INSTANCING=2,
+ DEFAULT_MAX_ELEMENTS = 4096,
+ MAX_LIGHTS = 4,
+ SORT_FLAG_SKELETON = 1,
+ SORT_FLAG_INSTANCING = 2,
};
static int max_elements;
struct Element {
-
float depth;
const InstanceData *instance;
const Skeleton *skeleton;
@@ -885,19 +872,18 @@ class RasterizerGLES2 : public Rasterizer {
};
};
-
Element *_elements;
Element **elements;
int element_count;
void clear() {
- element_count=0;
+ element_count = 0;
}
struct SortZ {
- _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const {
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
return A->depth > B->depth;
}
@@ -905,14 +891,13 @@ class RasterizerGLES2 : public Rasterizer {
void sort_z() {
- SortArray<Element*,SortZ> sorter;
- sorter.sort(elements,element_count);
+ SortArray<Element *, SortZ> sorter;
+ sorter.sort(elements, element_count);
}
-
struct SortMatGeom {
- _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const {
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
// TODO move to a single uint64 (one comparison)
if (A->material->shader_cache == B->material->shader_cache) {
if (A->material == B->material) {
@@ -931,19 +916,19 @@ class RasterizerGLES2 : public Rasterizer {
void sort_mat_geom() {
- SortArray<Element*,SortMatGeom> sorter;
- sorter.sort(elements,element_count);
+ SortArray<Element *, SortMatGeom> sorter;
+ sorter.sort(elements, element_count);
}
struct SortMatLight {
- _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const {
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
if (A->geometry_cmp == B->geometry_cmp) {
if (A->material == B->material) {
- return A->light<B->light;
+ return A->light < B->light;
} else {
return (A->material < B->material);
@@ -957,13 +942,13 @@ class RasterizerGLES2 : public Rasterizer {
void sort_mat_light() {
- SortArray<Element*,SortMatLight> sorter;
- sorter.sort(elements,element_count);
+ SortArray<Element *, SortMatLight> sorter;
+ sorter.sort(elements, element_count);
}
struct SortMatLightType {
- _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const {
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
if (A->light_type == B->light_type) {
if (A->material->shader_cache == B->material->shader_cache) {
@@ -987,13 +972,13 @@ class RasterizerGLES2 : public Rasterizer {
void sort_mat_light_type() {
- SortArray<Element*,SortMatLightType> sorter;
- sorter.sort(elements,element_count);
+ SortArray<Element *, SortMatLightType> sorter;
+ sorter.sort(elements, element_count);
}
struct SortMatLightTypeFlags {
- _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const {
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
if (A->sort_key == B->sort_key) {
if (A->material->shader_cache == B->material->shader_cache) {
@@ -1017,29 +1002,27 @@ class RasterizerGLES2 : public Rasterizer {
void sort_mat_light_type_flags() {
- SortArray<Element*,SortMatLightTypeFlags> sorter;
- sorter.sort(elements,element_count);
+ SortArray<Element *, SortMatLightTypeFlags> sorter;
+ sorter.sort(elements, element_count);
}
- _FORCE_INLINE_ Element* add_element() {
+ _FORCE_INLINE_ Element *add_element() {
- if (element_count>=max_elements)
+ if (element_count >= max_elements)
return NULL;
- elements[element_count]=&_elements[element_count];
+ elements[element_count] = &_elements[element_count];
return elements[element_count++];
}
void init() {
element_count = 0;
- elements=memnew_arr(Element*,max_elements);
- _elements=memnew_arr(Element,max_elements);
- for (int i=0;i<max_elements;i++)
- elements[i]=&_elements[i]; // assign elements
-
+ elements = memnew_arr(Element *, max_elements);
+ _elements = memnew_arr(Element, max_elements);
+ for (int i = 0; i < max_elements; i++)
+ elements[i] = &_elements[i]; // assign elements
}
RenderList() {
-
}
~RenderList() {
memdelete_arr(elements);
@@ -1047,14 +1030,11 @@ class RasterizerGLES2 : public Rasterizer {
}
};
-
-
RenderList opaque_render_list;
RenderList alpha_render_list;
RID default_material;
-
CameraMatrix camera_projection;
Transform camera_transform;
Transform camera_transform_inverse;
@@ -1066,12 +1046,10 @@ class RasterizerGLES2 : public Rasterizer {
bool texscreen_copied;
bool texscreen_used;
-
-
Plane camera_plane;
- void _add_geometry( const Geometry* p_geometry, const InstanceData *p_instance, const Geometry *p_geometry_cmp, const GeometryOwner *p_owner,int p_material=-1);
- void _render_list_forward(RenderList *p_render_list,const Transform& p_view_transform,const Transform& p_view_transform_inverse, const CameraMatrix& p_projection,bool p_reverse_cull=false,bool p_fragment_light=false,bool p_alpha_pass=false);
+ void _add_geometry(const Geometry *p_geometry, const InstanceData *p_instance, const Geometry *p_geometry_cmp, const GeometryOwner *p_owner, int p_material = -1);
+ void _render_list_forward(RenderList *p_render_list, const Transform &p_view_transform, const Transform &p_view_transform_inverse, const CameraMatrix &p_projection, bool p_reverse_cull = false, bool p_fragment_light = false, bool p_alpha_pass = false);
//void _setup_light(LightInstance* p_instance, int p_idx);
void _setup_light(uint16_t p_light);
@@ -1080,10 +1058,8 @@ class RasterizerGLES2 : public Rasterizer {
bool _setup_material(const Geometry *p_geometry, const Material *p_material, bool p_no_const_light, bool p_opaque_pass);
void _setup_skeleton(const Skeleton *p_skeleton);
-
- Error _setup_geometry(const Geometry *p_geometry, const Material* p_material,const Skeleton *p_skeleton, const float *p_morphs);
- void _render(const Geometry *p_geometry,const Material *p_material, const Skeleton* p_skeleton, const GeometryOwner *p_owner,const Transform& p_xform);
-
+ Error _setup_geometry(const Geometry *p_geometry, const Material *p_material, const Skeleton *p_skeleton, const float *p_morphs);
+ void _render(const Geometry *p_geometry, const Material *p_material, const Skeleton *p_skeleton, const GeometryOwner *p_owner, const Transform &p_xform);
/***********/
/* SHADOWS */
@@ -1103,8 +1079,12 @@ class RasterizerGLES2 : public Rasterizer {
#endif
LightInstance *owner;
- bool init(int p_size,bool p_use_depth);
- ShadowBuffer() { size=0; depth=0; owner=NULL; }
+ bool init(int p_size, bool p_use_depth);
+ ShadowBuffer() {
+ size = 0;
+ depth = 0;
+ owner = NULL;
+ }
};
Vector<ShadowBuffer> near_shadow_buffers;
@@ -1115,30 +1095,25 @@ class RasterizerGLES2 : public Rasterizer {
LightInstance *shadow;
int shadow_pass;
-
float shadow_near_far_split_size_ratio;
- bool _allocate_shadow_buffers(LightInstance *p_instance, Vector<ShadowBuffer>& p_buffers);
- void _debug_draw_shadow(GLuint tex, const Rect2& p_rect);
- void _debug_draw_shadows_type(Vector<ShadowBuffer>& p_shadows,Point2& ofs);
+ bool _allocate_shadow_buffers(LightInstance *p_instance, Vector<ShadowBuffer> &p_buffers);
+ void _debug_draw_shadow(GLuint tex, const Rect2 &p_rect);
+ void _debug_draw_shadows_type(Vector<ShadowBuffer> &p_shadows, Point2 &ofs);
void _debug_shadows();
void _debug_luminances();
void _debug_samplers();
-
-
/***********/
/* FBOs */
/***********/
-
struct FrameBuffer {
GLuint fbo;
GLuint color;
GLuint depth;
-
- int width,height;
+ int width, height;
int scale;
bool active;
@@ -1149,7 +1124,10 @@ class RasterizerGLES2 : public Rasterizer {
GLuint fbo;
GLuint color;
- Blur() { fbo=0; color=0; }
+ Blur() {
+ fbo = 0;
+ color = 0;
+ }
} blur[3];
struct Luminance {
@@ -1158,7 +1136,11 @@ class RasterizerGLES2 : public Rasterizer {
GLuint fbo;
GLuint color;
- Luminance() { fbo=0; color=0; size=0;}
+ Luminance() {
+ fbo = 0;
+ color = 0;
+ size = 0;
+ }
};
Vector<Luminance> luminance;
@@ -1167,7 +1149,7 @@ class RasterizerGLES2 : public Rasterizer {
GLuint sample_color;
FrameBuffer() {
- blur_size=0;
+ blur_size = 0;
}
} framebuffer;
@@ -1176,7 +1158,6 @@ class RasterizerGLES2 : public Rasterizer {
void _process_glow_and_bloom();
//void _update_blur_buffer();
-
/*********/
/* FRAME */
/*********/
@@ -1194,12 +1175,10 @@ class RasterizerGLES2 : public Rasterizer {
} _rinfo;
-
/*******************/
/* CANVAS OCCLUDER */
/*******************/
-
struct CanvasOccluder {
GLuint vertex_id; // 0 means, unconfigured
@@ -1214,7 +1193,6 @@ class RasterizerGLES2 : public Rasterizer {
/* CANVAS LIGHT SHADOW */
/***********************/
-
struct CanvasLightShadow {
int size;
@@ -1225,7 +1203,6 @@ class RasterizerGLES2 : public Rasterizer {
GLuint rgba; //for older devices
GLuint blur;
-
};
RID_Owner<CanvasLightShadow> canvas_light_shadow_owner;
@@ -1239,7 +1216,6 @@ class RasterizerGLES2 : public Rasterizer {
bool current_rt_vflip;
ViewportData *current_vd;
-
GLuint white_tex;
RID canvas_tex;
float canvas_opacity;
@@ -1251,13 +1227,11 @@ class RasterizerGLES2 : public Rasterizer {
CanvasItemMaterial *canvas_last_material;
bool canvas_texscreen_used;
Vector2 normal_flip;
- _FORCE_INLINE_ void _canvas_normal_set_flip(const Vector2& p_flip);
+ _FORCE_INLINE_ void _canvas_normal_set_flip(const Vector2 &p_flip);
-
- _FORCE_INLINE_ Texture* _bind_canvas_texture(const RID& p_texture);
+ _FORCE_INLINE_ Texture *_bind_canvas_texture(const RID &p_texture);
VS::MaterialBlendMode canvas_blend_mode;
-
int _setup_geometry_vinfo;
bool pack_arrays;
@@ -1265,8 +1239,8 @@ class RasterizerGLES2 : public Rasterizer {
bool use_reload_hooks;
bool cull_front;
bool lights_use_shadow;
- _FORCE_INLINE_ void _set_cull(bool p_front,bool p_reverse_cull=false);
- _FORCE_INLINE_ Color _convert_color(const Color& p_color);
+ _FORCE_INLINE_ void _set_cull(bool p_front, bool p_reverse_cull = false);
+ _FORCE_INLINE_ Color _convert_color(const Color &p_color);
void _process_glow_bloom();
void _process_hdr();
@@ -1285,7 +1259,6 @@ class RasterizerGLES2 : public Rasterizer {
RID overdraw_material;
float shader_time_rollback;
-
mutable MaterialShaderGLES2 material_shader;
mutable CanvasShaderGLES2 canvas_shader;
BlurShaderGLES2 blur_shader;
@@ -1294,11 +1267,11 @@ class RasterizerGLES2 : public Rasterizer {
mutable ShaderCompilerGLES2 shader_precompiler;
- void _draw_primitive(int p_points, const Vector3 *p_vertices, const Vector3 *p_normals, const Color* p_colors, const Vector3 *p_uvs,const Plane *p_tangents=NULL,int p_instanced=1);
- _FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color* p_colors, const Vector2 *p_uvs);
- _FORCE_INLINE_ void _draw_gui_primitive2(int p_points, const Vector2 *p_vertices, const Color* p_colors, const Vector2 *p_uvs, const Vector2 *p_uvs2);
- void _draw_textured_quad(const Rect2& p_rect, const Rect2& p_src_region, const Size2& p_tex_size,bool p_h_flip=false, bool p_v_flip=false, bool p_transpose=false );
- void _draw_quad(const Rect2& p_rect);
+ void _draw_primitive(int p_points, const Vector3 *p_vertices, const Vector3 *p_normals, const Color *p_colors, const Vector3 *p_uvs, const Plane *p_tangents = NULL, int p_instanced = 1);
+ _FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs);
+ _FORCE_INLINE_ void _draw_gui_primitive2(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs, const Vector2 *p_uvs2);
+ void _draw_textured_quad(const Rect2 &p_rect, const Rect2 &p_src_region, const Size2 &p_tex_size, bool p_h_flip = false, bool p_v_flip = false, bool p_transpose = false);
+ void _draw_quad(const Rect2 &p_rect);
void _copy_screen_quad();
void _copy_to_texscreen();
@@ -1313,28 +1286,28 @@ class RasterizerGLES2 : public Rasterizer {
GLuint tc0_id_cache;
GLuint tc0_idx;
- template<bool use_normalmap>
- _FORCE_INLINE_ void _canvas_item_render_commands(CanvasItem *p_item,CanvasItem *current_clip,bool &reclip);
- _FORCE_INLINE_ void _canvas_item_setup_shader_params(CanvasItemMaterial *material,Shader* p_shader);
- _FORCE_INLINE_ void _canvas_item_setup_shader_uniforms(CanvasItemMaterial *material,Shader* p_shader);
-public:
+ template <bool use_normalmap>
+ _FORCE_INLINE_ void _canvas_item_render_commands(CanvasItem *p_item, CanvasItem *current_clip, bool &reclip);
+ _FORCE_INLINE_ void _canvas_item_setup_shader_params(CanvasItemMaterial *material, Shader *p_shader);
+ _FORCE_INLINE_ void _canvas_item_setup_shader_uniforms(CanvasItemMaterial *material, Shader *p_shader);
+public:
/* TEXTURE API */
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=VS::TEXTURE_FLAGS_DEFAULT);
- virtual void texture_set_data(RID p_texture,const Image& p_image,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT);
- virtual Image texture_get_data(RID p_texture,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT) const;
- virtual void texture_set_flags(RID p_texture,uint32_t p_flags);
+ virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT);
+ virtual void texture_set_data(RID p_texture, const Image &p_image, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT);
+ virtual Image texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side = VS::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 bool texture_has_alpha(RID p_texture) const;
- virtual void texture_set_size_override(RID p_texture,int p_width, int p_height);
- virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const;
+ virtual void texture_set_size_override(RID p_texture, int p_width, int p_height);
+ 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 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<VS::TextureInfo> *r_info);
@@ -1344,23 +1317,22 @@ public:
/* SHADER API */
- virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_MATERIAL);
+ virtual RID shader_create(VS::ShaderMode p_mode = VS::SHADER_MATERIAL);
- virtual void shader_set_mode(RID p_shader,VS::ShaderMode p_mode);
+ virtual void shader_set_mode(RID p_shader, VS::ShaderMode p_mode);
virtual VS::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 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_fragment_code(RID p_shader) const;
virtual String shader_get_vertex_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;
+ 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;
- virtual Variant shader_get_default_param(RID p_shader, const StringName& p_name);
+ virtual Variant shader_get_default_param(RID p_shader, const StringName &p_name);
/* COMMON MATERIAL API */
@@ -1369,38 +1341,37 @@ public:
virtual void material_set_shader(RID p_shader_material, RID p_shader);
virtual RID material_get_shader(RID p_shader_material) const;
- 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;
+ 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;
- virtual void material_set_flag(RID p_material, VS::MaterialFlag p_flag,bool p_enabled);
- virtual bool material_get_flag(RID p_material,VS::MaterialFlag p_flag) const;
+ virtual void material_set_flag(RID p_material, VS::MaterialFlag p_flag, bool p_enabled);
+ virtual bool material_get_flag(RID p_material, VS::MaterialFlag p_flag) const;
virtual void material_set_depth_draw_mode(RID p_material, VS::MaterialDepthDrawMode p_mode);
virtual VS::MaterialDepthDrawMode material_get_depth_draw_mode(RID p_material) const;
- virtual void material_set_blend_mode(RID p_material,VS::MaterialBlendMode p_mode);
+ virtual void material_set_blend_mode(RID p_material, VS::MaterialBlendMode p_mode);
virtual VS::MaterialBlendMode material_get_blend_mode(RID p_material) const;
- virtual void material_set_line_width(RID p_material,float p_line_width);
+ virtual void material_set_line_width(RID p_material, float p_line_width);
virtual float material_get_line_width(RID p_material) const;
-
/* MESH API */
virtual RID mesh_create();
- virtual void mesh_add_surface(RID p_mesh,VS::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;
- virtual void mesh_add_custom_surface(RID p_mesh,const Variant& p_dat);
+ virtual void mesh_add_surface(RID p_mesh, VS::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;
+ virtual void mesh_add_custom_surface(RID p_mesh, const Variant &p_dat);
- virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount);
+ virtual void mesh_set_morph_target_count(RID p_mesh, int p_amount);
virtual int mesh_get_morph_target_count(RID p_mesh) const;
- virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode);
+ virtual void mesh_set_morph_target_mode(RID p_mesh, VS::MorphTargetMode p_mode);
virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const;
- virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned=false);
+ 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;
virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const;
@@ -1408,49 +1379,49 @@ public:
virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const;
virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
- virtual void mesh_remove_surface(RID p_mesh,int p_index);
+ virtual void mesh_remove_surface(RID p_mesh, int p_index);
virtual int mesh_get_surface_count(RID p_mesh) const;
- virtual AABB mesh_get_aabb(RID p_mesh,RID p_skeleton=RID()) const;
+ virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) const;
- virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb);
+ virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb);
virtual AABB mesh_get_custom_aabb(RID p_mesh) const;
/* MULTIMESH API */
virtual RID multimesh_create();
- virtual void multimesh_set_instance_count(RID p_multimesh,int p_count);
+ virtual void multimesh_set_instance_count(RID p_multimesh, int p_count);
virtual int multimesh_get_instance_count(RID p_multimesh) const;
- 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);
+ 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);
virtual RID multimesh_get_mesh(RID p_multimesh) const;
virtual AABB multimesh_get_aabb(RID p_multimesh) 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;
+ 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;
- virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible);
+ virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible);
virtual int multimesh_get_visible_instances(RID p_multimesh) const;
/* IMMEDIATE API */
virtual RID immediate_create();
- virtual void immediate_begin(RID p_immediate,VS::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& tex_uv);
- virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv);
+ virtual void immediate_begin(RID p_immediate, VS::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 &tex_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 AABB immediate_get_aabb(RID p_immediate) const;
- virtual void immediate_set_material(RID p_immediate,RID p_material);
+ virtual void immediate_set_material(RID p_immediate, RID p_material);
virtual RID immediate_get_material(RID p_immediate) const;
/* PARTICLES API */
@@ -1463,25 +1434,25 @@ public:
virtual void particles_set_emitting(RID p_particles, bool p_emitting);
virtual bool particles_is_emitting(RID p_particles) const;
- virtual void particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility);
+ virtual void particles_set_visibility_aabb(RID p_particles, const AABB &p_visibility);
virtual AABB particles_get_visibility_aabb(RID p_particles) const;
- virtual void particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents);
+ 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;
- virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity);
+ 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 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 void particles_set_gravity_normal(RID p_particles, const Vector3 &p_normal);
virtual Vector3 particles_get_gravity_normal(RID p_particles) const;
- virtual void particles_set_variable(RID p_particles, VS::ParticleVariable p_variable,float p_value);
+ virtual void particles_set_variable(RID p_particles, VS::ParticleVariable p_variable, float p_value);
virtual float particles_get_variable(RID p_particles, VS::ParticleVariable p_variable) const;
- virtual void particles_set_randomness(RID p_particles, VS::ParticleVariable p_variable,float p_randomness);
+ virtual void particles_set_randomness(RID p_particles, VS::ParticleVariable p_variable, float p_randomness);
virtual float particles_get_randomness(RID p_particles, VS::ParticleVariable p_variable) const;
virtual void particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos);
@@ -1490,19 +1461,19 @@ public:
virtual void particles_set_color_phases(RID p_particles, int p_phases);
virtual int particles_get_color_phases(RID p_particles) const;
- virtual void particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_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;
virtual void particles_set_attractors(RID p_particles, int p_attractors);
virtual int particles_get_attractors(RID p_particles) const;
- 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;
+ 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;
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 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 void particles_set_material(RID p_particles, RID p_material, bool p_owned = false);
virtual RID particles_get_material(RID p_particles) const;
virtual AABB particles_get_aabb(RID p_particles) const;
@@ -1516,68 +1487,61 @@ public:
/* SKELETON API */
virtual RID skeleton_create();
- virtual void skeleton_resize(RID p_skeleton,int p_bones);
+ 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);
-
+ 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);
/* LIGHT API */
virtual RID light_create(VS::LightType p_type);
virtual VS::LightType light_get_type(RID p_light) const;
- virtual void light_set_color(RID p_light,VS::LightColor p_type, const Color& p_color);
- virtual Color light_get_color(RID p_light,VS::LightColor p_type) const;
+ virtual void light_set_color(RID p_light, VS::LightColor p_type, const Color &p_color);
+ virtual Color light_get_color(RID p_light, VS::LightColor p_type) const;
- virtual void light_set_shadow(RID p_light,bool p_enabled);
+ virtual void light_set_shadow(RID p_light, bool p_enabled);
virtual bool light_has_shadow(RID p_light) const;
- virtual void light_set_volumetric(RID p_light,bool p_enabled);
+ virtual void light_set_volumetric(RID p_light, bool p_enabled);
virtual bool light_is_volumetric(RID p_light) const;
- virtual void light_set_projector(RID p_light,RID p_texture);
+ virtual void light_set_projector(RID p_light, RID p_texture);
virtual RID light_get_projector(RID p_light) const;
virtual void light_set_var(RID p_light, VS::LightParam p_var, float p_value);
virtual float light_get_var(RID p_light, VS::LightParam p_var) const;
- virtual void light_set_operator(RID p_light,VS::LightOp p_op);
+ virtual void light_set_operator(RID p_light, VS::LightOp p_op);
virtual VS::LightOp light_get_operator(RID p_light) const;
- virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode);
+ virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) const;
- virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode);
+ virtual void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode);
virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) const;
- virtual void light_directional_set_shadow_param(RID p_light,VS::LightDirectionalShadowParam p_param, float p_value);
- virtual float light_directional_get_shadow_param(RID p_light,VS::LightDirectionalShadowParam p_param) const;
-
-
+ virtual void light_directional_set_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param, float p_value);
+ virtual float light_directional_get_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param) const;
virtual AABB light_get_aabb(RID p_poly) const;
-
virtual RID light_instance_create(RID p_light);
- virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform);
+ virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform);
- virtual ShadowType light_instance_get_shadow_type(RID p_light_instance,bool p_far=false) const;
+ virtual ShadowType light_instance_get_shadow_type(RID p_light_instance, bool p_far = false) const;
virtual int light_instance_get_shadow_passes(RID p_light_instance) const;
virtual bool light_instance_get_pssm_shadow_overlap(RID p_light_instance) const;
- virtual void light_instance_set_shadow_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near=0,float p_split_far=0);
- virtual int light_instance_get_shadow_size(RID p_light_instance, int p_index=0) const;
-
+ virtual void light_instance_set_shadow_transform(RID p_light_instance, int p_index, const CameraMatrix &p_camera, const Transform &p_transform, float p_split_near = 0, float p_split_far = 0);
+ virtual int light_instance_get_shadow_size(RID p_light_instance, int p_index = 0) const;
virtual void shadow_clear_near();
virtual bool shadow_allocate_near(RID p_light);
virtual bool shadow_allocate_far(RID p_light);
-
/* SHADOW */
virtual RID particles_instance_create(RID p_particles);
- virtual void particles_instance_set_transform(RID p_particles_instance,const Transform& p_transform);
-
+ virtual void particles_instance_set_transform(RID p_particles_instance, const Transform &p_transform);
/* VIEWPORT */
@@ -1588,33 +1552,30 @@ public:
virtual RID render_target_get_texture(RID p_render_target) const;
virtual bool render_target_renedered_in_frame(RID p_render_target);
-
/* RENDER API */
/* all calls (inside begin/end shadow) are always warranted to be in the following order: */
virtual void begin_frame();
+ virtual void set_viewport(const VS::ViewportRect &p_viewport);
+ virtual void set_render_target(RID p_render_target, bool p_transparent_bg = false, bool p_vflip = false);
+ virtual void clear_viewport(const Color &p_color);
+ virtual void capture_viewport(Image *r_capture);
- virtual void set_viewport(const VS::ViewportRect& p_viewport);
- virtual void set_render_target(RID p_render_target,bool p_transparent_bg=false,bool p_vflip=false);
- virtual void clear_viewport(const Color& p_color);
- virtual void capture_viewport(Image* r_capture);
-
+ virtual void begin_scene(RID p_viewport_data, RID p_env, VS::ScenarioDebugMode p_debug);
- virtual void begin_scene(RID p_viewport_data,RID p_env,VS::ScenarioDebugMode p_debug);
+ virtual void begin_shadow_map(RID p_light_instance, int p_shadow_pass);
- virtual void begin_shadow_map( RID p_light_instance, int p_shadow_pass );
+ virtual void set_camera(const Transform &p_world, const CameraMatrix &p_projection, bool p_ortho_hint);
- virtual void set_camera(const Transform& p_world,const CameraMatrix& p_projection,bool p_ortho_hint);
+ virtual void add_light(RID p_light_instance); ///< all "add_light" calls happen before add_geometry calls
- virtual void add_light( RID p_light_instance ); ///< all "add_light" calls happen before add_geometry calls
+ typedef Map<StringName, Variant> ParamOverrideMap;
- typedef Map<StringName,Variant> ParamOverrideMap;
-
- virtual void add_mesh( const RID& p_mesh, const InstanceData *p_data);
- virtual void add_multimesh( const RID& p_multimesh, const InstanceData *p_data);
- virtual void add_immediate( const RID& p_immediate, const InstanceData *p_data);
- virtual void add_particles( const RID& p_particle_instance, const InstanceData *p_data);
+ virtual void add_mesh(const RID &p_mesh, const InstanceData *p_data);
+ virtual void add_multimesh(const RID &p_multimesh, const InstanceData *p_data);
+ virtual void add_immediate(const RID &p_immediate, const InstanceData *p_data);
+ virtual void add_particles(const RID &p_particle_instance, const InstanceData *p_data);
virtual void end_scene();
virtual void end_shadow_map();
@@ -1630,69 +1591,68 @@ public:
virtual void canvas_set_opacity(float p_opacity);
virtual void canvas_set_blend_mode(VS::MaterialBlendMode p_mode);
- virtual void canvas_begin_rect(const Transform2D& p_transform);
- virtual void canvas_set_clip(bool p_clip, const Rect2& p_rect);
+ virtual void canvas_begin_rect(const Transform2D &p_transform);
+ virtual void canvas_set_clip(bool p_clip, const Rect2 &p_rect);
virtual void canvas_end_rect();
- virtual void canvas_draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased);
- virtual void canvas_draw_rect(const Rect2& p_rect, int p_flags, const Rect2& p_source,RID p_texture,const Color& p_modulate);
- virtual void canvas_draw_style_box(const Rect2& p_rect, const Rect2& p_src_region, RID p_texture,const float *p_margins, bool p_draw_center=true,const Color& p_modulate=Color(1,1,1));
- virtual void canvas_draw_primitive(const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs, RID p_texture,float p_width);
- virtual void canvas_draw_polygon(int p_vertex_count, const int* p_indices, const Vector2* p_vertices, const Vector2* p_uvs, const Color* p_colors,const RID& p_texture,bool p_singlecolor);
- virtual void canvas_set_transform(const Transform2D& p_transform);
+ virtual void canvas_draw_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width, bool p_antialiased);
+ virtual void canvas_draw_rect(const Rect2 &p_rect, int p_flags, const Rect2 &p_source, RID p_texture, const Color &p_modulate);
+ virtual void canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margins, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1));
+ virtual void canvas_draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width);
+ virtual void canvas_draw_polygon(int p_vertex_count, const int *p_indices, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, const RID &p_texture, bool p_singlecolor);
+ virtual void canvas_set_transform(const Transform2D &p_transform);
- virtual void canvas_render_items(CanvasItem *p_item_list,int p_z,const Color& p_modulate,CanvasLight *p_light);
- virtual void canvas_debug_viewport_shadows(CanvasLight* p_lights_with_shadow);
+ virtual void canvas_render_items(CanvasItem *p_item_list, int p_z, const Color &p_modulate, CanvasLight *p_light);
+ virtual void canvas_debug_viewport_shadows(CanvasLight *p_lights_with_shadow);
/* CANVAS LIGHT SHADOW */
//buffer
virtual RID canvas_light_shadow_buffer_create(int p_width);
- virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D& p_light_xform, int p_light_mask,float p_near, float p_far, CanvasLightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache);
+ virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, CanvasLightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache);
//occluder
virtual RID canvas_light_occluder_create();
- virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2>& p_lines);
+ virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2> &p_lines);
/* ENVIRONMENT */
-
virtual RID environment_create();
- virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg);
+ virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
virtual VS::EnvironmentBG environment_get_background(RID p_env) const;
- virtual void environment_set_background_param(RID p_env,VS::EnvironmentBGParam p_param, const Variant& p_value);
- virtual Variant environment_get_background_param(RID p_env,VS::EnvironmentBGParam p_param) const;
+ virtual void environment_set_background_param(RID p_env, VS::EnvironmentBGParam p_param, const Variant &p_value);
+ virtual Variant environment_get_background_param(RID p_env, VS::EnvironmentBGParam p_param) const;
- virtual void environment_set_enable_fx(RID p_env,VS::EnvironmentFx p_effect,bool p_enabled);
- virtual bool environment_is_fx_enabled(RID p_env,VS::EnvironmentFx p_effect) const;
+ virtual void environment_set_enable_fx(RID p_env, VS::EnvironmentFx p_effect, bool p_enabled);
+ virtual bool environment_is_fx_enabled(RID p_env, VS::EnvironmentFx p_effect) const;
- virtual void environment_fx_set_param(RID p_env,VS::EnvironmentFxParam p_param,const Variant& p_value);
- virtual Variant environment_fx_get_param(RID p_env,VS::EnvironmentFxParam p_param) const;
+ virtual void environment_fx_set_param(RID p_env, VS::EnvironmentFxParam p_param, const Variant &p_value);
+ virtual Variant environment_fx_get_param(RID p_env, VS::EnvironmentFxParam p_param) const;
/* SAMPLED LIGHT */
- virtual RID sampled_light_dp_create(int p_width,int p_height);
+ virtual RID sampled_light_dp_create(int p_width, int p_height);
virtual void sampled_light_dp_update(RID p_sampled_light, const Color *p_data, float p_multiplier);
/*MISC*/
- virtual bool is_texture(const RID& p_rid) const;
- virtual bool is_material(const RID& p_rid) const;
- virtual bool is_mesh(const RID& p_rid) const;
- virtual bool is_immediate(const RID& p_rid) const;
- virtual bool is_multimesh(const RID& p_rid) const;
+ virtual bool is_texture(const RID &p_rid) const;
+ virtual bool is_material(const RID &p_rid) const;
+ virtual bool is_mesh(const RID &p_rid) const;
+ virtual bool is_immediate(const RID &p_rid) const;
+ virtual bool is_multimesh(const RID &p_rid) const;
virtual bool is_particles(const RID &p_beam) const;
- virtual bool is_light(const RID& p_rid) const;
- virtual bool is_light_instance(const RID& p_rid) const;
- virtual bool is_particles_instance(const RID& p_rid) const;
- virtual bool is_skeleton(const RID& p_rid) const;
- virtual bool is_environment(const RID& p_rid) const;
- virtual bool is_shader(const RID& p_rid) const;
+ virtual bool is_light(const RID &p_rid) const;
+ virtual bool is_light_instance(const RID &p_rid) const;
+ virtual bool is_particles_instance(const RID &p_rid) const;
+ virtual bool is_skeleton(const RID &p_rid) const;
+ virtual bool is_environment(const RID &p_rid) const;
+ virtual bool is_shader(const RID &p_rid) const;
- virtual bool is_canvas_light_occluder(const RID& p_rid) const;
+ virtual bool is_canvas_light_occluder(const RID &p_rid) const;
- virtual void free(const RID& p_rid);
+ virtual void free(const RID &p_rid);
virtual void init();
virtual void finish();
@@ -1710,14 +1670,14 @@ public:
void reload_vram();
virtual bool has_feature(VS::Features p_feature) const;
-
+
virtual void restore_framebuffer();
- static RasterizerGLES2* get_singleton();
+ static RasterizerGLES2 *get_singleton();
virtual void set_force_16_bits_fbo(bool p_force);
- RasterizerGLES2(bool p_compress_arrays=false,bool p_keep_ram_copy=true,bool p_default_fragment_lighting=true,bool p_use_reload_hooks=false);
+ RasterizerGLES2(bool p_compress_arrays = false, bool p_keep_ram_copy = true, bool p_default_fragment_lighting = true, bool p_use_reload_hooks = false);
virtual ~RasterizerGLES2();
};