From 6f0b4678e26c04abfc88c0226c803e78a108de98 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 29 May 2014 10:56:39 -0300 Subject: More 3D Improvements -=-=-=-=-=-=-=-=-=-= -Sprite3D and AnimatedSprite3D support. -Opaque pre-pass works, is compatible with shadows -Improved shadow map rendering (can differentiate between plain opaque and opaque with shaders/discard/etc) -Added option to use alpha discard in FixedMaterial -Improved Glow FX, many more options (three modes, Additive, Screen and SoftLight), strength and scale -Ability for Background (image or cubemap) to send to glow buffer -Dumb Deploy of clients now actually works in Android -Many Many rendering fixes, 3D is much more usable now. --- drivers/gles1/rasterizer_gles1.cpp | 81 ++++++++++++++++++++++++++++++++++++++ drivers/gles1/rasterizer_gles1.h | 28 +++++++++++++ 2 files changed, 109 insertions(+) (limited to 'drivers/gles1') diff --git a/drivers/gles1/rasterizer_gles1.cpp b/drivers/gles1/rasterizer_gles1.cpp index 60c88af508..9e13f12abe 100644 --- a/drivers/gles1/rasterizer_gles1.cpp +++ b/drivers/gles1/rasterizer_gles1.cpp @@ -2165,6 +2165,74 @@ int RasterizerGLES1::multimesh_get_visible_instances(RID p_multimesh) const { } +/* IMMEDIATE API */ + + +RID RasterizerGLES1::immediate_create() { + + Immediate *im = memnew( Immediate ); + return immediate_owner.make_rid(im); + +} + +void RasterizerGLES1::immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture){ + + +} +void RasterizerGLES1::immediate_vertex(RID p_immediate,const Vector3& p_vertex){ + + +} +void RasterizerGLES1::immediate_normal(RID p_immediate,const Vector3& p_normal){ + + +} +void RasterizerGLES1::immediate_tangent(RID p_immediate,const Plane& p_tangent){ + + +} +void RasterizerGLES1::immediate_color(RID p_immediate,const Color& p_color){ + + +} +void RasterizerGLES1::immediate_uv(RID p_immediate,const Vector2& tex_uv){ + + +} +void RasterizerGLES1::immediate_uv2(RID p_immediate,const Vector2& tex_uv){ + + +} + +void RasterizerGLES1::immediate_end(RID p_immediate){ + + +} +void RasterizerGLES1::immediate_clear(RID p_immediate) { + + +} + +AABB RasterizerGLES1::immediate_get_aabb(RID p_immediate) const { + + return AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); +} + +void RasterizerGLES1::immediate_set_material(RID p_immediate,RID p_material) { + + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + im->material=p_material; +} + +RID RasterizerGLES1::immediate_get_material(RID p_immediate) const { + + const Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND_V(!im,RID()); + return im->material; + +} + /* PARTICLES API */ @@ -5327,6 +5395,12 @@ bool RasterizerGLES1::is_mesh(const RID& p_rid) const { return mesh_owner.owns(p_rid); } + +bool RasterizerGLES1::is_immediate(const RID& p_rid) const { + + return immediate_owner.owns(p_rid); +} + bool RasterizerGLES1::is_multimesh(const RID& p_rid) const { return multimesh_owner.owns(p_rid); @@ -5447,6 +5521,13 @@ void RasterizerGLES1::free(const RID& p_rid) { particles_owner.free(p_rid); memdelete(particles); + } else if (immediate_owner.owns(p_rid)) { + + Immediate *immediate = immediate_owner.get(p_rid); + ERR_FAIL_COND(!immediate); + + immediate_owner.free(p_rid); + memdelete(immediate); } else if (particles_instance_owner.owns(p_rid)) { ParticlesInstance *particles_isntance = particles_instance_owner.get(p_rid); diff --git a/drivers/gles1/rasterizer_gles1.h b/drivers/gles1/rasterizer_gles1.h index dbb411c8a3..323d00a467 100644 --- a/drivers/gles1/rasterizer_gles1.h +++ b/drivers/gles1/rasterizer_gles1.h @@ -371,6 +371,15 @@ class RasterizerGLES1 : public Rasterizer { mutable RID_Owner multimesh_owner; + + struct Immediate { + + RID material; + int empty; + }; + + mutable RID_Owner immediate_owner; + struct Particles : public Geometry { ParticleSystemSW data; // software particle system @@ -963,6 +972,23 @@ 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(); @@ -1120,6 +1146,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(); @@ -1176,6 +1203,7 @@ public: virtual bool is_material(const RID& p_rid) const; virtual bool is_mesh(const RID& p_rid) const; virtual bool is_multimesh(const RID& p_rid) const; + virtual bool is_immediate(const RID& p_rid) const; virtual bool is_particles(const RID &p_beam) const; virtual bool is_light(const RID& p_rid) const; -- cgit v1.2.3