; ParticleRenderMode Example ; -------------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,-6 CameraClsColor camera,8,12,24 ; Mode 3 renders lit meshes, so give the scene a light light=CreateLight() RotateEntity light,45,-30,0 floor=CreatePlane() EntityColor floor,30,34,44 ; Mode names for the overlay Dim mode_name$(3) mode_name$(1)="1 billboard" mode_name$(2)="2 stretched billboard" mode_name$(3)="3 mesh" ; A spark fountain to view in each render mode emitter=CreateParticleEmitter(800) PositionEntity emitter,0,0.5,0 ParticleEmissionRate emitter,150 ParticleLifetime emitter,1.5,2.5 ParticleVelocity emitter,0,4,0,1,0.5,1 ParticleGravity emitter,0,-5,0 ParticleColor emitter,255,220,120,1,255,80,0,0 ParticleSize emitter,0.1,0.03,0.2 ; Mode 3 needs a source mesh to batch cone=CreateCone(6) HideEntity cone ParticleMesh emitter,cone mode=1 stretch#=0.08 ParticleRenderMode emitter,1,stretch While Not KeyDown(1) ; Keys 1-3 pick the render mode, [ / ] tune the mode-2 stretch factor If KeyHit(2) Then mode=1 If KeyHit(3) Then mode=2 If KeyHit(4) Then mode=3 If KeyDown(26) And stretch>0 Then stretch=stretch-0.002 If KeyDown(27) And stretch<0.3 Then stretch=stretch+0.002 ; Apply the current mode and stretch ParticleRenderMode emitter,mode,stretch ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 ; UpdateWorld also advances the particle simulation UpdateWorld RenderWorld Text 0,0,"Arrow keys: move camera 1/2/3: render mode [ / ] : stretch Esc: exit" Text 0,20,"ParticleRenderMode emitter,"+mode+","+stretch+" ("+mode_name$(mode)+")" Flip Wend End