Hi there, unfortunately i need help again
In the first code i've created a particle explosion effect. In the next one i tried to prepare the code for implementation. I used a structure and a linkedlist
to store the n3xtd pointers, but the particles are only rendered in pure white...
Here are both codes and a link to my zip:
(i know its chaos, but its only the creationphase of the explosion)
Code: Select all
IncludePath #PB_Compiler_Home + "Includes\N3xtd\" : IncludeFile "n3xtD_PB.pbi"
Global anglex.f, angley.f, flagXDown.w
Global mox.f, omx.f, moy.l, omy.l
Global *app.l, Quit.l, Fullscreen = 1
If Not Fullscreen
*app = ICreateGraphics3D(1024,768, 32, #False, #True,#EDT_DIRECT3D9)
Else
ExamineDesktops()
*app = ICreateGraphics3D(DesktopWidth(0),DesktopHeight(0),32, #True, #True, #EDT_DIRECT3D9)
EndIf
;SetCurrentDirectory("media/")
*cube.IMesh = iCreateSphere(1,4,#Null) : iVisibleNode(*cube,#False)
*cube2.IMesh = iCreateSphere(1,32,#Null) : iVisibleNode(*cube2,#False)
*cube4.IMesh = iCreateCube(4,#Null) : iVisibleNode(*cube4,#False)
*part.IParticleSystem = iCreateParticleSystem(#False, #Null)
*mesh_emitter.IParticle = iCreateParticleMeshEmitter(*part, *cube, #True,0,0,0, 80, -1, #True, 1, 1,$00FFFFC5,$00FC4C22,500,500,90,10,10,10,10)
iAddEmitterParticleSystem(*part, *mesh_emitter ) : iFadeOutParticleSystem( *part)
iMaterialFlagNode(*part, #EMF_LIGHTING, #False )
iMaterialFlagNode(*part, #EMF_ZWRITE_ENABLE, #False )
iLoadTextureNode(*part, "particle1.png")
iMaterialTypeNode(*part, #EMT_TRANSPARENT_VERTEX_ALPHA )
iRotationParticleSystem(*part,0,0,50)
*part2.IParticleSystem = iCreateParticleSystem(#False, #Null)
*mesh_emitter2.IParticle = iCreateParticleMeshEmitter(*part2, *cube2, #True,0,0,0, 80, -1, #True,1,1,$FFD7B728,$FF9F871D,600,1100,140,0.1,0.1,0.1,0.1)
iAddEmitterParticleSystem(*part2, *mesh_emitter2 ) : iFadeOutParticleSystem( *part2)
iMaterialFlagNode(*part2, #EMF_LIGHTING, #False )
iMaterialFlagNode(*part2, #EMF_ZWRITE_ENABLE, #False )
iLoadTextureNode(*part2, "particle1.png")
iMaterialTypeNode(*part2, #EMT_TRANSPARENT_VERTEX_ALPHA )
*part3.IParticleSystem = iCreateParticleSystem(#False, #Null)
*mesh_emitter3.IParticle = iCreateParticleMeshEmitter(*part3, *cube, #True,0,0,0, 70, -1, #True,1,1,$00D7B728,$FF808080,800,1000,20,0.3,0.3,0.5,0.5)
iAddEmitterParticleSystem(*part3, *mesh_emitter3 ) : iFadeOutParticleSystem( *part3)
iMaterialFlagNode(*part3, #EMF_LIGHTING, #False )
iMaterialFlagNode(*part3, #EMF_ZWRITE_ENABLE, #False )
iLoadTextureNode(*part3, "particle3.png")
iMaterialTypeNode(*part3, #EMT_TRANSPARENT_VERTEX_ALPHA )
iRotationParticleSystem(*part3,0,0,40)
;iDirectionParticle(*mesh_emitter3, 0,0.05,0)
;iGravityParticleSystem(*part2,0,-0.05,0,1000)
;iAttractionParticleSystem(*part2,2,5,9,24,#False,#True,#True,#True)
*part4.IParticleSystem = iCreateParticleSystem(#False, #Null)
*mesh_emitter4.IParticle = iCreateParticleMeshEmitter(*part4, *cube4, #True,0,0,0, 280, -1, #True,1,1,$00111111,$00111111,600,1300,50,15,15,20,20)
iAddEmitterParticleSystem(*part4, *mesh_emitter4 ) : iFadeOutParticleSystem(*part4)
iMaterialFlagNode(*part4, #EMF_LIGHTING, #False )
iMaterialFlagNode(*part4, #EMF_ZWRITE_ENABLE, #False )
iLoadTextureNode(*part4, "particle4.png")
iMaterialTypeNode(*part4, #EMT_TRANSPARENT_VERTEX_ALPHA )
Define *cam.ICamera = iCreateCamera( )
iPositionNode(*cam, 0,1,-20)
Repeat
If iGetKeyDown(#KEY_ARROW_UP)
iMoveNode(*cam, 0,0,0.5)
EndIf
If iGetKeyDown(#KEY_ARROW_DOWN)
iMoveNode(*cam, 0,0,-0.5)
EndIf
If iGetMouseEvent(#MOUSE_BUTTON_LEFT)
If flagXDown=0
omx = iGetMouseX()
omy = iGetMouseY()
flagXDown=11
Else
moy = iGetMouseY()-omy
angley=(moy/10.0)
omy= iGetMouseY()
mox = iGetMouseX()-omx
anglex=(mox/10.0)
omx= iGetMouseX()
iTurnNode(*cam, angley, anglex,0)
EndIf
Else
flagXDown=0
EndIf
If iGetKeyDown(#KEY_SPACE)
;If iNodeVisible(*part) : iVisibleNode(*part,#False) : Else : iVisibleNode(*part,#True) : EndIf
EndIf
If iGetKeyDown(#KEY_ESCAPE)
Quit=1
EndIf
;iMoveNode (*part,0,1,0)
iBeginScene(0,0,0)
iDrawScene()
iEndScene()
Until Quit=1
iFreeEngine()
Here is the other one, which doesnt work properly:
Code: Select all
IncludePath #PB_Compiler_Home + "Includes\N3xtd\" : IncludeFile "n3xtD_PB.pbi"
Global anglex.f, angley.f, flagXDown.w
Global mox.f, omx.f, moy.l, omy.l
Global *app.l, Quit.l
Declare CreateExplosion(x.f,y.f,z.f)
Structure ExplosionFX
*p1.IParticleSystem
*p2.IParticleSystem
*p3.IParticleSystem
*p4.IParticleSystem
*e1.IParticle
*e2.IParticle
*e3.IParticle
*e4.IParticle
*m1.IMesh
*m2.IMesh
*m3.IMesh
x.f
y.f
z.f
EndStructure
Global NewList Explosions.ExplosionFX()
Procedure CreateExplosion(x.f,y.f,z.f)
AddElement(Explosions())
Explosions()\m1 = iCreateSphere(1,4,#Null)
Explosions()\m2 = iCreateCube(4,#Null)
Explosions()\m3 = iCreateSphere(1,32,#Null)
iVisibleNode(Explosions()\m1,#False)
iVisibleNode(Explosions()\m2,#False)
iVisibleNode(Explosions()\m3,#False)
Explosions()\p1 = iCreateParticleSystem(#False, #Null)
Explosions()\p2 = iCreateParticleSystem(#False, #Null);Explosions()\p1)
Explosions()\p3 = iCreateParticleSystem(#False, #Null);Explosions()\p1)
Explosions()\p4 = iCreateParticleSystem(#False, #Null);Explosions()\p1)
Explosions()\e1 = iCreateParticleMeshEmitter(Explosions()\p1, Explosions()\m1,#True,0,0,0,80,-1,#True,1,1,$00FFFFC5,$00FC4C22,500,500,90,10,10,10,10)
Explosions()\e2 = iCreateParticleMeshEmitter(Explosions()\p2, Explosions()\m2,#True,0,0,0,70,-1,#True,1,1,$FFD7B728,$FF9F871D,600,1100,140,0.1,0.1,0.1,0.1)
Explosions()\e3 = iCreateParticleMeshEmitter(Explosions()\p3, Explosions()\m1,#True,0,0,0,80,-1,#True,1,1,$00D7B728,$FF808080,800,1000,20,0.3,0.3,0.5,0.5)
Explosions()\e4 = iCreateParticleMeshEmitter(Explosions()\p4, Explosions()\m3,#True,0,0,0,80,-1,#True,1,1,$00111111,$00111111,600,1300,50,15,15,20,20)
iLoadTextureNode(Explosions()\p1, "particle1.png")
iLoadTextureNode(Explosions()\p2, "particle1.png")
iLoadTextureNode(Explosions()\p3, "particle3.png")
iLoadTextureNode(Explosions()\p4, "particle4.png")
iAddEmitterParticleSystem(Explosions()\p1, Explosions()\e1) : iFadeOutParticleSystem(Explosions()\p1) : iRotationParticleSystem(Explosions()\p1,0,0,50)
iAddEmitterParticleSystem(Explosions()\p2, Explosions()\e2) : iFadeOutParticleSystem(Explosions()\p2)
iAddEmitterParticleSystem(Explosions()\p3, Explosions()\e3) : iFadeOutParticleSystem(Explosions()\p3) : iRotationParticleSystem(Explosions()\p3,0,0,40)
iAddEmitterParticleSystem(Explosions()\p4, Explosions()\e4) : iFadeOutParticleSystem(Explosions()\p4)
iMaterialFlagNode(Explosions()\p1,#EMF_LIGHTING,#False)
iMaterialFlagNode(Explosions()\p1,#EMF_ZWRITE_ENABLE, #False)
iMaterialTypeNode(Explosions()\p1,#EMT_TRANSPARENT_VERTEX_ALPHA)
iMaterialFlagNode(Explosions()\p2,#EMF_LIGHTING,#False)
iMaterialFlagNode(Explosions()\p2,#EMF_ZWRITE_ENABLE, #False)
iMaterialTypeNode(Explosions()\p2,#EMT_TRANSPARENT_VERTEX_ALPHA)
iMaterialFlagNode(Explosions()\p3,#EMF_LIGHTING,#False)
iMaterialFlagNode(Explosions()\p3,#EMF_ZWRITE_ENABLE, #False)
iMaterialTypeNode(Explosions()\p3,#EMT_TRANSPARENT_VERTEX_ALPHA)
iMaterialFlagNode(Explosions()\p4,#EMF_LIGHTING,#False)
iMaterialFlagNode(Explosions()\p4,#EMF_ZWRITE_ENABLE, #False)
iMaterialTypeNode(Explosions()\p4,#EMT_TRANSPARENT_VERTEX_ALPHA)
; iPositionNode(Explosions()\p1,x,y,z)
; iPositionNode(Explosions()\p2,x,y,z)
; iPositionNode(Explosions()\p3,x,y,z)
; iPositionNode(Explosions()\p4,x,y,z)
EndProcedure
*app = iCreateGraphics3D(800,600, 32, #False, #True, #EDT_DIRECT3D9)
If *app= #Null: End : EndIf
Define *cam.ICamera = iCreateCamera( )
iPositionNode(*cam, 0,1,-20)
CreateExplosion(0,0,0)
Repeat
If iGetKeyDown(#KEY_ARROW_UP)
iMoveNode(*cam, 0,0,0.5)
EndIf
If iGetKeyDown(#KEY_ARROW_DOWN)
iMoveNode(*cam, 0,0,-0.5)
EndIf
If iGetMouseEvent(#MOUSE_BUTTON_LEFT)
If flagXDown=0
omx = iGetMouseX()
omy = iGetMouseY()
flagXDown=11
Else
moy = iGetMouseY()-omy
angley=(moy/10.0)
omy= iGetMouseY()
mox = iGetMouseX()-omx
anglex=(mox/10.0)
omx= iGetMouseX()
iTurnNode(*cam, angley, anglex,0)
EndIf
Else
flagXDown=0
EndIf
If iGetKeyUp(#KEY_SPACE)
;CreateExplosion(0,0,0)
EndIf
If iGetKeyUp(#KEY_ESCAPE)
Quit=1
EndIf
iBeginScene(0,0,0)
iDrawScene()
iEndScene()
Until Quit=1
iFreeEngine()
http://www.file-upload.net/download-282 ... X.zip.html
Hope somebody can help!
Alex