@@ -13,17 +13,25 @@ var index_demo
13
13
var testRedPointCloud ;
14
14
var testEmitter
15
15
var targetRender
16
+ var main , sub
16
17
index_demo = {
17
18
start : function ( redGL , tView , tRenderer , tCamera ) {
18
19
tView . scene = tScene
20
+
19
21
// 렌더시작
20
22
targetRender . start ( redGL , function ( time ) {
21
- tCamera . x = Math . sin ( time / 1500 ) * 20
22
- tCamera . y = Math . cos ( time / 1500 ) * 10 + 15
23
+ // tCamera.x = Math.sin(time / 1500) * 20
24
+ // tCamera.y = Math.cos(time / 1500) * 10 + 15
25
+ // tCamera.z = Math.cos(time / 1500) * 20
26
+ tCamera . x = Math . sin ( time / 2000 ) * 30
27
+ tCamera . y = Math . cos ( time / 2500 ) * 20 + 15
23
28
tCamera . z = Math . cos ( time / 1500 ) * 20
29
+ tCamera . lookAt ( 0 , 0 , 0 )
24
30
// 파티클 업데이트
25
31
testEmitter . update ( time )
26
-
32
+ main . rotationX += 0.05
33
+ main . rotationY += 0.03
34
+ sub . rotationX -= 0.08
27
35
testEmitter . x = Math . sin ( time / 700 ) * 6
28
36
// testEmitter.y = Math.cos(time / 1500) * 4
29
37
testEmitter . z = Math . cos ( time / 700 ) * 6
@@ -41,6 +49,12 @@ var index_demo
41
49
targetRender = tRenderer
42
50
if ( ! tScene ) {
43
51
tScene = RedScene ( redGL ) ;
52
+
53
+ const effect = new RedPostEffect_Bloom ( redGL )
54
+ effect . bloomStrength = 0.4
55
+ effect . exposure = 1.3
56
+ tView . postEffectManager . addEffect ( effect )
57
+
44
58
tLight = RedDirectionalLight ( redGL , '#fff0ff' ) ;
45
59
tScene . addLight ( tLight )
46
60
tLight . x = 10 ;
@@ -177,8 +191,133 @@ var index_demo
177
191
} ) ) ;
178
192
179
193
}
180
- makeMesh ( redGL , 0 ) ;
194
+ ///////////////////////////////////////////////////////////////////////////////////////////
195
+ // material setup
196
+ const material1 = new RedBitmapMaterial ( redGL , new RedBitmapTexture ( redGL , '../asset/hud_003.png' ) )
197
+ const material2 = new RedBitmapMaterial ( redGL , new RedBitmapTexture ( redGL , '../asset/hud_001.png' ) )
198
+ const material3 = new RedBitmapMaterial ( redGL , new RedBitmapTexture ( redGL , '../asset/hud_006.png' ) )
199
+ material1 . alpha = 0.6
200
+ material2 . alpha = 0.7
201
+ material3 . alpha = 0.8
202
+ ///////////////////////////////////////////////////////////////////////////////////////////
203
+ // make obejct
204
+ const makeCyber = ( ) => {
205
+ let rootMesh = new RedMesh ( redGL ) ;
206
+
207
+ let tGeo = new RedSphere ( redGL , 8 , 8 , 8 , 8 )
208
+ let positionList = [ ]
209
+ let i = 0
210
+ let len = tGeo . interleaveBuffer . data . length / 8
211
+ for ( i ; i < len ; i ++ ) {
212
+ positionList . push (
213
+ [
214
+ tGeo . interleaveBuffer . data [ i * 8 ] ,
215
+ tGeo . interleaveBuffer . data [ i * 8 + 1 ] ,
216
+ tGeo . interleaveBuffer . data [ i * 8 + 2 ]
217
+ ]
218
+ )
219
+ }
220
+ // console.log(positionList)
221
+ i = positionList . length - 1
222
+ while ( i -- ) {
223
+ let tMesh = new RedMesh ( redGL , new RedPlane ( redGL ) , material1 )
224
+ tMesh . scaleX = tMesh . scaleY = ( Math . sqrt ( positionList [ i ] [ 0 ] * positionList [ i ] [ 0 ] + positionList [ i ] [ 2 ] * positionList [ i ] [ 2 ] ) ) * 0.5 + Math . random ( ) * 10
225
+ tMesh . useCullFace = false ;
226
+ tMesh . useDepthMask = false ;
227
+
228
+ tMesh . useTransparentSort = true
229
+ rootMesh . addChild ( tMesh )
230
+ //
231
+ const t = Math . random ( ) * 6 + 1
232
+ tMesh . x = positionList [ i ] [ 0 ] * t
233
+ tMesh . y = positionList [ i ] [ 1 ] * t
234
+ tMesh . z = positionList [ i ] [ 2 ] * t
235
+ tMesh . lookAt ( 0 , 0 , 0 )
236
+ tMesh . rotationZ = Math . random ( ) * 360
237
+ tMesh . opacity = Math . random ( ) * 0.5
238
+
239
+ //
240
+ let tMesh2 = new RedMesh ( redGL , new RedPlane ( redGL ) , material2 )
241
+ tMesh2 . scaleX = tMesh2 . scaleY = Math . random ( ) * 0.25
242
+ tMesh2 . z = Math . random ( )
243
+ tMesh2 . useCullFace = false ;
244
+ tMesh2 . useDepthMask = false ;
245
+ tMesh2 . useTransparentSort = true
246
+ tMesh . addChild ( tMesh2 )
181
247
248
+ {
249
+ let tRandomPositionScale = Math . random ( ) - 0.5 + 5.5
250
+ let tPosition = [
251
+ positionList [ i ] [ 0 ] ,
252
+ positionList [ i ] [ 1 ] ,
253
+ positionList [ i ] [ 2 ]
254
+ ]
255
+ let tScale = Math . random ( ) * 0.5 + 0.5
256
+ TweenMax . to ( tMesh , Math . random ( ) * 4 + 0.5 , {
257
+ x : tPosition [ 0 ] * tRandomPositionScale ,
258
+ y : tPosition [ 1 ] * tRandomPositionScale ,
259
+ z : tPosition [ 2 ] * tRandomPositionScale ,
260
+ scaleX : tScale ,
261
+ scaleY : tScale ,
262
+ yoyo : true ,
263
+ repeat : - 1 ,
264
+ ease : Quint . easeInOut
265
+ } )
266
+ TweenMax . to ( tMesh , Math . random ( ) * 2 + 0.3 , {
267
+ rotationZ : tMesh . rotationZ + Math . random ( ) * 90 - 45 ,
268
+ yoyo : true ,
269
+ repeat : - 1 ,
270
+ ease : Quint . easeInOut
271
+ } )
272
+ let tScale2 = Math . random ( ) * 0.5 - 0.25 + 1
273
+ TweenMax . to ( tMesh2 , Math . random ( ) * 2 + 0.5 , {
274
+ scaleX : tScale2 ,
275
+ scaleY : tScale2 ,
276
+ z : Math . random ( ) ,
277
+ yoyo : true ,
278
+ repeat : - 1 ,
279
+ ease : Quint . easeInOut
280
+ } )
281
+ TweenMax . to ( tMesh2 , Math . random ( ) * 2 + 0.3 , {
282
+ rotationZ : tMesh2 . rotationZ + Math . random ( ) * 90 - 45 ,
283
+ yoyo : true ,
284
+ repeat : - 1 ,
285
+ ease : Quint . easeInOut
286
+ } )
287
+ }
288
+
289
+ {
290
+
291
+ let tMesh3 = new RedMesh ( redGL , new RedPlane ( redGL ) , material3 )
292
+ tMesh3 . scaleX = tMesh3 . scaleY = 0.25
293
+ tMesh3 . z = - Math . random ( ) * 2
294
+ tMesh3 . useCullFace = false ;
295
+ tMesh3 . useDepthMask = false ;
296
+ tMesh3 . useTransparentSort = true
297
+ tMesh3 . addChild ( tMesh3 )
298
+
299
+ let tScale = Math . random ( ) * 0.5 - 0.25 + 0.5
300
+ TweenMax . to ( tMesh3 , Math . random ( ) * 3 + 1 , {
301
+ scaleX : tScale ,
302
+ scaleY : tScale ,
303
+ rotationZ : Math . random ( ) * 360 ,
304
+ yoyo : true ,
305
+ repeat : - 1 ,
306
+ ease : Quint . easeInOut
307
+ } )
308
+ }
309
+
310
+ }
311
+ return rootMesh
312
+ }
313
+ makeMesh ( redGL , 0 ) ;
314
+ main = makeCyber ( ) ;
315
+ sub = makeCyber ( ) ;
316
+ tScene . addChild ( main )
317
+ tScene . addChild ( sub )
318
+ sub . rotationX = sub . rotationY = sub . rotationZ = Math . random ( ) * 360
319
+ sub . scaleX = sub . scaleY = sub . scaleZ = 0.8
320
+ sub . opacity = 0.5
182
321
//////////////////////////////////////////////////////////////////
183
322
// RedPointCloud 설정
184
323
var i ;
@@ -236,7 +375,9 @@ var index_demo
236
375
RedBitmapTexture ( redGL , assetPath + 'particle.png' )
237
376
)
238
377
378
+
239
379
tScene . addChild ( testEmitter )
380
+
240
381
}
241
382
242
383
}
0 commit comments