1 (edited by gman 2006-01-27 19:06:11)

Topic: gg.IrrAddons - updated 2006/7/10

Re: gg.IrrAddons - updated 2006/7/10

i have added the new T_irr3PCameraAnimator type.  here is an example using a modified version of the movement Irrlicht sample (this also shows the smooth event receiver):

' make sure you build this example with the "Build GUI App" option turned off

Strict
Framework BRL.Blitz
Import BRL.StandardIO

Import gg.IrrBMAX
Import gg.IrrAddons

Local node:T_irrISceneNode

Rem
create a smooth event receiver so we can use commands similar to BMAX
Press 'W', the node moves up, And If you press 'S' it moves down.
EndRem
Local receiver:T_irrSmoothEventReceiver=T_irrSmoothEventReceiver.createReceiver()

Local device:T_irrIrrlichtDevice=T_irrIrrlichtDevice.create( ..
    EDT_OPENGL, ..
    T_irrDimension2d_s32.create(640,480), ..
    16,False,False,False,T_irrIEventReceiver(receiver))

If device.handle=0 Then Return ' could Not create selected driver.

Local driver:T_irrIVideoDriver=device.getVideoDriver()
Local smgr:T_irrISceneManager=device.getSceneManager()

node = smgr.addTestSceneNode()
node.setPosition(T_irrVector3df.createFromVals(0,0,30))
node.setMaterialTexture(0,driver.getTexture("../media/wall.bmp"))

Local n:T_irrISceneNode = smgr.addTestSceneNode()
n.setMaterialTexture(0,driver.getTexture("../media/t351sml.jpg"))

Local anim:T_irrISceneNodeAnimator = smgr.createFlyCircleAnimator( ..
    T_irrVector3df.createFromVals(0,0,30), 20.0)
n.addAnimator(anim)

Local anms:T_irrIAnimatedMeshSceneNode = smgr.addAnimatedMeshSceneNode( ..
    smgr.getMesh("../media/sydney.md2"))

If (n.isValid())

    anim = smgr.createFlyStraightAnimator(T_irrVector3df.createFromVals(100,0,60), ..
        T_irrVector3df.createFromVals(-100,0,60), 10000, True)
    anms.addAnimator(anim)
    
    anms.setMaterialFlag(EMF_LIGHTING, False)
    anms.setFrameLoop(320, 360)
    anms.setAnimationSpeed(30)
    anms.setRotation(T_irrVector3df.createFromVals(0,180.0,0))
    anms.setMaterialTexture(0,driver.getTexture("../media/sydney.bmp"))
EndIf

device.getCursorControl().setVisible(False)

' create a camera to use as the 3P cam
Local camera:T_irrICameraSceneNode=smgr.addCameraSceneNode()

' attach the 3P animator to the camera
' params are camera to attach to, device, and the node that is the target
attach3PCameraAnimator(camera,device,node)
'attach3PCameraAnimator(camera,device,anms)
'attach3PCameraAnimator(camera,device,n)

Local lastFPS:Int=-1
Local fps:Int=0
Local str:String=""

While(device.run())

    ' check if W is being pressed
    If receiver.IsKeyDown(EKEY_KEY_W)
        Local v:T_irrVector3df=node.getPosition()
        v.setY(v.getY()+2.0)
        node.setPosition(v)
    EndIf
    
    ' check if S is being pressed
    If receiver.IsKeyDown(EKEY_KEY_S)
        Local v:T_irrVector3df=node.getPosition()
        v.setY(v.getY()-2.0)
        node.setPosition(v)
    EndIf

    driver.beginScene(True, True, T_irrSColor.createFromVals(255,113,113,133))
    smgr.drawAll()
    driver.endScene()

    fps = driver.getFPS()

    If (lastFPS <> fps) Then
        str$ = "Movement Example - Irrlicht Engine ["
        str$ :+ driver.getName()
        str$ :+ "] FPS:"
        str$ :+ fps

        device.setWindowCaption(str$)
        lastFPS = fps
    EndIf
Wend

Rem
In the End, Delete the Irrlicht device.
EndRem
device.drop()

Re: gg.IrrAddons - updated 2006/7/10

i wrapped up the wind generator and grass patch node last night as well as ported most of the grass node sample.  the node and wind generator are functioning properly i just need to finish up the sample and release the addons.  should be tonight sometime.