@@ -20,7 +20,7 @@ Component({
2020 renderByXRFrame : false , // 是否使用 xr-frame渲染
2121 renderByWebGL2 : true , // 是否使用WebGL2渲染
2222 workerOn : true ,
23- maxGaussians : 50000 ,
23+ maxGaussians : 100000 ,
2424 } ,
2525 lifetimes : {
2626 /**
@@ -114,15 +114,19 @@ Component({
114114 let modelMatrixT = mat4 . create ( ) ;
115115 let modelMatrixR = mat4 . create ( ) ;
116116 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 ] ;
120121
121122 // 针对不同场景设置不同的 本地矩阵
122123 // Setup Camera
123124 switch ( id ) {
124125 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 ] ;
126130 this . camera . updateCameraInfo (
127131 // target
128132 [ 0 , 0 , 0 ] ,
@@ -135,7 +139,10 @@ Component({
135139 )
136140 break ;
137141 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 ] ;
139146 this . camera . updateCameraInfo (
140147 // target
141148 [ 0 , 0 , 0 ] ,
@@ -144,11 +151,12 @@ Component({
144151 // phi
145152 Math . PI / 2 ,
146153 // raidus
147- 8
154+ 2
148155 )
149156 break ;
150157 case 'stump' :
151- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , 1 , 0 ] )
158+ splatScale = 0.5 ;
159+ splatTranslate = [ 0 , 0 , 0 ] ;
152160 this . camera . updateCameraInfo (
153161 // target
154162 [ 0 , 0 , 0 ] ,
@@ -157,11 +165,14 @@ Component({
157165 // phi
158166 Math . PI / 4 ,
159167 // raidus
160- 4
168+ 2
161169 )
162170 break ;
163171 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 ] ;
165176 this . camera . updateCameraInfo (
166177 // target
167178 [ 0 , 0 , 0 ] ,
@@ -170,11 +181,11 @@ Component({
170181 // phi
171182 Math . PI / 2 ,
172183 // raidus
173- 12
184+ 1
174185 )
175186 break ;
176187 case 'usj' :
177- mat4 . translate ( modelMatrixT , modelMatrixR , [ 0 , 1 , 0 ] )
188+ splatTranslate = [ 0 , 1 , 0 ] ;
178189 this . camera . updateCameraInfo (
179190 // target
180191 [ 0 , 0 , 0 ] ,
@@ -183,11 +194,11 @@ Component({
183194 // phi
184195 Math . PI / 2 ,
185196 // raidus
186- 4
197+ 1
187198 )
188199 break ;
189200 case 'sakura' :
190- mat4 . translate ( modelMatrixT , modelMatrixR , [ - 1.6 , 0 , - 1 ] )
201+ splatTranslate = [ - 1.6 , 0 , - 1 ] ;
191202 this . camera . updateCameraInfo (
192203 // target
193204 [ 0 , 0 , 0 ] ,
@@ -196,11 +207,27 @@ Component({
196207 // phi
197208 Math . PI * 3 / 5 ,
198209 // 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
200224 )
201225 break ;
202226 }
203227
228+ mat4 . scale ( modelMatrixS , mat4 . create ( ) , [ splatScale , splatScale , splatScale ] )
229+ mat4 . rotate ( modelMatrixR , modelMatrixS , splatRotationAngle , splatRotationFlag )
230+ mat4 . translate ( modelMatrixT , modelMatrixR , splatTranslate )
204231 mat4 . copy ( modelMatrixLocal , modelMatrixT ) ;
205232
206233 // Y轴反转矩阵
@@ -213,7 +240,7 @@ Component({
213240
214241 // 世界矩阵
215242 const modelWorld = mat4 . create ( ) ;
216- // mat4.translate(modelWorld, mat4.create(), [0, 10 , 0])
243+ // mat4.translate(modelWorld, mat4.create(), [0, 1 , 0])
217244 mat4 . multiply ( splatModelMatrix , modelWorld , modelMatrixLocalFix ) ;
218245 this . camera . modelMatrix = splatModelMatrix ;
219246
@@ -395,7 +422,7 @@ Component({
395422 const cameraParameters = {
396423 up : [ 0 , 1.0 , 0.0 ] ,
397424 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
399426 }
400427 this . camera = new CameraWebGL ( gl , this . worker , cameraParameters )
401428
@@ -450,7 +477,7 @@ Component({
450477 const projMatrix = this . camera . projMatrix ;
451478 const viewMatrix = this . camera . viewMatrix ;
452479 let modelMatrix = mat4 . create ( ) ;
453- const cubeScale = 0.1 ;
480+ const cubeScale = 0.02 ;
454481 mat4 . scale ( modelMatrix , mat4 . create ( ) , [ cubeScale , cubeScale , cubeScale ] )
455482 this . drawCubeMesh ( gl , projMatrix , viewMatrix , modelMatrix )
456483
0 commit comments