Worklog for gman

Worklog 1

Return to Worklogs

info moved(Posted 2006-01-14)
any future information regarding this mod will be posted at 3impact.gprogs.com


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

special forum online(Posted 2006-01-04)
i have opened a forum for these mods.

http://irrlicht.gprogs.com


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

working on other things...(Posted 2005-12-21)
im currently not working directly on this project, although im working to gain knowledge that i could apply to it. i recently picked up:

3D Game Engine Architecture by David H. Eberly

and am finding it a very good read that is hard to put down. the proposed engine design is a bit different than others i have seen but all the key components are there. the later chapters on physics and collisions may prove most useful for this project.

also, im working on a utility project that if completed, will give mod developers the ability to host their own mod servers outside of the realm of BRL using PHP and MySQL.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

havent had a lot of time of late...(Posted 2005-12-05)
here is the mod in its current state. incomplete and heavily pre-alpha stage. has source this time.

2005_12_05 gg.IrrB3D Mod Pre-Alpha


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

updates for Irrlicht v0.14(Posted 2005-12-04)
the mods have been updated to be Irrlicht v0.14 compatible.

2005_12_04 gg Mods for Irrlicht v0.14/BMAX v1.14

and the .a and .dll files have been updated to Irrlicht v0.14:

IrrDX_v0_14.zip

NOTE: i do not have the samples converted yet. they are coming but for now the major issue you will have is the new driver type constants. just change EDT_DIRECTX9 and EDT_DIRECTX8 to EDT_DIRECT3D9 and EDT_DIRECT3D8. also there is a new one to try, EDT_SOFTWARE2 which is a fully implemented software driver.

a few instructions...

for installing the mods:

extract the mod distribution zip file into your mod folder under blitzmax. this should create a gg.mod folder under your mod folder and then the irrlicht.mod and irrbmax.mod folders under that.

for installing the lib and dll files:

if you download the Irrlicht distro then (looks like the directory names have changed a bit):

copy lib\Win32-gcc\libIrrlicht.a to your BMAX\lib folder
copy bin\Win32-gcc\Irrlicht.dll to your windows\system32 folder

if you download my lib distro then inside of IrrDX_v0_14.zip you should find 4 files:

D3DX81ab.dll
D3DX92ab.dll
Irrlicht.dll
libIrrlicht.a

place libIrrlicht.a into your BMAX\lib folder. put the .dll files in your windows system32 folder.

and finally, the API doc links (have not yet been updated to v0.14):

gg.IrrBMAX API Documentation

gg.Irrlicht API Documentation


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

updates for BMAX v1.14(Posted 2005-11-29)
the mods have been updated to be v1.14 compatible. this fixes any Int to Object conversions that were made invalid by v1.14.

2005_11_29 gg Mods for Irrlicht v0.12/BMAX v1.14

and the .a and .dll files have been updated to fix the C000005 crash some were encountering when running with the DX9 driver:

IrrDX_v0_12.zip

and the samples to fix the Int to Object conversions:

01.HelloWorld & 02.Quake3Map

03.CustomSceneNode

04.Movement & 05.UserInterface

06.2DGraphics & 07.Collision

09.MeshViewer

10.Shaders

08.SpecialFX & 11.PerPixelLighting

12.TerrainRendering

13.RenderToTexture

14.Win32Window

non-distribution samples

SplitScreen

also, a few instructions for installing the lib and dll files:

if you download the Irrlicht distro then (looks like the directory names have changed a bit):

copy lib\Win32-gcc\libIrrlicht.a to your BMAX\lib folder
copy bin\Win32-gcc\Irrlicht.dll to your windows\system32 folder

if you download my lib distro then inside of IrrDX_v0_12.zip you should find 4 files:

D3DX81ab.dll
D3DX92ab.dll
Irrlicht.dll
libIrrlicht.a

place libIrrlicht.a into your BMAX\lib folder. put the .dll files in your windows system32 folder.

and finally, the API doc links:

gg.IrrBMAX API Documentation

gg.Irrlicht API Documentation


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

updated with fixes(Posted 2005-11-28)
a big thank you to Budman for tracking these down. there are fixes to T_irrSMeshBuffer, T_irrIReadFile, and T_irrIWriteFile.

2005_11_28 gg Mods for Irrlicht v0.12/BMAX v1.12

also, the infamous Win32Window example is available for download. you must have MaxGUI in order to build and run.

14.Win32Window


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

delta time and terrain(Posted 2005-11-22)
i incorporated Wave's Delta class into the engine and terrain about 50% complete.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

design change(Posted 2005-11-17)
much of my free time i have been, amongst other things, busy reworking mods for v1.12 of bmax. the last thing i was doing with gg.IrrB3D was checking the differences between B3D scale and Irrlicht scale routines. i have thought about this quite a bit and have come to a conclusion that one of my original design goals for gg.IrrB3D is flawed. instead of trying to make commands _exactly_ compatible with B3D functions both in parameter type and expected value, i should really just be trying to create the command set itself. too much will go into conversions and such each loop to really make an "exact as possible" command set viable. the result, i will no longer be trying to exactly match B3D commands with gg.IrrB3D. the commands will be there (ie near all B3D functions will be represented), but the parameters and values needed for the parameters will be what Irrlicht is expecting and more than likely incompatible with the _exact_ same command in B3D. in the end this will definately be a good thing as it peels off a complexity layer and gets me back to moving forward with the command set.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

BMAX v1.12 compatible mods(Posted 2005-11-15)
BMAX v1.12 compatible mods are now available:

2005_11_15 gg Mods for Irrlicht v0.12/BMAX v1.12

i have yet to redo all the samples. for now most, if not all, should work by simply removing the FlushMem call.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

BMAX v1.12 update(Posted 2005-11-15)
adds support for the new BMAX v1.12 GC without FlushMem(). also includes source!

2005/11/15 release of the 3Impact mod


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Online API Documentation(Posted 2005-11-05)
thanks to my spankin' new registered copy of HotDocs (see the toolbox), you can now see a basic set of documentation for the gg.IrrBMAX and gg.Irrlicht APIs.

gg.IrrBMAX API Documentation

gg.Irrlicht API Documentation


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

pre-Alpha release 2005_11_05(Posted 2005-11-05)
this is a pre-alpha release. no source, not yet functionally complete. it took me way longer than i originally estimated on collisions so i wanted to get something out there that people can start playing around with. some major areas remaining are picking, animations, terrain, sprites, brush application.

BMAX v111 compatible 2005_11_05 gg.IrrB3D Mod Pre-Alpha

BMAX v110 compatible 2005_11_10 gg.IrrB3D Mod Pre-Alpha

need to extract into your gg.mod folder. it should create a folder under it called irrb3d.mod. when done, your mod directory tree should look like: mod/gg.mod/irrb3d.mod

here is some rough API documentation.

gg.IrrB3D API Documentation (rough)

here is a test program to get you started. you will need the missing files from the media folder of the Irrlicht examples.

Strict 
Framework gg.IrrB3D

ib3d_Graphics3D(640,480)

Local cam:CAMERA=ib3d_CreateCamera()
T_irrICameraSceneNode(cam._node).setAspectRatio(4.0/3.0) ' need interface to this and this needs to be default
ib3d_PositionEntity(cam,30,30,30)

Local syd:MESH=ib3d_LoadAnimMesh("sydney.md2")
ib3d_EntityTexture(syd,ib3d_LoadTexture("sydney.bmp"))

Local LIGHT:LIGHT=ib3d_CreateLight()
ib3d_LightColor(LIGHT,255,255,0)
ib3d_LightRange(LIGHT,1000)
ib3d_LightCastShadows(LIGHT,True)

T_irrIAnimatedMeshSceneNode(syd._node).setFrameLoop(0,320) ' animation stuff not done
ib3d_CameraClsColor(200,200,200)
ib3d_ShadowColor(150,0,0,0)

ib3d_EntityDebugDataVisible(syd,True)
ib3d_NameEntity(syd,"SYD")
ib3d_NameEntity(cam,"CAM")

ib3d_AddZipFileArchive("map-20kdm2.pk3")

Local quake:MESH=ib3d_LoadOctTreeMesh("20kdm2.bsp")
ib3d_PositionEntity(quake,-1300,-144,-1249)

ib3d_EntityRadius(cam,30)
ib3d_EntityOffset(cam,0,10,0)
ib3d_EntityType(cam,1)
ib3d_EntityType(syd,2)
ib3d_EntityType(syd,1)
ib3d_EntityType(quake,3)

ib3d_Collisions(1,2,CD_ELLIPSOID_POLY_IRRLICHT,CR_STOP,"TEST")
ib3d_MapIncludeInCounts(ib3d_Collisions(1,3,CD_ELLIPSOID_POLY_STATIC_IRRLICHT,CR_SLIDE_LIMITED_IRRLICHT,"TEST2"),False)

Local zoom:Float=1.0

While Not ib3d_KeyDown(EKEY_ESCAPE)

	If ib3d_KeyDown(EKEY_KEY_Z) Then zoom:+0.005
	If ib3d_KeyDown(EKEY_KEY_X) Then zoom:-0.005
	
	If ib3d_KeyDown(EKEY_NUMPAD9) Then ib3d_MoveEntity(cam,0,1,0)
	If ib3d_KeyDown(EKEY_NUMPAD3) Then ib3d_MoveEntity(cam,0,-1,0)
	If ib3d_KeyDown(EKEY_NUMPAD6) Then ib3d_MoveEntity(cam,1,0,0)
	If ib3d_KeyDown(EKEY_NUMPAD4) Then ib3d_MoveEntity(cam,-1,0,0)
	If ib3d_KeyDown(EKEY_NUMPAD8) Then ib3d_MoveEntity(cam,0,0,1)
	If ib3d_KeyDown(EKEY_NUMPAD2) Then ib3d_MoveEntity(cam,0,0,-1)
	
	If ib3d_KeyDown(EKEY_LEFT) Then ib3d_TurnEntity(cam,0,-1,0)
	If ib3d_KeyDown(EKEY_RIGHT) Then ib3d_TurnEntity(cam,0,1,0)
	If ib3d_KeyDown(EKEY_UP) Then ib3d_TurnEntity(cam,1,0,0)
	If ib3d_KeyDown(EKEY_DOWN) Then ib3d_TurnEntity(cam,-1,0,0)
	If ib3d_KeyDown(EKEY_SPACE) Then ib3d_TurnEntity(cam,0,0,1)

	If ib3d_KeyDown(EKEY_KEY_Y) Then ib3d_TrackEntity(cam)

	ib3d_CameraZoom(cam,zoom)
	
	ib3d_UpdateWorld()
	ib3d_RenderWorld()
Wend

ib3d_FreeEntity(syd)
ib3d_EndGraphics()



G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

new GC(Posted 2005-11-04)
im on v1.11 and im having a few issues with the new garbage collection and some of the stuff ive done in collisions. the errors im getting seem pretty random unfortunately making it take a lot longer than it should.

EDIT: got it worked out almost. not a problem with the GC but a problem with one of my routines creating a bad mesh that causes Irrlicht to have probs.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

currently on gg.IrrB3D(Posted 2005-10-27)
currently working on gg.IrrB3D and anxiously awaiting v0.13 of Irrlicht to be released. see the gg.IrrB3D worklog for more info on that.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

still going...(Posted 2005-10-26)
still on the collision system after a few structural revisions. these came about when i took a quick look at the 3rd party collision system ColDet and how it could be integrated into the gg.IrrB3D collision system. i think doing this really helped me anticipate how folks may need to extend the collision system.

major areas to hit after this are terrain, sprites, and animation. after terrain and sprites are done i plan on releasing for limited area testing (ie. test only the Entity movement functions, camera functions, etc).


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

just humming along...(Posted 2005-10-21)
Jan_ has come back with some good initial work on picking. things are humming along with collisions but it really has become much larger than i had originally conceptualized. unfortunately this is delaying me a bit but its for the better since collisions are a big part of a game and i want this collision system to be easy to use and extend. i would say probably late next week before i revisit the idea of releasing something to the public for some alpha testing.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

collision system nearly complete(Posted 2005-10-18)
ive been working madly on the collision system and its nearly complete. it will be as near to the B3D system as possible, but with some very cool twists. essentially the new system is modular with built-in elements that try to replicate the B3D system. you can customize the built-in detection and response types or create completely new ones.

the current built-in detection types are:

Const CD_SPHERE_SPHERE:Int=1
Const CD_SPHERE_POLY:Int=2
Const CD_SPHERE_POLY_STATIC:Int=3
Const CD_SPHERE_BOX:Int=4
Const CD_BOX_BOX:Int=5

the current built-in response types are:

Const CR_NOTHING:Int=0
Const CR_STOP:Int=1
Const CR_SLIDE_XYZ:Int=2 ' slides on all axis (full slide)
Const CR_SLIDE_XZ_UP:Int=3 ' slides just on UP, X & Z axis

hopefully with the customization capabilities i have included, moving to a different collision system (ie Newton or ODE) would be fairly easy without having to gut or work around the framework.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

making progress(Posted 2005-10-14)
the much of the 3D command set has been converted, but untested. i have taken on Jan_ as an accomplice and he is currently working on the picking routines. im working out collisions. there is still a ways to go...


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

the goal(Posted 2005-10-14)
the goal of gg.IrrB3D is to create a flexible framework based on the B3D command set for use in BMAX. the underlying renderer will be Irrlicht via the Irrlicht mods. while there will hopefully be a one-to-one function for every B3D 3D and 2D command, some parameters will be different. while you can use the functions, under the framework will be OO. this means that the functions are simply wrappers for method calls on objects. this means that essentially you wouldnt even need to call the functions and that you can extend the base IrrB3D types to add functionality as desired.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

initial release!(Posted 2005-10-01)
here you go :) the initial mod release is ready. follow the install directions in the CHM in the docs directory.

2005/10/01 release of the 3Impact mod

enjoy :)


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

looking good(Posted 2005-09-28)
i have 3 more samples to complete. i added window creation/destruction (so you dont have to use the built-in windows) and was able to get the mesh-buffers working (finally). i will finish up the samples tomorrow and then add some runtime error checking. looking real good for a late friday or sometime saturday release.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

BMAX demo preview(Posted 2005-09-28)
k.  for those of you with 3Impact already, here is a preview pack of the BMAX demos.  this does not contain any of the demo resources and there are a few demos yet to convert.  all EXEs are non-debug BMAX EXEs.  included are also the BMX code files for the demo.  this does _not_ contain the mod... it should be released this weekend.  for each EXE you wish to try, place it in the i3Impact4\3ImpactWork folder.  you will need the latest non-debug 3impact DLL available from the download page.

Demo EXE Preview Pack


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

working on demos(Posted 2005-09-27)
just a quick update. im about 3/4 through the demos right now. looking good for a mod release sometime this weekend.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

SimpleCar demo(Posted 2005-09-26)
this is fun. here is the simplecar demo with BlitzMax EXE, code, and everything needed to run it.

SimpleCar Demo


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

complete once again(Posted 2005-09-25)
the mod is again done and im converting samples. should be done this week with a release of the mod targeted for this weekend.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

another one down(Posted 2005-09-25)
just finished up MATH which was the last major one to complete.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

some good progress(Posted 2005-09-25)
the only sections i have left are:

REPLAY
MESH-BUFFERS
MATH
PROCESSING

once i finish those i will begin converting samples. i should be able to begin on the samples again monday.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

done through SPRITE(Posted 2005-09-23)
just finished up the SPRITE section...


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

done through MESH(Posted 2005-09-22)
just finished up the MESH section for the second time. cranking away...


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

port cancelled(Posted 2005-09-22)
the port will not happen... but dont dispair! the reason is that listed for TODOs for version 0.13.0 on the Irrlicht website is... yup, you guessed it. the MAC port. the next version of Irrlicht should have MAC support built-in thus negating the whole reason i am doing this. if anyone is interested in testing the MAC port out for me (i dont have a MAC but may be getting a low-end one soon because of this) please email me.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

two steps forward, one step back(Posted 2005-09-22)
as what happens often in the programming world, when i had time to stop and think i came up with a better design in mind for the 3Impact mod. what does this mean? it means it will be _much_ easier to use out of the box and that it will help utilize some of the benefits of BMAX giving the developer a bit more flexibility than just using 3Impact alone. of course, you do not have to use any of the features im adding if you wish and just use the straight 3Impact commands. the drawback is that although i had the entire 3Impact interface ready for BMAX and i was converting samples, now i am back to being finished down to BODY.

on a side note, since i am putting a lot of extra work above and beyond just an interface mod it will need to be maintained by me and thus when the mod is released it will be called gg._3Impact.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

sick with flu :((Posted 2005-09-20)
went down with the flu 2 days ago. im feeling good enough to return to work and will see if i can continue my work here either tonight or tomorrow.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

BallGame sample(Posted 2005-09-18)
the BallGame sample is ready for download:

BallGame 3Impact sample

extract the EXE into your 3Impact4/3ImpactWork folder and run it.
' This simple example implements a keyboard controlled ball.
' Arrow keys apply forces To the ball.
' [Ctrl] key reverses gravity force direction.

' After compilation, this source code is turned into a file named 3impactd.dll And
' saved To the 3impactWork folder on your hard disk.
' When 3impactd.exe file (the engine) is launched, it loads this .dll file And
' executes the five functions below, also known as 'callbacks'.
' They are: PreInit(), Init(), Run(), Exit(), PostExit().

' You can fully control the engine by calling creation functions, setting functions
' And transformation functions inside the callbacks. It is that easy! See below.

Strict
Framework Pub._3Impact

' In the Init() callback you'll see that we create virtual world objects by calling
' creation functions.
' Newly created objects should always be stored in proper 'containers', named
' 'object variables', to allow for subsequent handling.
' Object variables are typically declared at the beginning of the code. Typically, one
' single line of code declares one single variable. A declaration is made of two parts.
' The first part declares the Type of the variable (For example 'CAMERA*') and the
' second part declares its custom (user defined) name (For example 'Camera').
' For simplicity, an Object variable is usually called 'object' (e.g., 'camera object').
' The following are the Object variables we need For this example.
Global Camera:Byte Ptr
Global LoadingMessage:Byte Ptr
Global SkyBox:Byte Ptr
Global Terrain:Byte Ptr
Global TerrainMesh:Byte Ptr
Global Ball:Byte Ptr
Global BallMesh:Byte Ptr
Global BallMeshShadow:Byte Ptr
Global BallTerrain:Byte Ptr

i3ImpactOpen()

Local settings:ISETTINGS=New ISETTINGS
settings.dwMode=1024*768*32
settings.bFullScreen=False
settings.bDoNotShow=True

i3ImpactSettings(settings.param())

Local engine:sample_3IEngine=New sample_3IEngine

engine.BeginRenderingLoop()

Type sample_3IEngine Extends _3IEngine

	Method _Init()

	   ' This callback is executed once, Right after opening the rendering window Or the
	   ' rendering fullscreen display.
	   ' This callback is typically used To create objects, To set their initial status,
	   ' physics properties, rendering mode, etc.
	
	   ' We always need To create a camera (point of view). Without a camera, nothing can
	   ' be rendered To the screen. The following line calls the iCameraCreate() Function
	   ' And stores the camera Object which it creates in the Object variable named Camera.
	   Camera=iCameraCreate(0.0,0.0,1.0,1.0)
	   ' Now that the newly created camera is in the 'Camera' variable, we can handle it.
	   ' For example, we can set its location, inside the virtual space. The Next line of code
	   ' calls the iCameraLocationSet() Function, passing the Camera as first parameter And
	   ' a constant 3d vector as second parameter (the location).
	   iCameraLocationSet(Camera,_D3DXVECTOR3(0.0,3.0,-10.0))
	
	   ' We also want To specify sun light direction And color.
	   iLightDirectionalSet(_D3DXVECTOR3(1.0,-1.0,1.0),_D3DXVECTOR4(1.0,1.0,1.0,0.35))
	
	   ' Creating objects can be a lengthy operation. We want To display something While
	   ' loading is in progress. So we create a 2d Object (also known as 'sprite') to
	   ' display a 'Loading...' message.
	   ' Note that Object creation will typically require a resource file, as source.
	   ' For example, For sprites, we need an image file And a .x file.
	   ' Custom resources can be created. Refer To the quick start tutorial For details.
	   ' The Next line of code will create a sprite from the loading.x resource, And will
	   ' store it in the variable named 'LoadingMessage'.
	   LoadingMessage=iSpriteCreate("default_res\\sprites\\loading.x".ToCString(),Null)
	   ' We want the message displayed now, before we start creating (loading) all other objects.
	   iSpriteRender(LoadingMessage,False)
	
	   ' We now create a 3d background For the virtual space.
	   SkyBox=iSkyBoxCreate("default_res\\skyboxes\\skybox01.sky".ToCString())
	
	   ' The first 3d 'solid' object we create is a piece of terrain. Solid objects
	   ' are called 'bodies'. A body is considered 'solid' because it is collision-response
	   ' capable. In this Case, the body is a polygonal Object (polyhedron).
	   Terrain=iBodyCreate("default_res\\terrain_5.00.ply".ToCString())
	   ' Bodies are invisible. They are processed by the engine as invisible-solid objects.
	   ' It means that they cannot be rendered (displayed) by the engine. However, we can
	   ' attach a visible mesh To them, To show where they are And what their shape is.
	   ' Mesh objects are non-solid 3d models. Unlike bodies, they are rendered by the engine.
	   ' With the Next line of code, we create a 3d visible Object from a .x
	   ' resource file. As parameters, we pass the file name For the resource To load And
	   ' the body Object we want To attach the mesh To (Terrain).
	   TerrainMesh=iBodyMeshCreate("default_res\\terrain.x".ToCString(),Terrain)
	
	   ' The second body we create is a ball. Unlike the terrain, which is made of polygons,
	   ' this Object is sphere-group based. It is as simple as a ball, so it is a one-ball
	   ' group. See tutorials For details on polyhedron And sphere-group based bodies.
	   Ball=iBodySGCreate("default_res\\ball_.spg".ToCString(),0.13)
	   ' As a body, the newly created ball is invisible. Let's attach a ball-shaped mesh to it.
	   BallMesh=iBodyMeshCreate("default_res\\ball.x".ToCString(),Ball)
	   ' We want the ball at about 5 meters above the ground, at startup.
	   iBodyLocationSet(Ball,_D3DXVECTOR3(0.0,5.0,0.0),True)
	   ' By Default, there is no air friction For bodies. We can simulate it by setting
	   ' some damping For the ball.
	   ' See Reference document For details on iBodyDampingSet() instruction And damping.
	   iBodyDampingSet(Ball,0.0,0.999,0.0,0.995)
	
	   ' We want our ball To cast a shadow onto other objects in the scenery.
	   ' The Next line of code creates a shadow volume mesh from a source .x file
	   ' And attaches it To the Ball body. See Reference document For details on
	   ' iMeshBodyShadowCasterCreate() instruction And shadows.
	   BallMeshShadow=iMeshBodyShadowCasterCreate("default_res\\ball_shadow.x".ToCString(),Ball,500.0)
	
	   ' By Default, no collision checking is performed For the bodies we have created.
	   ' We have To tell the engine what body couples should be checked For collision.
	   ' The Next line of code creates a so called body-body object.
	   ' Basically, the body-body Object is a data block specifying a body couple And
	   ' a few parameters required by the engine To compute collision-response.
	   BallTerrain=iBodyBodyCreate(Ball,Terrain)
	   ' We have stored the body-body Object For the ball-terrain couple, so that we can
	   ' set collision-response parameters For it. See Reference document For details on them.
	   iBodyBodyFrictionSet(BallTerrain,10.0)
	
	   ' Newly created bodies are disabled (no physics, no collision-response computation).
	   ' The Next two lines of code enable Ball And Terrain bodies.
	   iBodyEnable(Terrain)
	   iBodyEnable(Ball)

	   ' We don't want to show the loading message any longer, now that object creation is complete.
	   iSpriteHide(LoadingMessage)
	   ' Newly created meshes are hidden. Let's show all of them.
	   iSkyBoxShow(SkyBox)
	   iMeshShow(TerrainMesh)
	   iMeshShow(BallMesh)
	   iMeshShow(BallMeshShadow)
	EndMethod
	Method _Run()
	   ' This callback is executed 75 times per second. The first execution happens
	   ' after the Init() callback above is completed.
	
	   ' It means that the engine will repeatedly scan the lines of code from the '{'
	   ' Right below the 'void Run()' line to the '}' right above the 'void Exit()' line.
	
	   ' Each scan from '{' to '}' is called 'dll loop'. It is basically the heartbeat
	   ' of the simulation.
	
	   ' The rendering phase, in which the virtual world is displayed in its current status,
	   ' as seen from the current camera location, happens after each dll loop is complete.
	
	   ' The dll loops Continue Until the [Esc] key is pressed Or the iExit() Function
	   ' is called. Terminating the dll loops basically stops the simulation.
	
	   ' So, we have a piece of terrain And a ball. We want the camera To constantly
	   ' take the ball, wherever it goes. First of all, let's define a vector variable
	   ' To save the current ball position, that is the target To point the camera to.
   	   Local cameratarget:D3DXVECTOR3=New D3DXVECTOR3

	   ' We put the current ball location into the vector by calling iBodyLocationCM().
	   iBodyLocationCM(Ball,cameratarget.param())
	   ' Finally, we call a special Function that will point the camera To the target.
	   iCameraLookAt(Camera,cameratarget.param(),0.1)
	
	   ' We finally want the ball To be controlled by key presses. The idea is applying
	   ' forces To it according To what arrow keys are pressed by the user.
	   ' First of all, let's define proper variables to store some temporary information
	   ' we need To achieve our goal.
	   Local acceleration:D3DXVECTOR3=New D3DXVECTOR3
	   Local cameraorientation:D3DXQUATERNION=New D3DXQUATERNION
	
	   ' Linear accelerations (*) are defined by 3d vectors. We have provided a variable
	   ' named 'acceleration' to store the acceleration generated by key presses.
	   ' This vector variable will work as an accumulator. The first Step is resetting it.
	   acceleration.x=0
	   acceleration.y=0
	   acceleration.z=0

	   ' Depending on what keys are pressed, we will add a constant vector To the
	   ' acceleration variable. The length of the vector defines the intensity of
	   ' the acceleration. The direction of the vector defines the direction of it.
	   ' For example, If up-arrow is pressed, we add a 10 meter Long vector
	   ' To the accumulator. Its direction is towards Z-positive world axis.
	   ' It basically means that the ball will be pushed with an acceleration of 10
	   ' meters per second^2 in that direction, when up-arrow is pressed (**).
	   If (iKeyDown(DIK_LEFT)) acceleration.PlusEq(D3DXVECTOR3.create(-10.0,0.0,0.0))
	   If (iKeyDown(DIK_RIGHT)) acceleration.PlusEq(D3DXVECTOR3.create(10.0,0.0,0.0))
	   If (iKeyDown(DIK_UP)) acceleration.PlusEq(D3DXVECTOR3.create(0.0,0.0,10.0))
	   If (iKeyDown(DIK_DOWN)) acceleration.PlusEq(D3DXVECTOR3.create(0.0,0.0,-10.0))
	
	   ' (**) The code above basically tends To push the ball along world's X and Z
	   ' axes only, no matter where the camera is taking the scene from. It makes a bit
	   ' difficult For the user To effectively direct the ball.
	   ' We want To re-orientate the resulting acceleration vectors so that they
	   ' are camera relative. For example, we want an acceleration towards X+ axis To be
	   ' re-orientated so that it becomes an acceleration towards the Right of the screen.
	   ' To achieve this, we first store the camera orientation in a quaternion variable.
	   ' Note: most physics engine quantities (locations, forces, torques, etc) can be stored
	   ' in vector variables. To store orientations And rotations we use special variables
	   ' called 'quaternions'.
	   iCameraOrientation(Camera,cameraorientation.param())
	   ' The Next Function takes a vector (acceleration) And rotates it by using a
	   ' quaternion as a reference. Basically, 'cameraorientation' quaternion is
	   ' the rotation required To change the camera from its natural status (that
	   ' is, looking at Z+ horizon) To its current orientation. We can
	   ' say that it is the current camera orientation, but it is a rotation actually. 
	   ' So, we basically apply that orientation To the given vector. The result
	   ' is that the vector is transformed from world coordinates (absolute) To
	   ' camera coordinates (relative). And it is exactly what we need here.
	   iVectorRotate(acceleration.param(),acceleration.param(),cameraorientation.param())
	
	   ' Controls are easier now that applied acceleration has been made camera-relative.
	   ' Still we aren't done yet. Controlling the ball when the camera is pitched (for
	   ' example facing downward) isn't very easy. For some reason, it would be easier
	   ' If acceleration vector direction was always parallel To the XZ (ground) plane.
	   ' To constrain the vector To the XZ plane we just have To force its Y
	   ' coordinate To zero. Note that this may reduce vector length (intensity) on
	   ' extreme camera pitching, but it is ok For this simple example.
	   acceleration.y = 0.0
	
	   ' Now that the acceleration vector is set (Or still reset To Null If no
	   ' key was pressed), we can finally apply it To the Ball body.
	   ' (*) We are applying an acceleration And Not a force. Applying a force
	   ' means transferring To a body a defined quantity of energy. So, the resulting
	   ' speed depends on the body mass: a force applied To an heavy body will generate
	   ' a Lower speed respect To the same force applied To a lighter body.
	   ' Applying an acceleration, instead, means transferring To a body the energy required
	   ' To obtain, over time, a defined velocity Or spin, regardless of the body mass.
	   iBodyAccelerationApply(Ball,acceleration.param())
	
	   ' Finally, we apply a constant acceleration To simulate gravity.
	   ' We also implement an additional control, with the Next lines of code.
	   ' We want To reverse the gravity force (but we should actually name it
	   ' 'gravity acceleration'...) while the [Ctrl] key is pressed.
	   If Not iKeyDown(DIK_LCONTROL)
	      iBodyAccelerationApply(Ball,_D3DXVECTOR3(0.0,-9.80665,0.0))
	   Else 
	      iBodyAccelerationApply(Ball,_D3DXVECTOR3(0.0,9.80665,0.0))
	   EndIf

	EndMethod
EndType



G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

new sample(Posted 2005-09-17)
the AlphaTexturesUnlimited sample is ready for download:

AlphaTexturesUnlimited 3Impact sample

same as before, extract the EXE into your 3Impact4/3ImpactWork folder and run it. i was a little disappointed with this one as it was a bit jumpy on my machine. i then compiled the DevCPP sample and it ran just the same so its either the sample code logic, my machine, or 3Impact.
'  ALPHA TEXTURES UNLIMITED DEMO.
'  By WeirdPumpkin.

'  This demo is based on the AlphaTexture demo. It has been modified To handle any number of masked objects,
'  automatically calculating the correct rendering priority order with a fast linked-list algorithm.
'  If you can find a better way, either by improving the sorting Or finding a workaround which eliminates the
'  entire need For sorting, please let me know.

'  The user controls the red ball. Move the red ball around And between the other balls, And knock them around.
'  You should find that distant balls are always visible through closer balls, regardless of which balls obscure which.
'  If you find a Case where this isn't so - let me know as well.

'  You can increase the number of balls easily. Just set the Balls constant, And specify locations For the balls.
'  Apart from that, the rest is handled automatically.

'  THIS SOURCE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. USE AT YOUR OWN RISK.

Strict

Framework Pub._3Impact

Global Camera:Byte Ptr
Global LoadingMessage:Byte Ptr
Global SkyBox:Byte Ptr
Global Terrain:Byte Ptr
Global TerrainMesh:Byte Ptr

' ************************************************
'  ADDED For THIS DEMO
' ************************************************
Const Balls:Int   = 5          '  Specify number of balls in scene.
Const Couples:Int = 10         '  5 objects - 10 unique connections. Count 'em.

Global Ball:Byte Ptr[Balls]
Global BallMesh:Byte Ptr[Balls]
Global ShadowMesh:Byte Ptr[Balls]
Global BallTerrain:Byte Ptr[Balls]
Global BallBall:Byte Ptr[Couples]
Global BallDist:Float[Balls]

'  Linked-list structure For quickly ordering objects For rendering.
Type _NODE 
    Field prev:_NODE     '  Reference To preceeding node, If any, Or NULL.
    Field _next:_NODE    '  Reference To Next node, If any, Or NULL.
    Field mesh:Byte Ptr     '  Reference To mesh at this node.
    Field dist:Float        '  Distance between camera And mesh.
EndType

Global Node:_NODE[Balls]

' init the nodes
For Local i:Int=0 To Balls-1
	Node[i]=New _NODE
Next

Global first:_NODE
Global Nodes:Int         '  Number of nodes used so far.

' ************************************************

Global rendermode:Int

Global FontWhite:Byte Ptr

i3ImpactOpen()

Local settings:ISETTINGS=New ISETTINGS
settings.dwMode=1024*768*32
settings.bFullScreen=False
settings.bDoNotShow=True

i3ImpactSettings(settings.param())

Local engine:sample_3IEngine=New sample_3IEngine

engine.BeginRenderingLoop()

Type sample_3IEngine Extends _3IEngine

	Method _Init()
	    Camera=iCameraCreate(0.0,0.0,1.0,1.0)
	    iCameraLocationSet(Camera,_D3DXVECTOR3(0.0,1.0,-10.0))
	
	    FontWhite=iFontCreate("default_res\\fontwhite\\font.wid".ToCString(),Null)
	
	    iLightDirectionalSet(_D3DXVECTOR3(1.0,-1.0,1.0),_D3DXVECTOR4(1.0,1.0,1.0,0.35))
	    iShadowColorSet(_D3DXVECTOR3(0.9,0.9,0.7))
	
	    LoadingMessage=iSpriteCreate("default_res\\sprites\\loading.x".ToCString(),Null)
	    iSpriteRender(LoadingMessage,False)
	
	    SkyBox=iSkyBoxCreate("default_res\\skyboxes\\skybox01.sky".ToCString())
	
	    Terrain     = iBodyCreate    ("default_res\\terrain_5.00.ply".ToCString())
	    TerrainMesh = iBodyMeshCreate("default_res\\terrain.x".ToCString(),Terrain)
	
	    ' ************************************************
	    '  ADDED For THIS DEMO
	    ' ************************************************
	    Local i:Int,j:Int,n:Int
	
	    '  Create balls.
	    For i = 0 To Balls-1
	        Ball[i] = iBodySGCreate("default_res\\ball_.spg".ToCString(),0.13)
	        If (i = 0)
	            '  First ball is red - And user-controlled.
	            BallMesh[i] = iBodyMeshCreate("default_res\\ballred.x".ToCString(),  Ball[i])
	        Else
	            '  Remaining balls are green - And Not user-controlled.
	            BallMesh[i] = iBodyMeshCreate("default_res\\ballgreen.x".ToCString(),Ball[i])
	        EndIf
	        ShadowMesh[i] = iMeshBodyShadowCasterCreate("default_res\\ball_shadow.x".ToCString(),Ball[i],25.0)
	        iMeshAlphaTextureChange(BallMesh[i],"default_res\\alpha_a.jpg")
	        iBodyDampingSet(Ball[i],0.0,0.999,0.0,0.995)
	        BallTerrain[i] = iBodyBodyCreate(Ball[i],Terrain)
	        iBodyBodyFrictionSet(BallTerrain[i],10.0)
	    Next
	
	    '  Set ball locations.
	    iBodyLocationSet(Ball[0],_D3DXVECTOR3( 0.0,1.2, 0.0),True)  '  Red ball - user controlled.
	    iBodyLocationSet(Ball[1],_D3DXVECTOR3( 4.0,1.2,-5.0),True)
	    iBodyLocationSet(Ball[2],_D3DXVECTOR3(-4.0,1.2,-5.0),True)
	    iBodyLocationSet(Ball[3],_D3DXVECTOR3( 4.0,1.2, 5.0),True)
	    iBodyLocationSet(Ball[4],_D3DXVECTOR3(-4.0,1.2, 5.0),True)
	
	    '  Create collsion couples.
	    n = 0
	    For i = 0 To Balls-1
	        For j = 0 To Balls-1
	            If (j > i) 
	                '  Create only unique collision couples.
	                BallBall[n] = iBodyBodyCreate(Ball[i],Ball[j])
	                iBodyBodyFrictionSet(BallBall[n],1.0)
	                n:+1
	            EndIf
	        Next
	    Next
	
	    '  Set initial render mode To 0
	    Rendermode = 0
	
	    '  Hide message And show all meshes
	    iSpriteHide(LoadingMessage)
	    iSkyBoxShow(SkyBox)
	    iBodyEnable(Terrain)
	    iMeshShow(TerrainMesh)
	    ' ************************************************
	    '  MODIFIED For THIS DEMO.
	    ' ************************************************
	    For i = 0 To Balls-1
	        iBodyEnable(Ball      [i])
	        iMeshShow  (BallMesh  [i])
	        iMeshShow  (ShadowMesh[i])
	    Next
	    ' ************************************************
	EndMethod

	Method _Run()
	    Local i:Int
	   Local cameratarget:D3DXVECTOR3=New D3DXVECTOR3
	   iBodyLocationCM(Ball[0],cameratarget.param())
	   iCameraLookAt(Camera,cameratarget.param(),0.1)
	
	   Local acceleration:D3DXVECTOR3=New D3DXVECTOR3
	   Local cameraorientation:D3DXQUATERNION=New D3DXQUATERNION
	
	   acceleration.x=0
	   acceleration.y=0
	   acceleration.z=0
	
	   If (iKeyDown(DIK_LEFT)) acceleration.PlusEq(D3DXVECTOR3.create(-10.0,0.0,0.0))
	   If (iKeyDown(DIK_RIGHT)) acceleration.PlusEq(D3DXVECTOR3.create(10.0,0.0,0.0))
	   If (iKeyDown(DIK_UP)) acceleration.PlusEq(D3DXVECTOR3.create(0.0,0.0,10.0))
	   If (iKeyDown(DIK_DOWN)) acceleration.PlusEq(D3DXVECTOR3.create(0.0,0.0,-10.0))
	
	   iCameraOrientation(Camera,cameraorientation.param())
	   iVectorRotate(acceleration.param(),acceleration.param(),cameraorientation.param())
	
	   acceleration.y = 0.0
	
	    '  Apply user-controlled accelerations To red ball.
	    iBodyAccelerationApply(Ball[0],acceleration.param())
	
	    '  Apply gravity To red ball, as dictated by user.
	    If Not iKeyDown(DIK_LCONTROL)
	       iBodyAccelerationApply(Ball[0],_D3DXVECTOR3(0.0,-9.80665,0.0))
	    Else 
	       iBodyAccelerationApply(Ball[0],_D3DXVECTOR3(0.0,9.80665,0.0))
	    EndIf	
	    '  Apply gravity To all other balls.
	    For i = 1 To Balls-1
	        iBodyAccelerationApply(Ball[i],_D3DXVECTOR3(0.0,-9.80665,0.0))
		Next
		
	    ' ************************************************
	    '  MODIFIED For THIS DEMO
	    ' ************************************************
	
	    '  Acquire distance between camera And each ball.
	   ' define some temporary vectors
	    Local cameralocation:D3DXVECTOR3=New D3DXVECTOR3
	    Local balllocation:D3DXVECTOR3=New D3DXVECTOR3

	    iCameraLocation(Camera,cameralocation.param())
	    For i = 0 To Balls-1
	        iMeshLocation(BallMesh[i],balllocation.param())
	        BallDist[i] = iVectorLengthSq(balllocation.Minus(cameralocation).param())
	    Next
	
	    '  Clear node list.
	    For i = 0 To Balls-1
	        Node[i].prev = Null
	        Node[i]._next = Null
	    Next
	
	    '  Add first mesh directly, so following balls have something To compare against.
	    Nodes       = 1
	    first       = Node[0]
	    first.mesh = BallMesh[0]
	    first.dist = BallDist[0]
	
	    '  Add remaining balls by finding the Right place For them in the linked list.
	    '  NOTE: Must be added in reverse order, that is, from farthest To nearest.
	    Local curr:_NODE = first
	    For i = 1 To Balls-1
	
	        Repeat
	
	            If (BallDist[i] > curr.dist)
	                '  This ball is further than the current node.
	
	                If (curr.prev)
	                    '  There is a previous node - jump To it now.
	                    curr = curr.prev
	
	                    '  Check If ball is closer than predeccessor.
	                    If (BallDist[i] < curr.dist)
	                        '  Ball is further than previous node, but closer than its predeccessor - so insert between them.
	                        Node[Nodes].prev = curr
	                        Node[Nodes]._next = curr._next
	                        Node[Nodes].mesh = BallMesh[i]
	                        Node[Nodes].dist = BallDist[i]
	                        curr._next.prev = Node[Nodes]
	                        curr._next       = Node[Nodes]
	                        Nodes:+1
	                        Exit
	                    EndIf
	                    
	                Else
	                    '  This is the first node - add the New node To the start of the list And Proceed To Next ball.
	                    Node[Nodes]._next = curr
	                    Node[Nodes].mesh = BallMesh[i]
	                    Node[Nodes].dist = BallDist[i]
	                    curr.prev = Node[Nodes]
	                    first      = Node[Nodes]
	                    Nodes:+1
	                    Exit
	                EndIf
	
	            Else
	                '  This ball is closer than the current node.
	
	                If (curr._next)
	                    '  There is a successor node - jump To it now.
	                    curr = curr._next
	
	                    '  Check If ball is further than successor.
	                    If (BallDist[i] > curr.dist)
	                        '  Ball is closer than previous node, but furhter than its successor - so insert between them.
	                        Node[Nodes].prev = curr.prev
	                        Node[Nodes]._next = curr
	                        Node[Nodes].mesh = BallMesh[i]
	                        Node[Nodes].dist = BallDist[i]
	                        curr.prev._next = Node[Nodes]
	                        curr.prev       = Node[Nodes]
	                        Nodes:+1
	                        Exit
	                    EndIf
	
	                Else
	                    '  This is the last node - add the New node To the End of the list And Proceed To Next ball.
	                    Node[Nodes].prev = curr
	                    Node[Nodes].mesh = BallMesh[i]
	                    Node[Nodes].dist = BallDist[i]
	                    curr._next = Node[Nodes]
	                    Nodes:+1
	                    Exit
	                EndIf
	            EndIf
	        Forever
	    Next
	
	    '  Set rendering order, from farthest (1) To closest (n).
	    Local order:Int = 1
	    Repeat
	        iMeshRenderPrioritySet(first.mesh,order)
	        first = first._next
	        order:+1
	    Until Not first
	
	    ' ************************************************
	
	    '  Select render mode For the balls according To current Rendermode variable state
	    If (Rendermode = 0)
	        '  Render the balls in normal mode
	        For i = 0 To Balls-1
	            iMeshRenderModeSet(BallMesh[i],D3DBLEND_SRCALPHA,D3DBLEND_INVSRCALPHA,True,False)
		   Next
	    Else
	        '  Render the balls in 'burnout' mode
	        For i = 0 To Balls-1
	            iMeshRenderModeSet(BallMesh[i],D3DBLEND_SRCALPHA,D3DBLEND_ONE,False,False)
		   Next
	    EndIf
	    '  Switch render modes on [space] key press
	    If (iKeyClick(DIK_SPACE)) Then Rendermode = Not RenderMode ' If 0 turns 1, If 1 turns 0
	    iPrintCentered("PRESS [SPACE] TO SWITCH RENDERING MODE".ToCString(),_D3DXVECTOR2(0.0,10.0),_D3DXVECTOR2(0.4,0.35),0.1,FontWhite,0.0)
	EndMethod
EndType


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

ya baby... yaaaa.(Posted 2005-09-17)
things are cruising way better than expected. Pub._3Impact is complete and i am already converting samples. the first is available as an EXE at:

AlphaTexture 3Impact sample

all you need to do is extract the EXE into your 3Impact4/3ImpactWork folder and run it. enjoy :) as with the Irrlicht wrapper, as soon as i get done converting the samples i will release the mod. this is so i can catch as many bugs as possible before initial release.

the code for the first sample (so you can compare to the .cpp version you already have) is as follows:

' Alpha texture demo

' THIS SOURCE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. USE AT YOUR OWN RISK.

Strict

Framework Pub._3Impact

Global Camera:Byte Ptr
Global LoadingMessage:Byte Ptr
Global SkyBox:Byte Ptr
Global Terrain:Byte Ptr
Global TerrainMesh:Byte Ptr
Global RedBall:Byte Ptr
Global GreenBall:Byte Ptr
Global RedBallMesh:Byte Ptr
Global RedBallMeshShadow:Byte Ptr
Global GreenBallMesh:Byte Ptr
Global GreenBallMeshShadow:Byte Ptr
Global RedBallTerrain:Byte Ptr
Global GreenBallTerrain:Byte Ptr
Global RedBallGreenBall:Byte Ptr

Global rendermode:Int

Global FontWhite:Byte Ptr

i3ImpactOpen()

Local settings:ISETTINGS=New ISETTINGS
settings.dwMode=1024*768*32
settings.bFullScreen=False
settings.bDoNotShow=True

i3ImpactSettings(settings.param())

Local engine:sample_3IEngine=New sample_3IEngine

engine.BeginRenderingLoop()

Type sample_3IEngine Extends _3IEngine

	Method _Init()
	   Camera=iCameraCreate(0.0,0.0,1.0,1.0)
	   iCameraLocationSet(Camera,_D3DXVECTOR3(0.0,1.0,-10.0))
	
	   FontWhite=iFontCreate("default_res\\fontwhite\\font.wid".ToCString(),Null)
	
	   iLightDirectionalSet(_D3DXVECTOR3(1.0,-1.0,1.0),_D3DXVECTOR4(1.0,1.0,1.0,0.35))
	   iShadowColorSet(_D3DXVECTOR3(0.9,0.9,0.7))
	
	   LoadingMessage=iSpriteCreate("default_res\\sprites\\loading.x".ToCString(),Null)
	   iSpriteRender(LoadingMessage,False)
	
	   SkyBox=iSkyBoxCreate("default_res\\skyboxes\\skybox01.sky".ToCString())
	
	   Terrain=iBodyCreate("default_res\\terrain_5.00.ply".ToCString())
	   TerrainMesh=iBodyMeshCreate("default_res\\terrain.x".ToCString(),Terrain)
	
	   ' create red ball body
	   RedBall=iBodySGCreate("default_res\\ball_.spg".ToCString(),0.13)
	   ' create red ball meshes And attach them To red ball body
	   RedBallMesh=iBodyMeshCreate("default_res\\ballred.x".ToCString(),RedBall)
	   RedBallMeshShadow=iMeshBodyShadowCasterCreate("default_res\\ball_shadow.x".ToCString(),RedBall,25.0)
	   ' change red ball alpha texture
	   iMeshAlphaTextureChange(RedBallMesh,"default_res\\alpha_a.jpg")
	
	   ' create green ball body
	   GreenBall=iBodySGCreate("default_res\\ball_.spg".ToCString(),0.13)
	   ' create green ball meshes And attach them To green ball body
	   GreenBallMesh=iBodyMeshCreate("default_res\\ballgreen.x".ToCString(),GreenBall)
	   GreenBallMeshShadow=iMeshBodyShadowCasterCreate("default_res\\ball_shadow.x".ToCString(),GreenBall,25.0)
	   ' change green ball alpha texture
	   iMeshAlphaTextureChange(GreenBallMesh,"default_res\\alpha_a.jpg")
	
	   ' NOTE: redball.x And greenball.x meshes have been modeled with a Double surface.
	   ' That is, both the outside And the inside of the balls are visible. This is
	   ' evident when we apply the transparent (alpha_a.jpg) texture To them.
	
	   ' set red ball body initial location
	   iBodyLocationSet(RedBall,_D3DXVECTOR3(0.0,5.0,0.0),True)
	   iBodyDampingSet(RedBall,0.0,0.999,0.0,0.995)
	   ' set green ball body initial location
	   iBodyLocationSet(GreenBall,_D3DXVECTOR3(4.0,1.2,-5.0),True)
	   iBodyDampingSet(GreenBall,0.0,0.999,0.0,0.995)
	
	   ' enable collisions
	   RedBallTerrain=iBodyBodyCreate(RedBall,Terrain)
	   iBodyBodyFrictionSet(RedBallTerrain,10.0)
	   GreenBallTerrain=iBodyBodyCreate(GreenBall,Terrain)
	   iBodyBodyFrictionSet(GreenBallTerrain,10.0)
	   RedBallGreenBall=iBodyBodyCreate(RedBall,GreenBall)
	   iBodyBodyFrictionSet(RedBallGreenBall,1.0)
	
	   ' set initial render mode To 0
	   Rendermode = 0
	
	   ' enable bodies
	   iBodyEnable(Terrain)
	   iBodyEnable(RedBall)
	   iBodyEnable(GreenBall)
	
	   ' hide message And show all meshes
	   iSpriteHide(LoadingMessage)
	   iSkyBoxShow(SkyBox)
	   iMeshShow(TerrainMesh)
	   iMeshShow(RedBallMesh)
	   iMeshShow(RedBallMeshShadow)
	   iMeshShow(GreenBallMesh)
	   iMeshShow(GreenBallMeshShadow)

	EndMethod

	Method _Run()
	   Local cameratarget:D3DXVECTOR3=New D3DXVECTOR3
	   iBodyLocationCM(RedBall,cameratarget.param())
	   iCameraLookAt(Camera,cameratarget.param(),0.1)
	
	   Local acceleration:D3DXVECTOR3=New D3DXVECTOR3
	   Local cameraorientation:D3DXQUATERNION=New D3DXQUATERNION
	
	   acceleration.x=0
	   acceleration.y=0
	   acceleration.z=0
	
	   If (iKeyDown(DIK_LEFT)) acceleration.PlusEq(D3DXVECTOR3.create(-10.0,0.0,0.0))
	   If (iKeyDown(DIK_RIGHT)) acceleration.PlusEq(D3DXVECTOR3.create(10.0,0.0,0.0))
	   If (iKeyDown(DIK_UP)) acceleration.PlusEq(D3DXVECTOR3.create(0.0,0.0,10.0))
	   If (iKeyDown(DIK_DOWN)) acceleration.PlusEq(D3DXVECTOR3.create(0.0,0.0,-10.0))
	
	   iCameraOrientation(Camera,cameraorientation.param())
	   iVectorRotate(acceleration.param(),acceleration.param(),cameraorientation.param())
	
	   acceleration.y = 0.0
	
	   iBodyAccelerationApply(RedBall,acceleration.param())
	
	   If Not iKeyDown(DIK_LCONTROL)
		iBodyAccelerationApply(RedBall,_D3DXVECTOR3(0.0,-9.80665,0.0))
	   Else 
		iBodyAccelerationApply(RedBall,_D3DXVECTOR3(0.0,9.80665,0.0))
        EndIf
	
	   iBodyAccelerationApply(GreenBall,_D3DXVECTOR3(0.0,-9.80665,0.0))
	
	   ' Set the rendering priority For the two ball meshes depending on their
	   ' distance from the camera, so that the farther ball is rendered first.
	
	   ' define some temporary vectors
	   Local cameralocation:D3DXVECTOR3=New D3DXVECTOR3
	   Local redlocation:D3DXVECTOR3=New D3DXVECTOR3
	   Local greenlocation:D3DXVECTOR3=New D3DXVECTOR3

	   ' And store current camera And ball locations in them
	   iCameraLocation(Camera,cameralocation.param())
	   iMeshLocation(RedBallMesh,redlocation.param())
	   iMeshLocation(GreenBallMesh,greenlocation.param())
	
	   ' compare the [squared] lengths of vector from camera To red ball And
	   ' from camera To green ball. Note that &(redlocation-cameralocation)
	   ' is an expression that calculates the vector from one point To another
	   ' And resolves To a pointer To a temporary variable allocated somewhere
	   ' by the compiler. It is basically an advanced C++ trick... ;-)
	   If (iVectorLengthSq(redlocation.Minus(cameralocation).param()) > iVectorLengthSq(greenlocation.Minus(cameralocation).param()))
	      ' red ball is farther
	      iPrintCentered("Red ball is farther: rendered first".ToCString(),_D3DXVECTOR2(0.0,11.0),_D3DXVECTOR2(1.0,0.5),0.1,FontWhite,0.0)
	      iMeshRenderPrioritySet(RedBallMesh,1) ' render this mesh...
	      iMeshRenderPrioritySet(GreenBallMesh,2) ' ...before this mesh
	   Else
	      ' green ball is farther
	      iPrintCentered("Green ball is farther: rendered first".ToCString(),_D3DXVECTOR2(0.0,11.0),_D3DXVECTOR2(1.0,0.5),0.1,FontWhite,0.0)
	      iMeshRenderPrioritySet(RedBallMesh,2) ' render this mesh...
	      iMeshRenderPrioritySet(GreenBallMesh,1) ' ...after this mesh
	   EndIf
	
	   ' Select render mode For the balls according To current Rendermode variable state
	   If (Rendermode = 0)
	      ' render the balls in normal mode
	      iMeshRenderModeSet(RedBallMesh,D3DBLEND_SRCALPHA,D3DBLEND_INVSRCALPHA,True,False)
	      iMeshRenderModeSet(GreenBallMesh,D3DBLEND_SRCALPHA,D3DBLEND_INVSRCALPHA,True,False)
	   Else
	      ' render the balls in 'burnout' mode
	      iMeshRenderModeSet(RedBallMesh,D3DBLEND_SRCALPHA,D3DBLEND_ONE,False,False)
	      iMeshRenderModeSet(GreenBallMesh,D3DBLEND_SRCALPHA,D3DBLEND_ONE,False,False)
	   EndIf
	
	   ' switch render modes on [space] key press
	   If (iKeyClick(DIK_SPACE)) Then Rendermode = Not RenderMode ' If 0 turns 1, If 1 turns 0
	   iPrintCentered("PRESS [SPACE] TO SWITCH RENDERING MODE".ToCString(),_D3DXVECTOR2(0.0,10.0),_D3DXVECTOR2(0.4,0.35),0.1,FontWhite,0.0)
	EndMethod

EndType



G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

status(Posted 2005-09-16)
for those following along, i started at the top and am down to the SOUND section of the API. progressing along very quickly although it is painfully obvious that the BMAX croud would benefit from some simple wrapping of the functions. i am strictly defining the interface with Pub._3Impact. i may write a gg._3Impact to help out a bit but im not sure...


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

as if i didnt have enough on my plate already(Posted 2005-09-15)
i had just completed both my project at work and the site prep for my new garage and 3Impact had to go and release their DLL which allows BlitzMax to use it. so here i go again with the interface writing :\ i would say i am around 33% complete right now. theres something like 500+ functions to write extern statements for so its going to take me a few days. the weekend is coming up and at this pace i should have it done by the time the weekend is up. as i did with the Irrlicht wrapper, i will then set out to convert the demo apps and bug fix along the way. since 3Impact is commercial i will _not_ distribute anything provided by 3Impact (ie .x demo files, header files, .a files, etc).


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

bah!(Posted 2005-09-06)
have a major deadline at work and in addition i am prepping my building site for my new garage. it will be about 2 weeks before i can get back to things.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

making progress(Posted 2005-08-30)
i overcame a bug that has had me at a standstill on the port for several days. yay! the bug mixed with the release of Irrlicht v0.12 has caused a big delay in the port.

just wanted to say im still working on it for those looking for an update. when i have a better idea on an alpha date i will post it here. unless i magically find some time i would say im at least 3 weeks out on any alpha.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht v0.12 compatible mods(Posted 2005-08-25)
havent got the examples recompiled yet, but here are the mods:

2005_08_26 gg Mods for Irrlicht v0.12

and the .a and .dll files.

IrrDX_v0_12.zip

all samples have been rebuilt to support v0.12 features and DLL. the one to be sure to check out is the terrain sample. there were only minor changes in a few others so getting them all is really not required.

01.HelloWorld & 02.Quake3Map

03.CustomSceneNode

04.Movement & 05.UserInterface

06.2DGraphics & 07.Collision

09.MeshViewer

10.Shaders

08.SpecialFX & 11.PerPixelLighting

12.TerrainRendering

13.RenderToTexture

14.Win32Window

non-distribution samples

SplitScreen

also, a few instructions for installing the lib and dll files:

if you download the Irrlicht distro then (looks like the directory names have changed a bit):

copy lib\Win32-gcc\libIrrlicht.a to your BMAX\lib folder
copy bin\Win32-gcc\Irrlicht.dll to your windows\system32 folder

if you download my lib distro then inside of IrrDX_v0_12.zip you should find 4 files:

D3DX81ab.dll
D3DX92ab.dll
Irrlicht.dll
libIrrlicht.a

place libIrrlicht.a into your BMAX\lib folder. put the .dll files in your windows system32 folder.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht v0.11 compatible mods(Posted 2005-08-12)
due to circumstance i built the new .a and .dll files so i went ahead and updated the current mods to v0.11 of Irrlicht.

2005_08_12 gg Mods for Irrlicht v0.11

in conjunction, you also need the new .a and .dll files.

IrrDX_v0_11.zip

remember... always back-up your work! enjoy :)


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

The Replacement Classes(Posted 2005-08-10)
porting was going better than expected but there was a looming issue in the back of my mind. i was essentially creating an extremely large and untested module from an extremely large, tested engine. i had been trying to think of what to do about that and i finally came up with a solution. the good news is i should get out a working module much faster and it should meet most of my original goals of the port. the only issue is that it will not be a full port yet. i worked out a way that i can seamlessly replace any C++ class in Irrlicht with a BMAX type using a design similar to how i bound types to classes for the original Irrlicht mod. this allows me to just replace what is needed to make it crossplatform/BMAX (ie. I/O classes and video driver classes) while keeping a majority of the already tested C++ code that is currently fine in all environments. in addition, i can replace C++ classes as i go with the goal of this mod being to end up with all C++ classes replaced. a few cool things about this...

a) i can use all the classes i have already ported when the time is right so im not just throwing away all i have done so far.
b) i can test as i go. replace a class and test the new BMAX code versus the old C++ code.
c) when all classes have been replaced, i can use the types i created for this mod for the final full-port mod
d) this will be a direct modification of gg.Irrlicht and will be fully compatible with gg.IrrBMAX. so hopefully all you need to do is a recompile.

so thats it. no time estimate yet, but the amount of classes i have to port to get something working directly from BMAX has dropped significantly.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht port status(Posted 2005-07-27)
updated - 2005/8/10 - ON HOLD... KINDA. SEE ABOVE POST.

Implementation classes:
core - 100% (interface is implementation with core)
io - 90% (all done except the XML stuff. XML is not essential and will be close to last as will any file readers using XML like Collada.)
irr - 50%
gui - 0%
scene - 0%
video - 10%

Interface classes:
core - 100% (i did not do all of them, but what i have done are the biggies and that is all im going to do)
io - 100%
irr - 100%
gui - 100%
scene - 100%
video - 100%


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht port info(Posted 2005-07-27)
since ive had quite a few inquiries let me try to give a little more info...

INFO: currently the port is slated as mod gg.IrrConv but i believe that will change. as soon as the port is done im going to break it out into the individual namespaces so that individual components can be used. this means that things like the IO namespace can be used in any project on its own without the need to include the entire Irrlicht mod set. also, each namespace will be broken into interface and implementation. this means that if you want, you can substitute your own version of something like the IO types by importing the IO interface and creating your own types.

GFX DRIVERS: initially i plan to support OpenGL. after that, i will make a good attempt at the DX stuff. if anything, i will keep the DX stuff wrapped and write an interaction layer that will allow BMAX to use the C++ DX classes. the ultimate goal is to have all drivers that Irrlicht has including the software driver.

DIFFERENCES: like the wrapper, im going to try to keep as true to Irrlicht as possible. also, converting from the wrapper to the port should be fairly painless. the major naming convention change will be that the T_irr prefix will be just T. another big change is that im going to try to enhance the factory capability a bit to help in customizing of things like scenenodes. this new functionality will be there, but it will not be required to use. last, any classes where there was a reasonable counterpart in BMAX i have converted to use that. ie. the arrays containing structs and classes in Irrlicht were essentially BMAX TList object.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Is all quiet?(Posted 2005-07-25)
while i have not yet updated the current wrappers to v0.11 (and depending on how things go i may not), i am still working with Irrlicht... i am working on a full BMAX port of the Irrlicht engine. this means hopefully everything (may exclude the DX stuff for now) will be native BMAX code and perfectly portable to all OS without the need to link any libs or provide any DLLs. i have no idea how its going to turn out performance-wise so lets hope for the best :)

STATUS: the Interface (all IClassname classes), structs, and core classes have been completely ported and i have started porting the actual implementation classes. no telling when i will be done (i would guess at least a month out), but i will do my best to update here as i get to certain milestones.

WHY!?!? - well... without binding (see below for info on binding) every single class, i felt the wrap just didnt give the flexiblity that i felt Irrlicht in BMAX needed to really take off (mac support and other misc things too). if at some point i deem the conversion not worth it, i will convert the wrapper to the current version of Irrlicht at that time and begin binding all classes.

NOTE TO ALL IRRLICHT WRAPPER USERS: i would like feedback on your experience so far. what do you like and not like? is it giving you what you need or is there more that can be done? thoughts? feel free to email me directly with any thoughts or comments.

thx.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht and Linux(Posted 2005-06-16)
thanks to the hard work of Budman and jamesmintram we now have a working version of Irrlicht for BMAX linux. if the regular distribution .a file does not work, you can try the special one Budman made.

Irrlicht Linux lib

the win/linux compatible mods can be downloaded here:

2005_06_16 gg Mods for Irrlicht v0.10

please note the samples have not been rebuilt since little changes for the win32 version. the included binaries are win32 compiles so you will need to recompile the mod after you extract it.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Important Note: Compiling(Posted 2005-06-03)
by default BlitzMax includes all modules when you build an application. that means if you have the Irrlicht mods installed when you build an application and you are not using Irrlicht, the client still has to have the Irrlicht DLL. to avoid this you have 2 options:

a) use the Framework command. this is the preferred choice since doing so will cut out all fluff from your EXE.

b) move the gg.mod folder somewhere else and only keep it in blitzmax\mod while you are building Irrlicht projects.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg Mods release 2005_06_01(Posted 2005-06-01)
there is a new release of the mods and this will be the final one until a new version of Irrlicht is released or if a major bug is found:

2005_06_01 gg Mods for Irrlicht v0.10

sample 13 is also done and shows rendering to a texture:

sample_13.zip

i cant do sample 14 (which shows rendering to a window that isnt created by Irrlicht) until the GUI mod is released.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht Development Status(Posted 2005-06-01)
ive read a few grumblings about Irrlicht being buggy and thought id put something here to help (i hope). its only v0.10, still under development, and despite already being used by projects it has never been released as a "production" release... so bugs should hopefully not come as a surprise. i think folks expecting it to be bug free is a testament to the developer of Irrlicht. after seeing what it can do, expectations are obviously high. to help people understand where the development of Irrlicht is at, here is the link to the development status of the Irrlicht project:

Irrlicht Development Status


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg.Mod release 2005_05_29(Posted 2005-05-29)
Update: 2005_06_01 - all the original samples have been rebuilt for Irrlicht v0.10. all are the same except 8 and 11. Be sure to definately check out 11 since it shows off the new parallax mapping.

Irrlicht v0.10 compatible mods are now available:

gg Mods for Irrlicht v0.10

im currently working on getting the current samples rebuilt and the new samples created. also, as with each new Irrlicht version, there is a new DX compatible download (again a big thx to Budman):

IrrDX_v0_10.zip


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Irrlicht v0.10(Posted 2005-05-26)
my apologies for being silent of late. the house thats been a thorn in my side (and my wallet) for the last 2 years has finally sold and is closing tomorrow (yay!). it was on an accelerated closing schedule so ive been cramming the last 2 weeks to get it ready... spending 6 vacations days on the dang thing. bah! life is gonna be good tomorrow :) anyways...

v0.10 of Irrlicht has been released. all effort will move from gg.IrrB3D to recompiling the mods with v0.10 and converting the new samples.

also, a huge thank-you to Budman for his fantastic work with getting Irrlicht to work with legally distributable runtime DX DLLs. v8 and v9 DX support for Irrlicht with a legal distribution would not have been possible without his "above and beyond" assistance.

i should have a new build of the mods for Irrlicht v0.10 and a download for the new DX supported distribution by sometime monday evening.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg.Mod Release(Posted 2005-05-04)
updated:
2005/05/16 - Implemented bound ISceneNodeAnimator. Fixed issues with retrieving different types of mesh vertices.
2005/05/12 - Implemented ITextSceneNode,IGPUProgrammingServices,IMaterialRendererServices,IShaderConstantSetCallBack
2005/05/10 - changed KEY_ constants to EKEY_

here we go:

gg Mods for Irrlicht

extract the above zip to your BMAX mods folder. it should create a directory called gg.mod inside of your mods folder. if you didnt extract it right, you will end up with gg.mod/gg.mod. if you have problems building make sure you check this.

to begin working with Irrlicht in BMAX you will need at least the Irrlicht v.09 distribution in order to build. place the .a files from the lib\devcpp folder in your BMAX libs folder before you try to build. if you want DX support you will need the DX download from the samples worklog entry. place the .a from that distribution into the libs folder of BMAX. also, if you are running windows you need to place the correct Irrlicht.dll file in your windows\system32 folder. if you are using the Irrlicht distribution file, be sure to use the DLL from the DevCPP folder.

NOTE: you must match the .a file to the corrosponding DLL. if you use the .a from my DX distribution you must use the DLL that is in there as well. if you use the .a from the Irrlicht distribution you must use the DevCPP DLL from that distribution.

Another NOTE: i kept my mod-specific build BAT files in the mod ZIP. i will be removing those from now on as they are pretty specific to my development setup and i dont want to confuse people when running them doesnt work. unless you change any of the files in the mods there should be no need to rebuild them since the compiled mod files are in the distribution.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg.IrrBMAX Design Info(Posted 2005-05-04)
gg.IrrBMAX
----------------------

- description

gg.IrrBMAX is a BMAX type wrap of the Irrlicht 3D engine utilizing the functions exposed by gg.Irrlicht. each wrap function should corrospond with a method in a BMAX type. care was taken to make the BMAX types as similar to their C++ counterpart as possible. ideally, you can find information about a certain type or type method simply by looking it up in the Irrlicht manual. using the types should be very similar to working with the C++ classes. this makes understanding examples written in C++ easy.

- folder convention

each namespace in Irrlicht has its own folder in gg.IrrBMAX. these folders contain the type wrapper files for the classes in the given namespace. the lone exception is the "bound" directory. this directory houses any bound type (see binding) that also has an unbound type.

- file convention

each Irrlicht class file has a corrosponding type .bmx file. the name of the file directly reflects the name of the type inside. for example, the type wrap for Irrlicht class ITexture will be in a file called itexture.bmx.

- naming convention

type names are the same as their C++ counterpart but with the prefix T_irr. i named them this way to help guarantee uniqueness among the other modules in case the BMAX developer chooses to not use the Framework command. so for example, ITexture in C++ becomes T_irrITexture in BMAX. all methods should be named the same as the C++ class methods with the exception of methods that are overloaded. due to BMAX not allowing method overloading these have been broken out into multiple methods in the BMAX types. i tried to name these something that corrosponded with the parameters being passed in. for example, if vector3df had 2 methods called set(), one with 3 integer parameters and another with a vector3df parameter, i would call the 2 methods in BMAX setFromVals() and setFromVect().

- base types

there are 2 base types in gg.IrrBMAX, bound and unbound. each type contains 2 subtypes, managed and unmanaged. managed types are maintained for the most part by the Irrlicht 3D engine. an instance extended from a managed type can be set to Null but it will still be there because Irrlicht still has a reference to it. any type based on T_irrIUnknown will be managed. unmanaged types are usually used as parameters or type fields such as vectors or dimensions. managed types are components of Irrlicht that are added to the Irrlicht system such as meshes, scenenodes, and images. Irrlicht stores pointers to these components and manages them.

- create vs new

since there are no parametertized New() methods in BMAX, all instances of types are created using that types "create" functions. you should _not_ use the keyword "New" to create BMAX type instances. for many types, there are multiple create functions. all create and return an instance of the type, but each accepts different parameters. for example, to create an instance of T_irrVector3df you could:

Local temp:T_irrVector3df=T_irrVector3df.createFromVals(1,2,3)
or
Local temp:T_irrVector3df=T_irrVector3df.createFromVect(vect2)

- pointers to C++ class instances

each instance of a BMAX type contains a pointer to an instance of an Irrlicht C++ class. this pointer is used to call the methods and access the properties of the instance. for the most part, pointers are maintained behind the scenes by the BMAX types. each type has a method called createFromHandle(). this method creates a new instance of the type and attaches a pointer to a C++ class to it. there are 2 parameters, the first being the pointer and the second is a logical telling the type whether it needs to manage the pointer or not. if you need to manually create type instances based on a C++ instance pointer, this is the function to use.

- extending types

most types in gg.IrrBMAX are types that wrap a C++ class and thus are set to "Final", disallowing extending of the type. this decision was made to avoid confusion. for example, if you extended T_irrISceneNode, overrode a few methods, and then passed that on to the Irrlicht engine, you might expect your extended code to run but it will not. the only time this will work is using bound types (see binding). there are some unbound types without the "Final" but these are types that have other unbound types extending from them. the only types that are truly extendable for use by both the Irrlicht engine and your code in BMAX are the bound types.

- binding

bound types allow BMAX code to be called by the C++ Irrlicht engine. essentially an instance of a C++ class stores a reference to an instance of a BMAX type. it passes this reference to the bound BMAX functions so that the appropriate method can be called. bound functions reside inside of the type definition making a bound type self contained. if you wish to manually remove an unmanaged, bound type you must call the Destroy() method. for managed types, this calls the corrosponding drop() method. for unmanaged types, this deletes the corrosponding C++ pointer. be sure that nothing else holds a reference to the unmanaged type when you call its Destroy() method.

- bound type create functions

one of the drawbacks of using a create function to create a type instance is that when you extend a type, you must override any function that performs a "New". worse yet, any function that calls the function performing the new must be overridden because if called from within the base type, the base version is called. some example code that shows this problem is:
Framework BRL.Basic

Type t1
	Function test1()
		test2()
	EndFunction
	
	Function test2()
		DebugLog("t1")
	EndFunction
EndType

Type t2 Extends t1
	Function test2()
		DebugLog("t2")
	EndFunction
EndType

t2.test1()

in the above example, you might expect "t2" to be displayed, but not so. even though you overrode test2(), since test2() is being called from a function you didnt override, the t1 version is called. to get around this, i implemented the generate() function. each time you extend a bound type, you must override the generate function and return an instance of the new type, but it needs to be cast to the base type. this generate function is then used as the first parameter to all the create functions. to implement this methodology in the above sample:
Framework BRL.Basic

Type t1
	Function test1(pTest2())
		pTest2()
	EndFunction
	
	Function test2()
		DebugLog("t1")
	EndFunction
EndType

Type t2 Extends t1
	Function test2()
		DebugLog("t2")
	EndFunction
EndType

t2.test1(t2.test2)

for a gg.IrrBMAX example, see any sample using an event reciever or the custom scene node example.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg.Irrlicht Design Info(Posted 2005-05-03)
gg.Irrlicht
----------------------

- description

gg.Irrlicht is a functional wrap of the Irrlicht 3D engine. all possible methods of nearly all Irrlicht classes are wrapped by extern defined C functions. these functions accept a pointer to an instance of an Irrlicht class along with all parameters and then calls the appropriate method.

- folder convention

each namespace in Irrlicht has its own folder in gg.Irrlicht. these folders contain the wrapper files for the classes in the given namespace. the lone exception is the "bound" directory. this directory houses any bound class (see binding) that also has an unbound functional wrap.

- file convention

each Irrlicht class wrap is broken into 2 files. a _wrap.h file that defines the wrapper C functions and a _wrap.bmx file that exposes those functions publicly to BMAX. the name of the file directly corrosponds with the name of the Irrlicht class so for example, ITexture has 2 files called itexture_wrap.h and itexture_wrap.bmx

- naming convention

the exposed function names follow the format IrrNamespace_Class_method where namespace, class, and method all depend on the class being wrapped and what namespace it falls under. for the most part, all functions are named precisely, but there is an exception. since there are no overloaded methods in BMAX, each overloaded version of a method must be a seperate function. i tried to name these something that corrosponded with the parameters being passed in. for example, if vector3df had 2 constructors, one with 3 integer parameters and another with a vector3df parameter, i would call the 2 constructors _newFromVals() and _newFromVect(). constructor functions use _new() for the method name.

- enumerations

all enumerations in Irrlicht have been broken out into their own files. these files are housed in the appropriate namespace directory and are included publicly in gg.Irrlicht. the name of the enumeration has stayed the same, but without the enumeration prefix. the enumeration prefix is used as the name of the file.

- binding

there are some C++ classes that are able to be "bound" to a BMX type. these classes are a subclass of an Irrlicht C++ class and essentially map each method to a corrosponding function in BMAX using function pointers. these classes also store an instance of a BMX type to a property. this allows the BMX instance of the type to fall out of scope or be set to null without breaking the binding. when a bound function is invoked in BMX, it uses this binding to call the appropriate code for the BMX type instance. this allows the C++ code to call code written in BMAX as if it were in C++ (see sample 03.CustomSceneNode).

NOTE: gg.IrrBMAX wraps the bindings up so that you wont have to deal with them manually. you essentially extend a bound type and override the methods as you would have in C++.

- differences

1) all interaction between BMAX and the C++ wrapper functions use pointers for anything other than base variable types. the pointers passed in must be managed by the caller if needed. for example, if the caller creates a pointer to an instance of SColor using the SColor_new() function, they must be sure to call the SColor_del() function to delete the pointer when they are done. all classes that are not based on IUnknown have a corrosponding _del() function to allow deletion of the created pointer and a _new() function to create a new instance and return a pointer. the C wrapper functions handle all needed conversions for the pointer parameters to the original parameters.

NOTE: the unbound Types in gg.IrrBMAX handle _del() and _drop() pointer management automatically.

2) array parameters or return values that were straight arrays have been converted to use the Irrlicht array<T> template class. the C wrapper functions handle all needed conversions.

3) anything that returned a const reference to a variable returns a new instance pointer to disallow any changes to the original.

4) there are several wrapped versions of array<T> classes to try to handle pretty much anything you might need.

5) most properties requiring direct access have been exposed using functions. these functions usually start with get and set and are combined with the property name. so if there was a property defined called Box, the corrosponding get/set methods would be _getBox() and _setBox().

6) the lock() methods of IImage and ITexture have been expanded to lock16(), lock32(), and lock8(). based on your image data type, use the proper one to directly modify the information.

7) operator overloads have been converted into functions.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Samples(Posted 2005-04-27)
updated:
2005/05/16 - split screen sample is done
2005/05/12 - sample 10 is done
2005/05/02 - sample 03 is done
2005/04/29 - sample 12 is done
2005/04/28 - sample 09 is done

im busy converting the samples and finishing up the Mods in the process. after a long struggle trying to come up with a method of binding BMX classes to C classes that i liked, i finally am satisfied. this should allow me to finish up the remaining classes. for all examples you will need the first DX download. put all DLLs into your System32 folder. you can overwrite the Irrlicht.dll but i would not overwrite the D3D* DLLs if they are already there (unless you have problems running).

the DX compatible Irrlicht DLL:

IrrDX_v09.DLL

below are the converted samples:

01.HelloWorld & 02.Quake3Map

03.CustomSceneNode

04.Movement & 05.UserInterface

06.2DGraphics & 07.Collision

09.MeshViewer

10.Shaders

08.SpecialFX & 11.PerPixelLighting

12.TerrainRendering

- all Irrlicht distribution samples converted!

non-distribution samples

SplitScreen


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg.IrrBMAX(Posted 2005-04-13)
updated:
2005/04/15 - mod complete and ready for testing

gg.IrrBMAX wraps the functions exposed by gg.Irrlicht into BMAX types that replicate the structure and use of the classes and structures found in Irrlicht. there will be some limitations, but the goal is to be able to develop applications utilizing Irrlicht in BMAX in much the same way you would in C++. code examples written in C++ should be converted with minimal effort to BMAX. since the classes and structures of Irrlicht are mimicked, i did not document the types since finding what a method does is a simple matter of looking the class/structure up in the Irrlicht manual.

(the % below are in relation to the amount of classes wrapped by gg.Irrlicht)
namespace:

- irr: 100% complete.

- irr::core: 100% complete.

- irr::io: 100% complete.

- irr::gui: 100% complete.

- irr::video: 100% complete.

- irr::scene: 100% complete.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

gg.Irrlicht(Posted 2005-04-13)
updated:
2005/05/12 - Implemented ITextSceneNode, IGPUProgrammingServices, IMaterialRendererServices, IShaderConstantSetCallBack
2005/05/03 - think i figured out the lock() methods of IImage and ITexture... will definately need to be tested. IAnimationEndCallBack is finished.
2005/05/02 - a subclass of ISceneNode has been bound to BMAX type BMXISceneNode. this allows subclassing of ISceneNode inside of BMAX and the BMAX code will be called by the C++ code. more classes will be bound this way, but not right now since it takes about 3x as longer to bind a class. im going to concentrate on the few classes i dont have done yet and get this baby out the door.
2005/04/27 - IEventReceiver has been wrapped and continuing sample conversion.
2005/04/19 - restructuring is complete and i have started converting the samples.
2005/04/18 - i found out friday when i got home my wife decided it was time to get a dog. there went my weekend. hopefully i will get some free time today and in the coming days to get this done.
2005/04/15 - im going to rework a bit of the design, changing my import statements to include. i will then go through my code and list any areas that i feel need particularly tested or i had issues with. This should take up my evening and i would estimate that tomorrow i can begin converting the samples.

gg.Irrlicht wraps the methods and exposed properties of most of the Irrlicht classes and structures into C functions and then exposes them to BMAX via Extern. any classes dealing with callbacks are not yet wrapped, but will be by the time i release it to the public. also, any methods that deal with locking of image data (ie IImage.lock() and ITexture.lock()) i will need help with. im not sure what type of data i am dealing with.

namespace:

- irr: 100% complete.

- irr::core: 100% complete. all classes have been wrapped with the exception of list which i will not be wrapping. i substituted any uses of list with array<T>. i have made many wraps for array<T> classes that are not listed in the manual but used by other classes.

- irr::io: 100% complete.

- irr::gui: 100% complete.

- irr::video: 90% complete. 2 advanced classes not needed for the working of the system are not done yet. they are: IImageLoader and IMaterialRenderer. once i work out callbacks when i convert the GUI example i hope to get a couple more of these wrapped. even though a few are not callback related, im going to use the same logic to implement them.

- irr:scene: 98% complete. IMeshLoader yet to go.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies

Initial Info(Posted 2005-04-13)
i will update soon with a full status of where im at, but i will tell you i am working around 5 hours a day on it and ahead of schedule. im starting this log with an informational comment i previously made in a forum entry.

--------
the Irrlicht wrapper wrap consists of 2 BMAX mods. the first (gg.Irrlicht) is a combination of .C wrap files that wrap all the methods of the Irrlicht classes/structures into C functions and .BMX files that publicly expose those C functions via extern statements. the second mod (gg.IrrBMAX) contains BMAX types that utilize the functions exposed by gg.Irrlicht. the types in gg.IrrBMAX are structured to near-faithfully represent the Irrlicht classes both in form and use. both mods will be compilable in Windows and Linux (there is no Mac port yet for Irrlicht that i know of). Irrlicht itself does have a DLL that must be installed with it (for windows)... and something i assume for linux as well. im not up on linux so i will need to rely on someone else to compile and test that for me.


G-Squared Games | Forum for My BlitzMax Irrlicht mods & Other Freebies