示例#1
0
        public override Vec3 TraceRay(Ray ray)
        {
            ShadeRec sr = new ShadeRec(world.HitBareBonesObjects(ray));

            if (sr.HitAnObject)
            {
                return(sr.Color);
            }

            return(base.TraceRay(ray));
        }
示例#2
0
        public override Vec3 TraceRay(Ray ray)
        {
            ShadeRec sr = world.HitBareBonesObjects(ray);

            if (sr.HitAnObject)
            {
                return(sr.Color);
            }

            return(world.BackgroundColor);
        }
示例#3
0
        public override Vec3 TraceRay(Ray ray, int depth)
        {
            ShadeRec sr = world.HitObjects(ray);

            if (sr.HitAnObject)
            {
                sr.Ray = ray;
                return(sr.Material.Shade(sr));
            }

            return(world.BackgroundColor);
        }
示例#4
0
        public virtual Vector3 TraceRay(Ray ray)
        {
            ShadeRec sr = m_context.HitObjects(ray);

            if (sr.isHitObj)
            {
                return(sr.hitMaterial.Shade(sr));
            }
            else
            {
                return(ColourF.Black);
            }
        }
示例#5
0
        public override Vector3 TraceRay(Ray ray)
        {
            ShadeRec sr = m_context.HitObjects(ray);

            if (sr.isHitObj)
            {
                return(sr.hitMaterial.ShadeAreaLight(sr));
            }
            else
            {
                return(ColourF.Black);
            }
        }
示例#6
0
        public override Vector3 TraceRay(Ray ray)
        {
            ShadeRec sr = m_context.HitObjects(ray);

            if (sr.isHitObj)
            {
                Vector3 normal = sr.normal.Nor();
                return(0.5f * (normal + Vector3.One));
            }
            else
            {
                return(ColourF.Black);
            }
        }
        public override Vec3 TraceRay(Ray ray, int depth)
        {
            if (depth > world.ViewPlane.MaxDepth)
            {
                return(ColorUtils.BLACK);
            }

            ShadeRec sr = world.HitObjects(ray);

            if (sr.HitAnObject)
            {
                sr.Depth = depth;
                sr.Ray   = ray;

                return(sr.Material.GlobalShade(sr));
            }

            return(world.BackgroundColor);
        }
示例#8
0
        public override Vec3 TraceRay(Ray ray, ref double tmin, int depth)
        {
            if (depth > world.ViewPlane.MaxDepth)
            {
                return(ColorUtils.BLACK);
            }
            else
            {
                ShadeRec sr = world.HitObjects(ray);

                if (sr.HitAnObject)
                {
                    sr.Ray   = ray;
                    sr.Depth = depth;
                    tmin     = sr.Tmin;

                    return(sr.Material.AreaLightShade(sr));
                }

                tmin = MathUtils.HugeValue;

                return(world.BackgroundColor);
            }
        }