public override bool hit(ref Ray ray, ref float t, ref Shade s)
    {
        Ray inv_ray = ray;

        inv_ray.origin    = Matrix.MultiplyPoint(inv_matrix, inv_ray.origin);
        inv_ray.direction = Matrix.MultiplyVector(inv_matrix, inv_ray.direction);
        if (obj_ptr.hit(ref inv_ray, ref t, ref s))
        {
            s.normal = Matrix.MultiplyVector(inv_matrix, s.normal, true);
            if (obj_ptr.get_material() != null)
            {
                mat_Ptr = obj_ptr.get_material();
            }
            return(true);
        }
        return(false);
    }
Esempio n. 2
0
 public virtual void set_object(MeshObject objPtr)
 {
     obj_ptr      = objPtr;
     materail_ptr = obj_ptr.get_material();
 }