Beispiel #1
0
        public TerrainRenderer(GraphicsDevice graphicsDevice, ContentManager content, Settings settings)
        {
            GraphicsDevice = graphicsDevice;
            Content = content;
            this.settings = settings;

            instanceVertexBuffer = new WritableVertexBuffer<PatchInstanceVertex>(GraphicsDevice, Selection.MaxSelectedNodeCount * 2);

            // TODO: I want to change a patch resolution at runtime.
            // patchGridSize = leafNodeSize * patchResolution;
            patchMesh = new PatchMesh(GraphicsDevice, settings.LeafNodeSize * DefaultPatchResolution);

            sourceEffect = Content.Load<Effect>("TerrainEffect");
            effect = new TerrainEffect(sourceEffect);
            effect.PatchGridSize = patchMesh.GridSize;
            effect.LevelCount = settings.LevelCount;

            lightDirection = new Vector3(0, -1, -1);
            lightDirection.Normalize();

            boundingBoxDrawer = new BoundingBoxDrawer(GraphicsDevice);
            debugEffect = new BasicEffect(GraphicsDevice);
            debugEffect.AmbientLightColor = Vector3.One;
            debugEffect.VertexColorEnabled = true;

            HeightColorVisible = true;
            LightEnabled = true;

            WireframeGap = 0.01f;
        }
Beispiel #2
0
        public Selection(Settings settings, IVisibleRanges visibleRanges)
        {
            this.settings = settings;
            VisibleRanges = visibleRanges;

            Frustum = new BoundingFrustum(Matrix.Identity);
            selectedNodes = new SelectedNode[MaxSelectedNodeCount];
        }
        public DefaultVisibleRanges(Settings settings)
        {
            this.settings = settings;

            FinestNodeSize = DefaultFinestNodeSize;
            DetailBalance = DefaultDetailBalance;
            ranges = new float[settings.LevelCount];
        }
Beispiel #4
0
 public Terrain(GraphicsDevice graphicsDevice, Settings settings)
 {
     GraphicsDevice = graphicsDevice;
     this.settings = settings;
 }