-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathgame_dom_element_3d_cube.html
139 lines (130 loc) · 5.33 KB
/
game_dom_element_3d_cube.html
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html>
<head>
<title>game avatar jitsi</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./assets/css/examples.css" />
<link rel="stylesheet" href="./assets/css/loading_screen.css" />
</head>
<body>
<script src="../dist/RUN_MODE/bundle.js"></script>
<script src="./assets/js/loadingScreen.js"></script>
<script>
const udviz = window.udviz;
udviz
.loadMultipleJSON([
'./assets/config/extents.json',
'./assets/config/crs.json',
'./assets/config/assetManager.json',
'./assets/config/frame3D_planars.json',
'./assets/config/layer/3DTiles_Lyon.json',
'./assets/config/layer/base_maps.json',
'./assets/config/layer/elevation.json',
])
.then((configs) => {
const assetManager = new udviz.gameBrowser.AssetManager();
assetManager.loadFromConfig(configs['assetManager']).then(() => {
udviz.proj4.default.defs(
configs['crs'][0].name,
configs['crs'][0].transform
);
const extent = new udviz.itowns.Extent(
configs['extents'][0].name,
parseInt(configs['extents'][0].west),
parseInt(configs['extents'][0].east),
parseInt(configs['extents'][0].south),
parseInt(configs['extents'][0].north)
);
const socketIOWrapper = new udviz.gameBrowser.SocketIOWrapper();
socketIOWrapper.connectToServer().then(() => {
const multiGame = new udviz.gameBrowser.MultiPlanarProcess(
socketIOWrapper,
extent,
assetManager,
new udviz.gameBrowser.InputManager(),
{
frame3DPlanarOptions: configs['frame3D_planars'][1],
externalGameScriptClass: [
udviz.gameBrowserTemplate.DomElement3DCube,
udviz.gameBrowserTemplate.ControllerNativeCommandManager,
],
sceneConfig: configs['scene'],
}
);
// eslint-disable-next-line no-constant-condition
if ('RUN_MODE' == 'production')
loadingScreen(multiGame.frame3DPlanar.itownsView, [
'UD-VIZ',
'UDVIZ_VERSION',
]);
multiGame.start({
entryGameObject3DUUID: 'dom_element_3d_cube_game_uuid',
});
// /// ADD LAYERS
{
multiGame.frame3DPlanar.itownsView.addLayer(
new udviz.itowns.ColorLayer(configs['base_maps'][0]['name'], {
updateStrategy: {
type: udviz.itowns.STRATEGY_DICHOTOMY,
options: {},
},
source: new udviz.itowns.WMSSource({
extent: extent,
name: configs['base_maps'][0].source['name'],
url: configs['base_maps'][0].source['url'],
version: configs['base_maps'][0].source['version'],
crs: extent.crs,
format: configs['base_maps'][0].source['format'],
}),
transparent: true,
})
);
configs['3DTiles_Lyon'].forEach((layerConfig) => {
udviz.itowns.View.prototype.addLayer.call(
multiGame.frame3DPlanar.itownsView,
new udviz.itowns.C3DTilesLayer(
layerConfig['id'],
{
name: layerConfig['id'],
source: new udviz.itowns.C3DTilesSource({
url: layerConfig['url'],
}),
},
multiGame.frame3DPlanar.itownsView
)
);
});
const isTextureFormat =
configs['elevation']['format'] == 'image/jpeg' ||
configs['elevation']['format'] == 'image/png';
multiGame.frame3DPlanar.itownsView.addLayer(
new udviz.itowns.ElevationLayer(
configs['elevation']['layer_name'],
{
useColorTextureElevation: isTextureFormat,
colorTextureElevationMinZ: isTextureFormat
? configs['elevation']['colorTextureElevationMinZ']
: null,
colorTextureElevationMaxZ: isTextureFormat
? configs['elevation']['colorTextureElevationMaxZ']
: null,
source: new udviz.itowns.WMSSource({
extent: extent,
url: configs['elevation']['url'],
name: configs['elevation']['name'],
crs: extent.crs,
heightMapWidth: 256,
format: configs['elevation']['format'],
}),
}
)
);
}
});
});
});
</script>
SCRIPT_TAG_RELOAD
</body>
</html>