Skip to content

Commit 92f481f

Browse files
-
1 parent 67007f9 commit 92f481f

File tree

9 files changed

+150
-9
lines changed

9 files changed

+150
-9
lines changed

asset/hud_001.png

125 KB
Loading

asset/hud_003.png

126 KB
Loading

asset/hud_005.png

16.1 KB
Loading

asset/hud_006.png

111 KB
Loading

asset/particle2.png

3.02 KB
Loading

example/index_demo1.js

+145-4
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,25 @@ var index_demo
1313
var testRedPointCloud;
1414
var testEmitter
1515
var targetRender
16+
var main,sub
1617
index_demo = {
1718
start: function (redGL, tView, tRenderer, tCamera) {
1819
tView.scene = tScene
20+
1921
// 렌더시작
2022
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
2328
tCamera.z = Math.cos(time / 1500) * 20
29+
tCamera.lookAt(0, 0, 0)
2430
// 파티클 업데이트
2531
testEmitter.update(time)
26-
32+
main.rotationX += 0.05
33+
main.rotationY += 0.03
34+
sub.rotationX -= 0.08
2735
testEmitter.x = Math.sin(time / 700) * 6
2836
// testEmitter.y = Math.cos(time / 1500) * 4
2937
testEmitter.z = Math.cos(time / 700) * 6
@@ -41,6 +49,12 @@ var index_demo
4149
targetRender = tRenderer
4250
if (!tScene) {
4351
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+
4458
tLight = RedDirectionalLight(redGL, '#fff0ff');
4559
tScene.addLight(tLight)
4660
tLight.x = 10;
@@ -177,8 +191,133 @@ var index_demo
177191
}));
178192

179193
}
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)
181247

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
182321
//////////////////////////////////////////////////////////////////
183322
// RedPointCloud 설정
184323
var i;
@@ -236,7 +375,9 @@ var index_demo
236375
RedBitmapTexture(redGL, assetPath + 'particle.png')
237376
)
238377

378+
239379
tScene.addChild(testEmitter)
380+
240381
}
241382

242383
}

release/RedGL.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21179,7 +21179,7 @@ var RedRenderer;
2117921179
tCacheState['useBlendMode'] != tMesh['useBlendMode'] ? (tCacheState['useBlendMode'] = tMesh['useBlendMode']) ? tGL.enable(tGL.BLEND) : tGL.disable(tGL.BLEND) : 0;
2118021180
// 블렌딩팩터 캐싱처리
2118121181
if (tCacheState['blendSrc'] != tMesh['blendSrc'] || tCacheState['blendDst'] != tMesh['blendDst']) {
21182-
tGL.blendFunc(tMesh['blendSrc'], tMesh['blendDst']);
21182+
tGL.blendFuncSeparate(tMesh['blendSrc'], tMesh['blendDst'],tGL.ONE,tGL.ONE_MINUS_SRC_ALPHA);
2118321183
tCacheState['blendSrc'] = tMesh['blendSrc'];
2118421184
tCacheState['blendDst'] = tMesh['blendDst'];
2118521185
}
@@ -30400,4 +30400,4 @@ var RedGLOffScreen;
3040030400
};
3040130401
RedWorkerCode = RedWorkerCode.toString().replace(/^function ?. ?\) ?\{|\}\;?$/g, '');
3040230402
})();
30403-
})();var RedGL_VERSION = {version : 'RedGL Release. last update( 2022-06-29 17:24:57)' };console.log(RedGL_VERSION);
30403+
})();var RedGL_VERSION = {version : 'RedGL Release. last update( 2022-07-08 14:05:55)' };console.log(RedGL_VERSION);

release/RedGL.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/RedRenderer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ var RedRenderer;
10501050
tCacheState['useBlendMode'] != tMesh['useBlendMode'] ? (tCacheState['useBlendMode'] = tMesh['useBlendMode']) ? tGL.enable(tGL.BLEND) : tGL.disable(tGL.BLEND) : 0;
10511051
// 블렌딩팩터 캐싱처리
10521052
if (tCacheState['blendSrc'] != tMesh['blendSrc'] || tCacheState['blendDst'] != tMesh['blendDst']) {
1053-
tGL.blendFunc(tMesh['blendSrc'], tMesh['blendDst']);
1053+
tGL.blendFuncSeparate(tMesh['blendSrc'], tMesh['blendDst'],tGL.ONE,tGL.ONE_MINUS_SRC_ALPHA);
10541054
tCacheState['blendSrc'] = tMesh['blendSrc'];
10551055
tCacheState['blendDst'] = tMesh['blendDst'];
10561056
}

0 commit comments

Comments
 (0)