diff options
author | James McLean <james@mcleanlabs.ca> | 2015-06-11 10:46:59 -0400 |
---|---|---|
committer | James McLean <james@mcleanlabs.ca> | 2015-06-11 10:46:59 -0400 |
commit | 237d6afa1602c414390e8f008580d288c3c7e694 (patch) | |
tree | 678b0ab27b66425ad2a292cea094661353c96f97 /drivers | |
parent | b19ed63eb6b3aa0fd9cdf54847deff96fd4830df (diff) | |
parent | c845c2a8276c61323416139790962a096a8d956e (diff) |
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 11 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_gles2.h | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index a588643fd9..f8e5d11dcf 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -4394,7 +4394,7 @@ void RasterizerGLES2::begin_shadow_map( RID p_light_instance, int p_shadow_pass } -void RasterizerGLES2::set_camera(const Transform& p_world,const CameraMatrix& p_projection) { +void RasterizerGLES2::set_camera(const Transform& p_world,const CameraMatrix& p_projection,bool p_ortho_hint) { camera_transform=p_world; if (current_rt && current_rt_vflip) { @@ -4406,6 +4406,7 @@ void RasterizerGLES2::set_camera(const Transform& p_world,const CameraMatrix& p_ camera_z_near=camera_projection.get_z_near(); camera_z_far=camera_projection.get_z_far(); camera_projection.get_viewport_size(camera_vp_size.x,camera_vp_size.y); + camera_ortho=p_ortho_hint; } void RasterizerGLES2::add_light( RID p_light_instance ) { @@ -4768,8 +4769,11 @@ void RasterizerGLES2::_add_geometry( const Geometry* p_geometry, const InstanceD e->geometry_cmp=p_geometry_cmp; e->material=m; e->instance=p_instance; - //e->depth=camera_plane.distance_to(p_world->origin); - e->depth=camera_transform.origin.distance_to(p_instance->transform.origin); + if (camera_ortho) { + e->depth=camera_plane.distance_to(p_instance->transform.origin); + } else { + e->depth=camera_transform.origin.distance_to(p_instance->transform.origin); + } e->owner=p_owner; e->light_type=0; e->additive=false; @@ -10796,6 +10800,7 @@ void RasterizerGLES2::init() { current_rt=NULL; current_vd=NULL; current_debug=VS::SCENARIO_DEBUG_DISABLED; + camera_ortho=false; glGenBuffers(1,&gui_quad_buffer); glBindBuffer(GL_ARRAY_BUFFER,gui_quad_buffer); diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index e83bd39caa..d337ecfb64 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -1052,6 +1052,7 @@ class RasterizerGLES2 : public Rasterizer { float camera_z_near; float camera_z_far; Size2 camera_vp_size; + bool camera_ortho; Set<String> extensions; bool texscreen_copied; bool texscreen_used; @@ -1589,7 +1590,7 @@ public: 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); + 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 |