language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/resources/data/world/license.md | @@ -8,4 +8,3 @@ The licence of that data is [CC-BY-SA](http://creativecommons.org/licenses/by-sa
Which means this data is also [CC-BY-SA](http://creativecommons.org/licenses/by-sa/3.0/).
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-cleanup-loaded-files.html | @@ -28,7 +28,6 @@
import * as THREE from './resources/threejs/r108/build/three.module.js';
import {GLTFLoader} from './resources/threejs/r108/examples/jsm/loaders/GLTFLoader.js';
-
class ResourceTracker {
constructor() {
this.resources = new Set(); | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-game-conga-line-w-notes.html | @@ -104,7 +104,6 @@
}
}
-
#labels {
position: absolute; /* let us position ourself inside the container */
left: 0; /* make our position the top left of the container */ | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-game-conga-line.html | @@ -104,7 +104,6 @@
}
}
-
#labels {
position: absolute; /* let us position ourself inside the container */
left: 0; /* make our position the top left of the container */ | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-offscreencanvas.html | @@ -33,7 +33,6 @@
</body>
<script type="module">
-
function main() { /* eslint consistent-return: 0 */
const canvas = document.querySelector('#c');
if (!canvas.transferControlToOffscreen) { | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-primitives-text.html | @@ -155,4 +155,3 @@
</script>
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-primitives.html | @@ -381,4 +381,3 @@
</script>
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-car.html | @@ -120,4 +120,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun-earth-moon-axes-grids.html | @@ -189,4 +189,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun-earth-moon-axes.html | @@ -127,4 +127,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun-earth-moon.html | @@ -119,4 +119,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun-earth-orbit-fixed.html | @@ -105,4 +105,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun-earth-orbit.html | @@ -101,4 +101,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun-earth.html | @@ -101,4 +101,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-sun.html | @@ -96,4 +96,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-scenegraph-tank.html | @@ -287,4 +287,3 @@
</html>
- | true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | threejs/threejs-tips-tabindex.html | @@ -38,7 +38,6 @@
</body>
<script type="module">
-
document.querySelectorAll('canvas').forEach((canvas) => {
const ctx = canvas.getContext('2d');
| true |
Other | mrdoob | three.js | 0c4969b330f0e84636d4f535a2e90dc80249a68e.json | remove extra lines | todo.md | @@ -4,4 +4,3 @@ TO DO
* Update first article with links to CDN?
- | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/lessons/threejs-load-obj.md | @@ -43,10 +43,9 @@ the hemispherical lighting example so I ended up with one
related to adjusting the lights. I also removed the cube and sphere
that were being added to the scene.
-From that the first thing we need to do is include the `OBJLoader2` loader in our scene. The `OBJLoader2` also needs the `LoaderSupport.js` file so let's add both.
+From that the first thing we need to do is include the `OBJLoader2` loader in our script.
```js
-import {LoaderSupport} from './resources/threejs/r108/examples/jsm/loaders/LoaderSupport.js';
import {OBJLoader2} from './resources/threejs/r108/examples/jsm/loaders/OBJLoader2.js';
```
@@ -57,8 +56,7 @@ the loaded model to our scene.
```js
{
const objLoader = new OBJLoader2();
- objLoader.load('resources/models/windmill/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.load('resources/models/windmill/windmill.obj', (root) => {
scene.add(root);
});
}
@@ -69,7 +67,7 @@ If we run that what happens?
{{{example url="../threejs-load-obj-no-materials.html" }}}
Well it's close but we're getting errors about materials since we haven't
-given the scene any matrials and .OBJ files don't have material
+given the scene any materials and .OBJ files don't have material
parameters.
The .OBJ loader can be passed an
@@ -130,7 +128,7 @@ and then chosing **Write Files to Current Directory**
<div class="threejs_center"><img style="width: 828px;" src="resources/images/windmill-overwrite.jpg"></div>
-This ends up writing the files in the same folder asthe .blend file
+This ends up writing the files in the same folder as the .blend file
in a sub folder called **textures**.
<div class="threejs_center"><img style="width: 758px;" src="resources/images/windmill-exported-texture-files.png"></div>
@@ -142,25 +140,27 @@ file to.
Now that we have the textures available we can load the .MTL file.
-First we need to include the `MTLLoader`
+First we need to include the `MTLLoader` and the `MtlObjBridge`;
```js
import * as THREE from './resources/three/r108/build/three.module.js';
import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
-import {LoaderSupport} from './resources/threejs/r108/examples/jsm/loaders/LoaderSupport.js';
import {OBJLoader2} from './resources/threejs/r108/examples/jsm/loaders/OBJLoader2.js';
+import {MTLLoader} from './resources/threejs/r108/examples/jsm/loaders/MTLLoader.js';
++import {MtlObjBridge} from './resources/threejs/r108/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js';
```
-Then we first load the .MTL file. When it's finished loading we set the just loaded materials on to the `OBJLoader2` itself and then load the .OBJ file.
+Then we first load the .MTL file. When it's finished loading we add
+the just loaded materials on to the `OBJLoader2` itself via the `MtlObjBridge`
+and then load the .OBJ file.
```js
{
-+ const objLoader = new OBJLoader2();
-+ objLoader.loadMtl('resources/models/windmill/windmill.mtl', null, (materials) => {
-+ objLoader.setMaterials(materials);
- objLoader.load('resources/models/windmill/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
++ const mtlLoader = new MTLLoader();
++ mtlLoader.load('resources/models/windmill/windmill.mtl', (mtlParseResult) => {
++ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
++ objLoader.addMaterials(materials);
+ objLoader.load('resources/models/windmill/windmill.obj', (root) => {
scene.add(root);
});
+ });
@@ -183,7 +183,9 @@ head I can think of 3 ways to fix this.
1. Loop over all the materials after loading them and set them all to double sided.
- objLoader.loadMtl('resources/models/windmill/windmill.mtl', null, (materials) => {
+ const mtlLoader = new MTLLoader();
+ mtlLoader.load('resources/models/windmill/windmill.mtl', (mtlParseResult) => {
+ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
for (const material of Object.values(materials)) {
material.side = THREE.DoubleSide;
}
@@ -200,8 +202,9 @@ head I can think of 3 ways to fix this.
out the blades use the material called `"Material"`so we could set
that one specifically
- const objLoader = new OBJLoader2();
- objLoader.loadMtl('resources/models/windmill/windmill.mtl', null, (materials) => {
+ const mtlLoader = new MTLLoader();
+ mtlLoader.load('resources/models/windmill/windmill.mtl', (mtlParseResult) => {
+ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
materials.Material.side = THREE.DoubleSide;
...
@@ -296,8 +299,7 @@ First off we can ask THREE.js to compute a box that contains the scene
we just loaded and ask for its size and center
```js
-objLoader.load('resources/models/windmill_2/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+objLoader.load('resources/models/windmill_2/windmill.obj', (root) => {
scene.add(root);
+ const box = new THREE.Box3().setFromObject(root);
@@ -329,7 +331,7 @@ altitude so we'll just have to pick something.
As we went over in [the article on cameras](threejs-cameras.html) the camera defines a frustum.
That frustum is defined by the field of view (`fov`) and the `near` and `far` settings. We
want to know given whatever field of view the camera currently has, how far away does the camera
-need to be so the box containing the scene fits inside the frustum assiming the frustum
+need to be so the box containing the scene fits inside the frustum assuming the frustum
extended forever. In other words let's assume `near` is 0.00000001 and `far` is infinity.
Since we know the size of the box and we know the field of view we have this triangle
@@ -341,7 +343,7 @@ front of it. We just computed the box that contains the the windmill. We need to
compute how far way the camera should be from the box so that the box appears
inside the frustum.
-Using basic *right triangle* trigonametry and [SOHCAHTOA](https://www.google.com/search?q=SOHCAHTOA),
+Using basic *right triangle* trigonometry and [SOHCAHTOA](https://www.google.com/search?q=SOHCAHTOA),
given we know the field of view for the frustum and we know the size of the box we can compute the *distance*.
<div class="threejs_center"><img style="width: 600px;" src="resources/images/field-of-view-camera.svg"></div>
@@ -390,8 +392,7 @@ larger size.
```js
{
const objLoader = new OBJLoader2();
- objLoader.load('resources/models/windmill_2/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.load('resources/models/windmill_2/windmill.obj', (root) => {
scene.add(root);
+ // compute the box that contains all the stuff
+ // from root and below
@@ -430,7 +431,7 @@ the windmill.
Let's change it to move sideways from the center of the box to in whatever direction
the camera is from the center. All we need to do to do that is zero out the `y` component
of the vector from the box to the camera. Then, when we normalize that vector it will
-become a vector parallel to the XZ plane. In otherwords parallel to the ground.
+become a vector parallel to the XZ plane. In other words parallel to the ground.
```js
-// compute a unit vector that points in the direction the camera is now
@@ -486,7 +487,7 @@ some textures but looking at the files I quickly see an issue.
There are TARGA (.tga) files and they are giant!
-THREE.js actually has a TGA loader but it's argubly wrong to use it for most use cases.
+THREE.js actually has a TGA loader but it's arguably wrong to use it for most use cases.
If you're making a viewer where you want to allow users to view random 3D files they
find on the net then maybe, just maybe, you might want to load TGA files. ([*](#loading-scenes))
@@ -553,11 +554,12 @@ and then set them on the `OBJLoader2`
```js
{
-+ const objLoader = new OBJLoader2();
-+ objLoader.loadMtl('resources/models/windmill_2/windmill-fixed.mtl', null, (materials) => {
-+ objLoader.setMaterials(materials);
- objLoader.load('resources/models/windmill/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
++ const mtlLoader = new MTLLoader();
++ mtlLoader.load('resources/models/windmill_2/windmill-fixed.mtl', (mtlParseResult) => {
++ const objLoader = new OBJLoader2();
++ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
++ objLoader.addMaterials(materials);
+ objLoader.load('resources/models/windmill/windmill.obj', (root) => {
root.updateMatrixWorld();
scene.add(root);
// compute the box that contains all the stuff | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-auto-camera-xz.html | @@ -109,8 +109,7 @@
{
const objLoader = new OBJLoader2();
- objLoader.load('resources/models/windmill_2/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.load('resources/models/windmill_2/windmill.obj', (root) => {
root.updateMatrixWorld();
scene.add(root);
// compute the box that contains all the stuff | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-auto-camera.html | @@ -106,8 +106,7 @@
{
const objLoader = new OBJLoader2();
- objLoader.load('resources/models/windmill_2/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.load('resources/models/windmill_2/windmill.obj', (root) => {
scene.add(root);
// compute the box that contains all the stuff
// from root and below | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-materials-fixed.html | @@ -24,6 +24,8 @@
import * as THREE from './resources/threejs/r108/build/three.module.js';
import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
import {OBJLoader2} from './resources/threejs/r108/examples/jsm/loaders/OBJLoader2.js';
+import {MTLLoader} from './resources/threejs/r108/examples/jsm/loaders/MTLLoader.js';
+import {MtlObjBridge} from './resources/threejs/r108/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js';
function main() {
const canvas = document.querySelector('#c');
@@ -82,12 +84,13 @@
}
{
- const objLoader = new OBJLoader2();
- objLoader.loadMtl('resources/models/windmill/windmill-fixed.mtl', null, (materials) => {
+ const mtlLoader = new MTLLoader();
+ mtlLoader.load('resources/models/windmill/windmill-fixed.mtl', (mtlParseResult) => {
+ const objLoader = new OBJLoader2();
+ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
materials.Material.side = THREE.DoubleSide;
- objLoader.setMaterials(materials);
- objLoader.load('resources/models/windmill/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.addMaterials(materials);
+ objLoader.load('resources/models/windmill/windmill.obj', (root) => {
scene.add(root);
});
}); | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-materials-windmill2.html | @@ -24,6 +24,8 @@
import * as THREE from './resources/threejs/r108/build/three.module.js';
import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
import {OBJLoader2} from './resources/threejs/r108/examples/jsm/loaders/OBJLoader2.js';
+import {MTLLoader} from './resources/threejs/r108/examples/jsm/loaders/MTLLoader.js';
+import {MtlObjBridge} from './resources/threejs/r108/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js';
function main() {
const canvas = document.querySelector('#c');
@@ -108,11 +110,12 @@
}
{
- const objLoader = new OBJLoader2();
- objLoader.loadMtl('resources/models/windmill_2/windmill-fixed.mtl', null, (materials) => {
- objLoader.setMaterials(materials);
- objLoader.load('resources/models/windmill_2/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ const mtlLoader = new MTLLoader();
+ mtlLoader.load('resources/models/windmill_2/windmill-fixed.mtl', (mtlParseResult) => {
+ const objLoader = new OBJLoader2();
+ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
+ objLoader.addMaterials(materials);
+ objLoader.load('resources/models/windmill_2/windmill.obj', (root) => {
scene.add(root);
// compute the box that contains all the stuff | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-materials.html | @@ -24,6 +24,8 @@
import * as THREE from './resources/threejs/r108/build/three.module.js';
import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
import {OBJLoader2} from './resources/threejs/r108/examples/jsm/loaders/OBJLoader2.js';
+import {MTLLoader} from './resources/threejs/r108/examples/jsm/loaders/MTLLoader.js';
+import {MtlObjBridge} from './resources/threejs/r108/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js';
function main() {
const canvas = document.querySelector('#c');
@@ -82,11 +84,12 @@
}
{
- const objLoader = new OBJLoader2();
- objLoader.loadMtl('resources/models/windmill/windmill.mtl', null, (materials) => {
- objLoader.setMaterials(materials);
- objLoader.load('resources/models/windmill/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ const mtlLoader = new MTLLoader();
+ mtlLoader.load('resources/models/windmill/windmill.mtl', (mtlParseResult) => {
+ const objLoader = new OBJLoader2();
+ const materials = MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);
+ objLoader.addMaterials(materials);
+ objLoader.load('resources/models/windmill/windmill.obj', (root) => {
scene.add(root);
});
}); | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-no-materials.html | @@ -84,8 +84,7 @@
{
const objLoader = new OBJLoader2();
- objLoader.load('resources/models/windmill/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.load('resources/models/windmill/windmill.obj', (root) => {
scene.add(root);
});
} | true |
Other | mrdoob | three.js | c44b5a9c1dc2d85089e9f1eaf94c0f92d1629274.json | fix obj loader article for r108 | threejs/threejs-load-obj-wat.html | @@ -84,8 +84,7 @@
{
const objLoader = new OBJLoader2();
- objLoader.load('resources/models/windmill_2/windmill.obj', (event) => {
- const root = event.detail.loaderRootNode;
+ objLoader.load('resources/models/windmill_2/windmill.obj', (root) => {
scene.add(root);
});
} | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/3dlut-base-cube-maker.html | @@ -24,8 +24,8 @@ <h1>Color Cube Image Maker</h1>
<span id="width"></span>x<span id="height"></span> )</div>
</p>
</body>
-<script>
-'use strict';
+<script type="module">
+
const ctx = document.querySelector('canvas').getContext('2d');
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/background-v01.html | @@ -21,20 +21,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="resources/threejs/r108/js/shaders/SSAOShader.js"></script>
-<script src="resources/threejs/r108/js/shaders/CopyShader.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/EffectComposer.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/RenderPass.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/ShaderPass.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/MaskPass.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/SSAOPass.js"></script>
-<script src="resources/threejs/r108/js/loaders/GLTFLoader.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import {GLTFLoader} from './resources/threejs/r108/examples/jsm/loaders/GLTFLoader.js';
function main() {
const canvas = document.querySelector('#c');
@@ -56,7 +46,7 @@
const camSpeed = 0.2;
if (useOrbitCamera) {
- const controls = new THREE.OrbitControls(camera);
+ const controls = new OrbitControls(camera);
controls.target.set(0, 100.01, 0.2);
controls.update();
}
@@ -97,7 +87,7 @@
scene.add(dirLightHeper);
}
- const loader = new THREE.GLTFLoader();
+ const loader = new GLTFLoader();
const camRadius = 600;
const camHeight = 160;
const camTarget = [0, 30, 0]; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/background.html | @@ -21,20 +21,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="resources/threejs/r108/js/shaders/SSAOShader.js"></script>
-<script src="resources/threejs/r108/js/shaders/CopyShader.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/EffectComposer.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/RenderPass.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/ShaderPass.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/MaskPass.js"></script>
-<script src="resources/threejs/r108/js/postprocessing/SSAOPass.js"></script>
-<script src="resources/threejs/r108/js/loaders/GLTFLoader.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import {GLTFLoader} from './resources/threejs/r108/examples/jsm/loaders/GLTFLoader.js';
function main() {
const canvas = document.querySelector('#c');
@@ -57,7 +47,7 @@
const showHelpers = false;
if (useOrbitCamera) {
- const controls = new THREE.OrbitControls(camera);
+ const controls = new OrbitControls(camera);
controls.target.set(0, 0, 0);
controls.update();
}
@@ -99,7 +89,7 @@
}
const birds = [];
- const loader = new THREE.GLTFLoader();
+ const loader = new GLTFLoader();
const fogNear = 1350;
const fogFar = 1500;
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/canvas-random-dots.html | @@ -8,8 +8,8 @@
</head>
<body>
</body>
-<script>
-'use strict';
+<script type="module">
+
function main() {
const ctx = document.createElement('canvas').getContext('2d'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/gpw-data-viewer.html | @@ -12,8 +12,8 @@
<body>
<canvas></canvas>
</body>
-<script>
-'use strict';
+<script type="module">
+
async function loadFile(url) {
const req = await fetch(url); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-align-html-elements-to-3d.js | @@ -1,6 +1,5 @@
-'use strict';
+import {GUI} from '../../../3rdparty/dat.gui.module.js';
-/* global dat */
{
function outlineText(ctx, msg, x, y) {
ctx.strokeText(msg, x, y);
@@ -119,7 +118,7 @@
rotation: 0.3,
};
- const gui = new dat.GUI({autoPlace: false});
+ const gui = new GUI({autoPlace: false});
gui.add(new DegRadHelper(settings, 'rotation'), 'value', -180, 180).name('rotation').onChange(render);
gui.domElement.style.position = 'absolute';
gui.domElement.style.top = '0'; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-cameras.js | @@ -1,6 +1,5 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
function addShape(color, geometry) { | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-custom-buffergeometry.js | @@ -1,6 +1,5 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
const loader = new THREE.TextureLoader(); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-fog.js | @@ -1,6 +1,6 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {GLTFLoader} from '../../resources/threejs/r108/examples/jsm/loaders/GLTFLoader.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
function fogExample(scene, fog) {
@@ -15,8 +15,9 @@
function houseScene(props, fogInHouse) {
const {scene, camera} = props;
+ scene.background = new THREE.Color('#FFF');
camera.far = 200;
- const loader = new THREE.GLTFLoader();
+ const loader = new GLTFLoader();
const settings = {
shininess: 0,
roughness: 1, | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-lesson-utils.js | @@ -1,8 +1,7 @@
-'use strict';
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {TrackballControls} from '../../resources/threejs/r108/examples/jsm/controls/TrackballControls.js';
-/* global THREE */
-
-window.threejsLessonUtils = {
+export const threejsLessonUtils = {
init() {
if (this.renderer) {
return;
@@ -144,15 +143,15 @@ window.threejsLessonUtils = {
targetFOVDeg = camera.fov;
if (settings.trackball !== false) {
- const controls = new THREE.TrackballControls(camera, elem);
+ const controls = new TrackballControls(camera, elem);
controls.noZoom = true;
controls.noPan = true;
resizeFunctions.push(controls.handleResize.bind(controls));
updateFunctions.push(controls.update.bind(controls));
}
// add the lights as children of the camera.
- // this is because TrackbacllControls move the camera.
+ // this is because TrackballControls move the camera.
// We really want to rotate the object itself but there's no
// controls for that so we fake it by putting all the lights
// on the camera so they move with it. | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-lights.js | @@ -1,6 +1,6 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from '../../resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
function makeCheckerTexture(repeats) {
@@ -39,7 +39,7 @@
return function(renderInfo) {
const {scene, camera, elem} = renderInfo;
- const controls = new THREE.OrbitControls(camera, elem);
+ const controls = new OrbitControls(camera, elem);
controls.enableDamping = true;
controls.enablePanning = false;
controls.enableKeys = false; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-lots-of-objects.js | @@ -1,6 +1,6 @@
-'use strict';
-
-/* global THREE, dat, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
+import {GUI} from '../../../3rdparty/dat.gui.module.js';
{
class DegRadHelper {
@@ -97,7 +97,7 @@
camera.position.set(1, 1.5, 1.5);
camera.lookAt(0, 0, 0);
- const gui = new dat.GUI({autoPlace: false});
+ const gui = new GUI({autoPlace: false});
renderInfo.elem.appendChild(gui.domElement);
gui.add(new DegRadHelper(lonHelper.rotation, 'y'), 'value', -180, 180).name('lonHelper x rotation');
gui.add(new DegRadHelper(latHelper.rotation, 'x'), 'value', -90, 90).name('latHelper y rotation'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-material-table.js | @@ -1,5 +1,3 @@
-'use strict';
-
const materials = [
{
name: 'MeshBasicMaterial', | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-materials.js | @@ -1,6 +1,5 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
function makeSphere(widthDivisions, heightDivisions) { | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-post-processing-3dlut.js | @@ -1,7 +1,3 @@
-'use strict';
-
-/* global */
-
{
class Waiter {
constructor() { | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-primitives.js | @@ -1,6 +1,5 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
const darkColors = { | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-textures.js | @@ -1,6 +1,5 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
const loader = new THREE.TextureLoader(); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/resources/threejs-voxel-geometry.js | @@ -1,6 +1,6 @@
-'use strict';
-
-/* global THREE, threejsLessonUtils */
+import * as THREE from '../../resources/threejs/r108/build/three.module.js';
+import {BufferGeometryUtils} from '../../resources/threejs/r108/examples/jsm/utils/BufferGeometryUtils.js';
+import {threejsLessonUtils} from './threejs-lesson-utils.js';
{
const darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
@@ -31,7 +31,7 @@
}
}
}
- const mergedGeometry = THREE.BufferGeometryUtils.mergeBufferGeometries(geometries, false);
+ const mergedGeometry = BufferGeometryUtils.mergeBufferGeometries(geometries, false);
const material = new THREE.MeshBasicMaterial({
color: colors.wire,
wireframe: true, | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/ru/threejs-cameras.md | @@ -591,7 +591,4 @@ function render(time) {
А пока давайте перейдем к [теням](threejs-shadows.html).
<canvas id="c"></canvas>
-<script src="../../resources/threejs/r108/three.min.js"></script>
-<script src="../../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="../resources/threejs-lesson-utils.js"></script>
-<script src="../resources/threejs-cameras.js"></script>
+<script type="module" src="resources/threejs-cameras.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/ru/threejs-lights.md | @@ -565,7 +565,4 @@ gui.add(light, 'power', 0, 2000);
Далее давайте перейдем к [работе с камерами](threejs-cameras.html).
<canvas id="c"></canvas>
-<script src="../../resources/threejs/r108/three.min.js"></script>
-<script src="../../resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../resources/threejs-lesson-utils.js"></script>
-<script src="../resources/threejs-lights.js"></script>
+<script type="module" src="../resources/threejs-lights.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/ru/threejs-material-table.md | @@ -7,6 +7,6 @@ Mesh. Вот таблица, показывающая, какие функции
<div>
<div id="material-table" class="threejs_center"></div>
-<script src="resources/threejs-material-table.js"></script>
-<link rel="stylesheet" href="resources/threejs-material-table.css">
+<script type="module" src="../resources/threejs-material-table.js"></script>
+<link rel="stylesheet" href="../resources/threejs-material-table.css">
</div> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/ru/threejs-materials.md | @@ -318,9 +318,6 @@ flat shaded
</div>
<canvas id="c"></canvas>
-<script src="../../resources/threejs/r108/three.min.js"></script>
-<script src="../../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="../resources/threejs-lesson-utils.js"></script>
-<script src="../resources/threejs-materials.js"></script>
+<script type="module" src="../resources/threejs-materials.js"></script>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/ru/threejs-primitives.md | @@ -331,8 +331,5 @@ function addLineGeometry(x, y, geometry) {
Далее давайте рассмотрим [как работает граф сцены и как его использовать](threejs-scenegraph.html).
<canvas id="c"></canvas>
-<script src="../../resources/threejs/r108/three.min.js"></script>
-<script src="../../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="../resources/threejs-lesson-utils.js"></script>
-<script src="../resources/threejs-primitives.js"></script>
+<script type="module" src="../resources/threejs-primitives.js"></script>
<link rel="stylesheet" href="resources/threejs-primitives.css"> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/ru/threejs-textures.md | @@ -616,8 +616,5 @@ roughness
-->
<canvas id="c"></canvas>
-<script src="../../resources/threejs/r108/three.min.js"></script>
-<script src="../../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="../resources/threejs-lesson-utils.js"></script>
-<script src="../resources/threejs-textures.js"></script>
+<script type="module" src="../resources/threejs-textures.js"></script>
<link rel="stylesheet" href="resources/threejs-textures.css"> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-align-html-elements-to-3d.md | @@ -785,5 +785,4 @@ elements with your 3D. A few things I might change.
Next up let's make it so you can [pick and highlight a country](threejs-indexed-textures.html).
<link rel="stylesheet" href="resources/threejs-align-html-elements-to-3d.css">
-<script src="/3rdparty/dat.gui.min.js"></script>
-<script src="resources/threejs-align-html-elements-to-3d.js"></script>
+<script type="module" src="resources/threejs-align-html-elements-to-3d.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-cameras.md | @@ -597,7 +597,4 @@ That's the fundamentals of cameras. We'll cover a few common ways to move camera
in other articles. For now let's move on to [shadows](threejs-shadows.html).
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-cameras.js"></script>
+<script type="module" src="resources/threejs-cameras.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-custom-buffergeometry.md | @@ -461,9 +461,6 @@ make your own geometry and how to dynamically update the contents of a
depends on your needs.
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-custom-buffergeometry.js"></script>
+<script type="module" src="resources/threejs-custom-buffergeometry.js"></script>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-fog.md | @@ -272,8 +272,4 @@ By turning fog off on the materials for the house we can fix that issue.
</div>
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="../resources/threejs/r108/js/loaders/GLTFLoader.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-fog.js"></script>
+<script type="module" src="resources/threejs-fog.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-lights.md | @@ -574,7 +574,4 @@ possible to achieve your goals.
Next up let's go over [dealing with cameras](threejs-cameras.html).
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-lights.js"></script>
+<script type="module" src="resources/threejs-lights.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-material-table.md | @@ -7,7 +7,7 @@ is a table showing which material support which features.
<div>
<div id="material-table" class="threejs_center"></div>
-<script src="resources/threejs-material-table.js"></script>
+<script type="module" src="resources/threejs-material-table.js"></script>
<link rel="stylesheet" href="resources/threejs-material-table.css">
</div>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-materials.md | @@ -304,9 +304,6 @@ switch from using one to using the other.
</div>
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-materials.js"></script>
+<script type="module" src="resources/threejs-materials.js"></script>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-optimize-lots-of-objects.md | @@ -532,8 +532,4 @@ though there are creative solutions. We'll explore one in
[another article](threejs-optimize-lots-of-objects-animated.html).
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="../../3rdparty/dat.gui.min.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-lots-of-objects.js"></script>
\ No newline at end of file
+<script type="module" src="resources/threejs-lots-of-objects.js"></script>
\ No newline at end of file | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-post-processing-3dlut.md | @@ -491,5 +491,5 @@ The sample below is just a modification of the code above. We only draw the back
One thing completely skipped is how the shader itself works. Hopefully we can cover a little more GLSL in the future. For now, if you're curious, you can follow the links in the [post processing article](threejs-post-processing.html) as well as maybe [take a look at this video](https://www.youtube.com/watch?v=rfQ8rKGTVlg#t=24m30s).
-<script src="resources/threejs-post-processing-3dlut.js"></script>
+<script type="module" src="resources/threejs-post-processing-3dlut.js"></script>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-primitives.md | @@ -349,10 +349,7 @@ Next up let's go over [how three's scene graph works and how
to use it](threejs-scenegraph.html).
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-primitives.js"></script>
<link rel="stylesheet" href="resources/threejs-primitives.css">
+<script type="module" src="resources/threejs-primitives.js"></script>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-textures.md | @@ -625,8 +625,5 @@ roughness
-->
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-textures.js"></script>
<link rel="stylesheet" href="resources/threejs-textures.css">
+<script type="module" src="resources/threejs-textures.js"></script> | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/lessons/threejs-voxel-geometry.md | @@ -1213,10 +1213,6 @@ I hope this has given you some ideas where to start and how
to generate some what efficient geometry.
<canvas id="c"></canvas>
-<script src="../resources/threejs/r108/three.min.js"></script>
-<script src="../resources/threejs/r108/js/utils/BufferGeometryUtils.js"></script>
-<script src="../resources/threejs/r108/js/controls/TrackballControls.js"></script>
-<script src="resources/threejs-lesson-utils.js"></script>
-<script src="resources/threejs-voxel-geometry.js"></script>
+<script type="module" src="resources/threejs-voxel-geometry.js"></script>
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/resources/editor-settings.js | @@ -46,7 +46,7 @@ function fixSourceLinks(url, source) {
const prefix = getPrefix(url);
function addPrefix(url) {
- return url.indexOf('://') < 0 && url[0] !== '?' ? (prefix + url) : url;
+ return url.indexOf('://') < 0 && !url.startsWith('data:') && url[0] !== '?' ? (prefix + url).replace(/\/.\//g, '/') : url;
}
function makeLinkFDedQuotes(match, fn, q1, url, q2) {
return fn + q1 + addPrefix(url) + q2; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-align-html-elements-to-3d-globe-too-many-labels.html | @@ -57,13 +57,10 @@
<div id="labels"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/utils/BufferGeometryUtils.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {BufferGeometryUtils} from './resources/threejs/r108/examples/jsm/utils/BufferGeometryUtils.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -76,7 +73,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 2.5;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.enableDamping = true;
controls.enablePan = false;
controls.minDistance = 1.2; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-align-html-elements-to-3d-globe.html | @@ -57,14 +57,11 @@
<div id="labels"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/utils/BufferGeometryUtils.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE, dat */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {BufferGeometryUtils} from './resources/threejs/r108/examples/jsm/utils/BufferGeometryUtils.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c');
@@ -77,7 +74,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 2.5;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.enableDamping = true;
controls.enablePan = false;
controls.minDistance = 1.2;
@@ -156,7 +153,7 @@
minArea: 20,
maxVisibleDot: -0.2,
};
- const gui = new dat.GUI({width: 300});
+ const gui = new GUI({width: 300});
gui.add(settings, 'minArea', 0, 50).onChange(requestRenderIfNotRequested);
gui.add(settings, 'maxVisibleDot', -1, 1, 0.01).onChange(requestRenderIfNotRequested);
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-align-html-to-3d-w-hiding.html | @@ -54,12 +54,9 @@
<div id="labels"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -72,7 +69,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 7;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 0, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-align-html-to-3d-w-sorting.html | @@ -56,12 +56,9 @@
<div id="labels"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -74,7 +71,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 7;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 0, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-align-html-to-3d.html | @@ -54,12 +54,9 @@
<div id="labels"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -72,7 +69,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 7;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 0, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-css.html | @@ -21,11 +21,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-cubemap.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -38,7 +35,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 3;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 0, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-equirectangularmap.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -38,7 +35,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.z = 3;
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 0, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-scene-background-fixed-aspect.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-scene-background.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-separate-scene-bad-aspect.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-background-separate-scene.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-billboard-labels-w-sprites-adjust-height.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-billboard-labels-w-sprites.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-billboard-trees-no-billboards.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.minPolarAngle = 0;
controls.maxPolarAngle = Math.PI / 2; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-billboard-trees-static-billboards.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.minPolarAngle = 0;
controls.maxPolarAngle = Math.PI / 2; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cameras-logarithmic-depth-buffer.html | @@ -20,13 +20,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE, dat */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c');
@@ -68,13 +65,13 @@
camera.updateProjectionMatrix();
}
- const gui = new dat.GUI();
+ const gui = new GUI();
gui.add(camera, 'fov', 1, 180).onChange(updateCamera);
const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);
gui.add(minMaxGUIHelper, 'min', 0.00001, 50, 0.00001).name('near').onChange(updateCamera);
gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far').onChange(updateCamera);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 5, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cameras-orthographic-2-scenes.html | @@ -36,13 +36,10 @@
<div id="view2" tabindex="2"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE, dat */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c');
@@ -82,13 +79,13 @@
}
}
- const gui = new dat.GUI();
+ const gui = new GUI();
gui.add(camera, 'zoom', 0.01, 1, 0.01).listen();
const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);
gui.add(minMaxGUIHelper, 'min', 0.1, 50, 0.1).name('near');
gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far');
- const controls = new THREE.OrbitControls(camera, view1Elem);
+ const controls = new OrbitControls(camera, view1Elem);
controls.target.set(0, 5, 0);
controls.update();
@@ -101,7 +98,7 @@
camera2.position.set(16, 28, 40);
camera2.lookAt(0, 5, 0);
- const controls2 = new THREE.OrbitControls(camera2, view2Elem);
+ const controls2 = new OrbitControls(camera2, view2Elem);
controls2.target.set(0, 5, 0);
controls2.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cameras-orthographic-canvas-top-left-origin.html | @@ -32,13 +32,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cameras-perspective-2-scenes.html | @@ -36,13 +36,10 @@
<div id="view2" tabindex="2"></div>
</div>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE, dat */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c');
@@ -82,13 +79,13 @@
}
}
- const gui = new dat.GUI();
+ const gui = new GUI();
gui.add(camera, 'fov', 1, 180);
const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);
gui.add(minMaxGUIHelper, 'min', 0.1, 50, 0.1).name('near');
gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far');
- const controls = new THREE.OrbitControls(camera, view1Elem);
+ const controls = new OrbitControls(camera, view1Elem);
controls.target.set(0, 5, 0);
controls.update();
@@ -101,7 +98,7 @@
camera2.position.set(40, 10, 30);
camera2.lookAt(0, 5, 0);
- const controls2 = new THREE.OrbitControls(camera2, view2Elem);
+ const controls2 = new OrbitControls(camera2, view2Elem);
controls2.target.set(0, 5, 0);
controls2.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cameras-perspective.html | @@ -20,13 +20,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE, dat */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c');
@@ -66,13 +63,13 @@
camera.updateProjectionMatrix();
}
- const gui = new dat.GUI();
+ const gui = new GUI();
gui.add(camera, 'fov', 1, 180).onChange(updateCamera);
const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);
gui.add(minMaxGUIHelper, 'min', 0.1, 50, 0.1).name('near').onChange(updateCamera);
gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far').onChange(updateCamera);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 5, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cameras-z-fighting.html | @@ -20,13 +20,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script src="../3rdparty/dat.gui.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE, dat */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
+import { GUI } from '../3rdparty/dat.gui.module.js';
function main() {
const canvas = document.querySelector('#c');
@@ -65,13 +62,13 @@
camera.updateProjectionMatrix();
}
- const gui = new dat.GUI();
+ const gui = new GUI();
gui.add(camera, 'fov', 1, 180).onChange(updateCamera);
const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);
gui.add(minMaxGUIHelper, 'min', 0.00001, 50, 0.00001).name('near').onChange(updateCamera);
gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far').onChange(updateCamera);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 5, 0);
controls.update();
| true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-canvas-textured-cube-qix.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-canvas-textured-cube.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-canvas-textured-labels-one-canvas.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.update();
@@ -177,7 +174,6 @@
return needResize;
}
-
function render() {
if (resizeRendererToDisplaySize(renderer)) {
const canvas = renderer.domElement; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-canvas-textured-labels-scale-to-fit.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.update();
@@ -162,7 +159,6 @@
return needResize;
}
-
function render() {
if (resizeRendererToDisplaySize(renderer)) {
const canvas = renderer.domElement; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-canvas-textured-labels.html | @@ -19,12 +19,9 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/controls/OrbitControls.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {OrbitControls} from './resources/threejs/r108/examples/jsm/controls/OrbitControls.js';
function main() {
const canvas = document.querySelector('#c');
@@ -37,7 +34,7 @@
const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
camera.position.set(0, 2, 5);
- const controls = new THREE.OrbitControls(camera, canvas);
+ const controls = new OrbitControls(camera, canvas);
controls.target.set(0, 2, 0);
controls.update();
@@ -154,7 +151,6 @@
return needResize;
}
-
function render() {
if (resizeRendererToDisplaySize(renderer)) {
const canvas = renderer.domElement; | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cleanup-loaded-files.html | @@ -24,13 +24,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/loaders/GLTFLoader.js"></script>
-<script>
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {GLTFLoader} from './resources/threejs/r108/examples/jsm/loaders/GLTFLoader.js';
-'use strict';
-
-/* global THREE */
class ResourceTracker {
constructor() {
@@ -145,7 +142,7 @@
camera.lookAt(boxCenter.x, boxCenter.y, boxCenter.z);
}
- const gltfLoader = new THREE.GLTFLoader();
+ const gltfLoader = new GLTFLoader();
function loadGLTF(url) {
return new Promise((resolve, reject) => {
gltfLoader.load(url, resolve, undefined, reject); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-cleanup-simple.html | @@ -24,13 +24,10 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script src="resources/threejs/r108/js/loaders/GLTFLoader.js"></script>
-<script>
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
+import {GLTFLoader} from './resources/threejs/r108/examples/jsm/loaders/GLTFLoader.js';
-'use strict';
-
-/* global THREE */
class ResourceTracker {
constructor() { | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-buffergeometry-cube-indexed.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-buffergeometry-cube-typedarrays.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-buffergeometry-cube.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-buffergeometry-dynamic.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-geometry-cube-face-colors.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-geometry-cube-face-normals.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-geometry-cube-texcoords.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Other | mrdoob | three.js | d2fd74e7b551b049b48e30bf191926aae87291fa.json | use modules in all examples | threejs/threejs-custom-geometry-cube-vertex-colors.html | @@ -19,11 +19,8 @@
<body>
<canvas id="c"></canvas>
</body>
-<script src="resources/threejs/r108/three.min.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
+<script type="module">
+import * as THREE from './resources/threejs/r108/build/three.module.js';
function main() {
const canvas = document.querySelector('#c'); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.