@@ -20,7 +20,7 @@ Component({
20
20
renderByXRFrame : false , // 是否使用 xr-frame渲染
21
21
renderByWebGL2 : true , // 是否使用WebGL2渲染
22
22
workerOn : true ,
23
- maxGaussians : 50000 ,
23
+ maxGaussians : 100000 ,
24
24
} ,
25
25
lifetimes : {
26
26
/**
@@ -114,15 +114,19 @@ Component({
114
114
let modelMatrixT = mat4 . create ( ) ;
115
115
let modelMatrixR = mat4 . create ( ) ;
116
116
let modelMatrixS = mat4 . create ( ) ;
117
- const splatScale = 1 ;
118
- mat4 . scale ( modelMatrixS , mat4 . create ( ) , [ splatScale , splatScale , splatScale ] )
119
- mat4 . rotate ( modelMatrixR , modelMatrixS , 0 , [ 0 , 1 , 0 ] )
117
+ let splatScale = 1 ;
118
+ let splatRotationAngle = 0 ;
119
+ let splatRotationFlag = [ 0 , 1 , 0 ] ;
120
+ let splatTranslate = [ 0 , 0 , 0 ] ;
120
121
121
122
// 针对不同场景设置不同的 本地矩阵
122
123
// Setup Camera
123
124
switch ( id ) {
124
125
case 'room' :
125
- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , - 2 , 1 ] )
126
+ splatScale = 0.6 ;
127
+ splatTranslate = [ 0 , - 3 , 0 ] ;
128
+ splatRotationAngle = - Math . PI / 180 * 26 ;
129
+ splatRotationFlag = [ 1 , 0 , 0 ] ;
126
130
this . camera . updateCameraInfo (
127
131
// target
128
132
[ 0 , 0 , 0 ] ,
@@ -135,7 +139,10 @@ Component({
135
139
)
136
140
break ;
137
141
case 'garden' :
138
- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , - 1 , 1 ] )
142
+ splatScale = 0.6 ;
143
+ splatTranslate = [ 0 , - 2 , 0 ] ;
144
+ splatRotationAngle = - Math . PI / 180 * 20 ;
145
+ splatRotationFlag = [ 1 , 0 , 0 ] ;
139
146
this . camera . updateCameraInfo (
140
147
// target
141
148
[ 0 , 0 , 0 ] ,
@@ -144,11 +151,12 @@ Component({
144
151
// phi
145
152
Math . PI / 2 ,
146
153
// raidus
147
- 8
154
+ 2
148
155
)
149
156
break ;
150
157
case 'stump' :
151
- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , 1 , 0 ] )
158
+ splatScale = 0.5 ;
159
+ splatTranslate = [ 0 , 0 , 0 ] ;
152
160
this . camera . updateCameraInfo (
153
161
// target
154
162
[ 0 , 0 , 0 ] ,
@@ -157,11 +165,14 @@ Component({
157
165
// phi
158
166
Math . PI / 4 ,
159
167
// raidus
160
- 4
168
+ 2
161
169
)
162
170
break ;
163
171
case 'oneflower' :
164
- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , - 1.5 , - 3 ] )
172
+ splatScale = 0.1 ;
173
+ splatTranslate = [ - 0.5 , - 2 , - 4 ] ;
174
+ splatRotationAngle = - Math . PI / 180 * 40 ;
175
+ splatRotationFlag = [ 1 , 0 , 0 ] ;
165
176
this . camera . updateCameraInfo (
166
177
// target
167
178
[ 0 , 0 , 0 ] ,
@@ -170,11 +181,11 @@ Component({
170
181
// phi
171
182
Math . PI / 2 ,
172
183
// raidus
173
- 12
184
+ 1
174
185
)
175
186
break ;
176
187
case 'usj' :
177
- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , 1 , 0 ] )
188
+ splatTranslate = [ 0 , 1 , 0 ] ;
178
189
this . camera . updateCameraInfo (
179
190
// target
180
191
[ 0 , 0 , 0 ] ,
@@ -183,11 +194,11 @@ Component({
183
194
// phi
184
195
Math . PI / 2 ,
185
196
// raidus
186
- 4
197
+ 1
187
198
)
188
199
break ;
189
200
case 'sakura' :
190
- mat4 . translate ( modelMatrixT , modelMatrixR , [ - 1.6 , 0 , - 1 ] )
201
+ splatTranslate = [ - 1.6 , 0 , - 1 ] ;
191
202
this . camera . updateCameraInfo (
192
203
// target
193
204
[ 0 , 0 , 0 ] ,
@@ -196,11 +207,27 @@ Component({
196
207
// phi
197
208
Math . PI * 3 / 5 ,
198
209
// raidus
199
- 0.5
210
+ 1
211
+ )
212
+ break ;
213
+ case '0517cruch' :
214
+ splatTranslate = [ 0 , 0 , 0 ] ;
215
+ this . camera . updateCameraInfo (
216
+ // target
217
+ [ 0 , 0 , 0 ] ,
218
+ // theta
219
+ - Math . PI / 2 ,
220
+ // phi
221
+ Math . PI / 2 ,
222
+ // raidus
223
+ 1
200
224
)
201
225
break ;
202
226
}
203
227
228
+ mat4 . scale ( modelMatrixS , mat4 . create ( ) , [ splatScale , splatScale , splatScale ] )
229
+ mat4 . rotate ( modelMatrixR , modelMatrixS , splatRotationAngle , splatRotationFlag )
230
+ mat4 . translate ( modelMatrixT , modelMatrixR , splatTranslate )
204
231
mat4 . copy ( modelMatrixLocal , modelMatrixT ) ;
205
232
206
233
// Y轴反转矩阵
@@ -213,7 +240,7 @@ Component({
213
240
214
241
// 世界矩阵
215
242
const modelWorld = mat4 . create ( ) ;
216
- // mat4.translate(modelWorld, mat4.create(), [0, 10 , 0])
243
+ // mat4.translate(modelWorld, mat4.create(), [0, 1 , 0])
217
244
mat4 . multiply ( splatModelMatrix , modelWorld , modelMatrixLocalFix ) ;
218
245
this . camera . modelMatrix = splatModelMatrix ;
219
246
@@ -395,7 +422,7 @@ Component({
395
422
const cameraParameters = {
396
423
up : [ 0 , 1.0 , 0.0 ] ,
397
424
target : [ 0 , 0 , 0 ] ,
398
- camera : [ Math . PI / 2 , Math . PI / 2 , 4 ] , // theta phi radius
425
+ camera : [ Math . PI / 2 , Math . PI / 2 , 1 ] , // theta phi radius
399
426
}
400
427
this . camera = new CameraWebGL ( gl , this . worker , cameraParameters )
401
428
@@ -450,7 +477,7 @@ Component({
450
477
const projMatrix = this . camera . projMatrix ;
451
478
const viewMatrix = this . camera . viewMatrix ;
452
479
let modelMatrix = mat4 . create ( ) ;
453
- const cubeScale = 0.1 ;
480
+ const cubeScale = 0.02 ;
454
481
mat4 . scale ( modelMatrix , mat4 . create ( ) , [ cubeScale , cubeScale , cubeScale ] )
455
482
this . drawCubeMesh ( gl , projMatrix , viewMatrix , modelMatrix )
456
483
0 commit comments