forked from JulieWinchester/iiif-threejs-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
243 lines (197 loc) · 8.61 KB
/
index.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>IIIF 3D Manifest Viewer -- X3DOM</title>
<script type='text/javascript' src='https://x3dom.org/release/x3dom-full.js'> </script>
<script type='module' src='./src/manifest_viewer.js'> </script>
<link rel='stylesheet' type='text/css' href='https://x3dom.org/release/x3dom.css'></link>
<link href="src/styles.css" rel="stylesheet" />
</head>
<body>
<!--
1 row 2 column table with
col 0 x3dom canvas and div for text of manifest label
col 1 UI for x3dom:
- show/axes
- headlight on/off
-->
<table>
<tr>
<td>
<div class="canvas-width canvas-height" style="margin-top:1em;">
<x3d id="x3delem" class="canvas-width canvas-height">
<scene>
<navigationinfo id="navigationinfo-node" headlight='true'></navigationinfo>
<background id="x3d-background" skyColor="0.8 0.8 0.8"> </background>
<!--
Adding a zero-intensity light. Otherwise X3DOM tries to be helpful
and puts in a default ambient light. The intention here is to only
have a headlight or lights added in a IIIF manifest
-->
<pointlight ambientIntensity="0.0" intensity="0" global='true'> </pointlight>
<viewpoint id="default-viewpoint"
position="0 0 10"
orientation="0 0 1 0"
centerOfRotation="0 0 0" ></viewpoint>
<!--
At this revision the viewpoints that are defined by annotations are implemented
by copying the x3d field values into either the iiif-perspective-viewpoint or
iiif-orthographic-viewpoint nodes defind here. This is because a viewpoint or
orthoviewpoint created and added to the scene by javascript are not responding
correctly to set_bind = true events.
-->
<viewpoint id="iiif-perspective-viewpoint"
position="0 0 10"
orientation="0 0 1 0.78"
centerOfRotation="0 0 0" ></viewpoint>
<orthoviewpoint id="iiif-orthographic-viewpoint"
position="0 0 10"
orientation="0 0 1 0.78"
centerOfRotation="0 0 0" > </orthoviewpoint>
<transform id="annotation_container" scale="1 1 1">
</transform>
<switch id="triad-switch-node" whichChoice="-1">
<inline url='"https://spri-open-resources.s3.us-east-2.amazonaws.com/iiif3dtsg/manifesto_viewer/CoordinateAxes.x3d"'></inline>
</switch>
<!--
The following white ball could be added to the scene to check
lighting effects
-->
<switch id="white-sphere" whichChoice="-1">
<transform translation = "0 -0.7 0">
<shape>
<sphere radius="0.25""></sphere>
<appearance>
<material emissiveColor="0 0 0" diffuseColor="1 1 1"></material>
</appearance>
</shape>
</transform>
</switch>
</scene>
</x3d>
</div>
<div class="canvas-width" id="text-annotations-container">
<div>Text Annotations</div>
<table id="text-annotations-table">
</table>
</div>
<div class="canvas-width" id="manifest_label_container"> </div>
<div class="canvas-width" id="manifest_summary_container"> </div>
</td>
<td style="padding-left:2em; vertical-align:top; width:360px">
<div >
Key Press Commands<br>
<span style="font-style:italic; font-size:10pt">Click scene to set focus (green border)</span><br>
a : Show All<br>
r : Reset View<br>
</div>
<div style="margin-top:2em">
<div>
<input type="checkbox" id="show-axes-checkbox" />
<span style="margin-left:0em">Show Coordinate Axes</span>
</div>
<div id="axes-description" style="line-height:1.2em; visibility:visible;">
Axes markers are 2 global units in length.<br>
Red X axis<br>
Green Y axis<br>
Blue Z axis<br>
<div style="font-style:italic; font-size:smaller;"><a href="https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxesIndex.html" target="_blank">CoordinateAxes</a> marker courtesy of <a href="https://web3d.org" target="_blank">Web3D
Consortium</a> Examples Archive.
</div>
</div>
</div>
<div style="margin-top:2em">
<div>
<input type="checkbox" id="headlight-on-checkbox" />
<span style="margin-left:0em">Headlight</span>
</div>
<div id="headlight-description" style="line-height:1.2em; visibility:visible;">
Headlight is default lighting available in X3D viewer.
</div>
</div>
</td>
</tr>
</table>
<!-- end 1 row 2 colomn table for X3DOM elements -->
<!--
Form UI for choosing manifest from drop down
or loading from text input
based on https://github.com/JulieWinchester/iiif-threejs-demo
-->
<div id="form">
<select name="manifest" id="manifest-select">
<optgroup label="1. Basic Model in Scene">
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/1_basic_model_in_scene/model_origin.json">
Single Model
</option>
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/1_basic_model_in_scene/model_origin_bgcolor.json">
Single Model with background color
</option>
</optgroup>
<optgroup label="2. Cameras">
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/2_cameras/positioned_camera_lookat_anno.json">
Positioned Camera LookAt an Annotation
</option>
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/2_cameras/positioned_camera_lookat_point.json">
Perspective Camera LookAt a Point
</option>
<option value="https://raw.githubusercontent.com/vincentmarchetti/iiif3dtsg/kshell-dev/manifests/2_cameras/orthographic_camera_lookat_point.json">
Orthographic Camera LookAt a Point
</option>
</optgroup>
<optgroup label="3. Lights">
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/3_lights/ambient_green_light.json">
Ambient Green Light
</option>
<option class="modified" value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/3_lights/direction_light_transform_rotate.json">
Directional Light with RotateTransform
</option>
<option class="modified" value="https://raw.githubusercontent.com/vincentmarchetti/iiif3dtsg/kshell-dev/manifests/3_lights/spotlight_lookat_positioned.json">
SpotLight with lookAt
</option>
</optgroup>
<optgroup label="4. Transform and Position">
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_position.json">
Single Positioned Model
</option>
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_scale_position.json">
Scaled, Translated Model with original for comparison
</option>
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_rotate_translate_position.json">
Rotated Translated Model
</option>
<option value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_translate_rotate_position.json">
Translated Rotated Model
</option>
<option class="modified" value="https://raw.githubusercontent.com/IIIF/3d/main/manifests/4_transform_and_position/model_transform_negative_scale_position.json">
Model shown normally and mirrored
</option>
</optgroup>
<optgroup
label="9. Supplementing Annotations" >
<option value="https://raw.githubusercontent.com/vincentmarchetti/iiif3dtsg/kshell-dev/manifests/9_supplementing_annotations/archie_with_supplement.json">
Archimedes with Theorem
</option>
</optgroup>
<optgroup
label="xx. Whale Comments" >
<option value="https://raw.githubusercontent.com/IIIF/3d/whale_anno/manifests/xx_whale_comments/a_cranium_and_mandible_positioned.json">
(a) cranium & mandible positioned
</option>
<option value="https://raw.githubusercontent.com/IIIF/3d/whale_anno/manifests/xx_whale_comments/c_comment_annotation_camera.json">
(c) comment and annotation camera
</option>
</optgroup>
</select>
<div class="form-group">
<input type="text" id="manifest-url" name="manifest-url" value=""></input>
<button id="load-manifest-from-url">Load Manifest From URL</button>
</div>
<textarea id="manifest-text" name="manifest-text" rows="10"></textarea>
<button id="load-manifest-from-text">Load Manifest From Text</button>
</div>
<!-- End form UI for choosing manifest -->
<script type="module" src="src/listeners.js"></script>
</body>
</html>