public override Ray Reflect(Vector vec, Vector dir, float dist, Ray ray) { Vector nextOrgin = new Vector(ray.orgin + dist * ray.dir); //Vector nextOrgin = dist * ray.dir; Vector nextNormal = norm; return(SurfaceFunc.Reflect(m_mat, nextOrgin, ray.dir, nextNormal)); }
public override Ray Reflect(Vector vec, Vector dir, float dist, Ray ray) { //dir = (dist * ray.dir + (ray.orgin - pos)).Normalize(); //Vector nextOrgin = new Vector(vec + dist * ray.dir); Vector nextOrgin = new Vector(ray.orgin + dist * ray.dir); Vector nextNormal = (nextOrgin - this.pos).Normalize(); //Vector nextNormal = (dist * ray.dir + (ray.orgin - pos)).Normalize(); nextOrgin = nextOrgin + nextNormal * 0.01f; return(SurfaceFunc.Reflect(m_mat, nextOrgin, ray.dir, nextNormal)); }
public override bool Intersect(Ray r, ref float dist) { Vector norm = SurfaceFunc.CalculateSurfaceNormal(m_pos); norm.m_y = -norm.m_y; float facing = norm.DotProduct(r.orgin); if (facing <= Config.Tolerance && facing >= Config.MinTolerance) { //normal = norm; //closest = quad; dist = (float)SurfaceFunc.Vec3Distance(r.orgin, norm); if (dist < Config.MinHitDistance) { return(false); } return(true); } return(false); }
public override Vector CalculateSurfaceNormal() { return(SurfaceFunc.CalculateSurfaceNormal(m_pos)); }
public override Ray Reflect(Vector vec, Vector normal, float dist, Ray ray) { //Bounce off the surface then just f**k off return(new Ray(SurfaceFunc.Reflect(vec, normal)));; }