Exemplo n.º 1
0
        public override ColorChannel calcColor(Ray3 ray, Vector3 position, Vector3 normal)
        {
            float        nl      = normal.dot(Constant.light);
            Vector3      h       = (Constant.light.sub(ray.getDirection)).nor();
            float        nh      = normal.dot(h);
            ColorChannel tmpDiff = diffuse.mul(Math.Max(nl, 0));
            ColorChannel tmpSpec = specular.mul(Math.Max(nh, 0));

            return(Constant.lightChannel.mud(tmpDiff.add(tmpSpec)));
        }