-
Notifications
You must be signed in to change notification settings - Fork 10
DTL.Shape.PerlinSolitaryIsland (形状クラス)
Gunji Ryota edited this page Jan 15, 2020
·
6 revisions
namespace DTL.Shape {
public class PerlinSolitaryIsland : RectBasePerlinSolitary<PerlinSolitaryIsland>
}
PerlinSolitaryIsland
とは "Matrixの描画範囲にパーリンノイズを使用して地形を生成する" 機能を持つクラスである。
DTL.Base.RectBasePerlinSolitary<TDerived> → DTL.Shape.PerlinSolitaryIsland
IDrawer<int>
ITerrainDrawer
// (1)
PerlinSolitaryIsland()
// (2)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height)
// (3)
PerlinSolitaryIsland(double truncatedProportion)
// (3)
PerlinSolitaryIsland(double truncatedProportion, double mountainProportion)
// (5)
PerlinSolitaryIsland(double truncatedProportion, double mountainProportion, double frequency)
// (6)
PerlinSolitaryIsland(double truncatedProportion, double mountainProportion, double frequency, uint octaves)
// (7)
PerlinSolitaryIsland(double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight)
// (8)
PerlinSolitaryIsland(double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight, int minHeight)
// (9)
PerlinSolitaryIsland(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, double truncatedProportion)
// (10)
PerlinSolitaryIsland(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, double truncatedProportion, double mountainProportion)
// (11)
PerlinSolitaryIsland(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, double truncatedProportion, double mountainProportion, double frequency)
// (12)
PerlinSolitaryIsland(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight)
// (13)
PerlinSolitaryIsland(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight)
// (14)
PerlinSolitaryIsland(DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange, double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight, int minHeight)
// (15)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height, double truncatedProportion)
// (16)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height, double truncatedProportion, double mountainProportion)
// (17)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height, double truncatedProportion, double mountainProportion, double frequency)
// (18)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height, double truncatedProportion, double mountainProportion, double frequency, uint octaves)
// (19)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height, double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight)
// (20)
PerlinSolitaryIsland(uint startX, uint startY, uint width, uint height, double truncatedProportion, double mountainProportion, double frequency, uint octaves, int maxHeight, int minHeight)
説明 |
---|
(1) 初期値なしのインスタンスを生成する。 |
(2) 描画範囲を指定したインスタンスを生成する。 |
(3), (6), (9) 最小値を指定したインスタンスを生成する。 |
(4), (7), (10) 最小値と高度を指定したインスタンスを生成する。 |
(5), (8), (11) 最小値と高度, 高度の変動値を指定したインスタンスを生成する。 |
Name | Accessibility | Descriptions | Version |
---|---|---|---|
uint startX | public get, protected set | 描画の開始点X | v0.1.0 |
uint startY | public get, protected set | 描画の開始点Y | v0.1.0 |
uint width | public get, protected set | 描画横幅W | v0.1.0 |
uint height | public get, protected set | 描画縦幅H | v0.1.0 |
double truncatedProportion | public get, protected set | truncatedProportion(例を参考) | v0.1.0 |
double mountainProportion | public get, protected set | mountainProportion | v0.1.0 |
double frequency | public get, protected set | 周波数 | v0.1.0 |
uint octaves | public get, protected set | オクターブ | v0.1.0 |
int minHeight | public get, protected set | 高さの最小値 | v0.1.0 |
int maxHeight | public get, protected set | 高さの最高値 | v0.1.0 |
Name | Descriptions | Version |
---|---|---|
GetPointX | 描画始点座標Xを取得 | v0.1.0 |
GetPointY | 描画始点座標Yを取得 | v0.1.0 |
GetWidth | 描画横幅Wを取得 | v0.1.0 |
GetHeight | 描画縦幅Hを取得 | v0.1.0 |
GetPoint | 描画始点座標を取得 | v0.1.0 |
GetValue | frequencyを取得 | v0.1.0 |
GetTruncatedProportion | truncatedProportionを取得 | v0.1.0 |
GetMountainProportion | mountainProportionを取得 | v0.1.0 |
GetFrequency | frequencyを取得 | v0.1.0 |
GetOctaves | octavesを取得 | v0.1.0 |
GetMinHeight | minHeightを取得 | v0.1.0 |
GetMaxHeight | maxHeightを取得 | v0.1.0 |
Name | Descriptions | Version |
---|---|---|
SetPointX | 描画始点座標Xを指定 | v0.1.0 |
SetPointY | 描画始点座標Yを指定 | v0.1.0 |
SetWidth | 描画横幅Wを指定 | v0.1.0 |
SetHeight | 描画縦幅Hを指定 | v0.1.0 |
SetPoint | 描画始点座標(X,Y)を指定 | v0.1.0 |
SetRange | 描画範囲(X,Y,W,H)を指定 | v0.1.0 |
SetValue | frequencyを指定 | v0.1.0 |
SetTruncatedProportion | truncatedProportionを指定 | v0.1.0 |
SetMountainProportion | mountainProportionを指定 | v0.1.0 |
SetFrequency | frequencyを指定 | v0.1.0 |
SetOctaves | octavesを指定 | v0.1.0 |
SetMinHeight | minHeightを指定 | v0.1.0 |
SetMaxHeight | maxHeightを指定 | v0.1.0 |
名前 | 説明 | 対応バージョン |
---|---|---|
ClearPointX | 描画始点座標Xを消去 | v0.1.0 |
ClearPointY | 描画始点座標Yを消去 | v0.1.0 |
ClearWidth | 描画横幅Wを消去 | v0.1.0 |
ClearHeight | 描画縦幅Hを消去 | v0.1.0 |
ClearPoint | 描画始点座標(X,Y)を消去 | v0.1.0 |
ClearRange | 描画範囲(X,Y,W,H)を消去 | v0.1.0 |
ClearValue | frequencyを消去 | v0.1.0 |
Clear | ClearRangeとClearValueを実行 | v0.1.0 |
ClearTruncatedProportion | truncatedProportionを消去 | v0.1.0 |
ClearMountainProportion | mountainProportionを消去 | v0.1.0 |
ClearFrequency | frequencyを消去 | v0.1.0 |
ClearOctaves | octavesを消去 | v0.1.0 |
ClearMinHeight | minHeightを消去 | v0.1.0 |
ClearMaxHeight | maxHeightを消去 | v0.1.0 |
Name | Descriptions | Version |
---|---|---|
Draw(int[,]) | Matrixに描画する | v0.1.0 |
Create(int[,]) | Matrixに描画してMatrixを返す | v0.1.0 |
DrawNormalize(float[,]) | [0, 1]に正規化した値をMatrixに描画する | v0.1.0 |
using UnityEngine;
using DTL.Console;
using DTL.Shape;
public class GeneratePerlinSolitaryIsland : MonoBehaviour {
public int height = 48;
public int width = 32;
public double frequency = 6.0;
public double truncatedProportion = 0.8;
public double mountainProportion = 0.4;
public uint octaves = 8;
public int maxHeight = 60;
private PerlinSolitaryIsland perlinSolitaryIsland;
private void Start () {
var matrix = new int[height, width];
perlinSolitaryIsland = new PerlinSolitaryIsland(truncatedProportion, mountainProportion, frequency, octaves, maxHeight);
perlinSolitaryIsland.Draw(matrix);
new OutputConsole().Draw(matrix);
}
}
18 21 20 16 19 18 17 22 27 28 20 16 11 11 14 15 18 21 24 20 17 18 17 12 13 17 14 20 16 13 13 17
21 22 20 14 19 20 19 24 29 32 25 23 16 16 14 19 22 24 30 25 22 23 21 14 15 17 15 17 14 9 13 15
23 24 21 15 19 14 14 19 28 29 26 25 18 17 17 21 21 21 29 27 22 25 25 23 17 24 19 13 13 17 17 15
20 20 21 18 17 17 17 20 28 31 22 17 15 10 16 21 20 24 27 28 27 32 29 24 25 28 24 20 15 19 20 18
22 21 23 23 22 21 20 26 33 30 19 13 12 11 13 21 22 24 26 26 27 32 32 26 24 25 25 24 24 22 22 21
21 21 16 18 22 23 24 29 33 30 21 22 15 14 18 18 22 26 28 26 23 26 28 25 24 21 24 25 25 26 24 22
12 15 13 16 24 25 28 31 33 32 30 28 21 15 18 20 27 30 35 31 24 19 21 23 25 24 21 23 27 26 26 24
16 14 12 20 25 30 35 36 35 35 35 29 27 24 22 23 29 38 34 28 18 14 15 18 24 23 19 20 21 22 27 28
18 13 19 27 31 36 40 41 41 41 35 30 25 26 28 32 37 42 34 28 21 21 16 18 23 23 25 26 24 22 28 24
18 18 25 31 29 31 36 40 38 37 39 31 28 28 28 35 40 42 33 24 25 28 24 22 24 27 30 32 27 25 22 20
23 23 25 21 21 25 29 34 36 33 33 31 27 27 28 32 32 34 32 28 22 28 30 30 25 25 28 29 30 25 18 17
15 17 22 20 20 27 30 32 35 32 28 29 28 27 25 26 30 29 33 29 28 28 32 32 32 26 23 26 26 20 12 13
10 15 18 20 17 21 24 29 36 37 31 30 30 25 28 27 27 26 29 33 35 37 37 33 31 27 21 21 21 20 13 13
16 18 18 14 12 15 20 22 33 34 33 35 36 30 26 28 25 21 27 36 41 39 41 31 30 32 25 22 19 19 10 10
18 21 16 10 12 20 24 27 28 35 32 34 36 34 30 30 26 23 31 37 40 35 33 30 33 33 28 24 17 12 6 7
21 18 16 14 16 22 23 30 35 35 37 35 36 40 33 30 31 33 39 39 36 34 27 27 26 27 29 26 17 13 12 12
18 16 10 14 19 25 32 31 33 31 37 38 42 45 40 35 38 39 43 42 39 37 31 31 26 23 26 25 19 16 15 19
18 14 10 14 25 33 35 35 33 32 36 40 42 44 45 38 37 38 43 46 41 39 33 32 28 27 26 24 21 21 22 23
13 14 14 16 27 36 38 35 30 30 32 35 39 42 44 38 39 39 40 43 49 43 36 33 32 29 28 23 18 19 21 26
18 20 23 25 27 30 29 29 25 22 29 32 34 40 44 43 39 41 39 43 45 39 37 35 35 31 31 23 22 23 21 22
25 26 26 30 29 26 21 25 21 19 27 30 35 42 42 45 43 42 38 40 40 40 37 35 33 34 29 22 23 25 20 20
20 19 23 27 30 30 23 24 23 24 30 35 41 48 44 44 40 41 38 35 34 35 35 37 35 34 29 25 25 23 15 16
15 13 21 25 30 31 25 26 25 30 38 42 45 49 43 43 43 39 36 31 28 33 33 36 33 34 29 21 20 21 13 16
5 11 21 25 27 27 27 29 29 34 43 42 45 46 42 46 45 44 41 32 30 32 28 34 33 25 24 20 22 20 17 21
9 16 21 28 28 28 34 30 28 31 36 37 41 45 43 45 46 44 45 34 31 30 30 35 33 26 24 27 25 24 19 23
15 18 24 30 29 31 36 31 28 30 34 34 39 39 38 43 43 45 42 33 33 32 35 41 37 31 31 27 28 22 24 24
17 21 25 32 32 27 30 27 27 28 31 35 39 36 33 39 46 47 42 38 36 36 37 40 39 30 28 23 21 23 23 22
19 21 28 31 28 26 27 26 29 28 35 40 43 39 37 38 39 42 43 43 35 33 35 39 33 28 29 24 22 23 25 24
16 22 29 32 28 25 24 26 28 33 40 43 44 42 43 37 37 41 47 40 35 31 32 34 33 28 27 23 22 25 24 19
16 19 25 26 26 25 26 28 31 32 38 37 36 38 43 45 41 43 46 40 36 37 33 31 33 27 27 17 17 20 16 18
20 23 23 25 29 31 32 33 32 31 37 36 31 34 39 43 46 48 48 44 44 39 31 28 26 30 30 19 17 17 13 18
19 21 22 22 23 26 32 35 31 35 37 36 38 35 34 41 47 44 42 44 43 42 32 27 28 31 32 23 21 16 12 16
18 19 23 23 20 26 29 33 33 34 36 36 38 37 32 32 36 37 36 43 42 36 33 26 31 32 31 23 21 16 13 20
17 22 24 19 20 26 30 32 30 32 38 32 37 38 30 28 30 34 37 44 43 35 31 30 33 30 27 22 19 17 12 16
23 22 23 20 20 26 25 27 38 40 42 36 37 39 34 32 33 32 35 41 39 38 37 32 30 25 26 24 26 15 12 12
15 16 18 18 21 23 23 27 33 42 44 40 40 40 34 33 34 32 34 34 39 36 37 31 28 21 25 25 24 18 11 6
13 13 19 17 21 21 20 27 33 40 41 39 38 38 34 33 29 28 34 33 34 31 29 29 27 24 24 27 25 20 12 10
17 19 18 22 28 26 23 26 31 32 35 30 30 30 31 28 30 29 32 34 29 30 29 25 22 24 27 26 29 24 17 19
17 23 23 23 27 29 30 25 25 25 27 22 24 24 28 27 26 24 22 27 29 25 24 18 18 20 22 24 26 29 24 18
23 27 29 29 31 32 32 28 25 19 22 15 14 20 26 23 23 21 18 21 24 23 19 16 16 20 20 24 27 29 30 22
27 27 30 25 28 29 30 31 26 20 20 15 12 15 25 25 21 18 16 21 22 18 16 12 17 20 23 26 24 24 30 26
24 27 26 21 22 27 25 29 28 26 24 19 14 15 24 27 26 22 18 18 22 18 17 12 18 23 27 27 23 20 26 25
21 20 19 17 20 21 22 25 27 29 28 23 17 17 24 25 24 24 20 21 19 22 19 16 20 30 29 23 23 24 25 21
17 17 17 19 20 23 25 21 27 35 28 19 15 22 30 24 21 26 24 24 26 26 23 18 24 26 26 21 16 16 18 21
17 14 12 14 18 21 18 18 23 27 27 22 18 21 24 23 22 24 23 25 27 25 23 16 20 24 23 18 13 11 16 14
12 6 9 14 20 19 13 13 16 21 23 22 19 23 22 22 21 25 24 25 28 25 17 17 20 20 19 15 12 13 15 16
7 8 13 17 20 19 14 12 12 8 13 16 16 24 24 22 23 25 27 28 32 27 20 19 19 21 14 11 8 16 18 13
14 16 22 22 22 19 18 11 4 4 9 14 18 19 18 19 19 20 22 28 23 24 21 16 14 14 10 8 8 14 17 18
using UnityEngine;
using System.Collections.Generic;
using DTL.Shape;
using DTL.Util;
public class GeneratePerlinSolitaryIslandTerrain : MonoBehaviour {
public int depth = 50;
public int height = 48;
public int width = 32;
public double truncatedProportion = 0.8;
public double mountainProportion = 0.4;
public double frequency = 6.0;
public uint octaves = 8;
public int maxHeight = 60;
public List<Texture2D> texture2D = new List<Texture2D>();
private Terrain terrain;
private PerlinSolitaryIsland perlinSolitaryIsland;
private void Start() {
perlinSolitaryIsland =
new PerlinSolitaryIsland(truncatedProportion, mountainProportion, frequency, octaves, maxHeight);
this.terrain = GetComponent<Terrain>();
TerrainUtil terrainUtil = new TerrainUtil(terrain, texture2D, perlinSolitaryIsland, height, width, depth, 2);
terrainUtil.Draw();
}
}
Copyright (c) 2017-2019 Kasugaccho. Copyright (c) 2018-2019 As Project.
Distributed under the Boost Software License, Version 1.0.(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)