// TODO: push this data in through the constructor, probably in a QuadMeshDefintion class, and make // this method private. Except that would do real work in construction. Hmmm. public void Initialize(double planetRadius, DoubleVector3 planeNormalVector, DoubleVector3 uVector, DoubleVector3 vVector, QuadNodeExtents extents, int level) { _planetRadius = planetRadius; _planeNormalVector = planeNormalVector; _uVector = uVector; _vVector = vVector; _extents = extents; _level = level; // TODO: get this from the QuadNode instead _locationRelativeToPlanet = (_planeNormalVector) + (_uVector * (_extents.North + (_extents.Width / 2.0))) + (_vVector * (_extents.West + (_extents.Width / 2.0))); _locationRelativeToPlanet = _locationRelativeToPlanet.ProjectUnitPlaneToUnitSphere() * _planetRadius; _meshStride = _extents.Width / (_gridSize - 1); // TODO: cover this in specs _boundingBox.Min = new Vector3(float.MaxValue); _boundingBox.Max = new Vector3(float.MinValue); GenerateIndices(); GenerateMeshVertices(); CollectMeshSamples(); _renderer.Initialize(_vertices, _indices, _boundingBox); TrimUnneededMemory(); }
public Color GetColor(double terrainHeight, int column, int row, int gridSize, QuadNodeExtents extents) { var color = _baseColorizer.GetColor(terrainHeight, column, row, gridSize, extents); if (!_settings.ShowQuadBoundaries) { return color; } if (row == 0) { color = extents.North == -1 ? Color.Green : Color.Red; } else if (row == gridSize - 1) { color = extents.South == 1 ? Color.Green : Color.Red; } else if (column == 0) { color = extents.West == -1 ? Color.Green : Color.Red; } else if (column == gridSize - 1) { color = extents.East == 1 ? Color.Green : Color.Red; } return color; }
// TODO: push this data in through the constructor, probably in a QuadMeshDefintion class, and make // this method private. Except that would do real work in construction. Hmmm. public void Initialize(double planetRadius, DoubleVector3 planeNormalVector, DoubleVector3 uVector, DoubleVector3 vVector, QuadNodeExtents extents, int level) { _planetRadius = planetRadius; _extents = extents; // TODO: get this from the QuadNode instead _locationRelativeToPlanet = (planeNormalVector) + (uVector * (_extents.North + (_extents.Width / 2.0))) + (vVector * (_extents.West + (_extents.Width / 2.0))); _locationRelativeToPlanet = _locationRelativeToPlanet.ProjectUnitPlaneToUnitSphere() * _planetRadius; // TODO: cover this in specs _boundingBox.Min = new Vector3(float.MaxValue); _boundingBox.Max = new Vector3(float.MinValue); GenerateIndices(); var heightmap = _generator.GenerateHeightmapSamples(new HeightmapDefinition() { GridSize = _gridSize, Stride = extents.Width / (_gridSize - 1), PlaneNormalVector = planeNormalVector, UVector = uVector, VVector = vVector, Extents = _extents, QuadLevel = level, PlanetRadius = planetRadius }); var vertices = GenerateMeshVertices(heightmap); CollectHeightmapSamples(heightmap); _renderer.Initialize(vertices, _indices, _boundingBox); }
// TODO: push this data in through the constructor, probably in a QuadMeshDefintion class, and make // this method private. Except that would do real work in construction. Hmmm. public void Initialize(double planetRadius, DoubleVector3 planeNormalVector, DoubleVector3 uVector, DoubleVector3 vVector, QuadNodeExtents extents, int level) { _planetRadius = planetRadius; _planeNormalVector = planeNormalVector; _uVector = uVector; _vVector = vVector; _extents = extents; _level = level; // TODO: get this from the QuadNode instead _locationRelativeToPlanet = (_planeNormalVector) + (_uVector * (_extents.North + (_extents.Width / 2.0))) + (_vVector * (_extents.West + (_extents.Width / 2.0))); _locationRelativeToPlanet = _locationRelativeToPlanet.ProjectUnitPlaneToUnitSphere() * _planetRadius; _meshStride = _extents.Width / (_gridSize - 1); // TODO: cover this in specs _boundingBox.Min = new Vector3(float.MaxValue); _boundingBox.Max = new Vector3(float.MinValue); GenerateIndices(); GenerateMeshVertices(); CollectMeshSamples(); _renderer.Initialize(_vertices, _indices, _boundingBox); TrimUnneededMemory(); }
// TODO: push this data in through the constructor, probably in a QuadNodeDefintion class, and make // this method private. Except that would do real work in construction. Hmmm. public void Initialize(double planetRadius, DoubleVector3 planeNormalVector, DoubleVector3 uVector, DoubleVector3 vVector, QuadNodeExtents extents, int level) { _planetRadius = planetRadius; _planeNormalVector = planeNormalVector; _uVector = uVector; _vVector = vVector; _extents = extents; Level = level; _locationRelativeToPlanet = (_planeNormalVector) + (_uVector * (_extents.North + (_extents.Width / 2.0))) + (_vVector * (_extents.West + (_extents.Width / 2.0))); _locationRelativeToPlanet = _locationRelativeToPlanet.ProjectUnitPlaneToUnitSphere() * _planetRadius; _mesh.Initialize(planetRadius, planeNormalVector, uVector, vVector, extents, level); Interlocked.Increment(ref _statistics.NumberOfQuadNodes); Interlocked.Increment(ref _statistics.NumberOfQuadNodesAtLevel[Level]); }
// TODO: push this data in through the constructor, probably in a QuadMeshDefintion class, and make // this method private. Except that would do real work in construction. Hmmm. public void Initialize(double planetRadius, DoubleVector3 planeNormalVector, DoubleVector3 uVector, DoubleVector3 vVector, QuadNodeExtents extents, int level) { _planetRadius = planetRadius; _planeNormalVector = planeNormalVector; _uVector = uVector; _vVector = vVector; _extents = extents; _level = level; _locationRelativeToPlanet = (_planeNormalVector) + (_uVector * ((_extents.West + (_extents.Width / 2.0)))) + (_vVector * ((_extents.North + (_extents.Width / 2.0)))); _locationRelativeToPlanet = _locationRelativeToPlanet.ProjectUnitPlaneToUnitSphere() * _planetRadius; _meshStride = _extents.Width / (_gridSize - 1); GenerateMeshVertices(); CollectMeshSamples(); _renderer.Initialize(_vertices, _indices); }
public Color GetColor(double terrainHeight, int column, int row, int gridSize, QuadNodeExtents extents) { if (terrainHeight > 0) { return(Color.White); } else { return(Color.Blue); } }
// TODO: push this data in through the constructor, probably in a QuadNodeDefintion class, and make // this method private. Except that would do real work in construction. Hmmm. public void Initialize(double planetRadius, DoubleVector3 planeNormalVector, DoubleVector3 uVector, DoubleVector3 vVector, QuadNodeExtents extents, int level) { _planetRadius = planetRadius; _planeNormalVector = planeNormalVector; _uVector = uVector; _vVector = vVector; _extents = extents; Level = level; _locationRelativeToPlanet = (_planeNormalVector) + (_uVector * (_extents.North + (_extents.Width / 2.0))) + (_vVector * (_extents.West + (_extents.Width / 2.0))); _locationRelativeToPlanet = _locationRelativeToPlanet.ProjectUnitPlaneToUnitSphere() * _planetRadius; _mesh.Initialize(planetRadius, planeNormalVector, uVector, vVector, extents, level); Interlocked.Increment(ref _statistics.NumberOfQuadNodes); Interlocked.Increment(ref _statistics.NumberOfQuadNodesAtLevel[Level]); }
public Color GetColor(double terrainHeight, int column, int row, int gridSize, QuadNodeExtents extents) { var color = _baseColorizer.GetColor(terrainHeight, column, row, gridSize, extents); if (!_settings.ShowQuadBoundaries) { return(color); } if (row == 0) { color = extents.North == -1 ? Color.Green : Color.Red; } else if (row == gridSize - 1) { color = extents.South == 1 ? Color.Green : Color.Red; } else if (column == 0) { color = extents.West == -1 ? Color.Green : Color.Red; } else if (column == gridSize - 1) { color = extents.East == 1 ? Color.Green : Color.Red; } return(color); }