erebus

diff liberebus/src/snode.cc @ 17:e9da2916bc79

fixed the normal bug
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 26 May 2014 05:41:28 +0300
parents e2d9bf168a41
children c4d48a21bc4a
line diff
     1.1 --- a/liberebus/src/snode.cc	Sun May 25 02:23:39 2014 +0300
     1.2 +++ b/liberebus/src/snode.cc	Mon May 26 05:41:28 2014 +0300
     1.3 @@ -119,6 +119,16 @@
     1.4  	return scale;	// TODO
     1.5  }
     1.6  
     1.7 +const Matrix4x4 &SceneNode::get_matrix() const
     1.8 +{
     1.9 +	return xform;
    1.10 +}
    1.11 +
    1.12 +const Matrix4x4 &SceneNode::get_inv_matrix() const
    1.13 +{
    1.14 +	return inv_xform;
    1.15 +}
    1.16 +
    1.17  
    1.18  void SceneNode::update_node(long msec)
    1.19  {
    1.20 @@ -154,6 +164,8 @@
    1.21  			if(!hit) return true;
    1.22  			if(hit->dist < nearest.dist) {
    1.23  				nearest = *hit;
    1.24 +				nearest.node = this;
    1.25 +				nearest.local_ray = local_ray;
    1.26  			}
    1.27  		}
    1.28  	}
    1.29 @@ -169,7 +181,6 @@
    1.30  
    1.31  	if(nearest.dist < FLT_MAX) {
    1.32  		*hit = nearest;
    1.33 -		hit->local_ray = local_ray;
    1.34  		hit->world_ray = ray;
    1.35  		return true;
    1.36  	}