-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathterrain.html
More file actions
55 lines (46 loc) · 1.63 KB
/
Copy pathterrain.html
File metadata and controls
55 lines (46 loc) · 1.63 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<html>
<head>
<title>terrain</title>
</head>
<body>
<script type="module">
import * as util from '/src/utils.js'
import World from '/src/World.js'
import Animator from '/src/Animator.js'
import { redfishUSA } from '/src/TileData.js'
import Model from '/models/HelloModel.js'
import ThreeDraw from '/src/ThreeDraw.js'
const [Z, X, Y] = [13, 1594, 3339]
const elevation = await redfishUSA.zxyToDataSet(Z, X, Y)
const el0to10 = elevation.scale(0, 10)
const model = new Model(World.defaultOptions(50))
model.population = 0
model.patches.importDataSet(el0to10, 'z')
await model.startup()
model.setup()
// REMIND: fix patches to update only once
const drawOptions = {
patchesMesh: 'PointsMesh',
patchesSize: 5,
patchesMap: 'Jet',
patchesColor: p => {
const map = view.drawOptions.patchesMap
const color = map.scaleColor(p.z, 0, 10)
return color
},
}
const view = new ThreeDraw(model, { div: 'modelDiv' }, drawOptions)
util.toWindow({ util, model, view })
await new Animator(
() => {
model.step()
view.draw()
},
1, // just draw once, is static
30
)
view.idle()
</script>
<div id="modelDiv"></div>
</body>
</html>