Example #1
0
        public override void Load(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            TreeGenerator generator = new TreeGenerator(X.GraphicsDevice, X.cloudSystem, X.Content.Load <Effect>("Content/Models/Lambert"));

            generator.LoadFromFile(Profile);
            generator.TrunkEffect.Parameters["AmbientMap"].SetValue(X.Content.Load <Texture2D>(BarkTexture));
            generator.LeafTexture = X.Content.Load <Texture>(LeafTexture);

            generator.GenerateTreeMesh(ref X, Seed, RadialSegments, AddLeaves, CuttoffLevel, out Trunk, out boundingBox, out Leaves);
            Trunk.Projection = X.DefaultCamera.Projection;


            base.Load(Content);
        }
Example #2
0
        public override void Load(ContentManager Content)
        {
            generators = new List <TreeGenerator>();

            // Create a tree generator for each kind of tree defined above in treeFiles
            for (int i = 0; i < TreeTypes.Length; i++)
            {
                TreeGenerator generator = new TreeGenerator(X.GraphicsDevice, X.cloudSystem, X.Content.Load <Effect>("Content/Models/Lambert"));
                generator.LoadFromFile(treePath + TreeTypes[i].Profile);

                // Set the texture assigned to newly generated trees.
                //TODO: Add custom shader for tree trunks to allow Engine lighting, etc
                generator.TrunkEffect.Parameters["AmbientMap"].SetValue(X.Content.Load <Texture2D>(texturePath + TreeTypes[i].BarkTexture));
                //generator.TrunkEffect.TextureEnabled = true;
                //generator.TrunkEffect.EnableDefaultLighting();
                generator.LeafTexture = X.Content.Load <Texture>(texturePath + TreeTypes[i].LeafTexture);
                generators.Add(generator);
            }

            //Generate a list of Vector3 of all tree positions
            GenerateFromTreemap(X.Content.Load <Texture2D>(treeMapFile));

            base.Load(X.Content);
        }