-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwater.js
More file actions
30 lines (25 loc) · 771 Bytes
/
water.js
File metadata and controls
30 lines (25 loc) · 771 Bytes
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
function createWater(renderer,camera,scene,geometry) {
/* Utilizzo uno shader da https://github.com/jbouny/ocean per realizzare dell'acqua */
var waterNormals = new THREE.ImageUtils.loadTexture('images/textures/waternormals.jpg');
waterNormals.wrapS = waterNormals.wrapT = THREE.RepeatWrapping;
water = new THREE.Water(renderer, camera, scene, {
textureWidth: 256,
textureHeight: 256,
waterNormals: waterNormals,
alpha: 0.5,
sunColor: 0xffffff,
waterColor: 0x001e0f,
betaVersion: 0,
side: THREE.DoubleSide
});
var aMeshMirror = new THREE.Mesh(
geometry,
water.material
);
aMeshMirror.add(water);
aMeshMirror.rotation.x = - Math.PI * 0.5;
var result = {};
result.water = water;
result.mesh = aMeshMirror;
return result;
}