Guest JRowe_1 Posted December 2, 2006 Posted December 2, 2006 (edited) [Actually, Irrlicht is not usable with AutoIt at this point in time, sorry for topic confusion]I fairly well derailed my own other thread, and this is a significantly more focused topic, so I decided I'd start a new thread. Sorry if I'm breaking etiquette. :"> Alright, so I found a wrapper for irrlicht. This is the freebasic API inlude, which tells the wrapper how to interface with the Irrlicht 3D engine. I think this is what PaulIA was asking for.I need to convert this script from FreeBasic to Autoit, so that I can inlude it in a script, then call it's functions from within that script. There are roughly 100 functions here.I think I can manage it, and I will do the grunt work gladly, but I need help understanding some syntax issues.For example, how would I convert the following to Autoit acceptable syntax?declare sub IrrStart CDECL alias "IrrStart" ( byval device_type as IRR_DEVICE_TYPES, byval iwidth as integer, byval iheight as integer, byval fullscreen as integer, byval use_shadows as integer, byval iCaptureMouse as integer)If someone could help me out and maybe check out the FreeBasic source to see if I'm not mistaken about what I have here, I would greatly appreciate it.CODE '''' A Freebasic Irrlicht Interface Test'' F.Dodd (2006)'''' This is a pure test of creating a wrapper DLL for Irrlicht simplifying its'' C++ architecture and providing a basic but functional 3D SDK for languages'' that are not object oriented. At the moment this provides very few calls and'' is merely a test for implementing such an interface.'''' This source uses Irrlicht definitions created by the Irrlicht authors'''' ////////////////////////////////////////////////////////////////////////////'' Instructions to link the required DLL's#inclib "IrrlichtWrapper"#inclib "Irrlicht"'' ////////////////////////////////////////////////////////////////////////////'' Enumerated Type Definitions' Rendering Device TypesENUM IRR_DEVICE_TYPES IRR_EDT_NULL = 0 ' a NULL device with no display IRR_EDT_SOFTWARE ' Irrlichts default software renderer IRR_EDT_SOFTWARE2 ' An improved quality software renderer IRR_EDT_OPENGL ' hardware accelerated OpenGL renderer IRR_EDT_DIRECT3D8 ' hardware accelerated DirectX 8 renderer IRR_EDT_DIRECT3D9 ' hardware accelerated DirectX 9 rendererEND ENUM' Material FlagsENUM IRR_MATERIAL_FLAGS IRR_EMF_WIREFRAME = 0 ' render as wireframe outline IRR_EMF_GOURAUD_SHADING ' render smoothly across polygons IRR_EMF_LIGHTING ' material is effected by lighting IRR_EMF_ZBUFFER ' enable z buffer IRR_EMF_ZWRITE_ENABLE ' can write as well as read z buffer IRR_EMF_BACK_FACE_CULLING ' cull polygons facing away IRR_EMF_BILINEAR_FILTER ' enable bilinear filtering IRR_EMF_TRILINEAR_FILTER ' enable trilinear filtering IRR_EMF_ANISOTROPIC_FILTER ' reduce blur in distant textures IRR_EMF_FOG_ENABLE ' enable fogging in the distance IRR_EMF_NORMALIZE_NORMALS ' use when scaling dynamically lighted modelsEND ENUM' Material TypesENUM IRR_MATERIAL_TYPES IRR_EMT_SOLID = 0 ' Standard solid rendering uses one texture IRR_EMT_SOLID_2_LAYER ' 2 blended textures (not available on OpenGL) IRR_EMT_LIGHTMAP ' 2 textures: 0=color 1=lighting level IRR_EMT_LIGHTMAP_ADD ' ... as above but adds levels IRR_EMT_LIGHTMAP_M2 ' ... as above but multiplies levels by 2 IRR_EMT_LIGHTMAP_M4 IRR_EMT_LIGHTMAP_LIGHTING ' ... as above with dynamic lighting IRR_EMT_LIGHTMAP_LIGHTING_M2 IRR_EMT_LIGHTMAP_LIGHTING_M4 IRR_EMT_DETAIL_MAP ' 2 textures blended one can be scaled IRR_EMT_SPHERE_MAP IRR_EMT_REFLECTION_2_LAYER IRR_EMT_TRANSPARENT_ADD_COLOR IRR_EMT_TRANSPARENT_ALPHA_CHANNEL IRR_EMT_TRANSPARENT_ALPHA_CHANNEL_REF IRR_EMT_TRANSPARENT_VERTEX_ALPHA IRR_EMT_TRANSPARENT_REFLECTION_2_LAYER IRR_EMT_NORMAL_MAP_SOLID IRR_EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR IRR_EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA IRR_EMT_PARALLAX_MAP_SOLID IRR_EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR IRR_EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA IRR_EMT_FORCE_32BIT = &h7fffffffEND ENUM' Mouse eventsENUM IRR_MOUSE_EVENTS IRR_EMIE_LMOUSE_PRESSED_DOWN = 0 IRR_EMIE_RMOUSE_PRESSED_DOWN IRR_EMIE_MMOUSE_PRESSED_DOWN IRR_EMIE_LMOUSE_LEFT_UP IRR_EMIE_RMOUSE_LEFT_UP IRR_EMIE_MMOUSE_LEFT_UP IRR_EMIE_MOUSE_MOVED IRR_EMIE_MOUSE_WHEELEND ENUM' MD2 Animation sequencesENUM IRR_MD2_ANIM_SEQUENCES IRR_EMAT_STAND = 0 IRR_EMAT_RUN IRR_EMAT_ATTACK IRR_EMAT_PAIN_A IRR_EMAT_PAIN_B IRR_EMAT_PAIN_C IRR_EMAT_JUMP IRR_EMAT_FLIP IRR_EMAT_SALUTE IRR_EMAT_FALLBACK IRR_EMAT_WAVE IRR_EMAT_POINT IRR_EMAT_CROUCH_STAND IRR_EMAT_CROUCH_WALK IRR_EMAT_CROUCH_ATTACK IRR_EMAT_CROUCH_PAIN IRR_EMAT_CROUCH_DEATH IRR_EMAT_DEATH_FALLBACK IRR_EMAT_DEATH_FALLFORWARD IRR_EMAT_DEATH_FALLBACKSLOW IRR_EMAT_BOOMEND ENUM'' ////////////////////////////////////////////////////////////////////////////'' Constant Definitions' Flag definition#define IRR_OFF 0#define IRR_ON 1' Input definitions#define IRR_KEY_UP 0#define IRR_KEY_DOWN 1' System Device definitions#define IRR_WINDOWED 0#define IRR_FULLSCREEN 1#define IRR_NO_SHADOWS 0#define IRR_SHADOWS 1#define IRR_IGNORE_EVENTS 0#define IRR_CAPTURE_EVENTS 1#define IRR_LINEAR_FOG 0#define IRR_EXPONENTIAL_FOG 1' Filing system definitions#define IRR_USE_CASE 0#define IRR_IGNORE_CASE 1#define IRR_USE_PATHS 0#define IRR_IGNORE_PATHS 1' 2D image definitions#define IRR_IGNORE_ALPHA 0#define IRR_USE_ALPHA 1' Node definitions#define IRR_INVISIBLE 0#define IRR_VISIBLE 1#define IRR_ONE_SHOT 0#define IRR_LOOP 1' Particle definitions#define IRR_NO_EMITTER 0#define IRR_DEFAULT_EMITTER 1' GUI Interface definitions#define IRR_GUI_NO_BORDER 0#define IRR_GUI_BORDER 1#define IRR_GUI_NO_WRAP 0#define IRR_GUI_WRAP 1'' ////////////////////////////////////////////////////////////////////////////'' Type Definitions' Irrlicht Keyboard and Mouse Event StructuresTYPE IRR_MOUSE_EVENT action as uinteger x as integer y as integerEND TYPETYPE IRR_KEY_EVENT key as uinteger direction as uinteger flags as uintegerEND TYPE' Particle emitter propertiesTYPE IRR_PARTICLE_EMITTER min_box_x as single ' The bounding box for the emitter min_box_y as single min_box_z as single max_box_x as single max_box_y as single max_box_z as single direction_x as single direction_y as single direction_z as single min_paritlcles_per_second as uinteger max_paritlcles_per_second as uinteger min_start_color_red as integer min_start_color_green as integer min_start_color_blue as integer max_start_color_red as integer max_start_color_green as integer max_start_color_blue as integer min_lifetime as uinteger max_lifetime as uinteger max_angle_degrees as integerEND TYPE' a vertex used in creating custom static mesh objectsTYPE IRR_VERT x as single ' The x position of the vertex y as single ' The y position of the vertex z as single ' The z position of the vertex normal_x as single ' The x normal of the vertex normal_y as single ' The y normal of the vertex normal_z as single ' The z normal of the vertex vcolor as uinteger ' The 32bit ARGB color of the vertex texture_x as single ' the x co-ordinate of the vertex on the texture (0 to 1) texture_y as single ' the y co-ordinate of the vertex on the texture (0 to 1)END TYPE' a vector consisting of 3 float valuesTYPE IRR_VECTOR x as single y as single z as singleEND TYPE' .............................................................................' Irrlicht Object Types - these are used to represent objects in the Irrlicht' engine and their purpose is to warn the programmer of type errors' (thanks to v1ctor for the advice on this correction)TYPE irr_mesh as UINTEGER PTRTYPE irr_texture as UINTEGER PTRTYPE irr_node as UINTEGER PTRTYPE irr_camera as UINTEGER PTRTYPE irr_terrain as UINTEGER PTRTYPE irr_selector as UINTEGER PTRTYPE irr_particle_system as UINTEGER PTRTYPE irr_animator as UINTEGER PTRTYPE irr_font as UINTEGER PTRUNION irr_model node as irr_node camera as irr_camera terrain as irr_terrain particles as irr_particle_systemEND UNION'' ////////////////////////////////////////////////////////////////////////////'' System Functions' Start the Irrlicht interfacedeclare sub IrrStart CDECL alias "IrrStart" ( byval device_type as IRR_DEVICE_TYPES, byval iwidth as integer, byval iheight as integer, byval fullscreen as integer, byval use_shadows as integer, byval iCaptureMouse as integer)' determine if the Irrlicht viewport is running. 0 = No 1 = Yesdeclare function IrrRunning CDECL alias "IrrRunning" () as integer' initialise the frame drawing cycle, erasing the canvas ready for drawingdeclare sub IrrBeginScene CDECL alias "IrrBeginScene" ( byval red as integer, byval green as integer, byval blue as integer)' draw the scene to the canvasdeclare sub IrrDrawScene CDECL alias "IrrDrawScene" ()' draw the user interface to the canvasdeclare sub IrrDrawGUI CDECL alias "IrrDrawGUI" ()' end all drawing operations and display the rendered framedeclare sub IrrEndScene CDECL alias "IrrEndScene" ()' Stop the Irrlicht engine freeing up its resourcesdeclare sub IrrStop CDECL alias "IrrStop" ()' get the current frame ratedeclare function IrrGetFPS CDECL alias "IrrGetFPS" () as integer' get the number of primitives (mostly triangles) drawn in the last framedeclare function IrrGetPrimitivesDrawn CDECL alias "IrrGetPrimitivesDrawn" () as uinteger' set the caption in the irrlicht windowdeclare sub IrrSetWindowCaption CDECL alias "IrrSetWindowCaption" ( byval text as wstring ptr )' make 32 bit representation of an Alpha, Red, Green, Blue colorfunction IrrMakeARGB ( Alpha as integer, Red as integer, Green as integer, Blue as integer ) as uinteger IrrMakeARGB = (Alpha SHL 24) + (Red SHL 16) + (Green SHL 8) + Blueend function'' ////////////////////////////////////////////////////////////////////////////'' Input Event Functions' find out if there is a key event ready to be read. returns 1 if there is an' event available (the event receiver must have been started when the system' was initialised)declare function IrrKeyEventAvailable CDECL alias "IrrKeyEventAvailable" () as integer' read a key event outdeclare function IrrReadKeyEvent CDECL alias "IrrReadKeyEvent" () as IRR_KEY_EVENT PTR' find out if there is a mouse event ready to be read. returns 1 if there is an' event available (the event receiver must have been started when the system' was initialised)declare function IrrMouseEventAvailable CDECL alias "IrrMouseEventAvailable" () as integer' read a mouse event outdeclare function IrrReadMouseEvent CDECL alias "IrrReadMouseEvent" () as IRR_MOUSE_EVENT PTR' show and hide the mouse pointer#define IrrHideMouse IrrDisplayMouse(0)#define IrrShowMouse IrrDisplayMouse(1)declare sub IrrDisplayMouse CDECL alias "IrrDisplayMouse" ( byval show_mouse as uinteger)'' ////////////////////////////////////////////////////////////////////////////'' Filing System Functions' add zip archive to the filing system allowing you to load files straight out' of the zip file. common pk3 files are simply zip filesdeclare sub IrrAddZipFile CDECL alias "IrrAddZipFile" ( byval path as zstring ptr, byval ignore_case as uinteger, byval ignore_paths as uinteger)' set irrlicht current working directorydeclare sub IrrChangeWorkingDirectory CDECL alias "IrrChangeWorkingDirectory" ( byval path as zstring ptr )' get irrlicht current working directorydeclare function IrrGetWorkingDirectory CDECL alias "IrrGetWorkingDirectory" () as zstring ptr'' ////////////////////////////////////////////////////////////////////////////'' 2D Functions' load a texture objectdeclare function IrrGetTexture CDECL alias "IrrGetTexture" ( byval path as zstring ptr ) as irr_texture' color key the image making parts of it transparentdeclare sub IrrColorKeyTexture CDECL alias "IrrColorKeyTexture" ( byval texture as irr_texture, byval red as integer, byval green as integer, byval blue as integer)' draw a 2d image to the displaydeclare sub IrrDraw2DImage CDECL alias "IrrDraw2DImage" ( byval texture as irr_texture, byval x as integer, byval y as integer )' draw an image to the screen from a specified rectangle in the source image' this enables you to place lots of images into one texture for 2D drawing. in' addition this function also uses image alpha channelsdeclare sub IrrDraw2DImageElement CDECL alias "IrrDraw2DImageElement" ( byval texture as irr_texture, byval x as integer, byval y as integer, byval source_tx as integer, byval source_ty as integer, byval source_bx as integer, byval source_by as integer, byval usealpha as integer )' load a bitmap based fontdeclare function IrrGetFont CDECL alias "IrrGetFont" ( byval path as zstring ptr ) as irr_font' draw text to the display using a bitmap fontdeclare sub Irr2DFontDraw CDECL alias "Irr2DFontDraw" ( byval font as irr_font, byval text as wstring ptr, byval top_x as integer, byval top_y as integer, byval bottom_x as integer, byval bottom_y as integer )'' ////////////////////////////////////////////////////////////////////////////'' Scene Manager Functions' load a mesh from a filedeclare function IrrGetMesh CDECL alias "IrrGetMesh" ( byval path as zstring ptr ) as irr_mesh' create a mesh from an array of verticies, an array of incidies to those' verticies that connect them to form triangles and finally texture co-ordinates' to map the verticies against a texture planedeclare function IrrCreateMesh CDECL alias "IrrCreateMesh" (byval mesh_name as zstring ptr, byval vertex_count as integer, byref vertices as IRR_VERT, byval indices_count as integer, byref indices as ushort) as irr_mesh' remove a loaded mesh from the scene cache useful if you are dealing with large' numbers of meshes that you dont want cached in memory at the same time (for' example when swapping between BSP maps for levelsdeclare sub IrrRemoveMesh CDECL alias "IrrRemoveMesh" (byval mesh as irr_mesh)' add a loaded mesh to the scene as a new nodedeclare function IrrAddMeshToScene CDECL alias "IrrAddMeshToScene" ( byval mesh as irr_mesh) as irr_node' add a loaded mesh to the scene as an octtree. this is an efficient method' for large complex meshes like BSP maps that occlude themselves a lotdeclare function IrrAddMeshToSceneAsOcttree CDECL alias "IrrAddMeshToSceneAsOcttree" (byval mesh as irr_mesh) as irr_node' adds a billboard to the scene this is a flat 3D textured spritedeclare function IrrAddBillBoardToScene CDECL alias "IrrAddBillBoardToScene" ( byval sizex as single, byval sizey as single, byval x as single, byval y as single, byval z as single ) as irr_node' add a particle system to the irrlicht scene managerdeclare function IrrAddParticleSystemToScene CDECL alias "IrrAddParticleSystemToScene" ( byval add_emitter as integer) as irr_particle_system' add a skybox to the irrlicht scene manager based on six picturesdeclare function IrrAddSkyBoxToScene CDECL alias "IrrAddSkyBoxToScene" ( byval up_texture as irr_texture, byval down_texture as irr_texture, byval left_texture as irr_texture, byval right_texture as irr_texture, byval front_texture as irr_texture, byval back_texture as irr_texture ) as irr_node' adds a test node to the scene, the node is a simple cubedeclare function IrrAddTestSceneNode CDECL alias "IrrAddTestSceneNode" () as irr_node' set the color of shadows in the scenedeclare sub IrrSetShadowColor CDECL alias "IrrSetShadowColor" ( byval Alpha as integer, byval R as integer, byval G as integer, byval B as integer )' set the scene fogdeclare sub IrrSetFog CDECL alias "IrrSetFog" ( byval R as integer, byval G as integer, byval B as integer, byval fogtype as integer, byval fog_start as single, byval fog_end as single, byval density as single )' get the number of indicies in the mesh bufferdeclare function IrrGetMeshIndexCount CDECL alias "IrrGetMeshIndexCount" ( byval mesh as irr_mesh, byval frame as integer ) as integer' copy the indicies of a mesh into the supplied buffer, the caller must ensure' that the buffer is big enough to store the datadeclare sub IrrGetMeshIndices CDECL alias "IrrGetMeshIndices" ( byval mesh as irr_mesh, byval frame as integer, byref indicies as ushort )' copy the indicies in the supplied buffer into the mesh , the caller must' ensure that the buffer is big enough to supply all of the datadeclare sub IrrSetMeshIndices CDECL alias "IrrSetMeshIndices" ( byval mesh as irr_mesh, byval frame as integer, byref indicies as ushort )' get the number of vertices in the mesh bufferdeclare function IrrGetMeshVertexCount CDECL alias "IrrGetMeshVertexCount" ( byval mesh as irr_mesh, byval frame as integer ) as integer' copy the vertices of a mesh into the supplied buffer, the caller must ensure' that the buffer is big enough to store the datadeclare sub IrrGetMeshVertices CDECL alias "IrrGetMeshVertices" ( byval mesh as irr_mesh, byval frame as integer, byref verticies as IRR_VERT )' copy the vertices in the supplied buffer into the mesh , the caller must' ensure that the buffer is big enough to supply all of the datadeclare sub IrrSetMeshVertices CDECL alias "IrrSetMeshVertices" ( byval mesh as irr_mesh, byval frame as integer, byref verticies as IRR_VERT )'' ////////////////////////////////////////////////////////////////////////////'' Scene Node Functions' apply an image file as a texturing material to a nodedeclare sub IrrSetNodeMaterialTexture CDECL alias "IrrSetNodeMaterialTexture" ( byval node as irr_node, byval texture as irr_texture, byval material_index as integer )' set a material flag property on a node. the value can be either 0 or 1declare sub IrrSetNodeMaterialFlag CDECL alias "IrrSetNodeMaterialFlag" ( byval node as irr_node, byval flag as IRR_MATERIAL_TYPES, byval value as uinteger )' set the way the materials applied to the node are rendereddeclare sub IrrSetNodeMaterialType CDECL alias "IrrSetNodeMaterialType" ( byval node as irr_node, byval mat_type as IRR_MATERIAL_FLAGS )' move a node in the scene to a new positiondeclare sub IrrSetNodePosition CDECL alias "IrrSetNodePosition" ( byval node as irr_node, byval X as single, byval Y as single, byval Z as single )' rotate a node in the scenedeclare sub IrrSetNodeRotation CDECL alias "IrrSetNodeRotation" ( byval node as irr_node, byval X as single, byval Y as single, byval Z as single )' scale a node in the scenedeclare sub IrrSetNodeScale CDECL alias "IrrSetNodeScale" ( byval node as irr_node, byval X as single, byval Y as single, byval Z as single )'render debugging information for nodes to the displaydeclare sub IrrDebugDataVisible CDECL alias "IrrDebugDataVisible" ( byval node as irr_node, byval visible as integer )' get the position of the node in the scenedeclare sub IrrGetNodePosition CDECL alias "IrrGetNodePosition" ( byval node as irr_node, byref X as single, byref Y as single, byref Z as single )' get the rotation of the node in the scenedeclare sub IrrGetNodeRotation CDECL alias "IrrGetNodeRotation" ( byval node as irr_node, byref X as single, byref Y as single, byref Z as single )' set the portion of the animation sequence in the node that is to be playeddeclare sub IrrSetNodeAnimationRange CDECL alias "IrrSetNodeAnimationRange" ( byval node as irr_node, byval startFrame as integer, byval iEndFrame as integer )' set the MD2 animation sequence to playback in the animationdeclare sub IrrPlayNodeMD2Animation CDECL alias "IrrPlayNodeMD2Animation" ( byval node as irr_node, byval sequence as uinteger )' set the speed of animation playbackdeclare sub IrrSetNodeAnimationSpeed CDECL alias "IrrSetNodeAnimationSpeed" ( byval node as irr_node, byval speed as integer )' get the current frame number being played in the animationdeclare function IrrGetNodeAnimationFrame CDECL alias "IrrGetNodeAnimationFrame" () as uinteger' get a node that represents the position of a joint in a Milkshape skeletondeclare function IrrGetMS3DJointNode CDECL alias "IrrGetMS3DJointNode" ( byval node as irr_node, byval joint_name as zstring ptr ) as irr_node' get a node that represents the position of a joint in a Direct X skeletondeclare function IrrGetDirectXJointNode CDECL alias "IrrGetDirectXJointNode" ( byval node as irr_node, byval joint_name as zstring ptr ) as irr_node' adds a node to another node as a child to a parentdeclare sub IrrAddChildToParent CDECL alias "IrrAddChildToParent" ( byval child as irr_node, byval parent as irr_node )' add a shadow to a nodedeclare sub IrrAddNodeShadow CDECL alias "IrrAddNodeShadow" ( byval node as irr_node )' set whether a node is visible or notdeclare sub IrrSetNodeVisibility CDECL alias "IrrSetNodeVisibility" ( byval node as irr_node, byval visible as integer )' delete this node from the scenedeclare sub IrrRemoveNode CDECL alias "IrrRemoveNode" ( byval node as irr_node )' get the parent of this node, returns 0 if there is no parentdeclare function IrrGetNodeParent CDECL alias "IrrGetNodeParent" ( byval node as irr_node ) as irr_node' get the ID of this nodedeclare function IrrGetNodeID CDECL alias "IrrGetNodeID" ( byval node as irr_node ) as integer' set the ID of this nodedeclare sub IrrSetNodeID CDECL alias "IrrSetNodeID" ( byval node as irr_node, byval id as integer )'' ////////////////////////////////////////////////////////////////////////////'' Animator Functions' add a collision animator to a nodedeclare function IrrAddCollisionAnimator CDECL alias "IrrAddCollisionAnimator" ( byval selector as irr_selector, byval node as irr_node, byval radiusx as single, byval radiusy as single, byval radiusz as single, byval gravityx as single, byval gravityy as single, byval gravityz as single, byval offsetx as single, byval offsety as single, byval offsetz as single ) as irr_animator' add a deletion animator to a nodedeclare function IrrAddDeleteAnimator CDECL alias "IrrAddDeleteAnimator" ( byval node as irr_node, byval delete_after_n_milliseconds as integer ) as irr_animator' add a fly-in-circle animator to a nodedeclare function IrrAddFlyCircleAnimator CDECL alias "IrrAddFlyCircleAnimator" ( byval node as irr_node, byval centre_x as single, byval centre_y as single, byval centre_z as single, byval radius as single, byval speed as single ) as irr_animator' add a fly-straight animator to a nodedeclare function IrrAddFlyStraightAnimator CDECL alias "IrrAddFlyStraightAnimator" ( byval node as irr_node, byval start_x as single, byval start_y as single, byval start_z as single, byval end_x as single, byval end_y as single, byval end_z as single, byval time_to_complete as uinteger, byval loop_path as integer ) as irr_animator' add a rotation animator to a nodedeclare function IrrAddRotationAnimator CDECL alias "IrrAddRotationAnimator" ( byval node as irr_node, byval x as single, byval y as single, byval z as single )as irr_animator' add a spline animator to a nodedeclare function IrrAddSplineAnimator CDECL alias "IrrAddSplineAnimator" ( byval node as irr_node, byval array_size as integer, byref x as single, byref y as single, byref z as single, byval time_to_start as integer, byval speed as single, byval tightness as single ) as irr_animator' remove an animator from a nodedeclare sub IrrRemoveAnimator CDECL alias "IrrRemoveAnimator" ( byval node as irr_node, byval node as irr_animator )'' ////////////////////////////////////////////////////////////////////////////'' Collision Functions' gets a collision object from a complex mesh like a mapdeclare function IrrGetCollisionGroupFromComplexMesh CDECL alias "IrrGetCollisionGroupFromComplexMesh" (byval mesh as irr_mesh, byval node as irr_node) as irr_selector' creates a collision object from triangles in a node defined by its' bounding boxdeclare function IrrGetCollisionGroupFromBox CDECL alias "IrrGetCollisionGroupFromBox" ( byval node as irr_node ) as irr_selector' creates a collision selector from a terrain nodedeclare function IrrGetCollisionGroupFromTerrain CDECL alias "IrrGetCollisionGroupFromTerrain" ( byval node as irr_node, byval level_of_detail as integer ) as irr_selector' creates a combined collision object that is a group of collision objects' for example you could combine a map and a terraindeclare function IrrCreateCombinedCollisionGroup CDECL alias "IrrCreateCombinedCollisionGroup" () as irr_selector' adds a collision object to a combined collision objectdeclare sub IrrAddCollisionGroupToCombination CDECL alias "IrrAddCollisionGroupToCombination" ( byval combined_collision_group as irr_selector, byval collision_group as irr_selector )' remove all collision objects from the combined collision objectdeclare sub IrrRemoveAllCollisionGroupsFromCombination CDECL alias "IrrRemoveAllCollisionGroupsFromCombination" ( byval combined_collision_group as irr_selector )' remove a particular collision object from the combined collision objectdeclare sub IrrRemoveCollisionGroupFromCombination CDECL alias "IrrRemoveCollisionGroupFromCombination" ( byval combined_collision_group as irr_selector, byval collision_group as irr_selector )' detect the collision point of a ray in the scene with a collision object if a' collision was detected 1 is returned and vector collision contains the' co-ordinates of the point of collisiondeclare function IrrGetCollisionPoint CDECL alias "IrrGetCollisionPoint" ( byref start as IRR_VECTOR, byref line_end as IRR_VECTOR, byval collision_group as irr_selector, byref collision_point as IRR_VECTOR ) as integer' get a ray that goes from the specified camera and through the screen' coordinates the information is coppied into the supplied start and end vectorsdeclare sub IrrGetRayFromScreenCoordinates CDECL alias "IrrGetRayFromScreenCoordinates" ( byval screen_x as integer, byval screen_y as integer, byval camera as irr_camera, byref start as IRR_VECTOR, byref line_end as IRR_VECTOR )' a ray is cast through the camera and the nearest node that is hit by the ray' is returned. if no node is hit zero is returned for the objectdeclare function IrrGetCollisionNodeFromCamera CDECL alias "IrrGetCollisionNodeFromCamera" ( byval camera as irr_camera ) as irr_node' a ray is cast through the supplied coordinates and the nearest node that is' hit by the ray is returned. if no node is hit zero is returned for the objectdeclare function IrrGetCollisionNodeFromRay CDECL alias "IrrGetCollisionNodeFromRay" ( byref start as IRR_VECTOR, byref line_end as IRR_VECTOR ) as irr_node' a ray is cast through the screen at the specified co-ordinates and the nearest' node that is hit by the ray is returned. if no node is hit zero is returned' for the objectdeclare function IrrGetCollisionNodeFromScreenCoordinates CDECL alias "IrrGetCollisionNodeFromScreenCoordinates" ( byval screen_x as integer, byval screen_y as integer ) as irr_node' screen co-ordinates are returned for the position of the specified 3d' co-ordinates if an object were drawn at them on the screen, this is ideal for' drawing 2D bitmaps or text around or on your 3D object on the screendeclare sub IrrGetScreenCoordinatesFrom3DPosition CDECL alias "IrrGetScreenCoordinatesFrom3DPosition" ( byref screen_x as integer, byref screen_y as integer, byval at_position as IRR_VECTOR )'' ////////////////////////////////////////////////////////////////////////////'' Camera Functions' add a basic first person perspective camera to the scene that can be' controlled with the cursor keys and mouse (as long as your not capturing' events yourself)declare function IrrAddFPSCamera CDECL alias "IrrAddFPSCamera" () as irr_camera' add a regular cameradeclare function IrrAddCamera CDECL alias "IrrAddCamera" ( byval cameraX as single, byval cameraY as single, byval cameraZ as single, byval targetX as single, byval targetY as single, byval targetZ as single ) as irr_camera' reposition the target location of a cameradeclare sub IrrSetCameraTarget CDECL alias "IrrSetCameraTarget" ( byval camera as irr_camera, byval X as single, byval Y as single, byval Z as single )' get the current target location of a camera, the location is copied into the' supplied variablesdeclare sub IrrGetCameraTarget CDECL alias "IrrGetCameraTarget" ( byval camera as irr_camera, byref X as single, byref Y as single, byref Z as single )' set the up vector of a camera object, this controls the upward direction of' the camera and allows you to roll it for free flight actiondeclare sub IrrSetCameraUpDirection CDECL alias "IrrSetCameraUpDirection" ( byval camera as irr_camera, byval X as single, byval Y as single, byval Z as single )' set the distance at which the camera starts to clip polysdeclare sub IrrSetCameraClipDistance CDECL alias "IrrSetCameraClipDistance" ( byval camera as irr_camera, byval distance as single )' set the active camera in the scenedeclare sub IrrSetActiveCamera CDECL alias "IrrSetActiveCamera" ( byval camera as irr_camera )'sets the field of view (Default: PI / 2.5f). declare sub IrrSetCameraFOV CDECL alias "IrrSetCameraFOV" ( byval camera as irr_camera, byval fov as single )'' ////////////////////////////////////////////////////////////////////////////'' Lighting Functions'add a light to the scenedeclare function IrrAddLight CDECL alias "IrrAddLight" ( byval x as single, byval y as single, byval z as single, byval red as single, byval green as single, byval blue as single, byval size as single ) as irr_node' set the scene ambient lightingdeclare sub IrrSetAmbientLight CDECL alias "IrrSetAmbientLight" ( byval R as single, byval G as single, byval B as single )'' ////////////////////////////////////////////////////////////////////////////'' Terrain Functions' create a terrain node from a highfield mapdeclare function IrrAddTerrain CDECL alias "IrrAddTerrain" ( byval path as zstring ptr ) as irr_terrain' scale the texture on a terrain nodedeclare sub IrrScaleTexture CDECL alias "IrrScaleTexture" ( byval terrain as irr_terrain, byval X as single, byval Y as single )'' ////////////////////////////////////////////////////////////////////////////'' Particle Functions' set the size of a particle in the particle systemdeclare sub IrrSetParticleSize CDECL alias "IrrSetParticleSize" ( byval particle_system as irr_particle_system, byval X as single, byval Y as single )' create an emitter that can be added to a particle systemdeclare sub IrrAddParticleEmitter CDECL alias "IrrAddParticleEmitter" ( byval particle_system as irr_particle_system, byval settings as IRR_PARTICLE_EMITTER )' Add an affector to the particle system to fade the particles outdeclare sub IrrAddFadeOutParticleAffector CDECL alias "IrrAddFadeOutParticleAffector" ( byval particle_system as irr_particle_system )' Add an affector to the particle system to alter their position with gravitydeclare sub IrrAddGravityParticleAffector CDECL alias "IrrAddGravityParticleAffector" ( byval particle_system as irr_particle_system, byval x as single, byval y as single, byval z as single )' remove all effectors from this particle systemdeclare sub IrrRemoveAffectors CDECL alias "IrrRemoveAffectors" ( byval particle_system as irr_particle_system )'' ////////////////////////////////////////////////////////////////////////////'' GUI Functions' add a static text object to the gui displaydeclare sub IrrAddStaticText CDECL alias "IrrAddStaticText" ( byval text as wstring ptr, byval TopX as integer, byval TopY as integer, byval BotX as integer, byval BotY as integer, byval border as uinteger, byval wordwrap as uinteger )Yes, I know, this is probably too hard for a noob to do, but I'd love to try.Damn that's alotta code, <3 boxes. Edited January 17, 2007 by JRowe_1
Guest JRowe_1 Posted December 2, 2006 Posted December 2, 2006 Ok, so ENUM is an array. All the variables to begin with are declarations of arrays ' Rendering Device Types ENUM IRR_DEVICE_TYPES IRR_EDT_NULL = 0 ' a NULL device with no display IRR_EDT_SOFTWARE ' Irrlichts default software renderer IRR_EDT_SOFTWARE2 ' An improved quality software renderer IRR_EDT_OPENGL ' hardware accelerated OpenGL renderer IRR_EDT_DIRECT3D8 ' hardware accelerated DirectX 8 renderer IRR_EDT_DIRECT3D9 ' hardware accelerated DirectX 9 renderer END ENUM In Autoit that would be: $IRR_DEVICE_TYPES[1] = "IRR_EDT_NULL" $IRR_DEVICE_TYPES[1] = "IRR_EDT_SOFTWARE" $IRR_DEVICE_TYPES[2] = "IRR_EDT_SOFTWARE2" $IRR_DEVICE_TYPES[3] = "IRR_EDT_OPENGL" $IRR_DEVICE_TYPES[4] = "IRR_EDT_DIRECT3D8" $IRR_DEVICE_TYPES[5] = "IRR_EDT_DIRECT3D9" Which calls IrrlichtWrapper.dll, (the return value is 1 or a 0) , calls IrrStart function from the wrapper, sends : Int, device type. Int, screen height. Int Windowed/fullscreen variable, 1 or a 0 Int UseShadows (1 or a 0) Int Mouse X position Int Mouse Y position I believe this is how the function works. Hopefully, I can rewrite the whole thing tomorrow and start testing. The program flow goes like this: Execute autoit. Autoit opens irrlicht wrapper dll Autoit opens irrlicht dll Autoit function calls wrapper function Wrapper function calls Irrlicht.dll function Etc, etc, which is a good place for me to stop because I am tired and I feel I've made progress. Thanks all for input! If you want to help,PM me tomorrow and I'll let you know where I am and where things are. I'm doing this to get 3D functionality for Autoit.
Valik Posted December 2, 2006 Posted December 2, 2006 Ok, so ENUM is an array.Errr, no, not in any language I've seen. It's an enumeration. That means it creates a named symbol with a constant value. Translating the enumeration into AutoIt code is simple: Enum $IRR_EDT_NULL, $IRR_EDT_SOFTWARE, $IRR_EDT_SOFTWARE2, $IRR_EDT_OPENGL, $IRR_EDT_DIRECT3D8, $IRR_EDT_DIRECT3D9 The symbol $IRR_EDT_NULL has the value 0, $IRR_EDT_SOFTWARE is 1 and so on up to $IRR_EDT_DIRECT3D9 which has the value 5. You can read how Enum works in the AutoIt documentation.
Guest JRowe_1 Posted December 2, 2006 Posted December 2, 2006 Cool. I'm gonna try to set up the barebones minimum required conversion for the engine to run, and I'll post progress. Thanks guys!
Guest JRowe_1 Posted December 2, 2006 Posted December 2, 2006 (edited) Ok, so in converting I ran into a few questions: Is this AutoIt code equivalent to the Freebasic code that follows? ;Flag definition Dim $IRR_OFF = 0 Dim $IRR_ON = 1 ; Input definitions Dim $IRR_KEY_UP = 0 Dim $IRR_KEY_DOWN = 1 '' Constant Definitions ' Flag definition #define IRR_OFF 0 #define IRR_ON 1 ' Input definitions #define IRR_KEY_UP 0 #define IRR_KEY_DOWN 1 And how would I represent this? ' Irrlicht Keyboard and Mouse Event Structures TYPE IRR_MOUSE_EVENT action as uinteger x as integer y as integer END TYPE Edited December 2, 2006 by JRowe_1
Guest JRowe_1 Posted December 2, 2006 Posted December 2, 2006 (edited) Ahhh, sigh. I think yet again I have been taking the wrong tack... so if I ignore the freebasic code except as a reference for everything that is necessary, I can look directly into the c++ code and recreate the wrapper. This is the function IrrStart in the IrrlichtWrapper.dll CODEbool DLL_EXPORT IrrStart( int iDevice, int iWidth, int iHeight, bool boFullscreen, bool boShadows, bool boCaptureEvents ) { bool boInitStatus = false; E_DRIVER_TYPE iDeviceTypes[] = { EDT_NULL, EDT_SOFTWARE, EDT_SOFTWARE2, EDT_OPENGL, EDT_DIRECT3D8, EDT_DIRECT3D9 }; // create an irrlicht device object the root of all irrlicht functionality // if it is successfully created if ( device = createDevice( iDeviceTypes[iDevice], dimension2d<s32>( iWidth, iHeight), 16, boFullscreen, boShadows, false, boCaptureEvents ? &receiver : 0 )) { /* Get a pointer to the video driver, the SceneManager and the graphical user interface environment */ // if we can successfully create these objects if (( driver = device->getVideoDriver()) && ( smgr = device->getSceneManager()) && ( guienv = device->getGUIEnvironment())) boInitStatus = true; } return boInitStatus; } This is the function called by AutoIt: DllCall("IrrlichtWrapper.dll" , "int:cdecl" , "Irrstart" DllCall("IrrlichtWrapper.dll" ,"int:cdel" , "Irrstart" , "int:cdel", $IRR_DEVICE_TYPES , "int:cdel", 600 , "int:cdel", 400, "int:cdel", $_IRR_WINDOWED , "int:cdel", $IRR_SHADOWS , "int:cdel", $MouseX , "int:cdel", $MouseY)oÝ÷ Øay®z-.$x·¶¶Ø^òØ â kzø¨ºÆµé©¶Â¢g®§Ø^~e£§ú+¶ºw-È®´j»ZºÚ"µÍ[ÈÝ ÌÍÒTÑUPÑWÕTTÈ ÌÍÒTÕÒSÕÑQ ÌÍÒTÔÒQÕÔÈ ÌÍÒTÑUSÊBQØ[ ][ÝÒXÚÜ ][ÝÈ ][ÝÚ[ ][ÝÈ ][ÝÒÝ ][ÝÈ ][ÝÚ[ ][ÝË ÌÍÒTÑUPÑWÕTTÈ ][ÝÚ[ ][ÝË ][ÝÚ[ ][ÝË ][ÝÚ[ ][ÝË ÌÍÒTÕÒSÕÑQ ][ÝÚ[ ][ÝË ÌÍÒTÔÒQÕÔÈ ][ÝÚ[ ][ÝÈ ÌÍÒTÑUSÊB[[ Edited December 3, 2006 by JRowe_1
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 Very frustrating doing this from scratch Any chance someone could throw me a bone and tell me how, for example, this function could be called from Autoit? int DLL_EXPORT IrrRunning ( void ) { return device->run(); } Just a few more "Ahh ha!" moments to go, I think I'm getting close
Zedna Posted December 3, 2006 Posted December 3, 2006 Look at DllCall code snippets in this forum, try search for "DllCall" and learn something first...Here is usefull thread to start learning something about DllCall Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted December 3, 2006 Posted December 3, 2006 Any chance someone could throw me a bone and tell me how, for example, this function could be called from Autoit? int DLL_EXPORT IrrRunning ( void ) { return device->run(); }oÝ÷ Ûú®¢×¬jey«¢+ØÀÌØíÉÑÕɸô±± ±° Ìäí%Éɱ¥¡Ñ]ÉÁÁȹ±°Ìäì°Ìäí¥¹ÐÌäì°Ìäí%ÉÉIÕ¹¹¥¹Ìäì¤ Resources UDF ResourcesEx UDF AutoIt Forum Search
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 (edited) Bleh, I'm stuck. I can't get the basic commands to work, no matter how much I twiddle things around. I just lack the basic knowledge necessary to run this stuff. I tried to recreate what happens in the FreeBasic Hello World example and I am plagued by constant AutoIt has encountered a fatal crash as a result of constant errors with the seond dllCall in my script. Unable to execute DLLCall.: Anyway, I'm stuck and I'm trying to learn what I need to do, but I'm starting to frustrate myself, because I try every possible combination of options and it crashes every time. I know I've got to be missing something fundamental here. Anyone have any insight? Edit: Ha, thanks man, I appreciate it! I always post too soon for my own good. I'll keep on kepin on and see where I get. Edited December 3, 2006 by JRowe_1
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 Definitely one of the most vexing problems I've ever encountered. I've read almost every post related to dllCall and I've found nothing that sheds light on the difficulties im having. It's like one of those blacksmith's puzzles that are so easy once you know the trick. There's a trick to this, even if it means changing the source code to the wrapper. Anyone else looked at this? Func IrrRunning() $return = DllCall('IrrlichtWrapper.dll','Int','IrrRunning') EndFunc Is what I had been trying with, and it doesn't work. I tried changing all the type declarations to cdecl , then tried changing each individual, one at a time, then tried changing all the combinations. It's not a cdecl problem, I think.
Valik Posted December 3, 2006 Posted December 3, 2006 There are so many things wrong with that code. First, the types are case sensitive. It's not "Int", it's "int". Second, not only is there no error checking (which would have caught that error), you don't even return anything from your function. You just assign the return value of DllCall() to a variable and do nothing.
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 (edited) Okay, should have been more clear. The function I was using actually looked like this, which is in the codebox from my second to last post. Func IrrRunning() $Run = DllCall($Wrapper ,"int" , "IrrRunning") Return $Run EndFunc Errorchecking as in what? I'm new to this stuff, so theres probably loads of ways I could figure this out totally on my own, except I don't know what those are. And I've looked, but it's a matter of not knowing what to look for, I think. Or how to find out how to learn what to learn to know how to look for what I need to make this work. Or something like that, anyway I believe the code I'm using in my example is perfectly fine as far as acceptable Autoit code goes, so the error isnt syntax. Edited December 3, 2006 by JRowe_1
Zedna Posted December 3, 2006 Posted December 3, 2006 Func IrrRunning() $Run = DllCall($Wrapper ,"int" , "IrrRunning") Return $Run[0] EndFunc Advice: Slow down your coding in the way od trying some wrong from your AutoIt noob head (no offence). Instead sit down open AutoIt HelpFile and read some basics from there Resources UDF ResourcesEx UDF AutoIt Forum Search
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 No offense intended, but I think I have spent more time with the html help file today than is safe or sane. And I've written less than 100 lines of code in the last 2 days (not counting changes of single lines, heh.) I'm very frustrated and annoyed with myself at this point, because it seems like I've wasted 2 days in the expectance of results on something that in all reality now looks like it's a months long project. To be frank, if I can't get things to work on a very basic level early on, I'm not going to spend months on it. I don't have the mentality to work without some sort of concrete success in front of me. Or maybe I've made an idiot mistake somewhere and am missing something critical but easily overlooked... Bleh, I'll try again tomorrow, I think it's time for sleep. Btw, those of you who have spent any time on this at all, I do sincerely appreciate your efforts to help. I'm either too thickheaded or there's more to this than a brief analysis would indicate. Please, please, if you are an Autoit pro, see if you can get the helloworld example to run by just recreating the functions needed to run it. I'll handle all the rest of the functions and probably be able to port in the latest version of irrlicht. The example is in freebasic, but is extremely readable and easy to understand which functions need to be called and how to recreate that example. Just think... 3D gui functionality for your scripts! Free! Fast! Threaded separately by default! I'll send 5 bucks through paypal for a working autoit helloworld example that I can recreate. I'd offer more, but I'm poor, so heh... Alternatively, I'll send 10 dollars to the AutoIt donation fund on request, or for results on a collaborative level.
Zedna Posted December 3, 2006 Posted December 3, 2006 (edited) Don't expect here coding for payment, you are at wrong forum if you wish this.Here are functions for error checking, call them after your DllCall() and you will see where is problem:Func _GetLastError() $aResult = DllCall("Kernel32.dll", "int", "GetLastError") Return $aResult[0] EndFunc Func _FormatMessage($iFlags, $pSource, $iMessageID, $iLanguageID, $pBuffer, $iSize, $vArguments) $aResult = DllCall("Kernel32.dll", "int", "FormatMessageA", "int", $iFlags, "hwnd", $pSource, _ "int", $iMessageID, "int", $iLanguageID, "ptr", $pBuffer, "int", $iSize, _ "ptr", $vArguments) Return $aResult[0] EndFunc Func _GetLastErrorMessage() Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000 $rBuffer = DllStructCreate("char[4096]") $pBuffer = DllStructGetPtr($rBuffer) _FormatMessage($FORMAT_MESSAGE_FROM_SYSTEM, 0, _GetLastError(), 0, $pBuffer, 4096, 0) $sResult = DllStructGetData($rBuffer, 1) $rBuffer = 0 Return $sResult EndFuncEDIT: little code corrections Edited December 3, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 Ok, a nights sleep and some light reading can do wonders to restore one's attitude. Am I correct in assuming that since the script reaches the second dllCall that it is in fact pulling off the first one without a hitch? The second dllCall always ends in a fatal crash of AutoIt, so I'm focussing on figuring out why it is so.
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 nothing changes that I can see, I still get fatal crashes, even after using cdecl in the IrrStart dllCall
Guest JRowe_1 Posted December 3, 2006 Posted December 3, 2006 Ok, how about the feasibility of using the COM functionality in autoIt to use the DirectX APIs ? It might be easier for me to start off with a microsoft oriented technology, given the focus of AutoIt on Windows systems. I'll fiddle with that idea for now, and someday when I'm more experienced with AutoIt I'll come back to this. It should be possible, but it seems like it's out of my league for now. Thanks all for the assistance!
zeroZshadow Posted January 11, 2007 Posted January 11, 2007 u could look a little at the openGL plugin to learn some ? *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now