Ejemplo n.º 1
0
        public void At(Surface.Intersection intersection, ref Surface.Attributes attributes)
        {
            Triangle tri = triangles[intersection.PrimitiveID];

            if (smoothNormals)
            {
                // barycentric interpolation
                Vector smoothed = tri.V1.Normal * intersection.LocalU
                                  + tri.V2.Normal * intersection.LocalV
                                  + tri.V0.Normal * (1 - intersection.LocalU - intersection.LocalV);

                attributes.Basis = new Basis(smoothed.Normalize());
            }
            else
            {
                attributes.Basis = new Basis(tri.FaceNormal);
            }
        }
Ejemplo n.º 2
0
 public void At(Surface.Intersection intersection, ref Surface.Attributes attributes)
 {
     attributes.Material = Material;
 }