Example #1
0
        public bool worldToScreen(Vector3 world, out Vector3 screen)
        {
            screen.Z = 0.0f;
            FMinimalViewInfo pov       = this._cameraCache.POV;
            D3DMatrix        d3Dmatrix = new D3DMatrix(pov.Rotation, new Vector3(0.0f, 0.0f, 0.0f));
            Vector3          mv1       = new Vector3(d3Dmatrix._11, d3Dmatrix._12, d3Dmatrix._13);
            Vector3          mv2       = new Vector3(d3Dmatrix._21, d3Dmatrix._22, d3Dmatrix._23);
            Vector3          mv3       = new Vector3(d3Dmatrix._31, d3Dmatrix._32, d3Dmatrix._33);
            Vector3          vector3_1 = world - pov.Location;
            Vector3          vector3_2 = new Vector3(vector3_1.DotProduct(mv2), vector3_1.DotProduct(mv3), vector3_1.DotProduct(mv1));

            if ((double)vector3_2.Z < 1.0)
            {
                vector3_2.Z = 1f;
            }
            float fov  = pov.FOV;
            float num1 = (float)this._width / 2f;
            float num2 = (float)this._heigth / 2f;

            screen.X = num1 + vector3_2.X * (num1 / (float)Math.Tan((double)fov * 3.14159274101257 / 360.0)) / vector3_2.Z;
            screen.Y = num2 - vector3_2.Y * (num1 / (float)Math.Tan((double)fov * 3.14159274101257 / 360.0)) / vector3_2.Z;
            if ((double)screen.X >= 0.0 && (double)screen.Y <= (double)this._heigth && (double)screen.Y >= 0.0)
            {
                return((double)screen.Y <= (double)this._heigth);
            }
            return(false);
        }
Example #2
0
        // Token: 0x06000274 RID: 628 RVA: 0x0000932C File Offset: 0x0000752C
        public bool worldToScreen(Vector3 world, out Vector3 screen)
        {
            screen.Z = 0f;
            FMinimalViewInfo pov       = this._cameraCache.POV;
            Vector3          rotation  = pov.Rotation;
            D3DMatrix        d3DMatrix = new D3DMatrix(rotation, new Vector3(0f, 0f, 0f));
            Vector3          mv        = new Vector3(d3DMatrix._11, d3DMatrix._12, d3DMatrix._13);
            Vector3          mv2       = new Vector3(d3DMatrix._21, d3DMatrix._22, d3DMatrix._23);
            Vector3          mv3       = new Vector3(d3DMatrix._31, d3DMatrix._32, d3DMatrix._33);
            Vector3          vector    = world - pov.Location;
            Vector3          vector2   = new Vector3(vector.DotProduct(mv2), vector.DotProduct(mv3), vector.DotProduct(mv));

            if (vector2.Z < 1f)
            {
                vector2.Z = 1f;
            }
            float fov  = pov.FOV;
            float num  = (float)this._width / 2f;
            float num2 = (float)this._heigth / 2f;

            screen.X = num + vector2.X * (num / (float)Math.Tan((double)(fov * 3.14159274f / 360f))) / vector2.Z;
            screen.Y = num2 - vector2.Y * (num / (float)Math.Tan((double)(fov * 3.14159274f / 360f))) / vector2.Z;
            return(screen.X >= 0f && screen.Y <= (float)this._heigth && screen.Y >= 0f && screen.Y <= (float)this._heigth);
        }