これをE3dなどに応用すればCPUへの負荷が少なく実装できるかもしれません。
#include "d3m.hsp"
; パーティクルを初期化 (作成)
d3mkparticle 0, 255, 80, 26
ddim d,3000,9
repeat 3000
d(cnt,0)=0.0 // X座標
d(cnt,1)=0.0 // Y座標
d(cnt,2)=5000.0+rnd(1500) // Z座標
d(cnt,3)=0.0 // X速度
d(cnt,4)=0.0 // Y速度
d(cnt,5)=0.0 // Z速度
d(cnt,6)=0.0 // パーティクル射出方向 仰角?
d(cnt,7)=1.0*rnd(360) // パーティクル射出方向 XY平面上の角度
d(cnt,8)=1.0*rnd(80)+50
loop
while 1
ct++
redraw 0
color 24, 24, 24
boxf
; カメラ座標を回転させる
d3setcam cos(0.04 * ct) * 2000, sin(0.04 * ct) * 2000, cos(0.03 * ct) * 1000
; 枠のボックス
color 64, 64, 64
d3box -500, -500, -500, 500, 500, 500
; パーティクル描画時のコピーモードを設定
gmode 5, , , 80
p=10.0
pz=0.0
pxy=0.0
px=0.0
py=0.0
repeat 1300
if(d(cnt,2)>(5000+1500) || (d(cnt,2)>(1500)&&d(cnt,2)<(3000)) || d(cnt,8)<0){
d(cnt,0)=0.0 // X座標
d(cnt,1)=0.0 // Y座標
d(cnt,2)=0.0// Z座標
d(cnt,3)=0.0 // X速度未使用
d(cnt,4)=0.0 // Y速度未使用
d(cnt,5)=0.0 // Z速度未使用
d(cnt,6)=1.0*rnd(160) +15// パーティクルに加わる力の方向 仰角?
d(cnt,7)=1.0*rnd(360) // パーティクルに加わる力の方向 XY平面内の角度
d(cnt,8)=1.0*rnd(80)+50
}
pz=cos(1.0*d(cnt,6)*M_PI/180)*p
pxy=sin(1.0*d(cnt,6)*M_PI/180)*p
px=sin(1.0*d(cnt,7))*pxy
py=cos(1.0*d(cnt,7))*pxy
d(cnt,6)*=0.986
d(cnt,6)-=0.7
if d(cnt,6)<0 :d(cnt,6)=0.0
d(cnt,8)-=1
d(cnt,0)+=px//正体不明の力(?)をパーティクルに加える
d(cnt,1)+=py//正体不明の力(?)をパーティクルに加える
d(cnt,2)+=pz//正体不明の力(?)をパーティクルに加える
d(cnt,0)*=0.995//パーティクルが中心に向かうように
d(cnt,1)*=0.995//パーティクルが中心に向かうように
if(d(cnt,2)<1500):d3particle 0, d(cnt,0), d(cnt,1), d(cnt,2), 80
loop
redraw 1
await 30
wend
; パーティクルを初期化 (作成)
d3mkparticle 0, 255, 80, 26
ddim d,3000,9
repeat 3000
d(cnt,0)=0.0 // X座標
d(cnt,1)=0.0 // Y座標
d(cnt,2)=5000.0+rnd(1500) // Z座標
d(cnt,3)=0.0 // X速度
d(cnt,4)=0.0 // Y速度
d(cnt,5)=0.0 // Z速度
d(cnt,6)=0.0 // パーティクル射出方向 仰角?
d(cnt,7)=1.0*rnd(360) // パーティクル射出方向 XY平面上の角度
d(cnt,8)=1.0*rnd(80)+50
loop
while 1
ct++
redraw 0
color 24, 24, 24
boxf
; カメラ座標を回転させる
d3setcam cos(0.04 * ct) * 2000, sin(0.04 * ct) * 2000, cos(0.03 * ct) * 1000
; 枠のボックス
color 64, 64, 64
d3box -500, -500, -500, 500, 500, 500
; パーティクル描画時のコピーモードを設定
gmode 5, , , 80
p=10.0
pz=0.0
pxy=0.0
px=0.0
py=0.0
repeat 1300
if(d(cnt,2)>(5000+1500) || (d(cnt,2)>(1500)&&d(cnt,2)<(3000)) || d(cnt,8)<0){
d(cnt,0)=0.0 // X座標
d(cnt,1)=0.0 // Y座標
d(cnt,2)=0.0// Z座標
d(cnt,3)=0.0 // X速度未使用
d(cnt,4)=0.0 // Y速度未使用
d(cnt,5)=0.0 // Z速度未使用
d(cnt,6)=1.0*rnd(160) +15// パーティクルに加わる力の方向 仰角?
d(cnt,7)=1.0*rnd(360) // パーティクルに加わる力の方向 XY平面内の角度
d(cnt,8)=1.0*rnd(80)+50
}
pz=cos(1.0*d(cnt,6)*M_PI/180)*p
pxy=sin(1.0*d(cnt,6)*M_PI/180)*p
px=sin(1.0*d(cnt,7))*pxy
py=cos(1.0*d(cnt,7))*pxy
d(cnt,6)*=0.986
d(cnt,6)-=0.7
if d(cnt,6)<0 :d(cnt,6)=0.0
d(cnt,8)-=1
d(cnt,0)+=px//正体不明の力(?)をパーティクルに加える
d(cnt,1)+=py//正体不明の力(?)をパーティクルに加える
d(cnt,2)+=pz//正体不明の力(?)をパーティクルに加える
d(cnt,0)*=0.995//パーティクルが中心に向かうように
d(cnt,1)*=0.995//パーティクルが中心に向かうように
if(d(cnt,2)<1500):d3particle 0, d(cnt,0), d(cnt,1), d(cnt,2), 80
loop
redraw 1
await 30
wend