-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyRelief.js
36 lines (23 loc) · 978 Bytes
/
MyRelief.js
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
import * as THREE from 'three';
class MyRelief {
constructor() {
this.mesh = this.build();
}
build() {
let planeGeometry = new THREE.PlaneGeometry(5, 5, 50, 50);
let rgbTexture = new THREE.TextureLoader().load('scenes/t01g03/textures/waterTex.jpg');
let depthMapTexture = new THREE.TextureLoader().load('scenes/t01g03/textures/waterMap.jpg');
let material = new THREE.ShaderMaterial({
uniforms: {
rgbTexture: { value: rgbTexture },
depthMapTexture: { value: depthMapTexture },
displacementScale: { value: 0.1 }
},
vertexShader: document.getElementById('vertexShader').textContent,
fragmentShader: document.getElementById('fragmentShader').textContent
});
let planeMesh = new THREE.Mesh(planeGeometry, material);
return planeMesh;
}
}
export { MyRelief}