Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static createWaterMaterial(name: string, noiseFile: string, scene: BABYLON.Scene): MATERIAL.WaterMaterial {
if (!name) {
console.error("GameUtils.createWaterMaterial: name is not defined");
return;
}
if (!noiseFile) {
console.error("GameUtils.createWaterMaterial: noiseFile is not defined");
return;
}
if (!scene) {
console.error("GameUtils.createWaterMaterial: scene is not defined");
return;
}
// Water material
let water = new MATERIAL.WaterMaterial(name, scene);
water.bumpTexture = new BABYLON.Texture(noiseFile, scene);
// Water properties
water.windForce = -15;
water.waveHeight = 0;
water.windDirection = new BABYLON.Vector2(1, 1);
water.waterColor = new BABYLON.Color3(0.25, 0.88, 0.82);
water.colorBlendFactor = 0.3;
water.bumpHeight = 0.1;
water.waveLength = 0.1;
return water
}