Skip to content

Commit a9aa142

Browse files
force blue tint on water
1 parent a234758 commit a9aa142

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/model/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,15 @@ let createCube = function (width, height, depth, name, faces, fallbackFaces, tex
792792
let context = canvas.getContext("2d");
793793
context.drawImage(img, Math.min(uv[0], uv[2]), Math.min(uv[1], uv[3]), canvas.width, canvas.height, 0, 0, canvas.width, canvas.height);
794794

795+
let tintColor;
795796
if (face.hasOwnProperty("tintindex")) {
796-
context.fillStyle = TINTS[face.tintindex];
797+
tintColor = TINTS[face.tintindex];
798+
} else if (baseName.startsWith("water_")) {
799+
tintColor = "blue";
800+
}
801+
802+
if (tintColor) {
803+
context.fillStyle = tintColor;
797804
context.globalCompositeOperation = 'multiply';
798805
context.fillRect(0, 0, canvas.width, canvas.height);
799806

@@ -920,6 +927,7 @@ let createCube = function (width, height, depth, name, faces, fallbackFaces, tex
920927
context1.drawImage(canvas.canvas, 0, i * canvas.width, canvas.width, canvas.width, 0, 0, canvas.width, canvas.width);
921928

922929
let data = canvas1.toDataURL("image/png");
930+
console.log(data);
923931
let hash = md5(data);
924932

925933
if (textureCache.hasOwnProperty(hash)) {// Use texture to cache

0 commit comments

Comments
 (0)