Exemplo n.º 1
0
        private void CreateBillboardSystem()
        {
            var r         = new Random();
            var positions = new Vector3[150];
            var tree      = Content.Load <Texture2D>("tree");

            for (int i = 0; i < positions.Length; i++)
            {
                var x = (float)(r.NextDouble() - 0.5) * 20000;
                var y = (float)(r.NextDouble() - 0.5) * 20000;
                positions[i] = new Vector3(x, tree.Bounds.Height, y);
            }

            trees = new BillboardSystem(GraphicsDevice, Content,
                                        tree, new Vector2(tree.Bounds.Width, tree.Bounds.Height),
                                        positions);
        }
Exemplo n.º 2
0
        private void CreateBillboardSystem()
        {
            var r = new Random();
            var positions = new Vector3[150];
            var tree = Content.Load<Texture2D>("tree");

            for (int i = 0; i < positions.Length; i++)
            {
                var x = (float)(r.NextDouble() - 0.5) * 20000;
                var y = (float)(r.NextDouble() - 0.5) * 20000;
                positions[i] = new Vector3(x, tree.Bounds.Height, y);
            }

            trees = new BillboardSystem(GraphicsDevice, Content,
                tree, new Vector2(tree.Bounds.Width, tree.Bounds.Height),
                positions);
        }