@jdultra/threedtiles 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/{skybox → src/images/skybox}/back.png +0 -0
- package/{skybox → src/images/skybox}/bottom.png +0 -0
- package/{skybox → src/images/skybox}/front.png +0 -0
- package/{skybox → src/images/skybox}/left.png +0 -0
- package/{skybox → src/images/skybox}/right.png +0 -0
- package/{skybox → src/images/skybox}/top.png +0 -0
- package/src/index.js +18 -18
- package/webpack.config.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdultra/threedtiles",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "An OGC 3DTiles viewer for Three.js",
|
|
5
5
|
"main": "tileset.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"gltf-validator": ">=2.0.0-dev.3.3",
|
|
27
|
+
"js-utils-z": "1.2.1",
|
|
27
28
|
"lodash": ">=4.17.20",
|
|
29
|
+
"path-browserify": "^1.0.1",
|
|
28
30
|
"regenerator-runtime": ">=0.13.7",
|
|
29
|
-
"three": "0.131.0"
|
|
30
|
-
"js-utils-z": "1.2.1"
|
|
31
|
+
"three": "0.131.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@babel/core": "^7.12.9",
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
"html-loader": "^1.3.2",
|
|
39
40
|
"html-webpack-plugin": "^4.5.0",
|
|
40
41
|
"mini-css-extract-plugin": "^1.3.1",
|
|
41
|
-
"webpack": "
|
|
42
|
-
"webpack-cli": "
|
|
43
|
-
"webpack-dev-server": "
|
|
42
|
+
"webpack": "^5.65.0",
|
|
43
|
+
"webpack-cli": "4.9.1",
|
|
44
|
+
"webpack-dev-server": "4.7.1",
|
|
44
45
|
"whatwg-fetch": "^3.5.0"
|
|
45
46
|
}
|
|
46
47
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,12 @@ import * as THREE from 'three';
|
|
|
3
3
|
import Stats from 'three/examples/jsm/libs/stats.module.js';
|
|
4
4
|
import { OGC3DTile } from "./tileset/OGC3DTile";
|
|
5
5
|
import { MapControls, OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
6
|
+
import back from './images/skybox/back.png';
|
|
7
|
+
import front from './images/skybox/front.png';
|
|
8
|
+
import top from './images/skybox/top.png';
|
|
9
|
+
import bottom from './images/skybox/bottom.png';
|
|
10
|
+
import right from './images/skybox/right.png';
|
|
11
|
+
import left from './images/skybox/left.png';
|
|
6
12
|
|
|
7
13
|
|
|
8
14
|
const scene = initScene();
|
|
@@ -21,12 +27,12 @@ animate();
|
|
|
21
27
|
function initSkybox(controller, camera, scene) {
|
|
22
28
|
const geometry = new THREE.BoxGeometry(8000, 8000, 8000);
|
|
23
29
|
const textures = [
|
|
24
|
-
loadTexture(
|
|
25
|
-
loadTexture(
|
|
26
|
-
loadTexture(
|
|
27
|
-
loadTexture(
|
|
28
|
-
loadTexture(
|
|
29
|
-
loadTexture(
|
|
30
|
+
loadTexture(back),
|
|
31
|
+
loadTexture(front),
|
|
32
|
+
loadTexture(top),
|
|
33
|
+
loadTexture(bottom),
|
|
34
|
+
loadTexture(right),
|
|
35
|
+
loadTexture(left),
|
|
30
36
|
];
|
|
31
37
|
function loadTexture(url) {
|
|
32
38
|
return new THREE.TextureLoader().load(url, (texture => {
|
|
@@ -117,8 +123,8 @@ function initStats(dom) {
|
|
|
117
123
|
|
|
118
124
|
function initCamera() {
|
|
119
125
|
const camera = new THREE.PerspectiveCamera(70, window.offsetWidth / window.offsetHeight, 1, 10000);
|
|
120
|
-
camera.position.set(-60,
|
|
121
|
-
camera.lookAt(-100,
|
|
126
|
+
camera.position.set(-60, 80, -30);
|
|
127
|
+
camera.lookAt(-100, 40, 0);
|
|
122
128
|
|
|
123
129
|
return camera;
|
|
124
130
|
}
|
|
@@ -126,15 +132,9 @@ function initCamera() {
|
|
|
126
132
|
function initTileset(scene) {
|
|
127
133
|
|
|
128
134
|
const ogc3DTile = new OGC3DTile({
|
|
129
|
-
url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
|
|
130
|
-
//url: "https://storage.googleapis.com/ogc-3d-tiles/castleX/tileset.json",
|
|
131
|
-
//url: "https://storage.googleapis.com/ogc-3d-tiles/berlinSubsetTiled/tileset.json",
|
|
132
135
|
//url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
|
|
133
|
-
//url: "https://
|
|
134
|
-
|
|
135
|
-
//url: "https://s3.us-east-2.wasabisys.com/construkted-assets/e63mubnpmg/tileset.json",
|
|
136
|
-
//url: "https://assets.cesium.com/697512/tileset.json?v=1",
|
|
137
|
-
//url:"https://a.3d.blc.shc.eu/WAB/base_layer/cesium_mesh_2020/tileset.json",
|
|
136
|
+
//url: "https://storage.googleapis.com/ogc-3d-tiles/castleX/tileset.json",
|
|
137
|
+
url: "https://storage.googleapis.com/ogc-3d-tiles/berlinSubsetTiled/tileset.json",
|
|
138
138
|
geometricErrorMultiplier: 1,
|
|
139
139
|
loadOutsideView: true,
|
|
140
140
|
meshCallback: mesh => {
|
|
@@ -148,7 +148,7 @@ function initTileset(scene) {
|
|
|
148
148
|
//ogc3DTile.translateOnAxis(new THREE.Vector3(0,1,0), -10)
|
|
149
149
|
//ogc3DTile.translateOnAxis(new THREE.Vector3(1,0,0), -65)
|
|
150
150
|
//ogc3DTile.translateOnAxis(new THREE.Vector3(0,0,1), -80)
|
|
151
|
-
//ogc3DTile.scale.set(0.
|
|
151
|
+
//ogc3DTile.scale.set(0.1,0.1,0.1);
|
|
152
152
|
//ogc3DTile.rotateOnAxis(new THREE.Vector3(1, 0, 0), -Math.PI * 0.5) // Z-UP to Y-UP
|
|
153
153
|
//// It's up to the user to call updates on the tileset. You might call them whenever the camera moves or at regular time intervals like here
|
|
154
154
|
|
|
@@ -177,7 +177,7 @@ function initTileset(scene) {
|
|
|
177
177
|
function initController(camera, dom) {
|
|
178
178
|
const controller = new OrbitControls(camera, dom);
|
|
179
179
|
|
|
180
|
-
controller.target.set(-20,
|
|
180
|
+
controller.target.set(-20, 40, 35);
|
|
181
181
|
controller.minDistance = 1;
|
|
182
182
|
controller.maxDistance = 500;
|
|
183
183
|
controller.update();
|
package/webpack.config.js
CHANGED
|
@@ -83,19 +83,13 @@ module.exports = {
|
|
|
83
83
|
}]
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
test: /\.(png|gif)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
options: {
|
|
90
|
-
name: "images/[name].[contenthash].[ext]"
|
|
91
|
-
}
|
|
92
|
-
}]
|
|
93
|
-
}
|
|
86
|
+
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
87
|
+
type: 'asset/resource',
|
|
88
|
+
},
|
|
94
89
|
],
|
|
95
90
|
},
|
|
96
91
|
optimization: {
|
|
97
92
|
minimizer: [new TerserPlugin({
|
|
98
|
-
cache: true,
|
|
99
93
|
parallel: true,
|
|
100
94
|
terserOptions: {
|
|
101
95
|
ecma: undefined,
|
|
@@ -119,8 +113,14 @@ module.exports = {
|
|
|
119
113
|
devServer: {
|
|
120
114
|
hot: true,
|
|
121
115
|
open: true,
|
|
122
|
-
openPage: "",
|
|
123
116
|
port: DEFAULT_WEBPACK_PORT
|
|
117
|
+
},
|
|
118
|
+
resolve: {
|
|
119
|
+
extensions: [".js", ".jsx", ".json", ".ts", ".tsx"],// other stuff
|
|
120
|
+
fallback: {
|
|
121
|
+
"fs": false,
|
|
122
|
+
"path": require.resolve("path-browserify")
|
|
123
|
+
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
};
|