public RectangleProjection(RectangleF rectangle, Matrix transform) { Vertices[0] = Vector2.Transform(rectangle.TopLeft, transform); Vertices[1] = Vector2.Transform(rectangle.TopRight, transform); Vertices[2] = Vector2.Transform(rectangle.BottomLeft, transform); Vertices[3] = Vector2.Transform(rectangle.BottomRight, transform); }
public TerrainChunk(float horizonalPosition, float[] heights, GraphicsDevice graphicsDevice, World world, float? firstHeight = null) { _body = BodyFactory.CreateBody(world, new Vector2(horizonalPosition, VerticalPosition), this); _bounds = new RotatableRectangleF(Dimensions) {TopLeft = _body.Position}; _heightmap = new Texture2D(graphicsDevice, HeightCount, 1, false, SurfaceFormat.Single); if (firstHeight.HasValue) heights[0] = (firstHeight.Value - VerticalPosition)/Dimensions.Y; Heights = heights; }