public void LoadNewTree(string profileName, int seed = -1, bool displayBranch = true, bool wind = true) { TreeProfile profile = Content.Load <TreeProfile>(profileName); if (seed == -1) { tree = profile.GenerateSimpleTree(); } else { Random rand = new Random(seed); tree = profile.GenerateSimpleTree(rand); } useTree = true; treeUseBranches = displayBranch; treeUseWind = wind; // Wind treeWind = new LTreesLibrary.Trees.Wind.WindStrengthSin(); treeAnimator = new LTreesLibrary.Trees.Wind.TreeWindAnimator(treeWind); // Scale ChangeCameraZoom(0); float BoundingSphereRadius = (float)(new Ray(Vector3.Zero, Vector3.Up)).Intersects(camera._frustum.Top); treeScale = BoundingSphereRadius / tree.TrunkMesh.BoundingSphere.Radius; treeMatrices = new Matrix[2]; treeMatrices[0] = Matrix.CreateScale(treeScale); treeMatrices[1] = Matrix.CreateTranslation(new Vector3(0, -BoundingSphereRadius / 2, 0)); }
static TreeManager() { treeWind = new LTreesLibrary.Trees.Wind.WindStrengthSin(); treeAnimator = new LTreesLibrary.Trees.Wind.TreeWindAnimator(treeWind); }