예제 #1
0
파일: Camera.cs 프로젝트: civicacid/myevo
            internal static Point WorldToScreen(float x, float y, float z, bool realPos)
            {

                var Result = new Point
                {
                    X = 0,
                    Y = 0
                };

                Vector pseudoVec = new Vector(x, y, z);

                Vector Pos = new Vector(X, Y, Z);

                Vector diff = pseudoVec - Pos;

                Vector view = diff * Matrix.Inverse();
                Vector cam = new Vector(-view.Y, -view.Z, view.X);

                Single WowWidth = Convert.ToSingle((uint)InterfaceHelper.WindowWidth);
                Single WowHeight = Convert.ToSingle((uint)InterfaceHelper.WindowHeight);

                Single fHorizontalAdjust = ((WowWidth / WowHeight >= 1.6f) ? 55.0f : 44.0f);

                Single fScreenX = WowWidth / 2.0f;
                Single fScreenY = WowHeight / 2.0f;

                Rect rect = new Rect();
                GetClientRect(Memory.WindowHandle, ref rect);

                float modifier = 1.0f;
                float modifier2 = 1.08f;
                if (1.0 * rect.right / rect.bottom > 1.5)
                {
                    modifier *= 1.15f;
                    modifier2 = 1.0f;
                }

                Single fTmpX = fScreenX / (Single)Math.Tan((((WowWidth / WowHeight) * fHorizontalAdjust) * modifier2 * modifier / 2.0f) * Deg2Rad);
                Single fTmpY = fScreenY / (Single)Math.Tan((((WowWidth / WowHeight) * 35) / 2.0f) * Deg2Rad);

                Result.X = (int)(fScreenX + cam.X * fTmpX / cam.Z);
                Result.Y = (int)(fScreenY + cam.Y * fTmpY / cam.Z);

                if (Result.X < 0 || Result.Y < 0)
                {
                    Result.X = 0;
                    Result.Y = 0;
                }
                else
                {
                    if (realPos)
                    {

                        Point p = new Point();
                        Frame.ScreenToClient(Memory.WindowHandle, ref p);
                        Result.X += Math.Abs(p.X);
                        Result.Y += Math.Abs(p.Y);

                    }
                    Result.Y -= 20;
                }
                return Result;
            }
예제 #2
0
파일: Camera.cs 프로젝트: civicacid/myevo
 public static Vector operator -(Vector v1, Vector v2)
 {
     var v3 = new Vector((v1._x - v2._x), (v1._y - v2._y), (v1._z - v2._z));
     return v3;
 }
예제 #3
0
파일: Camera.cs 프로젝트: civicacid/myevo
 public static Vector operator +(Vector v1, Vector v2)
 {
     var v3 = new Vector((v1._x + v2._x), (v1._y + v2._y), (v1._z + v2._z));
     return v3;
 }
예제 #4
0
파일: Camera.cs 프로젝트: civicacid/myevo
 public void SetVec(Vector v)
 {
     _x = v._x;
     _y = v._y;
     _z = v._z;
 }
예제 #5
0
파일: Camera.cs 프로젝트: civicacid/myevo
 public Vector(Vector v)
 {
     _x = v._x;
     _y = v._y;
     _z = v._z;
 }
예제 #6
0
파일: Camera.cs 프로젝트: civicacid/myevo
 public static Vector operator *(Vector v, Matrix m)
 {
     var res = new Vector(m._x1 * v.X + m._y1 * v.Y + m._z1 * v.Z,
                             m._x2 * v.X + m._y2 * v.Y + m._z2 * v.Z,
                             m._x3 * v.X + m._y3 * v.Y + m._z3 * v.Z);
     return res;
 }