コード例 #1
0
 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);
 }
コード例 #2
0
        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;
        }