00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LUGRE_LUABIND_OGREHELPER_H
00025 #define LUGRE_LUABIND_OGREHELPER_H
00026
00027 #include "lugre_luabind_direct.h"
00028 #include "lugre_fifo.h"
00029 #include <Ogre.h>
00030
00031 namespace Lugre {
00032
00033 class cLuaBindDirectOgreHelper : public cLuaBindDirectQuickWrapHelper { public:
00034 static inline int PushColourValue (lua_State *L,const Ogre::ColourValue& v) { PushNumber(L,v.r); PushNumber(L,v.g); PushNumber(L,v.b); PushNumber(L,v.a); return 4; }
00035 static inline int PushQuaternion (lua_State *L,const Ogre::Quaternion& v) { PushNumber(L,v.w); PushNumber(L,v.x); PushNumber(L,v.y); PushNumber(L,v.z); return 4; }
00036 static inline int PushVector4 (lua_State *L,const Ogre::Vector4& v) { PushNumber(L,v.w); PushNumber(L,v.x); PushNumber(L,v.y); PushNumber(L,v.z); return 4; }
00037 static inline int PushVector3 (lua_State *L,const Ogre::Vector3& v) { PushNumber(L,v.x); PushNumber(L,v.y); PushNumber(L,v.z); return 3; }
00038 static inline int PushVector2 (lua_State *L,const Ogre::Vector2& v) { PushNumber(L,v.x); PushNumber(L,v.y); return 2; }
00039 static inline int PushAxisAlignedBox (lua_State *L,const Ogre::AxisAlignedBox& v) { PushVector3(L,v.getMinimum()); PushVector3(L,v.getMaximum()); return 6; }
00040
00041 static inline int PushMatrix4 (lua_State *L,const Ogre::Matrix4& v) { for (int iRow=0;iRow<4;++iRow) for (int iCol=0;iCol<4;++iCol) PushNumber(L,v[iRow][iCol]); return 16; }
00042 static inline Ogre::Matrix4 ParamMatrix4 (lua_State *L,int i) { float m[4][4]; ParamFloatArr(L,i,&m[0][0],16); return Ogre::Matrix4(m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3],m[3][0],m[3][1],m[3][2],m[3][3]); }
00043
00044 static inline Ogre::Vector2 ParamVector2 (lua_State *L,int i) { float arr[2]; ParamFloatArr(L,i,arr,2); return Ogre::Vector2( arr[0],arr[1]); }
00045 static inline Ogre::Vector3 ParamVector3 (lua_State *L,int i) { float arr[3]; ParamFloatArr(L,i,arr,3); return Ogre::Vector3( arr[0],arr[1],arr[2]); }
00046 static inline Ogre::Vector4 ParamVector4 (lua_State *L,int i) { float arr[4]; ParamFloatArr(L,i,arr,4); return Ogre::Vector4( arr[0],arr[1],arr[2],arr[3]); }
00047 static inline Ogre::ColourValue ParamColourValue (lua_State *L,int i) { float arr[4]; ParamFloatArr(L,i,arr,4); return Ogre::ColourValue( arr[0],arr[1],arr[2],arr[3]); }
00048 static inline Ogre::Quaternion ParamQuaternion (lua_State *L,int i) { float arr[4]; ParamFloatArr(L,i,arr,4); return Ogre::Quaternion( arr[0],arr[1],arr[2],arr[3]); }
00049 static inline Ogre::AxisAlignedBox ParamAxisAlignedBox (lua_State *L,int i) { float arr[6]; ParamFloatArr(L,i,arr,6); return Ogre::AxisAlignedBox( arr[0],arr[1],arr[2],arr[3],arr[4],arr[5]); }
00050 static inline void* ParamFIFOData (lua_State *L,int i) { return (void*)cLuaBind<cFIFO>::checkudata_alive(L,i)->HackGetRawReader(); }
00051
00052 static inline int PushRadian (lua_State *L,const Ogre::Radian& v) { PushNumber(L,v.valueRadians()); return 1; }
00053 static inline Ogre::Radian ParamRadian (lua_State *L,int i) { return (Ogre::Radian)ParamNumber(L,i); }
00054
00055 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre::Node ,TransformSpace)
00056 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre ,PolygonMode)
00057 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre ,ProjectionType)
00058 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre ,FogMode)
00059 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre ,ShadowTechnique)
00060 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre ,PixelFormat)
00061 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre ,TextureType)
00062 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre::Light ,LightTypes)
00063 LUABIND_DIRECTWRAP_HELPER_ENUM(Ogre::SceneManager ,SpecialCaseRenderQueueMode)
00064
00065
00066 #define LUABIND_DIRECTWRAP_HELPER_OGRE_SHARED_PTR(name) static inline int Push##name##Ptr (lua_State *L,const Ogre::name##Ptr& v) { return Push##name(L,v.getPointer()); }
00067 LUABIND_DIRECTWRAP_HELPER_OGRE_SHARED_PTR(Skeleton)
00068 LUABIND_DIRECTWRAP_HELPER_OGRE_SHARED_PTR(Mesh)
00069 LUABIND_DIRECTWRAP_HELPER_OGRE_SHARED_PTR(Texture)
00070
00071 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,MovableObject )
00072 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Renderable )
00073 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Resource )
00074 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Node )
00075 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Light )
00076 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,SceneManager )
00077 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Frustum )
00078 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Camera )
00079 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,SceneNode )
00080 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,VertexData )
00081 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,IndexData )
00082 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Skeleton )
00083 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Bone )
00084 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Animation )
00085 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Mesh )
00086 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,SubMesh )
00087 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Entity )
00088 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,AnimationTrack )
00089 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,NodeAnimationTrack )
00090 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,AnimationState )
00091 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,KeyFrame )
00092 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,NumericKeyFrame )
00093 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,TransformKeyFrame )
00094 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,VertexMorphKeyFrame )
00095 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,VertexPoseKeyFrame )
00096 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Image )
00097 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Texture )
00098 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,RenderOperation )
00099 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,VertexDeclaration )
00100
00101
00102 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,Viewport )
00103 LUABIND_DIRECTWRAP_HELPER_OBJECT_PREFIX(Ogre ,RenderQueue )
00104
00105 LUABIND_DIRECTWRAP_HELPER_PUSH_COPY(Ogre ,Image )
00106
00107 };
00108
00109 };
00110
00111 #endif