Subversion Repositories gelsvn

Rev

Rev 510 | Rev 554 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 510 Rev 541
Line 66... Line 66...
66
            hit_pos = origin + dist*direction;      
66
            hit_pos = origin + dist*direction;      
67
        }
67
        }
68
 
68
 
69
        void compute_normal()
69
        void compute_normal()
70
        {
70
        {
71
            CGLA::Vec3i face = hit_object->normals.face(hit_face_id);
71
            const CGLA::Vec3i& face = hit_object->normals.face(hit_face_id);
72
            CGLA::Vec3f normal0 = hit_object->normals.vertex(face[0]);
72
            const CGLA::Vec3f& normal0 = hit_object->normals.vertex(face[0]);
73
            CGLA::Vec3f normal1 = hit_object->normals.vertex(face[1]);
73
            const CGLA::Vec3f& normal1 = hit_object->normals.vertex(face[1]);
74
            CGLA::Vec3f normal2 = hit_object->normals.vertex(face[2]);
74
            const CGLA::Vec3f& normal2 = hit_object->normals.vertex(face[2]);
75
            hit_normal = normalize(normal0*(1 - u - v) + normal1*u + normal2*v);      
75
            hit_normal = normalize(normal0*(1 - u - v) + normal1*u + normal2*v);      
76
        }
76
        }
77
 
77
 
78
        void reflect(const CGLA::Vec3f &normal)
78
        void reflect(const CGLA::Vec3f &normal)
79
        {
79
        {