コード例 #1
0
        public unsafe Color Lighting(ILight light, IShape shape, ref Tuple point, ref Tuple eye, ref Tuple normal, double lightIntensity)
        {
            var     color = Pattern.GetColorAtShape(shape, ref point);
            double *x     = stackalloc double[1];
            double *y     = stackalloc double[1];
            double *z     = stackalloc double[1];

            x[0] = light.Position.X;
            y[0] = light.Position.Y;
            z[0] = light.Position.Z;
            var lightColor = light.GetIntensityAt(x[0], y[0], z[0], ref point);

            return(Lighting(1, x, y, z, ref point, ref eye, ref normal, lightIntensity, color, lightColor));
        }