Skip to content

Commit f56d08c

Browse files
author
luosijie
committed
🌐 fix production error
1 parent 14353b2 commit f56d08c

30 files changed

+640
-1415
lines changed
File renamed without changes.

src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const workList = [
1010
{ link: '', img: '' },
1111
{ link: '/pages/house-in-desert/', img: cover('house-in-desert') },
1212
{ link: '/pages/jump/', img: cover('jump') },
13-
{ link: 'pages//mini-city/', img: cover('mini-city') },
13+
{ link: 'pages/mini-city/', img: cover('mini-city') },
1414
{ link: 'pages/china-map/', img: cover('china-map') }
1515
]
1616

src/pages/bedroom/main.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'
66

77
import createBackgroundMaterial from './materials/createBackground.js'
88

9+
import urlRoom from './resources/room.glb?url'
10+
import urlPlants from './resources/plants.glb?url'
11+
import urlMatcapGreen from './resources/matcap-green.webp?url'
12+
import urlImageBaked from './resources/baked.webp?url'
13+
914
const canvas : HTMLCanvasElement = <HTMLCanvasElement> document.querySelector('#canvas')
1015

1116
// Set loaders
1217

1318
const textureLoader = new TextureLoader()
1419

1520
const dracoLoader = new DRACOLoader()
16-
dracoLoader.setDecoderPath('draco/')
21+
dracoLoader.setDecoderPath('/draco/')
1722

1823
const gltfLoader = new GLTFLoader()
1924
gltfLoader.setDRACOLoader(dracoLoader)
@@ -44,12 +49,12 @@ backgroundMesh.updateMatrix()
4449
scene.add(backgroundMesh)
4550

4651
// Load room
47-
const roomTexture = textureLoader.load('./resources/baked.webp')
52+
const roomTexture = textureLoader.load(urlImageBaked)
4853
roomTexture.flipY = false
4954
roomTexture.encoding = sRGBEncoding
5055

5156
gltfLoader.load(
52-
'./resources/room.glb',
57+
urlRoom,
5358
gltf => {
5459
const bakedMesh : Mesh = <Mesh> gltf.scene.children.find(child => child.name === 'main')
5560

@@ -60,12 +65,12 @@ gltfLoader.load(
6065
)
6166

6267
// Load plants
63-
const plantsTexture = textureLoader.load('./resources/matcap-green.webp')
68+
const plantsTexture = textureLoader.load(urlMatcapGreen)
6469
plantsTexture.flipY = false
6570
plantsTexture.encoding = sRGBEncoding
6671

6772
gltfLoader.load(
68-
'./resources/plants.glb',
73+
urlPlants,
6974
gltf => {
7075
const mesh : Mesh = <Mesh> gltf.scene.children.find(child => child.name === 'plants')
7176

src/pages/house-in-desert/draco/README.md

-32
This file was deleted.

src/pages/house-in-desert/draco/draco_decoder.js

-52
This file was deleted.
Binary file not shown.

src/pages/house-in-desert/draco/draco_encoder.js

-33
This file was deleted.

src/pages/house-in-desert/draco/draco_wasm_wrapper.js

-104
This file was deleted.

src/pages/house-in-desert/draco/gltf/draco_decoder.js

-48
This file was deleted.
Binary file not shown.

src/pages/house-in-desert/draco/gltf/draco_encoder.js

-33
This file was deleted.

src/pages/house-in-desert/draco/gltf/draco_wasm_wrapper.js

-104
This file was deleted.

src/pages/house-in-desert/main.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'
77
import createBackgroundMaterial from './materials/createBackground.js'
88
import createFloorShadowMaterial from './materials/createFloorShadow.js'
99

10+
import urlImageBaked from './resources/baked.jpg?url'
11+
import urlImageFloorShadow from './resources/floor-shadow.jpg?url'
12+
import urlModelHouse from './resources/house.glb?url'
13+
1014
const canvas = document.querySelector('#canvas')
1115

1216
if (canvas instanceof HTMLCanvasElement) {
@@ -16,12 +20,12 @@ if (canvas instanceof HTMLCanvasElement) {
1620
const textureLoader = new TextureLoader()
1721

1822
// texture-baked
19-
const bakedTexture = textureLoader.load('./resources/baked.jpg')
23+
const bakedTexture = textureLoader.load(urlImageBaked)
2024
bakedTexture.flipY = false
2125
bakedTexture.encoding = sRGBEncoding
2226

2327
// texture-floor-shadow
24-
const floorShadowTexture = textureLoader.load('./resources/floor-shadow.jpg')
28+
const floorShadowTexture = textureLoader.load(urlImageFloorShadow)
2529
floorShadowTexture.flipY = false
2630
floorShadowTexture.encoding = sRGBEncoding
2731

@@ -38,7 +42,7 @@ if (canvas instanceof HTMLCanvasElement) {
3842

3943
// Draco loader
4044
const dracoLoader = new DRACOLoader()
41-
dracoLoader.setDecoderPath('draco/')
45+
dracoLoader.setDecoderPath('/draco/')
4246

4347
// GLTF loader
4448
const gltfLoader = new GLTFLoader()
@@ -55,7 +59,7 @@ if (canvas instanceof HTMLCanvasElement) {
5559

5660
// load-model
5761
gltfLoader.load(
58-
'./resources/house.glb',
62+
urlModelHouse,
5963
gltf => {
6064
const bakedMesh = gltf.scene.children.find(child => child.name === 'baked')
6165
if (bakedMesh instanceof Mesh) {

src/pages/jump/index.vue

+13
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ body {
6666
margin: 0;
6767
padding: 0;
6868
}
69+
6970
.container {
7071
display: flex;
7172
align-items: center;
@@ -75,6 +76,7 @@ body {
7576
background: #ffffff;
7677
flex-direction: column;
7778
}
79+
7880
.mask {
7981
position: fixed;
8082
display: flex;
@@ -85,9 +87,11 @@ body {
8587
height: 100%;
8688
background: rgb(0 0 0 / 40%);
8789
flex-direction: column;
90+
8891
.title {
8992
padding-bottom: 30px;
9093
}
94+
9195
.content {
9296
display: flex;
9397
justify-content: center;
@@ -100,21 +104,25 @@ body {
100104
flex-direction: column;
101105
}
102106
}
107+
103108
.score-container {
104109
text-align: center;
105110
color: #ffffff;
106111
}
112+
107113
.title {
108114
margin-bottom: 10px;
109115
font-size: 20px;
110116
font-weight: bold;
111117
color: rgb(255 255 255 / 60%);
112118
}
119+
113120
.score {
114121
margin-top: 20px;
115122
font-size: 100px;
116123
font-weight: bold;
117124
}
125+
118126
button.restart {
119127
width: 200px;
120128
height: 40px;
@@ -125,27 +133,32 @@ button.restart {
125133
background: white;
126134
cursor: pointer;
127135
}
136+
128137
button.restart:hover {
129138
color: #232323;
130139
}
140+
131141
.info {
132142
position: absolute;
133143
margin: 20px 0;
134144
width: 100%;
135145
text-align: center;
136146
opacity: 0.2;
137147
}
148+
138149
.info a {
139150
display: block;
140151
font-size: 16px;
141152
text-decoration: none;
142153
color: #ffffff;
143154
line-height: 28px;
144155
}
156+
145157
a.title {
146158
font-size: 20px;
147159
font-weight: bold;
148160
}
161+
149162
.score-gaming {
150163
margin-top: 10px;
151164
font-size: 16px;

src/pages/mini-city/index.html

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,23 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
8+
<link rel="stylesheet" href="./style.scss">
79
<title>Mini City</title>
810
</head>
911
<body>
10-
<script type="module" src="./main.ts"></script>
12+
13+
<div class="container">
14+
<div class="info">
15+
<a class="title" href="https://github.com/luosijie/threejs-examples" target="_blank">
16+
Mini City
17+
</a>
18+
<a class="author" href="https://luosijie.github.io/" target="_blank">
19+
Created By Jesse Luo
20+
</a>
21+
</div>
22+
<canvas></canvas>
23+
</div>
24+
<script type="module" src="./js/main.js"></script>
1125
</body>
1226
</html>

0 commit comments

Comments
 (0)