Esempio 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);
            }
        }
Esempio n. 2
0
 public void At(Surface.Intersection intersection, ref Surface.Attributes attributes)
 {
     attributes.Material = Material;
 }