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.h86
1 files changed, 75 insertions, 11 deletions
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index f18bdd1ff7..0fee8bf918 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -80,6 +80,8 @@ class RasterizerGLES2 : public Rasterizer {
bool read_depth_supported;
bool use_framebuffers;
bool use_shadow_mapping;
+ ShadowFilterTechnique shadow_filter;
+
bool use_shadow_esm;
bool use_shadow_pcf;
bool use_hw_skeleton_xform;
@@ -171,8 +173,11 @@ class RasterizerGLES2 : public Rasterizer {
bool can_zpass;
bool has_texscreen;
bool has_screen_uv;
+ bool writes_vertex;
+ bool uses_discard;
Map<StringName,ShaderLanguage::Uniform> uniforms;
+ StringName first_texture;
SelfList<Shader> dirty_list;
@@ -188,6 +193,8 @@ class RasterizerGLES2 : public Rasterizer {
can_zpass=true;
has_texscreen=false;
has_screen_uv=false;
+ writes_vertex=false;
+ uses_discard=false;
}
@@ -233,6 +240,7 @@ class RasterizerGLES2 : public Rasterizer {
flags[VS::MATERIAL_FLAG_VISIBLE]=true;
for(int i=0;i<VS::MATERIAL_HINT_MAX;i++)
hints[i]=false;
+ hints[VS::MATERIAL_HINT_NO_DEPTH_DRAW_FOR_ALPHA]=true;
line_width=1;
has_alpha=false;
@@ -254,7 +262,7 @@ class RasterizerGLES2 : public Rasterizer {
enum Type {
GEOMETRY_INVALID,
GEOMETRY_SURFACE,
- GEOMETRY_POLY,
+ GEOMETRY_IMMEDIATE,
GEOMETRY_PARTICLES,
GEOMETRY_MULTISURFACE,
};
@@ -374,6 +382,7 @@ class RasterizerGLES2 : public Rasterizer {
Vector<Surface*> surfaces;
int morph_target_count;
VS::MorphTargetMode morph_target_mode;
+ AABB custom_aabb;
mutable uint64_t last_pass;
Mesh() {
@@ -454,6 +463,31 @@ class RasterizerGLES2 : public Rasterizer {
mutable RID_Owner<MultiMesh> multimesh_owner;
mutable SelfList<MultiMesh>::List _multimesh_dirty_list;
+ struct Immediate : public Geometry {
+
+ struct Chunk {
+
+ RID texture;
+ VS::PrimitiveType primitive;
+ Vector<Vector3> vertices;
+ Vector<Vector3> normals;
+ Vector<Plane> tangents;
+ Vector<Color> colors;
+ Vector<Vector2> uvs;
+ Vector<Vector2> uvs2;
+ };
+
+ List<Chunk> chunks;
+ bool building;
+ int mask;
+ AABB aabb;
+
+ Immediate() { type=GEOMETRY_IMMEDIATE; building=false;}
+
+ };
+
+ mutable RID_Owner<Immediate> immediate_owner;
+
struct Particles : public Geometry {
ParticleSystemSW data; // software particle system
@@ -582,11 +616,15 @@ class RasterizerGLES2 : public Rasterizer {
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;
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;
@@ -659,11 +697,8 @@ class RasterizerGLES2 : public Rasterizer {
Transform transform;
CameraMatrix projection;
- Transform custom_transform;
- CameraMatrix custom_projection;
-
- Transform custom_transform2;
- CameraMatrix custom_projection2;
+ Transform custom_transform[4];
+ CameraMatrix custom_projection[4];
Vector3 light_vector;
Vector3 spot_vector;
@@ -675,11 +710,9 @@ class RasterizerGLES2 : public Rasterizer {
Vector2 dp;
- CameraMatrix shadow_projection;
- CameraMatrix shadow_projection2;
+ CameraMatrix shadow_projection[4];
+ float shadow_split[4];
- float shadow_split;
- float shadow_split2;
ShadowBuffer* near_shadow_buffer;
@@ -934,7 +967,7 @@ class RasterizerGLES2 : public Rasterizer {
void _setup_light(uint16_t p_light);
_FORCE_INLINE_ void _setup_shader_params(const Material *p_material);
- bool _setup_material(const Geometry *p_geometry,const Material *p_material,bool p_no_const_light);
+ 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);
@@ -1098,6 +1131,16 @@ class RasterizerGLES2 : public Rasterizer {
void _copy_screen_quad();
void _copy_to_texscreen();
+
+ Vector3 chunk_vertex;
+ Vector3 chunk_normal;
+ Plane chunk_tangent;
+ Color chunk_color;
+ Vector2 chunk_uv;
+ Vector2 chunk_uv2;
+ GLuint tc0_id_cache;
+ GLuint tc0_idx;
+
public:
/* TEXTURE API */
@@ -1183,6 +1226,9 @@ public:
virtual AABB mesh_get_aabb(RID p_mesh) const;
+ 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();
@@ -1204,6 +1250,22 @@ public:
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_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 RID immediate_get_material(RID p_immediate) const;
+
/* PARTICLES API */
virtual RID particles_create();
@@ -1363,6 +1425,7 @@ public:
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();
@@ -1410,6 +1473,7 @@ public:
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;