示例#1
0
        public void InitializeTerrin(QuadTree Qtree, Camera.Camera camera, Terrain terrain, Texture2D HeightMap, Vector3 WaterPos, ContentManager Content, GraphicsDevice graphicsDevice)
        {
            Camera.Camera.DefaultCamera = camera;
            float quadFrontTreeDetail = float.Parse(System.Configuration.ConfigurationManager.AppSettings[WindowsGame2.Properties.Resources.ChildFrontTestThreshold], CultureInfo.GetCultureInfo("en-us"));
            float quadFarTreeDetail = float.Parse(System.Configuration.ConfigurationManager.AppSettings[WindowsGame2.Properties.Resources.ChildFarTestThreshold], CultureInfo.GetCultureInfo("en-us"));
            float vertexDetail = float.Parse(System.Configuration.ConfigurationManager.AppSettings[WindowsGame2.Properties.Resources.VertexTestThreshold], CultureInfo.GetCultureInfo("en-us"));
            float nodeRelevance = float.Parse(System.Configuration.ConfigurationManager.AppSettings[WindowsGame2.Properties.Resources.ChildRelevanceThreshold], CultureInfo.GetCultureInfo("en-us"));

            for (int i = 0; i < terrain.QuadTrees.Count; i++)
            {
                terrain.QuadTrees[i].NodeRelevance = nodeRelevance;
                terrain.QuadTrees[i].QuadTreeDetailAtFront = quadFrontTreeDetail;
                terrain.QuadTrees[i].QuadTreeDetailAtFar = quadFarTreeDetail;
                terrain.QuadTrees[i].VertexDetail = vertexDetail;
                LoadGround(terrain.QuadTrees[i], HeightMap, Content);
            }

            Qtree.effect = Content.Load<Effect>("Effects//Terrain");
            Qtree._effect = Content.Load<Effect>("shaders//LPPMainEffect");
            terrain.Initialize();
            terrain.Load(graphicsDevice);
            Qtree.WaterHeight = WaterPos.Y;
        }
示例#2
0
        private void InitializeTerrain()
        {
            //create terrain object
            this.terrain = new Terrain.Terrain();
            //set the depth of the tree
            byte treeDepth = 8;
            //set the scale of the terrain
            float scale = 0.39f;
            //set the size of the terrain part represented by the root quad tree node.
            int landSize = (int)(32768 * scale);
            //create a new quadtree with the specified depth, land size and at location (0,0)
            Qtree = new QuadTree(treeDepth, landSize, scale, new Vector2(-landSize / 2, -landSize / 2));

            this.terrain.QuadTrees.Add(Qtree);
        }