Sign in to follow this  
Followers 0

Au3Irrlicht 2.0

440 posts in this topic

Posted (edited)

A.Percy built the first Au3Irrlicht by writing an AutoIt plugin wrapper around the object oriented 3D library called Irrlicht. He quickly encountered difficulties in handling arrays and other structures from the AutoIt side of things, which restricted the flexibility of the library. Since then, I've been looking for a solution that would allow us to utilize all the functionality of Irrlicht, without the restrictions imposed by plugins.

This is the result. Since 2006, Frank Dodd of the Freebasic community has been writing an Irrlicht wrapper for imperative languages. It started similar to Au3Irrlicht, but has one advantage - instead of plugin functions, we can use DllCall. That translates into unrestricted access of Irrlicht for AutoIt. There are 299 functions, and for the last several weeks I've been wrapping each with a DllCall for use by AutoIt.

Features Overview:

  • Mesh/Node: General Animation (bone based and mesh morphing), child/parent tree manipulation, Special animator types (circle, spline, flystraight)
  • Scene: Node management, Octtree, collision optimization, Save/Load using IrrEdit
  • 2D: Billboards, Sprites, RenderToTexture
  • Terrain: Tiled Terrain manager (paging terrains), Spherical Terrains, configurable LoD and zone manager
  • Environmental effects: Fog, Grass, Wind, Gravity, Water, Clouds, Skyboxes and Skydomes
  • Special Effects: Particles, Emitters, Mesh Emitters, Lens Flare, Advanced shaders, Dynamic lights and shadows
  • GUI: Image, EditBox, ListBox, Window, Text, IrrFonts
As of this release, 291 are wrapped. I will be recommending and/or implementing the unique functionality created by A.Percy for the IrrlichtWrapper.

Huge Thanks to A.Percy and all the rest who've made this possible! They've done amazing work, and I'm glad to have been able to use their work and experience to make this wrapper. This definitely exemplifies the idea of standing on the shoulders of giants. Thanks guys!

Download the code and examples here: http://code.google.com/p/au3irrlicht2/downloads/list

Let me know if you want to contribute and I will assign you as a contributor to the code project. Much thanks to Linus for his contributions and drive!

Edited by JRowe

Share this post


Link to post
Share on other sites



Posted (edited)

Add these examples to the same directory as the dlls and include.

Spaced at top and bottom so you can copy directly (don't have to use the popup if you don't want to.)

Hello World:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

_IrrStart($IRR_EDT_OPENGL, 600, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON)
_IrrSetWindowCaption("Example 01: Hello World")
_IrrAddStaticText("Hello World", 40, 10, 200, 26, $IRR_GUI_BORDER, $IRR_GUI_NO_WRAP, 0)

While _IrrRunning()
	_IrrBeginScene(200,200,200)
	_IrrDrawGUI()
	_IrrEndScene()
Wend

2D Images:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

$screen_width = 400
$screen_height = 200
_IrrStart($IRR_EDT_OPENGL, $screen_width, $screen_height, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption("Example 02: 2D Images")

$IrrlichtLogo = _IrrGetTexture( "./media/irrlichtlogo.bmp" )
$FreeBasicLogo = _IrrGetTexture( "./media/freebasiclogo.bmp" )
$FBIDELogo = _IrrGetTexture( "./media/fbidelogo.bmp" )
$CodeBlocksLogo = _IrrGetTexture( "./media/codeblockslogo.bmp" )
$WrapperLogo = _IrrGetTexture( "./media/wrapperby.tga" )

_IrrColorKeyTexture($FreeBasicLogo, 255, 255, 255 )

WHILE _IrrRunning()
	_IrrBeginScene( 255,255,0 )
	_IrrDraw2DImage($IrrlichtLogo, 4, 4)
	_IrrDraw2DImageElement($FreeBasicLogo, $screen_width-64, 4, 0, 0, 60, 31, $IRR_USE_ALPHA)
	_IrrDraw2DImageElement($FBIDELogo, 4, $screen_height-36, 0, 0, 128, 32, $IRR_IGNORE_ALPHA)
	_IrrDraw2DImageElement($WrapperLogo,($screen_width-110)/2, $screen_height-36, 0, 0, 100, 32, $IRR_USE_ALPHA)
	_IrrDraw2DImageElement($CodeBlocksLogo, $screen_width-114, $screen_height-36, 0,0,110,32, $IRR_IGNORE_ALPHA )
	_IrrEndScene()
WEND

Irrlicht Bitmap Fonts:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

_IrrStart($IRR_EDT_SOFTWARE, 400, 200, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption( "Example 03: Bitmap Fonts" )
$BitmapFont = _IrrGetFont("./media/bitmapfont.bmp")

WHILE _IrrRunning()
	_IrrBeginScene( 0,0,0 )
	_Irr2DFontDraw($BitmapFont, "SIMPLE MONOCHROME FONT", 120, 80, 250, 96)
	_IrrEndScene()
WEND

3D Models - Meshes and Nodes:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

_IrrStart($IRR_EDT_OPENGL, 400, 200, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption("Example 04: 3D Models - Meshes and Nodes")
_IrrAddStaticText("Zumlin model by Rowan 'Sumaleth' Crawford", 4, 0, 200, 16, $IRR_GUI_NO_BORDER, $IRR_GUI_NO_WRAP)
$MD2Mesh = _IrrGetMesh("./media/zumlin.md2")
$MeshTexture = _IrrGetTexture("./media/zumlin.pcx")
$SceneNode = _IrrAddMeshToScene($MD2Mesh)
_IrrSetNodeMaterialTexture($SceneNode, $MeshTexture, 0)
_IrrSetNodeMaterialFlag($SceneNode, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND)
$OurCamera = _IrrAddCamera(50, 0, 0, 0, 0, 0)

WHILE _IrrRunning()
	_IrrBeginScene(240, 255, 255)
	_IrrDrawScene()
	_IrrDrawGUI()
	_IrrEndScene()
WEND

BSP Map and Zip archive:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

_IrrStart($IRR_EDT_OPENGL, 800, 400, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption("Example 05: BSP Map")
_IrrAddZipFile("./media/map-20kdm2.pk3", $IRR_IGNORE_CASE, $IRR_IGNORE_PATHS)
$BSPMesh = _IrrGetMesh("20kdm2.bsp")
$BSPNode = _IrrAddMeshToSceneAsOcttree($BSPMesh)
$Camera = _IrrAddFPSCamera()
$CameraNode = $Camera
_IrrSetNodePosition($CameraNode, 1750, 149, 1369)
_IrrSetNodeRotation($CameraNode, 4, -461.63, 0)
_IrrHideMouse()

WHILE _IrrRunning()
	_IrrBeginScene(240, 255, 255)
	_IrrDrawScene()
	_IrrEndScene()
WEND

Billboard nodes:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

_IrrStart($IRR_EDT_OPENGL, 400, 200, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption("Example 06: Billboards")
$BillboardTexture = _IrrGetTexture("./media/freebasiclogo_big.jpg")
$Billboard = _IrrAddBillBoardToScene(200.0, 102, 0.0, 0.0, 100.0)
_IrrSetNodeMaterialTexture($Billboard, $BillboardTexture, 0)
_IrrSetNodeMaterialFlag($Billboard, $IRR_EMF_LIGHTING, $IRR_OFF)
$Camera = _IrrAddFPSCamera()
;_IrrHideMouse()

WHILE _IrrRunning()
	_IrrBeginScene(240, 255, 255)
	_IrrDrawScene()
	_IrrEndScene()
WEND

Particle system:

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

_IrrStart($IRR_EDT_OPENGL, 200, 200, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption("Example 07: Particle Systems")
$TestNode = _IrrAddTestSceneNode()
$SmokeParticles = _IrrAddParticleSystemToScene($IRR_NO_EMITTER)

$SmokeEmitter = ___CreateParticleEmitter(-7, 0, -7, 7, 1, 7, 0, 0.04, 0, 80, 100, 255, 255, 255, 255, 255, 255, 800, 2000, 15.0, 15.0, 15.0, 15.0, 15)
_IrrAddParticleEmitter($SmokeParticles, $SmokeEmitter)
_IrrAddFadeOutParticleAffector($SmokeParticles, 2000, 16, 8, 0)
_IrrAddGravityParticleAffector($SmokeParticles, 0.05, 0.05, 0.0)
_IrrAddParticleAttractionAffector($SmokeParticles, 10.0, 0.0, 0.0, 20.0, $IRR_REPEL)

;_IrrAddRotationAffector($SmokeParticles, 0.0, -120.0, 0.0, 0.0, 0.0, 0.0)

$ParticleTexture = _IrrGetTexture("./media/ParticleGrey.bmp")

_IrrSetNodeMaterialTexture($SmokeParticles, $ParticleTexture, 0)
_IrrSetNodeMaterialFlag($SmokeParticles, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeMaterialType($SmokeParticles, $IRR_EMT_TRANSPARENT_VERTEX_ALPHA)

$Camera = _IrrAddCamera(100, 40, 0, 0, 40, 0)

WHILE _IrrRunning()
	_IrrBeginScene(0, 0, 0)
	_IrrDrawScene()
	_IrrEndScene()
WEND
Edited by JRowe

Share this post


Link to post
Share on other sites

Posted

Wow! Great job getting everything together into one package. I will definately want to explore this a bit more.

Share this post


Link to post
Share on other sites

Posted

Just by chance, do you think this would support sketchup 3d models?

Share this post


Link to post
Share on other sites

Posted

Irrlicht supports the following mesh types:

Animated objects:

  • B3D files (.b3d, r, skeleton)
  • Microsoft DirectX (.x, r) (binary & text, skeleton)
  • Milkshape (.ms3d, r, skeleton)
  • Quake 3 models (.md3, r, morph)
  • Quake 2 models (.md2, r, morph)
Static objects:

  • Irrlicht scenes (.irr, r/w)
  • Irrlicht static meshes (.irrmesh, r/w)
  • 3D Studio meshes (.3ds, r)
  • Alias Wavefront Maya (.obj, r/w)
  • Lightwave Objects (.lwo, r)
  • COLLADA 1.4 (.xml, .dae, r/w)
  • OGRE meshes (.mesh, r)
  • My3DTools 3 (.my3D, r)
  • Pulsar LMTools (.lmts, r)
  • Quake 3 levels (.bsp, r)
  • DeleD (.dmf, r)
  • FSRad oct (.oct, r)
  • Cartography shop 4 (.csm, r)
  • STL 3D files (.stl, r/w)
  • PLY 3D files (.ply, r/w)

Just by chance, do you think this would support sketchup 3d models?

Sketchup exports to the .dae collada format, so yes. :idea:

Share this post


Link to post
Share on other sites

Posted

SWEET

Sketchup(pro) can export into .3ds, .dae, and .obj. I may just need to write a plugin to run a sketchup model form sketchup, so you can walk around like you would in a game......

<off topic> If anyone knows of a way to convert .skp files to any of those formats, please pm me</off topic>

I can't wait to start using this. i was excited when the last irrlicht udf came out, and thought it had been discontinued,,,,

Share this post


Link to post
Share on other sites

Posted

JRowe, could you explain the logic of your _IrrCreateMesh() function?

I can't find a sensible connection with what IrrlichtWrapper.dll (source) requires and what you're trying.

It looks that you need to pass arrays (if you want them) ByRef.

your $VerticesStruct is wrong. And $IndicesStruct is wrong too.

What am I missing? :idea:

Share this post


Link to post
Share on other sites

Posted (edited)

I was trying to pass two Struct arrays constructed from arrays passed to the function - I need to figure out what the relationship between the two arrays is. I know that the Vertices array is a 2D array containing a list of of x,y,z points, and the indices array somehow represents groups of 3 points.

I think I'd just copied from another function and filled in pseudo-values to try to get a grasp of how things would come together. I believe the correct struct would consist of something like this:

	$arrayOfVerticesStruct = DllStructCreate("ptr[" & $vSize & "])"
	
	For $i = 1 To $vSize
		$VerticesListEntry = DllStructCreate("float;float;float")
		DllStructSetData($VerticesListEntry, 1, $a_Vertices[$i - 1][0])
		DllStructSetData($VerticesListEntry, 2, $a_Vertices[$i - 1][1])
		DllStructSetData($VerticesListEntry, 3, $a_Vertices[$i - 1][2])
		$VerticesListEntryPtr = DllStructGetPtr($VerticesListEntry)
		DllStructSetData($arrayOfVerticesStruct, $i, $VerticesListEntryPtr)
	Next

A struct array of pointers to 3 valued structs filled in from an AutoIt array representing the vertices, or individual points of mesh.

From there, I need to figure out the relationship of the vertices to the indices, which is what's sticking in my craw, so to speak.

Edited by JRowe

Share this post


Link to post
Share on other sites

Posted

You should write an example script that uses _IrrCreateMesh(). It doesn't matter that it wouldn't work at this stage. Just for others who might help you to actually get your ideas.

Btw, $VerticesStruct should be derived from this:

typedef struct tag_IRR_VERT
{
    float x;                // The x position of the vertex
    float y;                // The y position of the vertex
    float z;                // The z position of the vertex
    float normal_x;         // The x normal of the vertex
    float normal_y;         // The y normal of the vertex
    float normal_z;         // The z normal of the vertex
    unsigned int vcolor;     // The 32bit ARGB color of the vertex
    float texture_x;        // the x co-ordinate of the vertex on the texture (0 to 1)
    float texture_y;        // the y co-ordinate of the vertex on the texture (0 to 1)
}
IRR_VERT;
So, you are missing elements.

Share this post


Link to post
Share on other sites

Posted (edited)

The docs are a bit scattered on some things.

You must supply a list of vertices of type IRR_VECT

IrrVect is just a struct with 3 floats, so what i put together should be correct. I'm going to go through and rewrite the docs for AutoIt, since there are a few misleading things throughout.

Anyway, I'll put together a demo script sometime tonight - after I figure out how the function is supposed to work, too - I don't know how IrrCreateMesh is supposed to work right now.

Down at the very end of the UDF, I have 3 helper funcs that create the structs. One of them is the one you found:

Func ___CreateVertex($f_X, $f_Y, $f_Z, $f_NormalX, $f_NormalY, $f_NormalZ, $i_ARGB, $f_TextureX, $f_TextureY)
	Local $VertexStruct = DllStructCreate("float;float;float;float;float;float;int;float;float")
	DllStructSetData($VertexStruct, 1, $f_X)
	DllStructSetData($VertexStruct, 2, $f_Y)
	DllStructSetData($VertexStruct, 3, $f_Z)
	DllStructSetData($VertexStruct, 4, $f_NormalX)
	DllStructSetData($VertexStruct, 5, $f_NormalY)
	DllStructSetData($VertexStruct, 6, $f_NormalZ)
	DllStructSetData($VertexStruct, 7, $i_ARGB)
	DllStructSetData($VertexStruct, 8, $f_TextureX)
	DllStructSetData($VertexStruct, 9, $f_TextureY)
	Return $VertexStruct
EndFunc ;==>___CreateVertex

There's probably a lot of work left for some of these functions, but I think I got the major milestones taken care of.

Edited by JRowe

Share this post


Link to post
Share on other sites

Posted

I added the first 7 demos and the updated wrapper. This is Au3Irrlicht 2.0.1

I've added the enumerations to the top of the include. They're definitely not all there, but as I go through rewriting the demos, I'll keep adding - others are free to chip in, as well, most of it's easy work. :idea:

Note: The Particle system demo doesn't work. There are completely undocumented functions used in the demos, which I am working on listing and fixing. My free time lately has disappeared, so I've only been doing bits and pieces here and there. Feel free to experiment, and post the fixes if you get things working!

Share this post


Link to post
Share on other sites

Posted (edited)

I added the first 7 demos and the updated wrapper. This is Au3Irrlicht 2.0.1

I've added the enumerations to the top of the include. They're definitely not all there, but as I go through rewriting the demos, I'll keep adding - others are free to chip in, as well, most of it's easy work. :idea:

Note: The Particle system demo doesn't work. There are completely undocumented functions used in the demos, which I am working on listing and fixing. My free time lately has disappeared, so I've only been doing bits and pieces here and there. Feel free to experiment, and post the fixes if you get things working!

You need to ask the author of the wrapper to recompile the dlls so that there wouldn't be MSVCblah.dll dependencies. Otherwise not many people would be able to run your examples. Edited by trancexx

Share this post


Link to post
Share on other sites

Posted (edited)

I think that's what this is for. The documentation is outdated in some things, and since I don't see "IrrlichtWrapper_gcc.dll", I'm going to assume that IrrlichtWrapper.dll can use both the ms and gcc version?

Overview

IrrlichtWrapper is supplied with three sets of files. MSVC versions, GCC versions and Linux Versions. The default version of the files are those compiled with MSVC, these provide support for OpenGL, Direct X 8, Direct X 9 and software rendering. The GCC and Linux versions support both OpenGL and Software rendering.

GCC Compiler

To use the GCC DLLs you need to rename the supplied files: -

1. Rename Irrlicht.dll to Irrlicht_ms.dll

2. Rename IrrlichtWrapper.dll to IrrlichtWrapper_ms.dll

3. Rename Irrlicht_gcc.dll to Irrlicht.dll

4. Rename IrrlichtWrapper_gcc.dll to IrrlichtWrapper.dll

If I'm wrong, I'll definitely try to get a fix from the author.

update: The instructions didn't work for me. I'll notify the author. I'll also package it accordingly once things are worked out.

Edited by JRowe

Share this post


Link to post
Share on other sites

Posted

Why not for now to re-rar and reupload his package until fix? or add it to au3Irrlicht2.zip

msvcr71.dll

Share this post


Link to post
Share on other sites

Posted (edited)

This is a working example for _IrrCreateMesh (no error-checking at all):

#include "au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc

Global Const $tagIRR_VERT = "float x; " & _ ;                // The x position of the vertex
    "float y; " & _ ;                // The y position of the vertex
    "float z; " & _ ;                // The z position of the vertex
    "float normal_x; " & _ ;         // The x normal of the vertex
    "float normal_y; " & _ ;         // The y normal of the vertex
    "float normal_z; " & _ ;         // The z normal of the vertex
    "uint vcolor; " & _ ;     // The 32bit ARGB color of the vertex
    "float texture_x; " & _ ;        // the x co-ordinate of the vertex on the texture (0 to 1)
    "float texture_y; " ;        // the y co-ordinate of the vertex on the texture (0 to 1)


_IrrStart($IRR_EDT_OPENGL, 400, 400, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS)
_IrrSetWindowCaption("Example 15: Create a custom mesh")


$tVertexArray = _VertexArrayCreate(5)

_VertexArraySet($tVertexArray, 0, "x", -10)
_VertexArraySet($tVertexArray, 0, "y", 0)
_VertexArraySet($tVertexArray, 0, "z", -10)
_VertexArraySet($tVertexArray, 1, "x", -10)

_VertexArraySet($tVertexArray, 1, "y", 0)
_VertexArraySet($tVertexArray, 1, "z", 10)
_VertexArraySet($tVertexArray, 2, "x", 10)
_VertexArraySet($tVertexArray, 2, "y", 0)
_VertexArraySet($tVertexArray, 2, "z", 10)
_VertexArraySet($tVertexArray, 3, "x", 10)
_VertexArraySet($tVertexArray, 3, "y", 0)
_VertexArraySet($tVertexArray, 3, "z", -10)

_VertexArraySet($tVertexArray, 4, "x", 0)
_VertexArraySet($tVertexArray, 4, "y", 20)
_VertexArraySet($tVertexArray, 4, "z", 0)

_VertexArraySet($tVertexArray, 0, "texture_x", 0)
_VertexArraySet($tVertexArray, 0, "texture_y", 0)
_VertexArraySet($tVertexArray, 1, "texture_x", 0)
_VertexArraySet($tVertexArray, 1, "texture_y", 1)
_VertexArraySet($tVertexArray, 2, "texture_x", 1)
_VertexArraySet($tVertexArray, 2, "texture_y", 1)
_VertexArraySet($tVertexArray, 3, "texture_x", 1)
_VertexArraySet($tVertexArray, 3, "texture_y", 0)
_VertexArraySet($tVertexArray, 4, "texture_x", 0.5)
_VertexArraySet($tVertexArray, 4, "texture_y", 0.5)

_VertexArraySet($tVertexArray, 0, "vcolor", 0x00FFFFFF)
_VertexArraySet($tVertexArray, 1, "vcolor", 0x00FFFFFF)
_VertexArraySet($tVertexArray, 2, "vcolor", 0x00FFFFFF)
_VertexArraySet($tVertexArray, 3, "vcolor", 0x00FFFFFF)
_VertexArraySet($tVertexArray, 4, "vcolor", 0x00FFFFFF)

$tIndices = DllStructCreate("ushort[18]")
DllStructSetData($tIndices, 1, 0, 1)

DllStructSetData($tIndices, 1, 1, 2)
DllStructSetData($tIndices, 1, 4, 3)

DllStructSetData($tIndices, 1, 1, 4)
DllStructSetData($tIndices, 1, 2, 5)
DllStructSetData($tIndices, 1, 4, 6)

DllStructSetData($tIndices, 1, 2, 7)
DllStructSetData($tIndices, 1, 3, 8)
DllStructSetData($tIndices, 1, 4, 9)

DllStructSetData($tIndices, 1, 3, 10)
DllStructSetData($tIndices, 1, 0, 11)
DllStructSetData($tIndices, 1, 4, 12)

DllStructSetData($tIndices, 1, 2, 13)
DllStructSetData($tIndices, 1, 1, 14)
DllStructSetData($tIndices, 1, 0, 15)

DllStructSetData($tIndices, 1, 0, 16)
DllStructSetData($tIndices, 1, 3, 17)
DllStructSetData($tIndices, 1, 2, 18)

$hMesh = DllCall($_irrDll, "ptr:cdecl", "IrrCreateMesh", "str", "TestMesh", "int", 5, "ptr", DllStructGetPtr($tVertexArray), "int", 18, "ptr", DllStructGetPtr($tIndices))
$hMesh = $hMesh[0]

$MeshTexture = _IrrGetTexture( "./media/texture.jpg" )

$SceneNode = _IrrAddMeshToScene( $hMesh )

_IrrSetNodeMaterialTexture( $SceneNode, $MeshTexture, 0 )

_IrrSetNodeMaterialFlag( $SceneNode, $IRR_EMF_LIGHTING, $IRR_OFF )

$OurCamera = _IrrAddFPSCamera()
_IrrSetNodePosition( $OurCamera, 30,50,25)
_IrrSetCameraTarget($OurCamera, 0,0,0)

WHILE _IrrRunning()
    _IrrBeginScene(240, 255, 255)
    _IrrDrawScene()
    _IrrEndScene()
WEND

Func _VertexArrayCreate($iCount)
	Local Static $iSize = DllStructGetSize(DllStructCreate($tagIRR_VERT, 1))
	Return DllStructCreate("byte[" & $iSize * $iCount & "]")
EndFunc
Func _VertexArraySet(ByRef $tVertexArray, $iVertex, $vMember, $vData)
	Local Static $iSize = DllStructGetSize(DllStructCreate($tagIRR_VERT, 1))
	DllStructSetData(DllStructCreate($tagIRR_VERT, DllStructGetPtr($tVertexArray) + $iSize*$iVertex), $vMember, $vData)
EndFunc

PS: You should add If @error Then Return Seterror(1,0,0) after each DLLCall.

Edited by ProgAndy

Share this post


Link to post
Share on other sites

Posted

First of all i must say i waited for this for a long time and finally it's here. Thank you JRowe your doing a great job.

Now i have a question about the GUI. I tried to use the function _IrrAddWindow("Simple window", 50, 50, 100, 50, "IRR_GUI_MODAL", "") but nothing appears when i run the application. And about the last argument, i read in the Reference Manual from the IrrWrapper from freebasic that the last argument can be skipped if there is no parent for that window, but i can't skip it. And about the 6th argument. Is it right, i took it from the same Reference Manual from freebasic.

Share this post


Link to post
Share on other sites

Posted (edited)

If you skip the argument, you don't include anything. Adding "" will bork it. The _IrrAddWindow function may also need to be modified to set 0 as the default.

Replace the _IrrAddWindow function with this:

Func _IrrAddWindow($s_Title, $i_TopX, $i_TopY, $i_BottomX, $i_BottomY, $i_Modal, $h_Parent = 0)
	$result = DllCall($_irrDll, "ptr:cdecl", "IrrAddWindow", "str", $s_Title, "int", $i_TopX, "int", $i_TopY, "int", $i_BottomX, "int", $i_BottomY, "int", $i_Modal, "ptr", $h_Parent)
	Return $result[0]
EndFunc ;==>_IrrAddWindow

Then call it with this:

_IrrAddWindow("Simple window", 50, 50, 100, 50, $IRR_GUI_MODAL)

I'll change that in the next release (probably saturday.)

Edited by JRowe

Share this post


Link to post
Share on other sites

Posted

I think "IRR_GUI_MODAL" is wrong. It should be $IRR_GUI_MODAL :idea:

Share this post


Link to post
Share on other sites

Posted

:idea:

Thanks ProgAndy , lol.Fixed it.

Share this post


Link to post
Share on other sites

Posted (edited)

Hi Jrowe,

I'm very exited but my attempt is solded by an error...

always the same :

C:\Program Files\AutoIt3\Include\au3Irrlicht2.au3 (1427) : ==> Subscript used with non-Array variable.:

Return $result[0]

Return $result^ ERROR

all your demo is solded by this message :idea:

Dlls are 32bit. That means you have to run 32bit AutoIt when using them.

edit:

It's not very nice to delete posts the way you did. Then I have to do what I did now.

Edited by trancexx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0