예제 #1
0
파일: TLight.cs 프로젝트: heber/FreeOQ
		public virtual TColor Result(TVec3 r, TVec3 n, TColor Diffuse)
		{
			TColor tcolor = this.Ambient;
			foreach (TLight.TSource tsource in this.ParallelBeams)
			{
				double num1 = n * tsource.o;
				if (num1 >= 0.0)
				{
					double num2 = num1 * num1 / (n * n * tsource.o * tsource.o);
					tcolor += num2 * tsource.c;
				}
			}
			foreach (TLight.TSource tsource in this.NearSources)
			{
				TVec3 tvec3 = tsource.o - r;
				double num1 = n * tvec3;
				double num2 = tvec3 * tvec3;
				if (num1 >= 0.0)
				{
					double num3 = num1 * num1 / (n * n * num2 * num2);
					tcolor += num3 * tsource.c;
				}
			}
			return Diffuse * tcolor;
		}
예제 #2
0
        public virtual TColor Result(TVec3 r, TVec3 n, TColor Diffuse)
        {
            TColor tcolor = this.Ambient;

            foreach (TLight.TSource tsource in this.ParallelBeams)
            {
                double num1 = n * tsource.o;
                if (num1 >= 0.0)
                {
                    double num2 = num1 * num1 / (n * n * tsource.o * tsource.o);
                    tcolor += num2 * tsource.c;
                }
            }
            foreach (TLight.TSource tsource in this.NearSources)
            {
                TVec3  tvec3 = tsource.o - r;
                double num1  = n * tvec3;
                double num2  = tvec3 * tvec3;
                if (num1 >= 0.0)
                {
                    double num3 = num1 * num1 / (n * n * num2 * num2);
                    tcolor += num3 * tsource.c;
                }
            }
            return(Diffuse * tcolor);
        }
예제 #3
0
        public static TColor Clip(TColor c)
        {
            TColor tcolor = c;

            tcolor.Clip();
            return(tcolor);
        }
예제 #4
0
        public TLight()
        {
            this.Ambient       = new TColor(Color.PaleTurquoise);
            this.ParallelBeams = new TLight.TSource[1]
            {
                new TLight.TSource(new TVec3(3, -2, 2), (TColor)Color.LightYellow)
            };
            this.NearSources = new TLight.TSource[0];

            this.SetSfumatoDay();
            this.SetShadowSources(0.25);
        }
예제 #5
0
파일: TLight.cs 프로젝트: heber/FreeOQ
		public TLight()
		{
			this.Ambient = new TColor(Color.PaleTurquoise);
			this.ParallelBeams = new TLight.TSource[1]
			{
				new TLight.TSource(new TVec3(3, -2, 2), (TColor)Color.LightYellow)
			};
			this.NearSources = new TLight.TSource[0];

			this.SetSfumatoDay();
			this.SetShadowSources(0.25);
		}
예제 #6
0
        private unsafe void Pnx3KTVZoc(int *obj0)
        {
            int[,] numArray = new int[this.Jm23JdRAV2, this.C843M1JDuK];
            if (!this.hH1321Stt8)
            {
                int *numPtr = obj0;
                for (int index1 = 0; index1 < this.C843M1JDuK; ++index1)
                {
                    for (int index2 = 0; index2 < this.Jm23JdRAV2; ++index2)
                    {
                        numArray[index2, index1] = *numPtr++;
                    }
                }
            }
            double normInf1 = this.tn83Ged55u.NormInf;
            double normInf2 = this.PqY3RZfYIU.NormInf;
            TVec3  Origin   = this.Sp23PRDLnW - 0.5 * this.tn83Ged55u - 0.5 * this.PqY3RZfYIU;
            TVec3  tvec3_1  = this.tn83Ged55u / normInf1;
            TVec3  tvec3_2  = this.PqY3RZfYIU / normInf2;
            double num1     = (this.MaxX - this.MinX) / normInf1;
            double num2     = (this.MaxY - this.MinY) / normInf2;
            double num3     = num1;
            double num4     = num2;

            if ((double)(2 * this.nx) >= normInf1 && (double)(2 * this.ny) >= normInf2)
            {
                num3 = (this.MaxX - this.MinX) / (double)this.nx;
                num4 = (this.MaxY - this.MinY) / (double)this.ny;
            }
            double ValO1   = this.MinX + 0.01 * num3;
            double ValO2   = this.MinY + 0.01 * num4;
            TVec3  tvec3_3 = this.tn83Ged55u;
            TVec3  tvec3_4 = this.PqY3RZfYIU;

            if (this.tn83Ged55u.z > 0.0)
            {
                ValO1   = this.MaxX - 0.99 * num3;
                num1    = -num1;
                num3    = -num3;
                Origin += this.tn83Ged55u;
                tvec3_3 = -this.tn83Ged55u;
                tvec3_1 = -tvec3_1;
            }
            if (this.PqY3RZfYIU.z > 0.0)
            {
                ValO2   = this.MaxY - 0.99 * num4;
                num2    = -num2;
                num4    = -num4;
                Origin += this.PqY3RZfYIU;
                tvec3_4 = -this.PqY3RZfYIU;
                tvec3_2 = -tvec3_2;
            }
            int num5 = (int)normInf1;
            int num6 = (int)normInf2;
            int num7 = (int)this.gcU3NtonPe.NormInf;

            bool[] flagArray1 = new bool[num5 + 2];
            bool[] flagArray2 = new bool[num6 + 2];
            bool[] flagArray3 = new bool[num7 + 2];
            if (this.Grid)
            {
                TAxisCalc taxisCalc1 = new TAxisCalc(Origin, Origin + tvec3_3, ValO1, ValO1 + normInf1 * num1, 10);
                TAxisCalc taxisCalc2 = new TAxisCalc(Origin, Origin + tvec3_4, ValO2, ValO2 + normInf2 * num2, 10);
                double    Val1       = ValO1;
                int       index1     = 0;
                while (index1 <= num5)
                {
                    if (taxisCalc1.TickPassed(Val1))
                    {
                        flagArray1[index1] = true;
                    }
                    ++index1;
                    Val1 += num1;
                }
                double Val2   = ValO2;
                int    index2 = 0;
                while (index2 <= num6)
                {
                    if (taxisCalc2.TickPassed(Val2))
                    {
                        flagArray2[index2] = true;
                    }
                    ++index2;
                    Val2 += num2;
                }
            }
            if (this.LevelLines)
            {
                for (int index = 0; index < num7; ++index)
                {
                    flagArray3[index] = (index & 4) != 0;
                }
            }
            switch (this.Look)
            {
            case EChartLook.FromZeroToSurface:
                double x1     = ValO1;
                int    index3 = 0;
                while (index3 <= num5)
                {
                    bool   flag    = flagArray1[index3];
                    TVec3  tvec3_5 = Origin;
                    double y       = ValO2;
                    int    index1  = 0;
                    while (index1 <= num6)
                    {
                        double num8 = this.f(x1, y);
                        if (num8 > 0.0)
                        {
                            int num9  = (int)tvec3_5.y;
                            int num10 = (int)(tvec3_5.y - num8);
                            if (num10 < 0)
                            {
                                num10 = 0;
                            }
                            TColor tcolor1 = this.color0(x1, y);
                            if (this.Grid && (flag || flagArray2[index1]))
                            {
                                tcolor1 = this.Surface.GridDiffuse;
                            }
                            TColor tcolor2 = this.E0C3BMxUWS(x1, y, num3, num4, tcolor1);
                            tcolor2.Clip();
                            int num11  = tcolor2.Get888();
                            int index2 = (int)tvec3_5.x;
                            if (this.LevelLines)
                            {
                                TColor tcolor3 = 0.81 * tcolor2;
                                tcolor3.Clip();
                                int num12 = tcolor3.Get888();
                                for (int index4 = num9; index4 >= num10; --index4)
                                {
                                    numArray[index2, index4] = flagArray3[num9 - index4] ? num12 : num11;
                                }
                            }
                            else
                            {
                                for (int index4 = num9; index4 >= num10; --index4)
                                {
                                    numArray[index2, index4] = num11;
                                }
                            }
                        }
                        ++index1;
                        y       += num2;
                        tvec3_5 += tvec3_2;
                    }
                    ++index3;
                    x1     += num1;
                    Origin += tvec3_1;
                }
                break;

            case EChartLook.SurfaceOnly:
                double x2     = ValO1;
                int    index5 = 0;
                while (index5 < num5)
                {
                    bool   flag    = flagArray1[index5];
                    TVec3  tvec3_5 = Origin;
                    double y       = ValO2;
                    int    index1  = 0;
                    while (index1 < num6)
                    {
                        double num8  = this.f(x2, y);
                        double num9  = this.f(x2 + num1, y);
                        double num10 = this.f(x2, y + num2);
                        double num11 = this.f(x2 + num1, y + num2);
                        double num12 = num8;
                        double num13 = num8;
                        if (num9 < num12)
                        {
                            num12 = num9;
                        }
                        if (num10 < num12)
                        {
                            num12 = num10;
                        }
                        if (num11 < num12)
                        {
                            num12 = num11;
                        }
                        if (num9 > num13)
                        {
                            num13 = num9;
                        }
                        if (num10 > num13)
                        {
                            num13 = num10;
                        }
                        if (num11 > num13)
                        {
                            num13 = num11;
                        }
                        int num14 = (int)tvec3_5.y;
                        int num15 = (int)(tvec3_5.y - num12 + 1.0);
                        int num16 = (int)(tvec3_5.y - num13);
                        if (num15 < this.C843M1JDuK && num15 >= 0 && (num16 < this.C843M1JDuK && num16 >= 0))
                        {
                            TColor tcolor1 = this.color0(x2, y);
                            if (this.Grid && (flag || flagArray2[index1]))
                            {
                                tcolor1 = this.Surface.GridDiffuse;
                            }
                            TColor tcolor2 = this.E0C3BMxUWS(x2, y, num3, num4, tcolor1);
                            tcolor2.Clip();
                            int num17  = tcolor2.Get888();
                            int index2 = (int)tvec3_5.x;
                            if (this.LevelLines)
                            {
                                TColor tcolor3 = 0.81 * tcolor2;
                                tcolor3.Clip();
                                int num18 = tcolor3.Get888();
                                for (int index4 = num15; index4 >= num16; --index4)
                                {
                                    if (num12 > 0.0 || numArray[index2, index4] >= 0 || numArray[index2, index4] == -1)
                                    {
                                        numArray[index2, index4] = (num14 - index4 & 4) != 0 ? num18 : num17;
                                    }
                                }
                            }
                            else
                            {
                                for (int index4 = num15; index4 >= num16; --index4)
                                {
                                    if (num12 > 0.0 || numArray[index2, index4] >= 0 || numArray[index2, index4] == -1)
                                    {
                                        numArray[index2, index4] = num17;
                                    }
                                }
                            }
                        }
                        ++index1;
                        y       += num2;
                        tvec3_5 += tvec3_2;
                    }
                    ++index5;
                    x2     += num1;
                    Origin += tvec3_1;
                }
                break;
            }
            for (int index1 = 0; index1 < this.C843M1JDuK; ++index1)
            {
                for (int index2 = 0; index2 < this.Jm23JdRAV2; ++index2)
                {
                    *obj0++ = numArray[index2, index1];
                }
            }
        }
예제 #7
0
        private TColor E0C3BMxUWS(double obj0, double obj1, double obj2, double obj3, TColor obj4)
        {
            TVec3 n = new TVec3(obj2, 0.0, this.f(obj0 + obj2, obj1) - this.f(obj0, obj1)) ^ new TVec3(0.0, obj3, this.f(obj0, obj1 + obj3) - this.f(obj0, obj1));

            return(this.trP3fdnMpS.Result(new TVec3(obj0, obj1, this.f(obj0, obj1)), n, obj4));
        }
예제 #8
0
파일: TLight.cs 프로젝트: heber/FreeOQ
			public TSource(TVec3 o, TColor c)
			{
				this.o = o;
				this.c = c;
			}
예제 #9
0
파일: TLight.cs 프로젝트: heber/FreeOQ
		public void SetVeryBrightDay()
		{
			this.SetSfumatoDay();
			this.Ambient *= 1.2;
			this.ParallelBeams[0].c *= 1.2;
		}
예제 #10
0
파일: TColor.cs 프로젝트: heber/FreeOQ
		public static TColor Clip(TColor c)
		{
			TColor tcolor = c;
			tcolor.Clip();
			return tcolor;
		}
예제 #11
0
 public TSource(TVec3 o, TColor c)
 {
     this.o = o;
     this.c = c;
 }
예제 #12
0
 public void SetVeryBrightDay()
 {
     this.SetSfumatoDay();
     this.Ambient            *= 1.2;
     this.ParallelBeams[0].c *= 1.2;
 }
예제 #13
0
 public void SetNormalDay()
 {
     this.SetSfumatoDay();
     this.Ambient            *= 1.1;
     this.ParallelBeams[0].c *= 1.1;
 }
예제 #14
0
 public void SetSfumatoDay()
 {
     this.Ambient            = new TColor(0.55, 0.55, 0.7);
     this.ParallelBeams[0].c = 2.05 * new TColor(1.0, 1.0, 0.55);
 }
예제 #15
0
파일: TFunction.cs 프로젝트: heber/FreeOQ
		private TColor E0C3BMxUWS(double obj0, double obj1, double obj2, double obj3, TColor obj4)
		{
			TVec3 n = new TVec3(obj2, 0.0, this.f(obj0 + obj2, obj1) - this.f(obj0, obj1)) ^ new TVec3(0.0, obj3, this.f(obj0, obj1 + obj3) - this.f(obj0, obj1));
			return this.trP3fdnMpS.Result(new TVec3(obj0, obj1, this.f(obj0, obj1)), n, obj4);
		}
예제 #16
0
파일: TSurface.cs 프로젝트: heber/FreeOQ
		public TSurface()
		{
			this.Diffuse = new TColor(Color.White);
			this.GridDiffuse = new TColor(Color.Orange);
			this.Specular = new TColor(Color.White);
		}
예제 #17
0
파일: TLight.cs 프로젝트: heber/FreeOQ
		public void SetSfumatoDay()
		{
			this.Ambient = new TColor(0.55, 0.55, 0.7);
			this.ParallelBeams[0].c = 2.05 * new TColor(1.0, 1.0, 0.55);
		}
예제 #18
0
 public TSurface()
 {
     this.Diffuse     = new TColor(Color.White);
     this.GridDiffuse = new TColor(Color.Orange);
     this.Specular    = new TColor(Color.White);
 }
예제 #19
0
파일: TLight.cs 프로젝트: heber/FreeOQ
		public void SetNormalDay()
		{
			this.SetSfumatoDay();
			this.Ambient *= 1.1;
			this.ParallelBeams[0].c *= 1.1;
		}