-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrip_to_britain.pde
82 lines (71 loc) · 2.19 KB
/
trip_to_britain.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
float ELEVATION_SCALE = 1;
float ELEVATION_ELEVATION_PERLIN_INCR = 0.005;
int SAND_TEXTURE_WATERCOLOR_NUMBER = 300;
int SAND_TEXTURE_WATERCOLOR_RADIUS = 100;
int[][] SAND_PALETTE = {
{199,191,187} ,
{223,215,202} ,
{233,227,222} ,
{186,140,72} ,
{164,114,80}
};
float WATER_TEXTURE_PERLIN = 0.0025;
float WATER_TEXTURE_WEIGHT = 5;
int[][] WATER_TEXTURE_PALETTE = {
{6,66,115} ,
{118,182,196} ,
{127,205,255} ,
{29,162,216} ,
{222,243,246}
};
void setup() {
size(2160, 2106, P2D);
int rows = (int)(height / ELEVATION_SCALE) + 1;
int cols = (int)(width / ELEVATION_SCALE) + 1;
float[][] elevationMatrix = createGradientElevationMatrix(
rows,
cols,
ELEVATION_ELEVATION_PERLIN_INCR * ELEVATION_SCALE
);
PGraphics waterTexture = createWaterTexture(WATER_TEXTURE_PERLIN, WATER_TEXTURE_WEIGHT, WATER_TEXTURE_PALETTE);
// PGraphics waterTexture = createGraphics(width, height, P2D);
// waterTexture.beginDraw();
// waterTexture.background(127,205,255);
// waterTexture.endDraw();
PGraphics waterMask = createElevationMask(
elevationMatrix, ELEVATION_SCALE, 0
);
waterTexture.mask(waterMask);
image(waterTexture, 0, 0);
PGraphics sandTexture = createSandTexture();
// PGraphics sandTexture = createGraphics(width, height, P2D);
// sandTexture.beginDraw();
// sandTexture.background(236,204,162);
// sandTexture.endDraw();
PGraphics sandMask = createElevationMask(
elevationMatrix, ELEVATION_SCALE, 0.55
);
sandTexture.mask(sandMask);
image(sandTexture, 0, 0);
PGraphics rockTexture = createGraphics(width, height, P2D);
rockTexture.beginDraw();
rockTexture.background(101,83,83);
rockTexture.endDraw();
PGraphics rockMask = createElevationMask(
elevationMatrix, ELEVATION_SCALE, 0.65
);
rockTexture.mask(rockMask);
image(rockTexture, 0, 0);
PGraphics grassTexture = createGraphics(width, height, P2D);
grassTexture.beginDraw();
grassTexture.background(65,152,10);
grassTexture.endDraw();
PGraphics grassMask = createElevationMask(
elevationMatrix, ELEVATION_SCALE, 0.75
);
grassTexture.mask(grassMask);
image(grassTexture, 0, 0);
// drawCanvas();
save("out/final.png");
noLoop();
}