Project() public méthode

public Project ( Vector3 vec ) : Vector3
vec Vector3
Résultat Vector3
Exemple #1
0
        public static Rectangle CalculateScissors(Camera camera, Matrix batchTransform, Rectangle area)
        {
            Vector3 pos = Vector3.Transform(new Vector3(area.X, area.Y, 0), batchTransform);
            pos = camera.Project(pos);

            Vector3 size = Vector3.Transform(new Vector3(area.X + area.Width, area.Y + area.Height, 0), batchTransform);
            size = camera.Project(size);

            return new Rectangle((int)pos.X, (int)pos.Y, (int)size.X - (int)pos.X, (int)size.Y - (int)pos.Y);
        }
Exemple #2
0
        public static Vector2 ToWindowCoordinates(Camera camera, Matrix transform, Vector2 point)
        {
            Vector3 vec = Vector3.Transform(new Vector3(point, 0), transform);
            vec = camera.Project(vec);
            vec.Y = camera.GraphicsDevice.Viewport.Height - vec.Y;

            return new Vector2(vec.X, vec.Y);
        }