;///////////////////////////////////////////////////////// ;// ;// パーティクルのサンプルです。 ;// ;////////////////////////////////////////////////////////// ; e3dhsp.dll test script #include "e3dhsp3.as" #module #deffunc waitbyfps int p1, var fps E3DWaitbyFPS@ p1, fps await 0 return #global dim keybuf, 256 ;file のpath 用のバッファーの作成 pathlen = 2048 sdim mediadir, pathlen mediadir = dir_cur + "\\Media" sdim pathbuf, pathlen, 2 screenw = 640 : screenh = 480 screen 0, screenw, screenh, 1 pointmax = 100 title "Easy3D for HSP3 sample" ;開発中は下の行のコメントアウトを外すことを推奨します。 ;E3DEnableDbgFile ;初期化 E3DInit 0, -1, 0, 16, 0, scid1 ;カメラの初期化 eye_y = 1500.0 camposx = 0.0 : camposy = eye_y : camposz = -5000.0 E3DSetCameraPos camposx, camposy, camposz camdegxz = 180.0 : camdegy = 0.0 E3DSetCameraDeg camdegxz, camdegy targetx = 0.0 targety = eye_y targetz = 0.0 cameradist = 5000.0 ;projectionの変更をしたいときは、以下の2行を有効にしてください。 proj_near = 100.0 : proj_far = 30000.0 : proj_fov = 60.0 E3DSetProjection proj_near, proj_far, proj_fov E3DCreateProgressBar E3DSetProgressBar 0 lightdirx1 = 0.0 lightdiry1 = 0.0 lightdirz1 = 1.0 lightr1 = 255 lightg1 = 255 lightb1 = 255 E3DCreateLight lid1 E3DSetDirectionalLight lid1, lightdirx1, lightdiry1, lightdirz1, lightr1, lightg1, lightb1 /////////////////////// E3DCreateQ camq E3DCreateQ invcamq chkfps1 = 0 E3DDestroyProgressBar /////////////////////// pathbuf.0 = mediadir + "\\particle.bmp" E3DCreateParticle 200, pathbuf.0, 300.0, 300.0, 1, ptlid1 E3DSetParticlePos ptlid1, 0.0, 0.0, 0.0 E3DSetParticleGravity ptlid1, 4000 E3DSetParticleLife ptlid1, 2.0 E3DSetParticleEmitNum ptlid1, 1 E3DSetParticleVel0 ptlid1, -1000, 4000, -1000, 1000, 4000, 1000 E3DSetParticleRotation ptlid1, 0 E3DSetParticleDiffuse ptlid1, 255, 255, 255 pathbuf.0 = mediadir + "\\star.bmp" E3DCreateParticle 200, pathbuf.0, 500.0, 500.0, 0, ptlid2 E3DSetParticlePos ptlid2, 0.0, 0.0, 0.0 E3DSetParticleGravity ptlid2, 4000 E3DSetParticleLife ptlid2, 2.0 E3DSetParticleEmitNum ptlid2, 0.2 E3DSetParticleVel0 ptlid2, -1000, 4000, -1000, 1000, 4000, 1000 E3DSetParticleRotation ptlid2, 0 E3DSetParticleDiffuse ptlid2, 255, 255, 255 *main ; keybuf変数は、メインループの外で、dim keybuf, 256 として、確保しておいてください。 E3DGetKeyboardState keybuf if keybuf.VK_ESCAPE = 1 : goto *bye ; [ESC]で終了 gosub *MoveParticle1 gosub *ChangeParticle2 E3DBeginScene scid1 E3DRenderParticle ptlid2, chkfps1 E3DRenderParticle ptlid1, chkfps1 E3DEndScene E3DPresent scid1 waitbyfps 60, chkfps1 goto *main *bye E3DBye end *MoveParticle1 movedeg = double(movedeg) + 2.5 mover = 1500.0 E3DCos movedeg, cos1 E3DSin movedeg, sin1 ptlx = mover * cos1 ptlz = mover * sin1 ptly = 0.0 E3DSetParticlePos ptlid1, ptlx, ptly, ptlz return *ChangeParticle2 E3DSetParticleRotation ptlid2, 5.0 colorcnt++ restcolcnt = colorcnt \ 60 if( restcolcnt == 0 ){ colorkind++ restcolkind = colorkind \ 3 if( restcolkind == 0 ){ E3DSetParticleDiffuse ptlid2, 255, 0, 0 } if( restcolkind == 1 ){ E3DSetParticleDiffuse ptlid2, 0, 255, 0 } if( restcolkind == 2 ){ E3DSetParticleDiffuse ptlid2, 255, 255, 255 } } return