Exemplo n.º 1
0
        public bool Evaluate(Vector3 pos, ref LightProbProperties ret)
        {
            if (this._groups == null)
            {
                return(false);
            }
            ret = new LightProbProperties();
            int num = 0;

            foreach (MonoLightProbGroup group in this._groups)
            {
                LightProbProperties properties = new LightProbProperties();
                if (group.Evaluate(pos, ref properties))
                {
                    num++;
                    ret += properties;
                }
            }
            if (num != 0)
            {
                ret = (LightProbProperties)(ret / ((float)num));
            }
            else
            {
                ret = this.properties;
            }
            return(true);
        }
Exemplo n.º 2
0
        public override bool Evaluate(Vector3 pos, LightProbProperties defaultProperties, ref LightProbProperties ret)
        {
            Vector3 vector = Matrix4x4.TRS(base.transform.position, base.transform.rotation, Vector3.one).inverse.MultiplyPoint3x4(pos);

            this.validateInput();
            float a = 0f;
            float b = 0f;

            if (vector.z < 0f)
            {
                return(false);
            }
            b = (this.zlen - (2f * vector.z)) / this.zlen;
            if (vector.x >= 0f)
            {
                a = ((this.pXlen * vector.z) + (vector.x * this.zlen)) / (this.pXlen * this.zlen);
                if (a > 1f)
                {
                    return(false);
                }
            }
            else
            {
                a = ((this.nXlen * vector.z) - (vector.x * this.zlen)) / (this.nXlen * this.zlen);
                if (a > 1f)
                {
                    return(false);
                }
            }
            ret = LightProbProperties.Lerp(defaultProperties, base.properties, base.attenuateCurve.Evaluate(Mathf.Max(a, b)));
            return(true);
        }
Exemplo n.º 3
0
        public bool Evaluate(Vector3 pos, ref LightProbProperties ret)
        {
            if (Vector3.Distance(pos, base.XZPosition) > base.radius)
            {
                return(false);
            }
            ret = new LightProbProperties();
            int num2 = 0;

            foreach (MonoLightProb prob in this._probs)
            {
                LightProbProperties properties = new LightProbProperties();
                if (prob.Evaluate(pos, base.properties, ref properties))
                {
                    num2++;
                    ret += properties;
                }
            }
            if (num2 != 0)
            {
                ret = (LightProbProperties)(ret / ((float)num2));
            }
            else
            {
                ret = base.properties;
            }
            return(true);
        }
Exemplo n.º 4
0
        public virtual bool Evaluate(Vector3 pos, LightProbProperties defaultProperties, ref LightProbProperties ret)
        {
            float num = Vector3.Distance(pos, base.XZPosition);

            if (num > base.radius)
            {
                return(false);
            }
            ret = LightProbProperties.Lerp(defaultProperties, base.properties, this.attenuateCurve.Evaluate(num / base.radius));
            return(true);
        }
Exemplo n.º 5
0
        public override bool Evaluate(Vector3 pos, LightProbProperties defaultProperties, ref LightProbProperties ret)
        {
            Vector3 vector = Matrix4x4.TRS(base.transform.position, base.transform.rotation, Vector3.one).inverse.MultiplyPoint3x4(pos);
            float   num    = 0.5f * this.xlen;
            float   num2   = 0.5f * this.zlen;

            if (((vector.x > num) || (vector.x < -num)) || ((vector.z > num2) || (vector.z < -num2)))
            {
                return(false);
            }
            float a = Mathf.Abs(vector.x) / num;
            float b = Mathf.Abs(vector.z) / num2;

            ret = LightProbProperties.Lerp(defaultProperties, base.properties, base.attenuateCurve.Evaluate(Mathf.Max(a, b)));
            return(true);
        }
Exemplo n.º 6
0
        public bool Evaluate(Vector3 pos, ref LightProbProperties ret)
        {
            if (Vector3.Distance(pos, this.XZPosition) > this.radius)
            {
                return(false);
            }
            ret = new LightProbProperties();
            float t = 0f;

            foreach (MonoLightShadow shadow in this._probs)
            {
                float num4 = shadow.Evaluate(pos);
                if (num4 > t)
                {
                    t = num4;
                }
            }
            ret = LightProbProperties.Lerp(this.baseProperties, this.shadowProperties, t);
            return(true);
        }
Exemplo n.º 7
0
 public static LightProbProperties Lerp(LightProbProperties a, LightProbProperties b, float t)
 {
     return(new LightProbProperties {
         bodyColor = Color.Lerp(a.bodyColor, b.bodyColor, t), shadowColor = Color.Lerp(a.shadowColor, b.shadowColor, t)
     });
 }