Topic: how to convert this c++ code into BMAX ?

P5E Q6600@2,6Ghz, 4go corsair, 2*150go velociraptor, Radeon3850, 24" samsung LCD.
BMAX 1.30 + Irrlicht wrapper 1.4.2

Re: how to convert this c++ code into BMAX ?

greetings smile  not sure if this is what is supposed to look like, but here is the converted code:

SuperStrict
Framework Irrlicht.Core


Local driverType:Int=EDT_NULL

Local i:String=Input("Please select the driver you want for this example:"+Chr(13)+Chr(10)+ ..
    " (a) Direct3D 9.0c"+Chr(13)+Chr(10)+" (b) Direct3D 8.1"+Chr(13)+Chr(10)+ ..
    " (c) OpenGL 1.5"+Chr(13)+Chr(10)+" (d) Software Renderer"+Chr(13)+Chr(10)+ ..
    " (e) Burning's Software Renderer"+Chr(13)+Chr(10)+" (f) NullDevice"+Chr(13)+Chr(10)+ ..
    " (otherKey) Exit"+Chr(13)+Chr(10)+Chr(13)+Chr(10))

Select i
    Case "a" driverType=EDT_DIRECT3D9
    Case "b" driverType=EDT_DIRECT3D8
    Case "c" driverType=EDT_OPENGL
    Case "d" driverType=EDT_SOFTWARE
    Case "e" driverType=EDT_BURNINGVIDEO
    Case "f" driverType=EDT_NULL
    Default Return 
EndSelect

' create engine And camera
Local device:IrrlichtDevice= ..
    IrrlichtDevice.Create(EDT_OPENGL,_DIMENSION2DI(640,480),16,False)

If Not device Return ' could Not create selected driver.

Local driver:IVideoDriver = device.getVideoDriver()
Local smgr:ISceneManager = device.getSceneManager()
Local guienv:IGUIEnvironment = device.getGUIEnvironment()

' Create an orthogonal (orthographic projection) camera
Local camera:ICameraSceneNode = smgr.addCameraSceneNode(Null, _VECTOR3DF(0,0,-10), _VECTOR3DF(0,0,0))
Local orthoMatrix:Matrix4 = Matrix4.Create()
orthoMatrix.buildProjectionMatrixOrthoLH(20, 15, 5, 100)

'camera.setProjectionMatrix(orthoMatrix, True)      '  SVN / 1.5
camera.setProjectionMatrix(orthoMatrix)    '  <= 1.4.2
camera.setIsOrthogonal(True)

'  Create a simple quad mesh
Local buffer:SMeshBuffer = SMeshBuffer.Create()
Local vertices:S3DVertex[4]
vertices[0] = S3DVertexDefault.createFromVals(0.5, 0.5, 0.0, 0.0, 0.0, -1.0, _SColor(0, 255, 255, 255), 1.0, 1.0)
vertices[1] = S3DVertexDefault.createFromVals(0.5, -0.5, 0.0, 0.0, 0.0, -0.5, _SColor(0, 255, 255, 255), 0.5, 0.0)
vertices[2] = S3DVertexDefault.createFromVals(-0.5, -0.5, 0.0, 0.0, 0.0, -0.5, _SColor(0, 255, 255, 255), 0.0, 0.0)
vertices[3] = S3DVertexDefault.createFromVals(-0.5, 0.5, 0.0, 0.0, 0.0, -0.5, _SColor(0, 255, 255, 255), 0.0, 0.5)

Local indices:Short[] = [ Short(0), Short(1), Short(2), Short(0), Short(2), Short(3) ]
buffer.append(vertices, indices)

Local mesh:SMesh = SMesh.Create()
mesh.addMeshBuffer(buffer)
buffer.drop()

'  That's our quad mesh created

'  Fill the screen with nodes that use this quad mesh. We are using an ortho camera
'  that defines a 20 x 15 view over 1x1 nodes, so we need 20 x 15 nodes.
Const MAX_NODES:Int = 20 * 15

Local nodes:IMeshSceneNode[MAX_NODES]

For Local index:Int = 0 Until MAX_NODES

    nodes[index] = smgr.addMeshSceneNode(mesh)

    If nodes[index]

        nodes[index].setMaterialFlag(EMF_LIGHTING, True)
        Local texture:ITexture
        
        Local nodeX:Int = index Mod 20
        Local nodeY:Int = index / 20
        
        nodes[index].setPosition(_VECTOR3DF(nodeX - 9.5, nodeY - 7, 0))
        
        If (nodeX + nodeY) Mod 2
            texture = driver.getTexture("../../media/wall.bmp")
        Else
            texture = driver.getTexture("../../media/detailmap3.jpg")
        EndIf
        
        nodes[index].setMaterialTexture( 0, texture)
    EndIf

Next

mesh.drop()
mesh = Null

'  Move a light over the scene
Local billboard:IBillboardSceneNode = smgr.addBillboardSceneNode()

If(billboard)

    billboard.setMaterialType(EMT_TRANSPARENT_ADD_COLOR )
    billboard.setMaterialTexture(0, driver.getTexture("../../media/particle.bmp"))
    billboard.setMaterialFlag(EMF_LIGHTING, False)
    billboard.setMaterialFlag(EMF_ZBUFFER, False)
    billboard.setSize(_DIMENSION2DF(1.0, 1.0))

    Local animator:ISceneNodeAnimator = smgr.createFlyCircleAnimator(_VECTOR3DF(0, 0, -1), 7, 0.001, _VECTOR3DF(0, 0, -1))
    If(animator)
        billboard.addAnimator(animator)
        animator.drop()
        animator = Null
    EndIf

    smgr.addLightSceneNode(billboard, _VECTOR3DF(0, 0, 0), _SCOLORF(1, 1, 0, 1), 5)
EndIf

smgr.setAmbientLight(_SCOLORF(0.25, 0.25, 0.5, 1.0))


While(device.run())
    driver.beginScene(True, True, _SCOLOR(255,100,101,140))
    smgr.drawAll()
    driver.endScene()
Wend

device.drop()

Re: how to convert this c++ code into BMAX ?

BIG thanks boss...

P5E Q6600@2,6Ghz, 4go corsair, 2*150go velociraptor, Radeon3850, 24" samsung LCD.
BMAX 1.30 + Irrlicht wrapper 1.4.2