<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — how to convert this c++ code into BMAX ?]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=341&amp;type=atom" />
	<updated>2008-09-28T01:45:35Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=341</id>
		<entry>
			<title type="html"><![CDATA[Re: how to convert this c++ code into BMAX ?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1302#p1302" />
			<content type="html"><![CDATA[<p>BIG thanks boss...</p>]]></content>
			<author>
				<name><![CDATA[Kali]]></name>
				<uri>https://gprogs.com/profile.php?id=52</uri>
			</author>
			<updated>2008-09-28T01:45:35Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1302#p1302</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: how to convert this c++ code into BMAX ?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1301#p1301" />
			<content type="html"><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; not sure if this is what is supposed to look like, but here is the converted code:<br /></p><div class="codebox"><pre><code>SuperStrict
Framework Irrlicht.Core


Local driverType:Int=EDT_NULL

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

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

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

If Not device Return &#039; could Not create selected driver.

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

&#039; 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)

&#039;camera.setProjectionMatrix(orthoMatrix, True)      &#039;  SVN / 1.5
camera.setProjectionMatrix(orthoMatrix)    &#039;  &lt;= 1.4.2
camera.setIsOrthogonal(True)

&#039;  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()

&#039;  That&#039;s our quad mesh created

&#039;  Fill the screen with nodes that use this quad mesh. We are using an ortho camera
&#039;  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(&quot;../../media/wall.bmp&quot;)
        Else
            texture = driver.getTexture(&quot;../../media/detailmap3.jpg&quot;)
        EndIf
        
        nodes[index].setMaterialTexture( 0, texture)
    EndIf

Next

mesh.drop()
mesh = Null

&#039;  Move a light over the scene
Local billboard:IBillboardSceneNode = smgr.addBillboardSceneNode()

If(billboard)

    billboard.setMaterialType(EMT_TRANSPARENT_ADD_COLOR )
    billboard.setMaterialTexture(0, driver.getTexture(&quot;../../media/particle.bmp&quot;))
    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()</code></pre></div>]]></content>
			<author>
				<name><![CDATA[gman]]></name>
				<uri>https://gprogs.com/profile.php?id=2</uri>
			</author>
			<updated>2008-09-27T19:35:42Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1301#p1301</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[how to convert this c++ code into BMAX ?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1300#p1300" />
			<content type="html"><![CDATA[]]></content>
			<author>
				<name><![CDATA[Kali]]></name>
				<uri>https://gprogs.com/profile.php?id=52</uri>
			</author>
			<updated>2008-09-25T09:07:28Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1300#p1300</id>
		</entry>
</feed>
