Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit d90282e

Browse files
author
Alexander Kovelenov
committed
Updated for Verge3D 4.0 release
1 parent 0aa8259 commit d90282e

File tree

1,254 files changed

+87027
-62808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,254 files changed

+87027
-62808
lines changed

css2d_label.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@
1717
<body>
1818
<div id="info"><a href="https://www.soft8soft.com/verge3d" target="_blank" rel="noopener">Verge3D</a> css2d - label</div>
1919

20+
<!-- Import maps polyfill -->
21+
<!-- Remove this when import maps will be widely supported -->
22+
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
23+
24+
<script type="importmap">
25+
{
26+
"imports": {
27+
"v3d": "../build/v3d.module.js"
28+
}
29+
}
30+
</script>
31+
2032
<script type="module">
2133

22-
import * as v3d from '../build/v3d.module.js';
34+
import * as v3d from 'v3d';
2335

2436
import { OrbitControls } from './jsm/controls/OrbitControls.js';
2537
import { CSS2DRenderer, CSS2DObject } from './jsm/renderers/CSS2DRenderer.js';

css3d_molecules.html

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,21 @@
6464
</div>
6565
<div id="menu"></div>
6666

67+
<!-- Import maps polyfill -->
68+
<!-- Remove this when import maps will be widely supported -->
69+
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
70+
71+
<script type="importmap">
72+
{
73+
"imports": {
74+
"v3d": "../build/v3d.module.js"
75+
}
76+
}
77+
</script>
78+
6779
<script type="module">
6880

69-
import * as v3d from '../build/v3d.module.js';
81+
import * as v3d from 'v3d';
7082

7183
import { TrackballControls } from './jsm/controls/TrackballControls.js';
7284
import { PDBLoader } from './jsm/loaders/PDBLoader.js';
@@ -86,31 +98,31 @@
8698
let visualizationType = 2;
8799

88100
const MOLECULES = {
89-
"Ethanol": "ethanol.pdb",
90-
"Aspirin": "aspirin.pdb",
91-
"Caffeine": "caffeine.pdb",
92-
"Nicotine": "nicotine.pdb",
93-
"LSD": "lsd.pdb",
94-
"Cocaine": "cocaine.pdb",
95-
"Cholesterol": "cholesterol.pdb",
96-
"Lycopene": "lycopene.pdb",
97-
"Glucose": "glucose.pdb",
98-
"Aluminium oxide": "Al2O3.pdb",
99-
"Cubane": "cubane.pdb",
100-
"Copper": "cu.pdb",
101-
"Fluorite": "caf2.pdb",
102-
"Salt": "nacl.pdb",
103-
"YBCO superconductor": "ybco.pdb",
104-
"Buckyball": "buckyball.pdb",
105-
//"Diamond": "diamond.pdb",
106-
"Graphite": "graphite.pdb"
101+
'Ethanol': 'ethanol.pdb',
102+
'Aspirin': 'aspirin.pdb',
103+
'Caffeine': 'caffeine.pdb',
104+
'Nicotine': 'nicotine.pdb',
105+
'LSD': 'lsd.pdb',
106+
'Cocaine': 'cocaine.pdb',
107+
'Cholesterol': 'cholesterol.pdb',
108+
'Lycopene': 'lycopene.pdb',
109+
'Glucose': 'glucose.pdb',
110+
'Aluminium oxide': 'Al2O3.pdb',
111+
'Cubane': 'cubane.pdb',
112+
'Copper': 'cu.pdb',
113+
'Fluorite': 'caf2.pdb',
114+
'Salt': 'nacl.pdb',
115+
'YBCO superconductor': 'ybco.pdb',
116+
'Buckyball': 'buckyball.pdb',
117+
// 'Diamond': 'diamond.pdb',
118+
'Graphite': 'graphite.pdb'
107119
};
108120

109121
const loader = new PDBLoader();
110122
const colorSpriteMap = {};
111123
const baseSprite = document.createElement('img');
112124

113-
const menu = document.getElementById("menu");
125+
const menu = document.getElementById('menu');
114126

115127
init();
116128
animate();
@@ -140,7 +152,7 @@
140152

141153
baseSprite.onload = function() {
142154

143-
loadMolecule("models/pdb/caffeine.pdb");
155+
loadMolecule('models/pdb/caffeine.pdb');
144156
createMenu();
145157

146158
};
@@ -173,15 +185,15 @@
173185
button.innerHTML = m;
174186
menu.appendChild(button);
175187

176-
const url = "models/pdb/" + MOLECULES[m];
188+
const url = 'models/pdb/' + MOLECULES[m];
177189

178190
button.addEventListener('click', generateButtonCallback(url));
179191

180192
}
181193

182-
const b_a = document.getElementById("b_a");
183-
const b_b = document.getElementById("b_b");
184-
const b_ab = document.getElementById("b_ab");
194+
const b_a = document.getElementById('b_a');
195+
const b_b = document.getElementById('b_b');
196+
const b_ab = document.getElementById('b_ab');
185197

186198
b_a.addEventListener('click', function() {
187199

@@ -214,12 +226,12 @@
214226

215227
if (object instanceof CSS3DSprite) {
216228

217-
object.element.style.display = "";
229+
object.element.style.display = '';
218230
object.visible = true;
219231

220232
} else {
221233

222-
object.element.style.display = "none";
234+
object.element.style.display = 'none';
223235
object.visible = false;
224236

225237
}
@@ -236,12 +248,12 @@
236248

237249
if (object instanceof CSS3DSprite) {
238250

239-
object.element.style.display = "none";
251+
object.element.style.display = 'none';
240252
object.visible = false;
241253

242254
} else {
243255

244-
object.element.style.display = "";
256+
object.element.style.display = '';
245257
object.element.style.height = object.userData.bondLengthFull;
246258
object.visible = true;
247259

@@ -257,7 +269,7 @@
257269

258270
const object = objects[i];
259271

260-
object.element.style.display = "";
272+
object.element.style.display = '';
261273
object.visible = true;
262274

263275
if (!(object instanceof CSS3DSprite)) {
@@ -397,15 +409,15 @@
397409
//
398410

399411
let bond = document.createElement('div');
400-
bond.className = "bond";
401-
bond.style.height = bondLength + "px";
412+
bond.className = 'bond';
413+
bond.style.height = bondLength + 'px';
402414

403415
let object = new CSS3DObject(bond);
404416
object.position.copy(start);
405417
object.position.lerp(end, 0.5);
406418

407-
object.userData.bondLengthShort = bondLength + "px";
408-
object.userData.bondLengthFull = (bondLength + 55) + "px";
419+
object.userData.bondLengthShort = bondLength + 'px';
420+
object.userData.bondLengthFull = (bondLength + 55) + 'px';
409421

410422
//
411423

@@ -426,8 +438,8 @@
426438
//
427439

428440
bond = document.createElement('div');
429-
bond.className = "bond";
430-
bond.style.height = bondLength + "px";
441+
bond.className = 'bond';
442+
bond.style.height = bondLength + 'px';
431443

432444
const joint = new v3d.Object3D(bond);
433445
joint.position.copy(start);
@@ -445,8 +457,8 @@
445457
object.matrixAutoUpdate = false;
446458
object.updateMatrix();
447459

448-
object.userData.bondLengthShort = bondLength + "px";
449-
object.userData.bondLengthFull = (bondLength + 55) + "px";
460+
object.userData.bondLengthShort = bondLength + 'px';
461+
object.userData.bondLengthFull = (bondLength + 55) + 'px';
450462

451463
object.userData.joint = joint;
452464

css3d_orthographic.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,21 @@
2020
<body>
2121
<div id="info"><a href="https://www.soft8soft.com/verge3d" target="_blank" rel="noopener">Verge3D</a> css3d - orthographic</div>
2222

23+
<!-- Import maps polyfill -->
24+
<!-- Remove this when import maps will be widely supported -->
25+
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
26+
27+
<script type="importmap">
28+
{
29+
"imports": {
30+
"v3d": "../build/v3d.module.js"
31+
}
32+
}
33+
</script>
34+
2335
<script type="module">
2436

25-
import * as v3d from '../build/v3d.module.js';
37+
import * as v3d from 'v3d';
2638

2739
import { OrbitControls } from './jsm/controls/OrbitControls.js';
2840
import { CSS3DRenderer, CSS3DObject } from './jsm/renderers/CSS3DRenderer.js';
@@ -125,10 +137,10 @@
125137

126138
const aspect = window.innerWidth / window.innerHeight;
127139

128-
camera.left = - frustumSize * aspect / 2;
140+
camera.left = -frustumSize * aspect / 2;
129141
camera.right = frustumSize * aspect / 2;
130142
camera.top = frustumSize / 2;
131-
camera.bottom = - frustumSize / 2;
143+
camera.bottom = -frustumSize / 2;
132144

133145
camera.updateProjectionMatrix();
134146

0 commit comments

Comments
 (0)