IrrLua

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
SiriusCG
Posts: 58
Joined: Tue Feb 14, 2006 1:05 am

Post by SiriusCG »

Thx for the info! I'll take a look at the IrrLua.pkg file as you suggest and see what's there.

Thanks for all your hard work on this! 8)
imagination304
Posts: 56
Joined: Mon Jan 09, 2006 2:02 am

Post by imagination304 »

Hi all,

What IDE do you use with irrLua, so that we could easily run and debug inside the IDE?

1. I tried LuaEdit, but it seems that it is only for Lua 5.0 not Lua 5.1
2. I tried gVim, but it seems that it does not support compilation. (In the 'set compiler' options, there is no Lua???)

Thanks in advance.
Hopes everyone here all success!!!
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

imagination304 wrote:Hi all,

What IDE do you use with irrLua, so that we could easily run and debug inside the IDE?

1. I tried LuaEdit, but it seems that it is only for Lua 5.0 not Lua 5.1
2. I tried gVim, but it seems that it does not support compilation. (In the 'set compiler' options, there is no Lua???)

Thanks in advance.

There isn't an IDE, at least not any that are really good that I've found.

I've tried LuaEdit. When I click the close button, I get an error message and have to kill the process. Yuck. no thanks.

I chose to dump 5.0 support when 5.1 came out due to the new binary package standard. I was hoping the rest of the world would adhere to this standard but they haven't so far. There is a lua package called compat-5.1 which works around the issue but I haven't added support for it in IrrLua yet. Adding support means adding 5.0 support back. There are a lot of 5.0 packages available so I'll probably do that in the next release, which should be soon. I have irrlicht 1.1 working with all the examples w00t.

If you are editing '01.HelloWorld.lua" in Vim, to run the program you would type:

Code: Select all

:!lua 01.HelloWorld.lua
(assuming your working directory is the bin directory)


When using Visual Studio 2003 you can open the IrrLua solution and set the 'Examples" project to the active project. The project is setup so that you can hit 'F5' to run Lua. That's what I do when developing on IrrLua, but doesn't really help you develop Lua code. There is also a visual studio plugin that adds lua syntax highlighting and psuedo code completion that's also pretty good.

There used to be a decent debugger in the wxLua project, but the latest release links the lua binaries statically, so there is no way to load binary packages like IrrLua using the wx2.6 release. The old wx2.4 release used to work but I haven't tried it in a while.

The problem with wxLua's debugger is that both it and Irrlicht are processing the window messages. Breakpoints don't always work. What's the point without breakpoints? ;)
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

IrrLua 1.1 has been released with support for Irrlicht 1.1, Lua 5.0.2, and Lua 5.1. Njoy!

P.S. Please note the install location has changed. IrrLua should be extracted under the Irrlicht-1.1\source\ directory, not in the source\Irrlicht folder like it used to be.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
Overlord
Posts: 8
Joined: Sun Jun 18, 2006 2:32 pm
Location: Germany

Post by Overlord »

Great, now we need a C# version. ;)
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

I was wandering about using IrrLua for a game. I've run some demos and I noticed ther's a significant difference in performance between IrrLua and C++Irrlicht. The 04.Movement.lua runs at 120 FPS while the CPP example runs at >450 FPS. Same with the other examples. (Hello Word at 28 FPS !)

I'm I doing something wrong here? I remember reading somewhere IrrLua doesn't have a major speed drop, at least not like what I'm getting.

Thanks
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

The problem with benchmarking some of the examples is that they are set to render in a window and also they are not all set to disable vsync.

Try modifying the examples (cpp and lua) in question so that they run full screen with vsync disabled. When the apps are running in a window your framerate is going to depend upon a lot of things. If you run with vsync on you'll never exceed your monitor's refresh rate for example.

When benchmarking the default example04.exe vs example4.lua, I see wildly varying framerates, mostly due to the fact they render to a window. Both the .exe AND the lua version will go from ~20fps to ~80fps depending on what's happening with the system. Trying to compare results is meaningless here.

Try running CDemo.exe with +full screen -vsync and then again try CDemo.lua with the same options. You should see more comparable results.

Functionally, the only runtime difference between 04.movement.exe and 04.movement.lua is the main rendering loop at the bottom. Everything else would only effect startup time. There are maybe 30-40 extra function calls being made per frame due to Lua overhead; the difference in execution time could be measured in microseconds if not nanoseconds.

If the rendering loop overhead is really bad, you could implement the loop in C++ and call it from Lua without much work. Instead of beginScene();drawAll();endScene(); you would just call something like StartMainRenderingLoop(). That way there would be no Lua overhead at all except for callbacks and what not.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

Ok, thanks for clarifying that out. In fullscreen the lua demo did had same speed as native demo.

Calin.
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

Hey zenaku, I thought you might be interested, We're using IrrLua in this project:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=18067

We'll have a homemade Lua binding eventually (without low level access to Irrlicht), however in the mean time we're using IrrLua.
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

Hey Josh, do you plan updating IrrLua to Irrlicht 1.2?
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

pin3 wrote:Hey Josh, do you plan updating IrrLua to Irrlicht 1.2?
I do at some point, but I'm not sure when I'm going to get back into the project. Maintaining a language binding is about as much fun as pulling teeth :cry:

When I originally started IrrLua, I was hoping to be completed by the time Irrlicht reached 1.0. Now that has, the fun is gone. Glue code is tedious, uncreative work. I will someday, but irrlicht will probably go through a few more minor point revisions before I do. It saves me a lot of work because it's actually easier to do the update from one point revision to the next than it is to make a new release of IrrLua. If you need to use Irrlicht 1.2, I'm pretty sure the IrrLua 1.1 binding will compile against irrlicht 1.2, you just won't have any of the new 1.2 stuff available in Lua.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

I've got it working with Irrlicht 1.2. There were few incompatible bindings, none of them was important so I left them out.
pinballwizard
Posts: 67
Joined: Wed Aug 02, 2006 1:47 am

PATCH: update IrrLua to Irrlicht 1.2

Post by pinballwizard »

zenaku wrote:
pin3 wrote:Hey Josh, do you plan updating IrrLua to Irrlicht 1.2?
I do at some point, but I'm not sure when I'm going to get back into the project. Maintaining a language binding is about as much fun as pulling teeth :cry:

When I originally started IrrLua, I was hoping to be completed by the time Irrlicht reached 1.0. Now that has, the fun is gone. Glue code is tedious, uncreative work. I will someday, but irrlicht will probably go through a few more minor point revisions before I do. It saves me a lot of work because it's actually easier to do the update from one point revision to the next than it is to make a new release of IrrLua. If you need to use Irrlicht 1.2, I'm pretty sure the IrrLua 1.1 binding will compile against irrlicht 1.2, you just won't have any of the new 1.2 stuff available in Lua.
Thanks for your work on IrrLua.

Here's a patch to make it work with 1.2. (EDIT 2006-12-29: updated patch)

The only major problem was in Irrlicht 1.2, the class IAnimatedMeshSceneNode now has 2 new pure virtual functions. This means the class IAnimatedMeshSceneNode cannot be instantiated. However IrrLua tries to generate code to instantiate IAnimatedMeshSceneNode to allow creating new Irrlicht subclasses in Lua (http://irrlua.sourceforge.net/using.html). I therefore removed IAnimatedMeshSceneNode.pkg and IrrLuaIAnimatedMeshSceneNode.pkg from the IrrLua.pkg file, meaning these classes are no longer available to Lua.

EDIT 2006-12-29: In the updated patch below, Irrlicht 1.2's IAnimatedMeshSceneNode is properly implemented and accessible from Lua. The problem was that the new pure virtual functions in the abstract interface IAnimatedMeshSceneNode created two new "holes" in the Lua proxy class implementation that intercepts all virtual function calls and re-reoutes them to Lua functions. Because there was no Lua proxy class implementation of the new pure virtual functions, when compiling IrrLua_imp.cpp, g++ tried to instantiate the abstract IAnimatedMeshSceneNode (because the "holes" created by the new pure virtual functions forced the compiler to seek symbol resolution in the abstract base class, which failed). I fixed this by adding new Lua redirector functions in the Lua proxy class, in tolua/include/IrrLuaIAnimatedMeshSceneNode.h, that now (hopefully) can properly intercept the virtual function calls and redirect them back to Lua functions.

However I'm getting some compiler warnings, "reference to temporary". There were some interfaces that changed from 1.1-1.2, from using call-by-copy parameters to call-by-reference (&) parameters.Maybe this is related to the "reference to temporary" warnings I get when I compile IrrLua. When I have time I'll investigate further. (EDIT 2006-12-29: I get these when compiling IrrLua against Irrlicht 1.1, too, so it's at least not a new problem.)

Also I couldn't quite get the new IGUIColorSelectDialog working, but I think that's not a big loss.

Wading through all of the header diffs between Irrlicht 1.1 and Irrlicht 1.2 wasn't exactly fun, but it did give me a good overview of all the available classes :-)

I copied over new or modified interfaces from the Irrlicht 1.2 header files back into the IrrLua *.pkg files. I didn't always update the comments in the .pkg files when the interface changed, so there may be some minor inconsistencies between the comments and the actual interface. The updated IrrLua interfaces however should be consistent with Irrlicht 1.2, even if the comments are not.

zenaku - it would be helpful if you could give my patch a quick look sometime to make sure there are no glaring errors. Also, could you make some comments about things to be careful about when updating IrrLua from one version to another? Some things I noticed were: multiple constructors seem not to work (only one is chosen and used in IrrLua), and default values on construction are handled with a helper Lua function that sets the default values in Lua then calls the C++ constructor. Any other such "pitfalls" would be helpful in knowing how to keep IrrLua up-to-date.

I hope this project continues to thrive!

NOTE: to get the text of this patch, "quote" this message, then copy the text from the edit box.

NOTE 2: My copy of IrrLua came with source files in DOS format with extra newlines at the end of each line. if you're on Linux, you'll probably need to strip these extra newlines from all your source files for this patch file to work (e.g. you can use a command like "dos2unix").

Code: Select all

diff -Nur IrrLua/include/IrrLuaIAnimatedMeshSceneNode.h IrrLua-new/include/IrrLuaIAnimatedMeshSceneNode.h
--- IrrLua/include/IrrLuaIAnimatedMeshSceneNode.h	2006-12-30 17:40:32.000000000 +0900
+++ IrrLua-new/include/IrrLuaIAnimatedMeshSceneNode.h	2006-12-30 17:41:39.000000000 +0900
@@ -169,6 +169,29 @@
 		lua_pop(L, 1);
 		return  ret;	
 	}
+
+	virtual IAnimatedMesh* getMesh()
+	{
+		GetNode(L, "getMesh");			
+		if(lua_isnil(L, -1))									
+		{
+			warn("IrrLua: pure virtual function 'getMesh' undefined.\n");
+			lua_pop(L, 1);
+			return NULL;
+		}
+
+		GetNode(L);							
+		if(lua_pcall(L, 1, 1, 0) != 0) //FIXME - check if these parms are right?
+		{
+			HandleError(L);
+			return NULL;
+		}
+
+		IAnimatedMesh* ret =  (IAnimatedMesh*) tolua_tousertype(L, -1, NULL);
+		lua_pop(L, 1);
+		return  ret;	
+	}
+
 	
 	virtual ISceneNode* getMS3DJointNode(const c8* jointName)
 	{
@@ -215,6 +238,29 @@
 		lua_pop(L, 1);
 		return  ret;	
 	}
+
+	virtual ISceneNode* getB3DJointNode(const c8* jointName)
+	{
+		GetNode(L, "getB3DJointNode");			
+		if(lua_isnil(L, -1))									
+		{
+			warn("IrrLua: pure virtual function 'getB3DJointNode' undefined.\n");
+			lua_pop(L, 1);
+			return NULL;
+		}
+
+		GetNode(L);		
+		tolua_pushusertype(L, (void *) jointName, "irr::c8");
+		if(lua_pcall(L, 2, 1, 0) != 0)				
+		{
+			HandleError(L);
+			return NULL;
+		}
+
+		ISceneNode *ret = (ISceneNode *) tolua_tousertype(L, -1, NULL);
+		lua_pop(L, 1);
+		return  ret;	
+	}
 	
 	virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim)
 	{
@@ -1148,6 +1194,7 @@
 		}
 	}
 
+
 	
 	///////////////////
 	//IUnknown
diff -Nur IrrLua/pkg/EGUIElementTypes.pkg IrrLua-new/pkg/EGUIElementTypes.pkg
--- IrrLua/pkg/EGUIElementTypes.pkg	2006-12-30 17:40:34.000000000 +0900
+++ IrrLua-new/pkg/EGUIElementTypes.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -16,6 +16,7 @@
     EGUIET_CONTEXT_MENU,
 	EGUIET_EDIT_BOX,
 	EGUIET_FILE_OPEN_DIALOG,
+	EGUIET_COLOR_SELECT_DIALOG,
 	EGUIET_IN_OUT_FADER,
 	EGUIET_IMAGE,
 	EGUIET_LIST_BOX,
diff -Nur IrrLua/pkg/IAnimatedMesh.pkg IrrLua-new/pkg/IAnimatedMesh.pkg
--- IrrLua/pkg/IAnimatedMesh.pkg	2006-12-30 17:40:34.000000000 +0900
+++ IrrLua-new/pkg/IAnimatedMesh.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -44,10 +44,10 @@
 		//! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
 		//! The oct file format contains 3D geometry and lightmaps and can 
 		//! be loaded directly by Irrlicht
-		EAMTS_OCT,
+		EAMT_OCT,
 
 		//! Blitz Basic .b3d file, the file format by Mark Sibly
-		EAMTS_B3D
+		EAMT_B3D
 	};
 
 	//! Interface for an animated mesh.
diff -Nur IrrLua/pkg/IAnimatedMeshB3d.pkg IrrLua-new/pkg/IAnimatedMeshB3d.pkg
--- IrrLua/pkg/IAnimatedMeshB3d.pkg	2006-12-30 17:40:34.000000000 +0900
+++ IrrLua-new/pkg/IAnimatedMeshB3d.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -16,7 +16,7 @@
 		//! objects to parts of animated meshes. For example a weapon to an animated
 		//! hand.
 		//! \param jointNumber: Zero based index of joint. The last joint has the number
-		//! IAnimatedMeshMS3D::getJointCount()-1;
+		//! IAnimatedMeshB3d::getJointCount()-1;
 		//! \param frame: Frame of the animation.
 		//! \return Returns a pointer to the matrix of the mesh part or
 		//! null if an error occured.
@@ -25,9 +25,12 @@
 		//! Returns a pointer to a matrix of a part of the mesh unanimated
 		irr::core::matrix4* getMatrixOfJointUnanimated(s32 jointNumber);
 
-		//! Set a Matrix to be multiplied by the animated joint's matrix each frame
-		//! For example a turning a meshes head
-		void AddMatrixToJoint(s32 jointNumber, irr::core::matrix4* matrix);
+		//! Move this Joint's local matrix when animating
+		//! \param jointNumber: Zero based index of joint. The last joint has the number
+		//! IAnimatedMeshB3d::getJointCount()-1;
+		//! \param On: False= Leave joint's local matrix, True= Animate
+		//! (not used yet)
+		virtual void setJointAnimation(s32 jointNumber, bool On);
 
 		//! Gets joint count.
 		//! \return Returns amount of joints in the skeletal animated mesh.
@@ -43,6 +46,18 @@
 		//! \param name: Name of the joint.
 		//! \return Returns the number of the joint or -1 if not found.
 		s32 getJointNumber(const c8* name);
+
+		//!Sets Interpolation Mode
+		//!0- Constant
+		//!1- Linear (default)
+		virtual void SetInterpolationMode(s32 mode);
+
+		//!Want should happen on when animating
+		//!0-Nothing
+		//!1-Update nodes only
+		//!2-Update skin only
+		//!3-Update both nodes and skin (default)
+		virtual void SetAnimateMode(s32 mode);
 	};
 
 } // end namespace scene
diff -Nur IrrLua/pkg/IAnimatedMeshSceneNode.pkg IrrLua-new/pkg/IAnimatedMeshSceneNode.pkg
--- IrrLua/pkg/IAnimatedMeshSceneNode.pkg	2006-12-30 17:40:35.000000000 +0900
+++ IrrLua-new/pkg/IAnimatedMeshSceneNode.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -34,10 +34,10 @@
 
 		//! Constructor
 /*
-		IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
-			core::vector3d<f32>& position ,
-			core::vector3d<f32>& rotation ,
-			core::vector3d<f32>& scale );
+//		IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
+//			core::vector3d<f32>& position ,
+//			core::vector3d<f32>& rotation ,
+//			core::vector3d<f32>& scale );
 */
 
 		//! Destructor
@@ -116,6 +116,24 @@
 		//! ms3d mesh or the name of the joint could not be found.
 		virtual irr::scene::ISceneNode* getXJointNode(c8* jointName);
 
+		//! Returns a pointer to a child node, wich has the same transformation as
+		//! the corresponding joint, if the mesh in this scene node is a b3d mesh.
+		//! Otherwise 0 is returned. With this method it is possible to
+		//! attach scene nodes to joints more easily. In this way, it is
+		//! for example possible to attach a weapon to the left hand of an
+		//! animated model. This example shows how:
+		//! \code
+		//! ISceneNode* hand =
+		//!		yourB3DAnimatedMeshSceneNode->getB3DJointNode("LeftHand");
+		//! hand->addChild(weaponSceneNode);
+		//! \endcode
+		//! Please note that the SceneNode returned by this method may not exist
+		//! before this call and is created by it.
+		//! \param jointName: Name of the joint.
+		//! \return Returns a pointer to the scene node which represents the joint
+		//! with the specified name. Returns 0 if the contained mesh is not an
+		//! ms3d mesh or the name of the joint could not be found.
+		virtual irr::scene::ISceneNode* getB3DJointNode(const c8* jointName);
 
 		//! Starts a default MD2 animation. 
 		//! With this method it is easily possible to start a Run, Attack,
@@ -164,6 +182,8 @@
 		//! Sets a new mesh
 		virtual void setMesh(irr::scene::IAnimatedMesh* mesh);
 
+		//! Returns the current mesh
+		virtual irr::scene::IAnimatedMesh* getMesh(void);
 
 		////////////////////////////////////////////////////////////////////////////////////////////
 		// ISceneNode
diff -Nur IrrLua/pkg/IAttributes.pkg IrrLua-new/pkg/IAttributes.pkg
--- IrrLua/pkg/IAttributes.pkg	2006-12-30 17:40:35.000000000 +0900
+++ IrrLua-new/pkg/IAttributes.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -34,6 +34,9 @@
 	// 3d vector attribute
 	EAT_VECTOR3D,
 
+        // 2d position attribute
+	EAT_POSITION2D,
+
 	// binary data attribute
 	EAT_BINARY,
 
@@ -79,6 +82,9 @@
 	//! Adds an attribute as 3d vector
 	virtual void addVector3d(c8* attributeName, irr::core::vector3d<f32> value);
 
+	//! Adds an attribute as position
+	virtual void addPosition2d(const c8* attributeName, core::position2df value);
+
 	//! Adds an attribute as binary data
 	virtual void addBinary(c8* attributeName, void* data, s32 dataSizeInBytes);
 
@@ -180,18 +186,30 @@
 	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
 	virtual irr::video::SColorf getAttributeAsColorf(s32 index);
 
-	//! Sets a attribute as vector
+	//! Sets a attribute as 3d vector
 	virtual void setAttribute(c8* attributeName, irr::core::vector3d<f32> v);
 
-	//! Gets an attribute as floating point color
+	//! Gets an attribute as 3d vector
 	//! \param attributeName: Name of the attribute to get.
 	//! \return Returns value of the attribute previously set by setAttribute()
 	virtual irr::core::vector3d<f32> getAttributeAsVector3d(c8* attributeName);
 
-	//! Gets an attribute as floating point color
+	//! Gets an attribute as 3d vector
 	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
 	virtual irr::core::vector3d<f32> getAttributeAsVector3d(s32 index);
 
+	//! Sets a attribute as 2d position
+	virtual void setAttribute(const c8* attributeName, core::position2df v);
+
+	//! Gets an attribute as position
+	//! \param attributeName: Name of the attribute to get.
+	//! \return Returns value of the attribute previously set by setAttribute()
+	virtual core::position2df getAttributeAsPosition2d(const c8* attributeName);
+
+	//! Gets an attribute as position
+	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
+	virtual core::position2df getAttributeAsPosition2d(s32 index);
+
 	//! Sets an attribute as binary data
 	virtual void setAttribute(c8* attributeName, void *data, s32 dataSizeInBytes);
 
diff -Nur IrrLua/pkg/IFileSystem.pkg IrrLua-new/pkg/IFileSystem.pkg
--- IrrLua/pkg/IFileSystem.pkg	2006-12-30 17:40:35.000000000 +0900
+++ IrrLua-new/pkg/IFileSystem.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -52,7 +52,16 @@
 	//! without its complete path.
 	//! \return Returns true if the archive was added successful, false if not.
 	virtual bool addZipFileArchive(c8* filename, bool ignoreCase, bool ignorePaths);
-	
+
+	//! Adds an unzipped archive ( or basedirectory with subdirectories..) to the file system.
+	/** Useful for handling data which will be in a zip file
+	\param filename: Filename of the unzipped zip archive base directory to add to the file system.
+	\param ignoreCase: If set to true, files in the archive can be accessed without
+	writing all letters in the right case.
+	\param ignorePaths: If set to true, files in the added archive can be accessed
+	without its complete path.
+	\return Returns true if the archive was added successful, false if not. */
+	virtual bool addUnZipFileArchive(c8* filename, bool ignoreCase, bool ignorePaths);
 
 	//! Adds an pak archive to the file system.
 	/** After calling this, the Irrlicht Engine will search and open files directly from this archive too. 
@@ -78,6 +87,9 @@
 	//! \return Returns true if successful, otherwise false.
 	virtual bool changeWorkingDirectoryTo(c8* newDirectory);
 
+	//! Converts a relative path to an absolute (unique) path, resolving symbolic links if required
+	virtual irr::core::stringc getAbsolutePath(irr::core::stringc &filename);
+
 	//! Creates a list of files and directories in the current working directory 
 	//! and returns it.
 	//! \return a Pointer to the created IFileList is returned. After the list has been used
diff -Nur IrrLua/pkg/IGUIColorSelectDialog.pkg IrrLua-new/pkg/IGUIColorSelectDialog.pkg
--- IrrLua/pkg/IGUIColorSelectDialog.pkg	1970-01-01 09:00:00.000000000 +0900
+++ IrrLua-new/pkg/IGUIColorSelectDialog.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -0,0 +1,28 @@
+// Copyright (C) 2005-2006 Pinball Wizard, Josh Turpen, Nikolaus Gebhardt
+// This file is part of the IrrLua Lua binding for Irrlicht.
+// For conditions of distribution and use, see copyright notice in IrrLua.h
+
+namespace irr
+{
+namespace gui
+{
+	//! Standard file chooser dialog.
+	class IGUIColorSelectDialog : public irr::gui::IGUIElement
+	{
+	public:
+
+		//! constructor
+		IGUIColorSelectDialog(irr::gui::IGUIEnvironment* environment, 
+                        irr::gui::IGUIElement* parent, 
+                        s32 id, 
+                        irr::core::rect<s32> rectangle);
+
+		//! destructor
+		virtual ~IGUIColorSelectDialog() {};
+
+
+	};
+
+
+} // end namespace gui
+} // end namespace irr
diff -Nur IrrLua/pkg/IGUIEnvironment.pkg IrrLua-new/pkg/IGUIEnvironment.pkg
--- IrrLua/pkg/IGUIEnvironment.pkg	2006-12-30 17:40:37.000000000 +0900
+++ IrrLua-new/pkg/IGUIEnvironment.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -158,6 +158,15 @@
 	//! This pointer should not be dropped. See IUnknown::drop() for more information.
 	virtual irr::gui::IGUIFileOpenDialog* addFileOpenDialog(wchar_t* title, bool modal, irr::gui::IGUIElement* parent, s32 id);
 
+	//! Adds a color select dialog.
+	/** \param modal: Defines if the dialog is modal. This means, that all other
+	 gui elements which were created before the message box cannot be used
+	 until this messagebox is removed.
+	 \return
+	 Returns a pointer to the created file open dialog. Returns 0 if an error occured.
+	 This pointer should not be dropped. See IUnknown::drop() for more information. */
+	// virtual IGUIColorSelectDialog* addColorSelectDialog(wchar_t* title, bool modal, IGUIElement* parent, s32 id);
+
 	//! Adds a static text. The returned pointer must not be dropped.
 	//! \param text is the text to be displayed. Can be altered after creation with SetText().
 	//! \param rectangle is the position of the static text.
@@ -349,7 +358,19 @@
 	irr.cast.delete_wchar_t_ptr(txt)
 	return ret
 end
-	
+
+
+--local _addColorSelectDialog = irr.gui.IGUIEnvironment.addColorSelectDialog 
+--function irr.gui.IGUIEnvironment:addColorSelectDialog(text, modal,  parent, id ) 
+--	id = id or -1
+--	text = text or ""
+--	modal = modal or true
+--	local txt = irr.cast.to_wchar_t_ptr(text)
+--	local ret = _addColorSelectDialog(self, txt, modal, parent, id ) 
+--	irr.cast.delete_wchar_t_ptr(txt)
+--	return ret
+--end
+
 
 local _addEditBox = irr.gui.IGUIEnvironment.addEditBox 
 function irr.gui.IGUIEnvironment:addEditBox(text, rectangle, border, parent, id ) 
diff -Nur IrrLua/pkg/IGUIScrollBar.pkg IrrLua-new/pkg/IGUIScrollBar.pkg
--- IrrLua/pkg/IGUIScrollBar.pkg	2006-12-30 17:40:37.000000000 +0900
+++ IrrLua-new/pkg/IGUIScrollBar.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -21,6 +21,9 @@
 		//! sets the maximum value of the scrollbar. must be > 0
 		virtual void setMax(s32 max);
 
+		//! sets the small step value
+		virtual void setSmallStep(s32 step);
+
 		//! gets the current position of the scrollbar
 		virtual s32 getPos();
 
diff -Nur IrrLua/pkg/IGUISkin.pkg IrrLua-new/pkg/IGUISkin.pkg
--- IrrLua/pkg/IGUISkin.pkg	2006-12-30 17:40:37.000000000 +0900
+++ IrrLua-new/pkg/IGUISkin.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -12,7 +12,8 @@
 	enum EGUI_SKIN_TYPE
 	{
 		EGST_WINDOWS_CLASSIC,
-		EGST_WINDOWS_METALLIC
+		EGST_WINDOWS_METALLIC,
+                EGST_BURNING_SKIN
 	};
 
 	enum EGUI_DEFAULT_COLOR
@@ -82,6 +83,13 @@
 
 		//! height of a default button
 		EGDS_BUTTON_HEIGHT,
+	
+		//! distance for text from background
+		EGDS_TEXT_DISTANCE_X,
+
+		//! distance for text from background
+		EGDS_TEXT_DISTANCE_Y,
+
 		
 		//! this value is not used, it only specifies the amount of default sizes
 		//! available.
diff -Nur IrrLua/pkg/IMeshBuffer.pkg IrrLua-new/pkg/IMeshBuffer.pkg
--- IrrLua/pkg/IMeshBuffer.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/IMeshBuffer.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -6,6 +6,41 @@
 {
 namespace scene
 {
+enum E_PRIMITIVE_TYPE
+{
+	//! All vertices are non-connected points.
+	EPT_POINTS=0,
+
+	//! All vertices form a single connected line.
+	EPT_LINE_STRIP,
+
+	//! Just as LINE_STRIP, but the last and the first vertex is also connected.
+	EPT_LINE_LOOP,
+
+	//! Every two vertices are connected creating n/2 lines.
+	EPT_LINES,
+
+	//! After the first two vertices each vertex defines a new triangle.
+	//! Always the two last and the new one form a new triangle.
+	EPT_TRIANGLE_STRIP,
+
+	//! After the first two vertices each vertex defines a new triangle.
+	//! All around the common first vertex.
+	EPT_TRIANGLE_FAN,
+
+	//! Explicitly set all vertices for each triangle.
+	EPT_TRIANGLES,
+
+	//! After the first two vertices each further tw vetices create a quad with the preceding two.
+	EPT_QUAD_STRIP,
+
+	//! Every four vertices create a quad.
+	EPT_QUADS,
+
+	//! Just as LINE_LOOP, but filled.
+	EPT_POLYGON
+};
+
 	//! Struct for holding a mesh with a single material
 	/** SMeshBuffer is a simple implementation of a MeshBuffer. */
 	class IMeshBuffer : public irr::IUnknown
diff -Nur IrrLua/pkg/IMeshCache.pkg IrrLua-new/pkg/IMeshCache.pkg
--- IrrLua/pkg/IMeshCache.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/IMeshCache.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -29,7 +29,7 @@
 		\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this 
 		parameter, the method will return the mesh parameter given with this method. 
 		\param mesh: Pointer to a mesh which will now be referenced by this name. */ 
-		virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0;
+		virtual void addMesh(const c8* filename, IAnimatedMesh* mesh);
 
 		//! Removes a mesh from the cache.
 		/** After loading a mesh with getMesh(), the mesh can be removed from the cache
diff -Nur IrrLua/pkg/IMeshSceneNode.pkg IrrLua-new/pkg/IMeshSceneNode.pkg
--- IrrLua/pkg/IMeshSceneNode.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/IMeshSceneNode.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -20,6 +20,9 @@
 	//! Sets a new mesh to display
 	virtual void setMesh(irr::scene::IMesh* mesh);
 
+	//! Returns the current mesh
+	virtual IMesh* getMesh(void);
+
 	//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
 	/* In this way it is possible to change the materials a mesh causing all mesh scene nodes 
 	referencing this mesh to change too. */
diff -Nur IrrLua/pkg/IParticleAffector.pkg IrrLua-new/pkg/IParticleAffector.pkg
--- IrrLua/pkg/IParticleAffector.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/IParticleAffector.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -19,15 +19,24 @@
 
 
 //! A particle affector modifies particles.
-class IParticleAffector : public irr::IUnknown
+class IParticleAffector : public virtual io::IAttributeExchangingObject
 {
 
+	//! constructor
+	//IParticleAffector() : Enabled(true) {}
+
 	//! Affects an array of particles.
 	//! \param now: Current time. (Same as ITimer::getTime() would return)
 	//! \param particlearray: Array of particles.
 	//! \param count: Amount of particles in array.
 	virtual void affect(u32 now, irr::scene::SParticle* particlearray, u32 count);
 
+	//! Sets whether or not the affector is currently enabled.
+	virtual void setEnabled(bool enabled);
+
+	//! Gets whether or not the affector is currently enabled.
+	virtual bool getEnabled();
+
 	//! Writes attributes of the object.
 	//! Implement this to expose the attributes of your scene node animator for 
 	//! scripting languages, editors, debuggers or xml serialization purposes.
diff -Nur IrrLua/pkg/IParticleEmitter.pkg IrrLua-new/pkg/IParticleEmitter.pkg
--- IrrLua/pkg/IParticleEmitter.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/IParticleEmitter.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -19,7 +19,7 @@
 //! A particle emitter for using with particle systems.
 /** A Particle emitter emitts new particles into a particle system.
 */
-class IParticleEmitter : public irr::IUnknown
+class IParticleEmitter : public virtual io::IAttributeExchangingObject
 {
 public:
 
diff -Nur IrrLua/pkg/IParticleSystemSceneNode.pkg IrrLua-new/pkg/IParticleSystemSceneNode.pkg
--- IrrLua/pkg/IParticleSystemSceneNode.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/IParticleSystemSceneNode.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -67,9 +67,9 @@
 	//! returned pointer, after you don't need it any more, see
 	//! IUnknown::drop() for more informations.
 	virtual irr::scene::IParticleEmitter* createPointEmitter(
-		irr::core::vector3d<f32> direction, 
+		irr::core::vector3d<f32>& direction, 
 		u32 minParticlesPerSecond,
-		u32 maxParticlePerSecond,
+		u32 maxParticlesPerSecond,
 		irr::video::SColor minStartColor,
 		irr::video::SColor maxStartColor,
 		u32 lifeTimeMin, u32 lifeTimeMax,
@@ -96,7 +96,16 @@
 	//! just call setEmitter(). Note that you'll have to drop() the
 	//! returned pointer, after you don't need it any more, see
 	//! IUnknown::drop() for more informations.
-	virtual irr::scene::IParticleEmitter* createBoxEmitter( irr::core::aabbox3d<f32> box, irr::core::vector3d<f32> direction, u32 minParticlesPerSecond, u32 maxParticlePerSecond, irr::video::SColor minStartColor, irr::video::SColor maxStartColor, u32 lifeTimeMin, u32 lifeTimeMax, s32 maxAngleDegrees);
+	virtual irr::scene::IParticleEmitter* createBoxEmitter( 
+                irr::core::aabbox3d<f32>& box, 
+                irr::core::vector3d<f32>& direction, 
+                u32 minParticlesPerSecond, 
+                u32 maxParticlePerSecond, 
+                irr::video::SColor minStartColor, 
+                irr::video::SColor maxStartColor, 
+                u32 lifeTimeMin, 
+                u32 lifeTimeMax, 
+                s32 maxAngleDegrees);
 
 	//! Creates a fade out particle affector. This affector modifies
 	//! the color of every particle and and reaches the final color
@@ -130,7 +139,7 @@
 	//! just call addAffector(). Note that you'll have to drop() the
 	//! returned pointer, after you don't need it any more, see
 	//! IUnknown::drop() for more informations.
-	virtual irr::scene::IParticleAffector* createGravityAffector( irr::core::vector3d<f32> gravity, u32 timeForceLost);
+	virtual irr::scene::IParticleAffector* createGravityAffector( irr::core::vector3d<f32>& gravity, u32 timeForceLost);
 
 
 		////////////////////////////////////////////////////////////////////////////////////////////
@@ -430,6 +439,28 @@
 							maxAngleDegrees)
 end
 	
+local _createPointEmitter = irr.scene.IParticleSystemSceneNode.createPointEmitter
+function irr.scene.IParticleSystemSceneNode:createPointEmitter(direction, minParticlesPerSecond, 
+															maxParticlesPerSecond, minStartColor, maxStartColor, 
+															lifeTimeMin, lifeTimeMax, maxAngleDegrees)
+
+	direction = direction or irr.core.vector3d(0,0.3, 0)
+	minParticlesPerSecond = minParticlesPerSecond or 5
+	maxParticlesPerSecond = maxParticlesPerSecond or 10
+
+	minStartColor = minStartColor or irr.video.SColor(255,0,0,0)
+	maxStartColor = maxStartColor or irr.video.SColor(255,255,255,255)	
+		
+	lifeTimeMin = lifeTimeMin or 2000
+	lifeTimeMax = lifeTimeMax or 4000
+	maxAngleDegrees = maxAngleDegrees or 0
+
+	return _createPointEmitter(self, direction, minParticlesPerSecond, 
+							maxParticlesPerSecond, minStartColor, maxStartColor, 
+							lifeTimeMin, lifeTimeMax, 
+							maxAngleDegrees)
+end
+	
 
 
 local _createFadeOutParticleAffector = irr.scene.IParticleSystemSceneNode.createFadeOutParticleAffector
diff -Nur IrrLua/pkg/ISceneCollisionManager.pkg IrrLua-new/pkg/ISceneCollisionManager.pkg
--- IrrLua/pkg/ISceneCollisionManager.pkg	2006-12-30 17:40:38.000000000 +0900
+++ IrrLua-new/pkg/ISceneCollisionManager.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -48,7 +48,7 @@
 		//! \param outFallint: Is set to true if the ellipsoid is falling down, caused
 		//! by gravity.
 		//! \return Returns the new position of the ellipsoid.
-		virtual core::vector3df getCollisionResultPosition(
+		virtual core::vector3d<f32> getCollisionResultPosition(
 			irr::scene::ITriangleSelector* selector,
 			irr::core::vector3d<f32>& ellipsoidPosition,
 			irr::core::vector3d<f32>& ellipsoidRadius, 
diff -Nur IrrLua/pkg/ISceneManager.pkg IrrLua-new/pkg/ISceneManager.pkg
--- IrrLua/pkg/ISceneManager.pkg	2006-12-30 17:40:39.000000000 +0900
+++ IrrLua-new/pkg/ISceneManager.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -19,10 +19,16 @@
 	//! Enumeration for render passes.
 	enum E_SCENE_NODE_RENDER_PASS
 	{
-		//! Scene nodes which are lights or camera should use this,
-		//! the very first pass.
+		//! Deprecated. You should use ESNRP_LIGHT or ESNRP_CAMERA instead
 		ESNRP_LIGHT_AND_CAMERA,	
 
+		//! Camera pass. The active view is set up here.
+		//! The very first pass.
+		ESNRP_CAMERA,
+
+		//! In this pass, lights are transformed into camera space and added to the driver
+		ESNRP_LIGHT,
+
 		//! This is used for sky boxes.
 		ESNRP_SKY_BOX,
 
@@ -521,8 +527,9 @@
 		//! and the animator will animate it.
 		//! If you no longer need the animator, you should call ISceneNodeAnimator::drop().
 		//! See IUnknown::drop() for more information.
-		//virtual ISceneNodeAnimator* createFlyCircleAnimator(core::vector3df& center, f32 radius, f32 speed);
-		virtual irr::scene::ISceneNodeAnimator* createFlyCircleAnimator(irr::core::vector3d<f32>& center, f32 radius, f32 speed);
+		//virtual ISceneNodeAnimator* createFlyCircleAnimator(core::vector3df& center,
+		//	f32 radius, f32 speed, core::vector3df& direction);
+		virtual irr::scene::ISceneNodeAnimator* createFlyCircleAnimator(irr::core::vector3d<f32>& center, f32 radius, f32 speed, irr::core::vector3d<f32>& direction);
 
 		//! Creates a fly straight animator, which lets the attached scene node
 		//! fly or move along a line between two points.
@@ -928,11 +935,12 @@
 end
 
 local _createFlyCircleAnimator = irr.scene.ISceneManager.createFlyCircleAnimator 
-function irr.scene.ISceneManager:createFlyCircleAnimator(vector1, radius, speed)
+function irr.scene.ISceneManager:createFlyCircleAnimator(vector1, radius, speed, direction)
 	vector1 = vector1 or irr.core.vector3d(0,0,0)
 	radius = radius or 0
 	speed = speed or 0.001
-	return _createFlyCircleAnimator(self, vector1, radius, speed)
+        direction = direction or irr.core.vector3d(0,1,0)
+	return _createFlyCircleAnimator(self, vector1, radius, speed, direction)
 end
 
 local _createFlyStraightAnimator = irr.scene.ISceneManager.createFlyStraightAnimator 
diff -Nur IrrLua/pkg/ISceneNode.pkg IrrLua-new/pkg/ISceneNode.pkg
--- IrrLua/pkg/ISceneNode.pkg	2006-12-30 17:40:39.000000000 +0900
+++ IrrLua-new/pkg/ISceneNode.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -142,9 +142,10 @@
 		//! This function is needed for inserting the node into the scene hirachy on a
 		//! optimal position for minimizing renderstate changes, but can also be used
 		//! to directly modify the material of a scene node.
-		//! \param i: Zero based index i. The maximal value for this may be getMaterialCount() - 1.
+		//! \param num: Zero based index. The maximal value is getMaterialCount() - 1.
 		//! \return Returns the material of that index.
-		virtual irr::video::SMaterial& getMaterial(s32 i);
+		virtual irr::video::SMaterial& getMaterial(s32 num);
+
 
 
 		//! Returns amount of materials used by this scene node.
diff -Nur IrrLua/pkg/ITerrainSceneNode.pkg IrrLua-new/pkg/ITerrainSceneNode.pkg
--- IrrLua/pkg/ITerrainSceneNode.pkg	2006-12-30 17:40:39.000000000 +0900
+++ IrrLua-new/pkg/ITerrainSceneNode.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -95,8 +95,11 @@
 		//! Returns center of terrain.
 		virtual irr::core::vector3d<f32> getTerrainCenter();
 
+		//! Returns height of a point of the terrain.
+		virtual f32 getHeight( f32 x, f32 y );
 		//! Sets the movement camera threshold which is used to determine when to recalculate
 		//! indices for the scene node.  The default value is 10.0f.
+
 		virtual void setCameraMovementDelta(f32 delta);
 
 		//! Sets the rotation camera threshold which is used to determine when to recalculate
diff -Nur IrrLua/pkg/ITexture.pkg IrrLua-new/pkg/ITexture.pkg
--- IrrLua/pkg/ITexture.pkg	2006-12-30 17:40:39.000000000 +0900
+++ IrrLua-new/pkg/ITexture.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -141,6 +141,9 @@
 	//! Returns name of texture (in most cases this is the filename)
 	irr::core::stringc& getName();
 
+	//! Returns texture transformation matrix
+	irr::core::matrix4& getTransformation();
+
 	//////////////////////////////////////////////////////////////////////////////////////	
 	//IUnknown
 	//////////////////////////////////////////////////////////////////////////////////////
diff -Nur IrrLua/pkg/IVideoDriver.pkg IrrLua-new/pkg/IVideoDriver.pkg
--- IrrLua/pkg/IVideoDriver.pkg	2006-12-30 17:40:39.000000000 +0900
+++ IrrLua-new/pkg/IVideoDriver.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -20,16 +20,22 @@
 	enum E_VIDEO_DRIVER_FEATURE
 	{
 		//! Is driver able to render to a surface?
-		EVDF_RENDER_TO_TARGET = 0,	
-
-		//! Is driver able to render with a bilinear filter applied?
-		EVDF_BILINEAR_FILTER,			
+		EVDF_RENDER_TO_TARGET = 0,
 
 		//! Is hardeware transform and lighting supported?
-		EVDF_HARDWARE_TL,			
+		EVDF_HARDWARE_TL,
+
+		//! Are multiple textures per material possible?
+		EVDF_MULTITEXTURE,
+
+		//! Is driver able to render with a bilinear filter applied?
+		EVDF_BILINEAR_FILTER,
 
 		//! Can the driver handle mip maps?
-		EVDF_MIP_MAP,		
+		EVDF_MIP_MAP,
+
+		//! Can the driver update mip maps automatically?
+		EVDF_MIP_MAP_AUTO_UPDATE,
 
 		//! Are stencilbuffers switched on and does the device support stencil buffers?
 		EVDF_STENCIL_BUFFER,
@@ -66,10 +72,18 @@
 
 		//! Are ARB fragment programs v1.0 supported?
 		EVDF_ARB_FRAGMENT_PROGRAM_1,
-		
+
+		//! Is GLSL supported?
 		EVDF_ARB_GLSL,
-		
-		EVDF_HLSL
+
+		//! Is HLSL supported?
+		EVDF_HLSL,
+
+		//! Are non-power-of-two textures supported?
+		EVDF_TEXTURE_NPOT,
+
+		//! Are framebuffer objects supported?
+		EVDF_FRAMEBUFFER_OBJECT
 	};
 
 	//! enumeration for geometry transformation states
@@ -201,7 +215,7 @@
 		//! cases have the ECF_A1R5G5B5 or ECF_A8R8G8B8 format.
 		virtual irr::video::ITexture *addTexture(c8 *name, IImage *image);
 
-		virtual irr::video::ITexture *createRenderTargetTexture(irr::core::dimension2d<s32> size);
+		virtual irr::video::ITexture *createRenderTargetTexture(irr::core::dimension2d<s32>& size);
 
 		//! Removes a texture from the texture cache and deletes it, freeing lot of
 		//! memory. Please note that after calling this, the pointer to the ITexture
@@ -264,6 +278,21 @@
 		//! \return Returns rectangle of the current vieport.
 		virtual irr::core::rect<s32>& getViewPort();
 
+		//! draws a vertex primitive list
+		/** Note that there may be at maximum 65536 vertices, because the
+		index list is an array of 16 bit values each with a maximum value
+		of 65536. If there are more than 65536 vertices in the list,
+		results of this operation are not defined.
+		\param vertices: Pointer to array of vertices.
+		\param vertexCount: Amount of vertices in the array.
+		\param indexList: Pointer to array of indizes.
+		\param triangleCount: amount of Triangles.
+		\param vType: Vertex type, e.g. EVT_STANDARD for S3DVertex.
+		\param pType: Primitive type, e.g. EPT_TRIANGLE_FAN for a triangle fan. */
+		virtual void drawVertexPrimitiveList(void* vertices, 
+                        s32 vertexCount, u16* indexList, s32 triangleCount, 
+                        E_VERTEX_TYPE vType, irr::scene::E_PRIMITIVE_TYPE pType);
+
 		//! Draws an indexed triangle list.
 		//! Note that there may be at maximum 65536 vertices, because the
 		//! index list is a array of 16 bit values each with a maximum value 
@@ -386,6 +415,29 @@
 			irr::core::rect<s32>& sourceRect, irr::core::rect<s32>* clipRect,
 			SColor irr::video::color, bool useAlphaChannelOfTexture);
 
+		//! draws a set of 2d images, using a color and the alpha
+		/** channel of the texture if desired. The images are drawn
+		beginning at pos and concatenated in one line. All drawings
+		are clipped against clipRect (if != 0).
+		The subtextures are defined by the array of sourceRects
+		and are chosen by the indices given.
+		\param texture: Texture to be drawn.
+		\param pos: Upper left 2d destination position where the image will be drawn.
+		\param sourceRects: Source rectangles of the image.
+		\param indices: List of indices which choose the actual rectangle used each time.
+		\param clipRect: Pointer to rectangle on the screen where the image is clipped to.
+		This pointer can be 0. Then the image is not clipped.
+		\param color: Color with which the image is colored.
+		Note that the alpha component is used: If alpha is other than 255, the image will be transparent.
+		\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
+		used to draw the image. */
+		virtual void draw2DImage(irr::video::ITexture* texture,
+				irr::core::position2d<s32>& pos,
+				irr::core::array<core::rect<s32> >& sourceRects,
+				irr::core::array<s32>& indices,
+				irr::core::rect<s32>* clipRect, SColor color,
+				bool useAlphaChannelOfTexture);
+
 		//! Draws a part of the texture into the rectangle. Suggested and first implemented by zola.
 		//! \param texture: the texture to draw from 
 		//! \param destRect: the rectangle to draw into 
@@ -493,6 +545,11 @@
 		//! \return Size of screen or render window.
 		irr::core::dimension2d<s32> getScreenSize();
 
+		//! Returns the size of the current render target, or the screen size if the driver 
+		//! doesnt support render to texture
+		/** \return Size of render target or screen/window */
+		virtual irr::core::dimension2d<s32> getCurrentRenderTargetSize();
+
 		//! Returns current frames per second value.
 		//! \return Returns amount of frames per second drawn.
 		virtual s32 getFPS();
diff -Nur IrrLua/pkg/IXMLWriter.pkg IrrLua-new/pkg/IXMLWriter.pkg
--- IrrLua/pkg/IXMLWriter.pkg	2006-12-30 17:40:40.000000000 +0900
+++ IrrLua-new/pkg/IXMLWriter.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -36,6 +36,11 @@
 			wchar_t* attr4Name, wchar_t* attr4Value,
 			wchar_t* attr5Name, wchar_t* attr5Value);
 
+		//! Writes an xml element with any number of attributes
+		virtual void writeElement(wchar_t* name, bool empty,
+				irr::core::array<irr::core::stringw> &names, 
+                                irr::core::array<irr::core::stringw> &values);
+
 		//! Writes a comment into the xml file
 		virtual void writeComment(wchar_t* comment);
 
diff -Nur IrrLua/pkg/S3DVertex.pkg IrrLua-new/pkg/S3DVertex.pkg
--- IrrLua/pkg/S3DVertex.pkg	2006-12-30 17:40:41.000000000 +0900
+++ IrrLua-new/pkg/S3DVertex.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -29,11 +29,11 @@
 	//S3DVertex();
 
 	//! constructor
-	S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor& c, f32 tu, f32 tv);
+	S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv);
 
 	//! constructor
 	//S3DVertex(irr::core::vector3d<f32>& pos, irr::core::vector3d<f32>& normal,
-	//	video::SColor& color, irr::core::vector2d<f32>& tcoords);
+	//	video::SColor color, irr::core::vector2d<f32>& tcoords);
 
 	//! Position
 	irr::core::vector3d<f32> Pos;	
diff -Nur IrrLua/pkg/SColor.pkg IrrLua-new/pkg/SColor.pkg
--- IrrLua/pkg/SColor.pkg	2006-12-30 17:40:41.000000000 +0900
+++ IrrLua-new/pkg/SColor.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -7,44 +7,49 @@
 namespace video  
 {
 	
-	s16 RGB16(s32 r, s32 g, s32 b);
-	s16 RGBA16(s32 r, s32 g, s32 b, s32 a);
-	s16 X8R8G8B8toA1R5G5B5(s32 color);
-	s32 getAlpha(s16 color);
-	s32 getRed(s16 color);
-	s32 getGreen(s16 color);
-	s32 getBlue(s16 color);
-	s32 getLuminance(s16 color);
-	s32 A1R5G5B5toA8R8G8B8(s16 color);
-	s32 R5G6B5toA8R8G8B8(s16 color);
-	s16 R5G6B5toA1R5G5B5(s16 color);
-	s16 A1R5G5B5toR5G6B5(s16 color);
+	u16 RGB16(u32 r, u32 g, u32 b);
+	u16 RGBA16(u32 r, u32 g, u32 b, u32 a);
+	u16 RGB16from16(u16 r, u16 g, u16 b);
+	u16 X8R8G8B8toA1R5G5B5(u32 color);
+	u32 getAlpha(u16 color);
+	u32 getRed(u16 color);
+	u32 getGreen(u16 color);
+	u32 getBlue(u16 color);
+	s32 getRedSigned(u16 color);
+	s32 getGreenSigned(u16 color);
+	s32 getBlueSigned(u16 color);
+	u32 getLuminance(u16 color);
+	u32 A1R5G5B5toA8R8G8B8(u32 color);
+	u32 R5G6B5toA8R8G8B8(u16 color);
+	u16 R5G6B5toA1R5G5B5(u16 color);
+	u16 A1R5G5B5toR5G6B5(u16 color);
 	
 	class SColor
 	{
 		//inline SColor();
-		SColor(s32 a, s32 r, s32 g, s32 b);
-		//inline SColor(s32 clr);
+		SColor(u32 a, u32 r, u32 g, u32 b);
+		//inline SColor(u32 clr);
 
 
-		 s32 getAlpha();
-		 s32 getRed();
-		 s32 getGreen();
-		s32 getBlue();
-
-		void setAlpha(s32 a);
-		void setRed(s32 r);
-		void setGreen(s32 g);
-		 void setBlue(s32 b);
-
-		s16 toA1R5G5B5();
-		s32 toOpenGLColor(); 
-		void set(s32 a, s32 r, s32 g, s32 b);
+		 u32 getAlpha();
+		 u32 getRed();
+		 u32 getGreen();
+		u32 getBlue();
+        	u32 getLuminance();
+
+		void setAlpha(u32 a);
+		void setRed(u32 r);
+		void setGreen(u32 g);
+		 void setBlue(u32 b);
+
+		u16 toA1R5G5B5();
+		void toOpenGLColor(u8* dest);
+		void set(u32 a, u32 r, u32 g, u32 b);
 		bool operator==(SColor& other);
 
 		//inline bool operator!=(SColor& other);
 
-		SColor getInterpolated(SColor other, f32 d);
+		SColor getInterpolated(SColor& other, f32 d);
         
 		s32 color; 
 		
diff -Nur IrrLua/pkg/SIrrCreationParameters.pkg IrrLua-new/pkg/SIrrCreationParameters.pkg
--- IrrLua/pkg/SIrrCreationParameters.pkg	2006-12-30 17:40:41.000000000 +0900
+++ IrrLua-new/pkg/SIrrCreationParameters.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -114,7 +114,7 @@
 		//! Don't use or change this parameter. 
 		/** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
 		This is needed for sdk version checks. */
-		char* SDK_version_do_not_use;
+		c8* SDK_version_do_not_use;
 	};
 
 
diff -Nur IrrLua/pkg/aabbox3d.pkg IrrLua-new/pkg/aabbox3d.pkg
--- IrrLua/pkg/aabbox3d.pkg	2006-12-30 17:40:42.000000000 +0900
+++ IrrLua-new/pkg/aabbox3d.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -17,6 +17,7 @@
 		// Constructors
 
 		aabbox3d();
+		aabbox3d(irr::core::aabbox3d<T>& other);
 		aabbox3d(irr::core::vector3d<T>& min, irr::core::vector3d<T>& max);
 		aabbox3d(irr::core::vector3d<T>& init);
 		aabbox3d(T minx, T miny, T minz, T maxx, T maxy, T maxz);
diff -Nur IrrLua/pkg/irrMath.pkg IrrLua-new/pkg/irrMath.pkg
--- IrrLua/pkg/irrMath.pkg	2006-12-30 17:40:42.000000000 +0900
+++ IrrLua-new/pkg/irrMath.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -33,6 +33,9 @@
 	inline f32 max_(const f32 a, const f32 b);
 
 	inline bool equals(const f32 a, const f32 b);
+	inline s32 floor32 ( f32 x );
+	inline s32 ceil32 ( f32 x );
+	inline s32 round32 ( f32 x );
 
 } // end namespace core
 }// end namespace irr
diff -Nur IrrLua/pkg/rect.pkg IrrLua-new/pkg/rect.pkg
--- IrrLua/pkg/rect.pkg	2006-12-30 17:40:43.000000000 +0900
+++ IrrLua-new/pkg/rect.pkg	2006-12-30 17:41:41.000000000 +0900
@@ -37,6 +37,9 @@
 
 		//rect<T>& operator+=(position2d<T>& pos);
 		
+		rect<T> operator-(position2d<T>& pos);
+
+		// rect<T>& operator-=(position2d<T>& pos);
 
         bool operator == (irr::core::rect<T>& other);
 		

zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Re: PATCH: update IrrLua to Irrlicht 1.2

Post by zenaku »

Thanks for your work on IrrLua.

Here's a patch to make it work with 1.2. (EDIT 2006-12-29: updated patch)

The only major problem was in Irrlicht 1.2, the class IAnimatedMeshSceneNode now has 2 new pure virtual functions. This means the class IAnimatedMeshSceneNode cannot be instantiated. However IrrLua tries to generate code to instantiate IAnimatedMeshSceneNode to allow creating new Irrlicht subclasses in Lua (http://irrlua.sourceforge.net/using.html). I therefore removed IAnimatedMeshSceneNode.pkg and IrrLuaIAnimatedMeshSceneNode.pkg from the IrrLua.pkg file, meaning these classes are no longer available to Lua.

EDIT 2006-12-29: In the updated patch below, Irrlicht 1.2's IAnimatedMeshSceneNode is properly implemented and accessible from Lua. The problem was that the new pure virtual functions in the abstract interface IAnimatedMeshSceneNode created two new "holes" in the Lua proxy class implementation that intercepts all virtual function calls and re-reoutes them to Lua functions. Because there was no Lua proxy class implementation of the new pure virtual functions, when compiling IrrLua_imp.cpp, g++ tried to instantiate the abstract IAnimatedMeshSceneNode (because the "holes" created by the new pure virtual functions forced the compiler to seek symbol resolution in the abstract base class, which failed). I fixed this by adding new Lua redirector functions in the Lua proxy class, in tolua/include/IrrLuaIAnimatedMeshSceneNode.h, that now (hopefully) can properly intercept the virtual function calls and redirect them back to Lua functions.
Yep that's the general fix for those. In all honesty, a lot of those classes are pretty useless. You would never want to implement your own IAnimatedMeshSceneNode in Lua, but I give you the ability through IrrLuaIAnimatedMeshSceneNode anyway. It's just too slow performance-wise.
However I'm getting some compiler warnings, "reference to temporary". There were some interfaces that changed from 1.1-1.2, from using call-by-copy parameters to call-by-reference (&) parameters.Maybe this is related to the "reference to temporary" warnings I get when I compile IrrLua. When I have time I'll investigate further. (EDIT 2006-12-29: I get these when compiling IrrLua against Irrlicht 1.1, too, so it's at least not a new problem.)
The 'reference to temporary' can't be avoided; it's generated by tolua++. I just disable the warning when compiling any generated files in the IrrLua project files. The reference is actually refering to a variable on the Lua stack, so the compiler doesn't know it's temporary or not.
Also I couldn't quite get the new IGUIColorSelectDialog working, but I think that's not a big loss.

Wading through all of the header diffs between Irrlicht 1.1 and Irrlicht 1.2 wasn't exactly fun, but it did give me a good overview of all the available classes :-)
That's pretty much the process of updating IrrLua versions. I just windiff "Irrlicht-1.1/include" and "Irrlicht-1.2/include". If I'm lucky, not much has changed and the update is easy.
I copied over new or modified interfaces from the Irrlicht 1.2 header files back into the IrrLua *.pkg files. I didn't always update the comments in the .pkg files when the interface changed, so there may be some minor inconsistencies between the comments and the actual interface. The updated IrrLua interfaces however should be consistent with Irrlicht 1.2, even if the comments are not.
Again, IrrLua already has this problem from how I've updated it from 0.6 to 1.1. Like you, I didn't always copy the comments but just made sure the interface was consistent.
zenaku - it would be helpful if you could give my patch a quick look sometime to make sure there are no glaring errors. Also, could you make some comments about things to be careful about when updating IrrLua from one version to another? Some things I noticed were: multiple constructors seem not to work (only one is chosen and used in IrrLua), and default values on construction are handled with a helper Lua function that sets the default values in Lua then calls the C++ constructor. Any other such "pitfalls" would be helpful in knowing how to keep IrrLua up-to-date.

I hope this project continues to thrive!

NOTE: to get the text of this patch, "quote" this message, then copy the text from the edit box.

NOTE 2: My copy of IrrLua came with source files in DOS format with extra newlines at the end of each line. if you're on Linux, you'll probably need to strip these extra newlines from all your source files for this patch file to work (e.g. you can use a command like "dos2unix").
I'm familiar with diff and patch but it's been a while since I've used them :oops: How would I apply the patch?



Here are some general tips for using tolua++:

1. Avoid 'const' at ALL costs in pkg files.

tolua++ says it supports it, but I've had very wierd errors from the parser corrupting stuff. If you avoid const in the pkg files everything seems to work ok.

2. Default parameters:
tolua++ says it supports these as well. Sometimes they work, sometimes they don't and throw parser errors. I just avoid them when possible and implement them on the Lua side.

In Lua you can set defaults like this:

Code: Select all


-- void foo(int x=640,int y=480, bool z=true,bool a=false);

function foo(x,y,z,a)
   x = x or 640
   y = y or 480
   z = z and z   -- default to true 
   a = a or false  -- default to false
end

Note the default to true boolean is a little tricky and has to do with how nil compares to boolean.


3. Multiple default constructors

tolua++ says it supports this, but it really depends on the arguments and the order the constructors appear in the package file.

Code: Select all

class foo
{
     public:
    foo();
    foo(int x);
    foo(char *s);
};
The last function defined is the first one tried, basically. tolua++ does support inspecting the types and calling the right values. The problem is that char * isn't directly supported so I have to wrap that in lua glue code. It supports std::string, but not char *. If irrlicht was standardized on std::string instead of char *, wchar_t *, IrrString(), tchar *, etc IrrLua would have been a lot easier :).

4. This code is equivalent:

Code: Select all

  local foo = some_c_func:new_local()
  return foo
and

Code: Select all

  local foo = some_c_fun:new()
  tolua.takeownership(foo)
  return foo

5. DirectX by default is not supported with Lua 5.1

DirectX breaks the FPU ABI which Lua depends on. To get around it, any call to CreateDevice() with EDT_DIRECT3D8/9 as parameter routes to CreateDeviceEx() with PRESERVE_FPU flag set to be compatible with Lua 5.1.


6. Linking new IrrLua projects with IrrLua

You'll probably want to use IrrLua as a base and then implement higher levels of abstraction on top. For example you may have a C++ Player() object that you create in Lua script. It's a much higher level interface than IrrLua. Once done, you'd have a Player.dll and Player.lua.dll to link in with IrrLua.dll and Irrlicht.dll.

You implement the Player() in C++, export it using tolua++ to Lua, and now you can access it, but now you want to set it's parent scene node. The Player() object is in C++ but it still uses Irrlicht underneath so these things will come up in your design.

Code: Select all

    void Player::SetParent(ISceneNode *parent);
To do it in Lua, you can either deal with the C-data type ISceneNode yourself, or you can link in IrrLua and get a definition for it. If you use IrrLua, you won't have to define it yourself.

In your Player.pkg file, you can include the IrrLua .pkg files you need like ISceneNode.pkg and link against IrrLua.lib. This way, from the IrrLua interpreter, the ISceneNode generated by IrrLua is compatible with the ISceneNode that Player::SetParent() is expecting. You can successfully create a TestSceneNode() in IrrLua script and then pass it to the Player::SetParent() method without type collisions from tolua++ this way.

If you look at the 03.CustomSceneNode, you can see an example of how this is done. The CustomSceneNode.pkg includes the other pkg files and links against IrrLua.lib.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
pinballwizard
Posts: 67
Joined: Wed Aug 02, 2006 1:47 am

Re: PATCH: update IrrLua to Irrlicht 1.2

Post by pinballwizard »

Wow, thanks for the detailed response. Just a quick answer to your question:
zenaku wrote:
I'm familiar with diff and patch but it's been a while since I've used them :oops: How would I apply the patch?
First quote this message, then copy the text from the edit box and save it to a file patch.txt.

Then, under Linux, you can do:

% cd IrrLua

% find . -type f | xargs dos2unix
This command eliminates all dos-format line endings and changes them to unix-format line endings. It also corrupts all binary files, but we plan to recompile anyway. You can also change the dos-format endings to unix-format manually by editing each source file then removing the ^M at the end of each line. Under Windows, I don't know what you need to to; probably nothing. The important thing is that the patch file and the source files have the same newline convention, else patch will barf.

% patch -p1 < ../patch.txt
patching file include/IrrLuaIAnimatedMeshSceneNode.h
patching file pkg/EGUIElementTypes.pkg
patching file pkg/IAnimatedMesh.pkg
patching file pkg/IAnimatedMeshB3d.pkg
patching file pkg/IAnimatedMeshSceneNode.pkg
patching file pkg/IAttributes.pkg
patching file pkg/IFileSystem.pkg
patching file pkg/IGUIColorSelectDialog.pkg
patching file pkg/IGUIEnvironment.pkg
patching file pkg/IGUIScrollBar.pkg
patching file pkg/IGUISkin.pkg
patching file pkg/IMeshBuffer.pkg
patching file pkg/IMeshCache.pkg
patching file pkg/IMeshSceneNode.pkg
patching file pkg/IParticleAffector.pkg
patching file pkg/IParticleEmitter.pkg
patching file pkg/IParticleSystemSceneNode.pkg
patching file pkg/ISceneCollisionManager.pkg
patching file pkg/ISceneManager.pkg
patching file pkg/ISceneNode.pkg
patching file pkg/ITerrainSceneNode.pkg
patching file pkg/ITexture.pkg
patching file pkg/IVideoDriver.pkg
patching file pkg/IXMLWriter.pkg
patching file pkg/S3DVertex.pkg
patching file pkg/SColor.pkg
patching file pkg/SIrrCreationParameters.pkg
patching file pkg/aabbox3d.pkg
patching file pkg/irrMath.pkg
patching file pkg/rect.pkg
Post Reply