Пример #1
0
 public void Setup(RayIntersection isect)
 {
     for (int index = 0; index < bxdfs.Count; index++)
     {
         bxdfs[index].Setup(isect);
     }
 }
Пример #2
0
        public RayIntersection EvalIntersection(RayDifferential ray, ref RayHit rh, RayIntersection isect)
        {
            var ii = isect ?? (isect = new RayIntersection());
            var currentTriangleIndex = (int) rh.Index;

            var obj = GetObjectByTriangleIndex(currentTriangleIndex);
            ii.Hitpoint = ray.Point(rh.Distance);
            ii.BaryCentricPoint = new UV(rh.U, rh.V);
            

            obj.Entity.InterpolateTriangleNormal(currentTriangleIndex, rh.U, rh.V, ref ii.ShadingNormal);
            obj.Entity.InterpolateTriUV(currentTriangleIndex, rh.U, rh.V, out ii.TextureCoords);

            ii.GeoNormal = scene.sceneData.Triangles[currentTriangleIndex].ComputeNormal(scene.sceneData.GeoData.Vertices);
            ii.ComputeDifferential(ray);

            return ii;
        }