Skip to content

Commit 8e0383d

Browse files
committed
make ambientOcclusion it's own method
1 parent 856a0fc commit 8e0383d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/client/scripts/World/ChunkMesher.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,17 @@ class ChunkMesher {
271271
type, pos) {
272272
var block = this.chunkTerrain.getBlock(...pos);
273273
var faceVertex = this.genBlockFace(type, block, pos);
274+
this.ambientOcclusion(t_positions, t_normals, t_uvs, t_colors,
275+
positions, normals, uvs, colors, block, pos, faceVertex, type)
276+
this.push(t_positions, t_normals, t_uvs, t_colors,
277+
positions, normals, uvs, colors,
278+
faceVertex, this.chunkTerrain.getBlock(...pos).transparent);
279+
280+
281+
};
282+
283+
ambientOcclusion(t_positions, t_normals, t_uvs, t_colors,
284+
positions, normals, uvs, colors, block, pos, faceVertex, type) {
274285
var loaded = {};
275286
for (var x = -1; x <= 1; x++) {
276287
for (var y = -1; y <= 1; y++) {
@@ -412,12 +423,7 @@ class ChunkMesher {
412423
...col3,
413424
...col4];
414425

415-
this.push(t_positions, t_normals, t_uvs, t_colors,
416-
positions, normals, uvs, colors,
417-
faceVertex, this.chunkTerrain.getBlock(...pos).transparent);
418-
419-
420-
};
426+
}
421427

422428
push(t_positions, t_normals, t_uvs, t_colors,
423429
positions, normals, uvs, colors,
@@ -434,6 +440,7 @@ class ChunkMesher {
434440
colors.push(...faceVertex.color);
435441
}
436442
}
443+
437444
aoColor(type) {
438445
if (type === 0) {
439446
return [0.9, 0.9, 0.9];

0 commit comments

Comments
 (0)