Просмотр исходного кода

Merge branch 'next' of https://github.com/blackberry/GamePlay into next

Steve Grenier 13 лет назад
Родитель
Сommit
c7194b34ef
66 измененных файлов с 1497 добавлено и 201 удалено
  1. 8 0
      gameplay-encoder/gameplay-encoder.xcodeproj/project.pbxproj
  2. 1 0
      gameplay-encoder/src/Object.h
  3. 1 1
      gameplay-encoder/src/Thread.h
  4. 2 2
      gameplay/res/shaders/textured-unlit.vert
  5. 1 0
      gameplay/src/Animation.h
  6. 16 0
      gameplay/src/AudioListener.cpp
  7. 30 0
      gameplay/src/AudioListener.h
  8. 5 0
      gameplay/src/AudioSource.cpp
  9. 9 0
      gameplay/src/AudioSource.h
  10. 11 8
      gameplay/src/Base.h
  11. 11 0
      gameplay/src/BoundingBox.cpp
  12. 24 0
      gameplay/src/BoundingBox.h
  13. 10 10
      gameplay/src/DebugNew.cpp
  14. 17 0
      gameplay/src/FileSystem.cpp
  15. 9 0
      gameplay/src/FileSystem.h
  16. 5 0
      gameplay/src/Font.cpp
  17. 15 0
      gameplay/src/Font.h
  18. 5 0
      gameplay/src/Frustum.cpp
  19. 11 0
      gameplay/src/Frustum.h
  20. 5 0
      gameplay/src/Game.cpp
  21. 13 0
      gameplay/src/Game.h
  22. 20 0
      gameplay/src/Light.cpp
  23. 52 0
      gameplay/src/Light.h
  24. 19 19
      gameplay/src/Material.cpp
  25. 11 9
      gameplay/src/Material.h
  26. 6 0
      gameplay/src/Mesh.h
  27. 1 0
      gameplay/src/Node.h
  28. 5 0
      gameplay/src/PhysicsCharacter.cpp
  29. 14 0
      gameplay/src/PhysicsCharacter.h
  30. 36 0
      gameplay/src/PhysicsRigidBody.h
  31. 24 0
      gameplay/src/PhysicsRigidBody.inl
  32. 11 0
      gameplay/src/Plane.cpp
  33. 19 0
      gameplay/src/Plane.h
  34. 2 2
      gameplay/src/PlatformAndroid.cpp
  35. 1 1
      gameplay/src/PlatformMacOSX.mm
  36. 1 1
      gameplay/src/PlatformQNX.cpp
  37. 2 2
      gameplay/src/PlatformWin32.cpp
  38. 2 2
      gameplay/src/PlatformiOS.mm
  39. 16 0
      gameplay/src/Ray.cpp
  40. 30 0
      gameplay/src/Ray.h
  41. 5 5
      gameplay/src/Ref.cpp
  42. 2 0
      gameplay/src/Scene.h
  43. 40 8
      gameplay/src/ScriptController.cpp
  44. 1 1
      gameplay/src/ScriptController.h
  45. 1 1
      gameplay/src/lua/lua_Animation.cpp
  46. 99 3
      gameplay/src/lua/lua_AudioListener.cpp
  47. 29 1
      gameplay/src/lua/lua_AudioSource.cpp
  48. 92 2
      gameplay/src/lua/lua_BoundingBox.cpp
  49. 40 0
      gameplay/src/lua/lua_FileSystem.cpp
  50. 1 0
      gameplay/src/lua/lua_FileSystem.h
  51. 127 1
      gameplay/src/lua/lua_Font.cpp
  52. 32 1
      gameplay/src/lua/lua_Frustum.cpp
  53. 45 1
      gameplay/src/lua/lua_Game.cpp
  54. 0 37
      gameplay/src/lua/lua_Global.cpp
  55. 0 3
      gameplay/src/lua/lua_Global.h
  56. 1 1
      gameplay/src/lua/lua_Joint.cpp
  57. 165 7
      gameplay/src/lua/lua_Light.cpp
  58. 0 51
      gameplay/src/lua/lua_Material.cpp
  59. 0 1
      gameplay/src/lua/lua_Material.h
  60. 7 7
      gameplay/src/lua/lua_Mesh.cpp
  61. 1 1
      gameplay/src/lua/lua_Node.cpp
  62. 29 1
      gameplay/src/lua/lua_PhysicsCharacter.cpp
  63. 116 4
      gameplay/src/lua/lua_PhysicsRigidBody.cpp
  64. 72 2
      gameplay/src/lua/lua_Plane.cpp
  65. 109 3
      gameplay/src/lua/lua_Ray.cpp
  66. 2 2
      gameplay/src/lua/lua_Scene.cpp

+ 8 - 0
gameplay-encoder/gameplay-encoder.xcodeproj/project.pbxproj

@@ -58,6 +58,7 @@
 		42D277591472EFA700D867A4 /* libpcre.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42D277571472EFA700D867A4 /* libpcre.a */; };
 		42D2775A1472EFA700D867A4 /* libpcrecpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42D277581472EFA700D867A4 /* libpcrecpp.a */; };
 		5BCD0643152CFC3C0071FAB5 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5BCD0642152CFC3C0071FAB5 /* libpng.a */; };
+		F18DCD0615D554B800DB35DB /* Heightmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F18DCD0315D554B800DB35DB /* Heightmap.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -172,6 +173,9 @@
 		42D277571472EFA700D867A4 /* libpcre.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpcre.a; path = "../external-deps/pcre/lib/macosx/libpcre.a"; sourceTree = "<group>"; };
 		42D277581472EFA700D867A4 /* libpcrecpp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpcrecpp.a; path = "../external-deps/pcre/lib/macosx/libpcrecpp.a"; sourceTree = "<group>"; };
 		5BCD0642152CFC3C0071FAB5 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/libpng/lib/macosx/libpng.a"; sourceTree = "<group>"; };
+		F18DCD0315D554B800DB35DB /* Heightmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Heightmap.cpp; path = src/Heightmap.cpp; sourceTree = SOURCE_ROOT; };
+		F18DCD0415D554B800DB35DB /* Heightmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Heightmap.h; path = src/Heightmap.h; sourceTree = SOURCE_ROOT; };
+		F18DCD0515D554B800DB35DB /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Thread.h; path = src/Thread.h; sourceTree = SOURCE_ROOT; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -213,6 +217,9 @@
 		42475CE9147208A000610A6A /* src */ = {
 			isa = PBXGroup;
 			children = (
+				F18DCD0315D554B800DB35DB /* Heightmap.cpp */,
+				F18DCD0415D554B800DB35DB /* Heightmap.h */,
+				F18DCD0515D554B800DB35DB /* Thread.h */,
 				42C8EDB714724CD700E43619 /* Animation.cpp */,
 				42C8EDB814724CD700E43619 /* Animation.h */,
 				42C8EDB914724CD700E43619 /* AnimationChannel.cpp */,
@@ -416,6 +423,7 @@
 				4283905914896E6C00E2B2F5 /* BoundingVolume.cpp in Sources */,
 				42783423148D6F7500A6E27F /* FBXSceneEncoder.cpp in Sources */,
 				4251B12C152D044B002F6199 /* Curve.cpp in Sources */,
+				F18DCD0615D554B800DB35DB /* Heightmap.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 1 - 0
gameplay-encoder/src/Object.h

@@ -2,6 +2,7 @@
 #define OBJ_H_
 
 #include "FileIO.h"
+#include "Base.h"
 
 namespace gameplay
 {

+ 1 - 1
gameplay-encoder/src/Thread.h

@@ -65,7 +65,7 @@ namespace gameplay
         delete data;
         data = NULL;
         int retVal = threadFunction(arg);
-        pthread_exit(retVal);
+        pthread_exit((void*)retVal);
     }
 
     static bool createThread(THREAD_HANDLE* handle, int(*threadFunction)(void*), void* arg)

+ 2 - 2
gameplay/res/shaders/textured-unlit.vert

@@ -49,9 +49,9 @@ void main()
     v_texCoord1 = a_texCoord1;
     #endif
     #if defined(TEXTURE_REPEAT)
-    v_texCoord *= u_textureRepeat;
+    v_texCoord0 *= u_textureRepeat;
     #endif
     #if defined(TEXTURE_OFFSET)
-    v_texCoord += u_textureOffset;
+    v_texCoord0 += u_textureOffset;
     #endif
 }

+ 1 - 0
gameplay/src/Animation.h

@@ -59,6 +59,7 @@ public:
      * @param end The time (in milliseconds) that the AnimationClip will end.
      * 
      * @return The newly created AnimationClip; NULL if an AnimationClip already exists with the same ID.
+     * @script{create}
      */
     AnimationClip* createClip(const char* id, unsigned long start, unsigned long end);
     

+ 16 - 0
gameplay/src/AudioListener.cpp

@@ -41,6 +41,11 @@ void AudioListener::setPosition(const Vector3& position)
     _position = position;
 }
 
+void AudioListener::setPosition(float x, float y, float z)
+{
+    _position.set(x, y, z);
+}
+
 const Vector3& AudioListener::getVelocity() const 
 { 
     return _velocity; 
@@ -51,6 +56,11 @@ void AudioListener::setVelocity(const Vector3& velocity)
     _velocity = velocity;
 }
 
+void AudioListener::setVelocity(float x, float y, float z)
+{
+    _velocity.set(x, y, z);
+}
+
 const float* AudioListener::getOrientation() const
 {
     return (const float*)&_orientation[0];
@@ -77,6 +87,12 @@ void AudioListener::setOrientation(const Vector3& forward, const Vector3& up)
     _orientation[1].z = up.z;
 }
 
+void AudioListener::setOrientation(float forwardX, float forwardY, float forwardZ, float upX, float upY, float upZ)
+{
+    _orientation[0].set(forwardX, forwardY, forwardZ);
+    _orientation[1].set(upX, upY, upZ);
+}
+
 Camera* AudioListener::getCamera() const
 {
     return _camera;

+ 30 - 0
gameplay/src/AudioListener.h

@@ -40,6 +40,15 @@ public:
      */
     void setPosition(const Vector3& position);
 
+    /**
+     * Sets the position of the audio source.
+     * 
+     * @param x The x coordinate of the position.
+     * @param y The y coordinate of the position.
+     * @param z The z coordinate of the position.
+     */
+    void setPosition(float x, float y, float z);
+
     /**
      * Returns the gain of the audio listener.
      *
@@ -68,6 +77,15 @@ public:
      */
     void setVelocity(const Vector3& velocity);
 
+    /**
+     * Sets the velocity of the audio source
+     * 
+     * @param x The x coordinate of the velocity.
+     * @param y The y coordinate of the velocity.
+     * @param z The z coordinate of the velocity.
+     */
+    void setVelocity(float x, float y, float z);
+
     /**
      * Gets the float pointer to the orientation of the audio listener.
      * Orientation is represented as 6 floats. (forward.x, forward.y, forward.z, up.x, up.y, up.z).
@@ -99,6 +117,18 @@ public:
      */
     void setOrientation(const Vector3& forward, const Vector3& up);
 
+    /**
+     * Sets the orientation of the audio listener.
+     * 
+     * @param forwardX The x coordinate of the forward vector.
+     * @param forwardY The y coordinate of the forward vector.
+     * @param forwardZ The z coordinate of the forward vector.
+     * @param upX The x coordinate of the up vector.
+     * @param upY The y coordinate of the up vector.
+     * @param upZ The z coordinate of the up vector.
+     */
+    void setOrientation(float forwardX, float forwardY, float forwardZ, float upX, float upY, float upZ);
+
     /**
      * Gets the camera currently associated with the audio listener.
      *

+ 5 - 0
gameplay/src/AudioSource.cpp

@@ -233,6 +233,11 @@ void AudioSource::setVelocity(const Vector3& velocity)
     _velocity = velocity;
 }
 
+void AudioSource::setVelocity(float x, float y, float z)
+{
+    setVelocity(Vector3(x, y, z));
+}
+
 Node* AudioSource::getNode() const
 {
     return _node;

+ 9 - 0
gameplay/src/AudioSource.h

@@ -141,6 +141,15 @@ public:
      */
     void setVelocity(const Vector3& velocity);
 
+    /**
+     * Sets the velocity of the audio source.
+     *
+     * @param x The x coordinate of the velocity.
+     * @param y The y coordinate of the velocity.
+     * @param z The z coordinate of the velocity.
+     */
+    void setVelocity(float x, float y, float z);
+
     /**
      * Gets the node that this source is attached to.
      * 

+ 11 - 8
gameplay/src/Base.h

@@ -49,8 +49,11 @@ using std::modf;
 
 namespace gameplay
 {
-/** Print logging (implemented per platform). */
-extern void printError(const char* format, ...);
+/**
+ * Print logging (implemented per platform).
+ * @script{ignore}
+ */
+extern void print(const char* format, ...);
 }
 
 // Current function macro.
@@ -73,9 +76,9 @@ extern void printError(const char* format, ...);
 #else
 #define GP_ERROR(...) do \
     { \
-        printError("%s -- ", __current__func__); \
-        printError(__VA_ARGS__); \
-        printError("\n"); \
+        gameplay::print("%s -- ", __current__func__); \
+        gameplay::print(__VA_ARGS__); \
+        gameplay::print("\n"); \
         assert(0); \
         std::exit(-1); \
     } while (0)
@@ -84,9 +87,9 @@ extern void printError(const char* format, ...);
 // Warning macro.
 #define GP_WARN(...) do \
     { \
-        printError("%s -- ", __current__func__); \
-        printError(__VA_ARGS__); \
-        printError("\n"); \
+        gameplay::print("%s -- ", __current__func__); \
+        gameplay::print(__VA_ARGS__); \
+        gameplay::print("\n"); \
     } while (0)
 
 // Bullet Physics

+ 11 - 0
gameplay/src/BoundingBox.cpp

@@ -15,6 +15,11 @@ BoundingBox::BoundingBox(const Vector3& min, const Vector3& max)
     set(min, max);
 }
 
+BoundingBox::BoundingBox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
+{
+    set(minX, minY, minZ, maxX, maxY, maxZ);
+}
+
 BoundingBox::BoundingBox(const BoundingBox& copy)
 {
     set(copy);
@@ -247,6 +252,12 @@ void BoundingBox::set(const Vector3& min, const Vector3& max)
     this->max = max;
 }
 
+void BoundingBox::set(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
+{
+    min.set(minX, minY, minZ);
+    max.set(maxX, maxY, maxZ);
+}
+
 static void updateMinMax(Vector3* point, Vector3* min, Vector3* max)
 {
     GP_ASSERT(point);

+ 24 - 0
gameplay/src/BoundingBox.h

@@ -36,6 +36,18 @@ public:
      */
     BoundingBox(const Vector3& min, const Vector3& max);
 
+    /**
+     * Constructs a new bounding box from the specified values.
+     * 
+     * @param minX The x coordinate of the minimum point of the bounding box.
+     * @param minY The y coordinate of the minimum point of the bounding box.
+     * @param minZ The z coordinate of the minimum point of the bounding box.
+     * @param maxX The x coordinate of the maximum point of the bounding box.
+     * @param maxY The y coordinate of the maximum point of the bounding box.
+     * @param maxZ The z coordinate of the maximum point of the bounding box.
+     */
+    BoundingBox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ);
+
     /**
      * Constructs a new bounding box from the given bounding box.
      *
@@ -163,6 +175,18 @@ public:
      */
     void set(const Vector3& min, const Vector3& max);
 
+    /**
+     * Sets this bounding box to the specified values.
+     * 
+     * @param minX The x coordinate of the minimum point of the bounding box.
+     * @param minY The y coordinate of the minimum point of the bounding box.
+     * @param minZ The z coordinate of the minimum point of the bounding box.
+     * @param maxX The x coordinate of the maximum point of the bounding box.
+     * @param maxY The y coordinate of the maximum point of the bounding box.
+     * @param maxZ The z coordinate of the maximum point of the bounding box.
+     */
+    void set(float minX, float minY, float minZ, float maxX, float maxY, float maxZ);
+
     /**
      * Sets this bounding box to the specified bounding box.
      *

+ 10 - 10
gameplay/src/DebugNew.cpp

@@ -122,7 +122,7 @@ void* debugAlloc(std::size_t size, const char* file, int line)
         if (!initialized)
         {
             if (!SymInitialize(GetCurrentProcess(), NULL, true))
-                gameplay::printError("Stack trace tracking will not work.\n");
+                gameplay::print("Stack trace tracking will not work.\n");
             initialized = true;
         }
     
@@ -181,7 +181,7 @@ void debugFree(void* p)
     // Sanity check: ensure that address in record matches passed in address
     if (rec->address != (unsigned long)p)
     {
-        gameplay::printError("[memory] CORRUPTION: Attempting to free memory address with invalid memory allocation record.\n");
+        gameplay::print("[memory] CORRUPTION: Attempting to free memory address with invalid memory allocation record.\n");
         return;
     }
 
@@ -221,7 +221,7 @@ void printStackTrace(MemoryAllocationRecord* rec)
         symbol->MaxNameLength = bufferSize;
         if (!SymGetSymFromAddr64(GetCurrentProcess(), pc, &displacement, symbol))
         {
-            gameplay::printError("[memory] STACK TRACE: <unknown location>\n");
+            gameplay::print("[memory] STACK TRACE: <unknown location>\n");
         }
         else
         {
@@ -243,7 +243,7 @@ void printStackTrace(MemoryAllocationRecord* rec)
                     line.SizeOfStruct = sizeof(line);
                     if (!SymGetLineFromAddr64(GetCurrentProcess(), pc, &displacement, &line))
                     {
-                        gameplay::printError("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>\n", symbol->Name);
+                        gameplay::print("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>\n", symbol->Name);
                     }
                     else
                     {
@@ -253,7 +253,7 @@ void printStackTrace(MemoryAllocationRecord* rec)
                         else
                             file++;
                         
-                        gameplay::printError("[memory] STACK TRACE: %s - %s:%d\n", symbol->Name, file, line.LineNumber);
+                        gameplay::print("[memory] STACK TRACE: %s - %s:%d\n", symbol->Name, file, line.LineNumber);
                     }
                 }
             }
@@ -267,24 +267,24 @@ extern void printMemoryLeaks()
     // Dump general heap memory leaks
     if (__memoryAllocationCount == 0)
     {
-        gameplay::printError("[memory] All HEAP allocations successfully cleaned up (no leaks detected).\n");
+        gameplay::print("[memory] All HEAP allocations successfully cleaned up (no leaks detected).\n");
     }
     else
     {
-        gameplay::printError("[memory] WARNING: %d HEAP allocations still active in memory.\n", __memoryAllocationCount);
+        gameplay::print("[memory] WARNING: %d HEAP allocations still active in memory.\n", __memoryAllocationCount);
         MemoryAllocationRecord* rec = __memoryAllocations;
         while (rec)
         {
 #ifdef WIN32
             if (rec->trackStackTrace)
             {
-                gameplay::printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d:\n", rec->address, rec->size);
+                gameplay::print("[memory] LEAK: HEAP allocation leak at address %#x of size %d:\n", rec->address, rec->size);
                 printStackTrace(rec);
             }
             else
-                gameplay::printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+                gameplay::print("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
 #else
-            gameplay::printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+            gameplay::print("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
 #endif
             rec = rec->next;
         }

+ 17 - 0
gameplay/src/FileSystem.cpp

@@ -305,6 +305,23 @@ char* FileSystem::readAll(const char* filePath, int* fileSize)
     return buffer;
 }
 
+bool FileSystem::isAbsolutePath(const char* filePath)
+{
+    if (filePath == 0 || filePath[0] == '\0')
+        return false;
+#ifdef WIN32
+    if (strlen(filePath) >= 2)
+    {
+        char first = filePath[0];
+        if (filePath[1] == ':' && ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')))
+            return true;
+    }
+    return false;
+#else
+    return filePath[0] == '/';
+#endif
+}
+
 void createFileFromAsset(const char* path)
 {
 #ifdef __ANDROID__

+ 9 - 0
gameplay/src/FileSystem.h

@@ -129,6 +129,15 @@ public:
      */
     static char* readAll(const char* filePath, int* fileSize = NULL);
 
+    /**
+     * Determines if the file path is an absolute path for the current platform.
+     * 
+     * @param filePath The file path to test.
+     * 
+     * @return True if the path is an absolute path or false otherwise.
+     */
+    static bool isAbsolutePath(const char* filePath);
+
 private:
 
     /**

+ 5 - 0
gameplay/src/Font.cpp

@@ -541,6 +541,11 @@ void Font::drawText(const char* text, int x, int y, const Vector4& color, unsign
     }
 }
 
+void Font::drawText(const char* text, int x, int y, float red, float green, float blue, float alpha, unsigned int size, bool rightToLeft)
+{
+    drawText(text, x, y, Vector4(red, green, blue, alpha), size, rightToLeft);
+}
+
 void Font::drawText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size, Justify justify, bool wrap, bool rightToLeft, const Rectangle* clip)
 {
     GP_ASSERT(text);

+ 15 - 0
gameplay/src/Font.h

@@ -128,6 +128,21 @@ public:
      */
     void drawText(const char* text, int x, int y, const Vector4& color, unsigned int size = 0, bool rightToLeft = false);
 
+    /**
+     * Draws the specified text in a solid color, with a scaling factor.
+     * 
+     * @param text The text to draw.
+     * @param x The viewport x position to draw text at.
+     * @param y The viewport y position to draw text at.
+     * @param red The red channel of the text color.
+     * @param green The green channel of the text color.
+     * @param blue The blue channel of the text color.
+     * @param alpha The alpha channel of the text color.
+     * @param size The size to draw text (0 for default size).
+     * @param rightToLeft Whether to draw text from right to left.
+     */
+    void drawText(const char* text, int x, int y, float red, float green, float blue, float alpha, unsigned int size = 0, bool rightToLeft = false);
+
     /**
      * Draws the specified text within a rectangular area, with a specified alignment and scale.
      * Clips text outside the viewport. Optionally wraps text to fit within the width of the viewport.

+ 5 - 0
gameplay/src/Frustum.cpp

@@ -93,6 +93,11 @@ bool Frustum::intersects(const Vector3& point) const
     return true;
 }
 
+bool Frustum::intersects(float x, float y, float z) const
+{
+    return intersects(Vector3(x, y, z));
+}
+
 bool Frustum::intersects(const BoundingSphere& sphere) const
 {
     return sphere.intersects(*this);

+ 11 - 0
gameplay/src/Frustum.h

@@ -122,6 +122,17 @@ public:
      */
     bool intersects(const Vector3& point) const;
 
+    /**
+     * Tests whether this frustum instersects the specified point.
+     *
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     * @param z The z coordinate.
+     *
+     * @return true if the specified point intersects this frustum; false otherwise.
+     */
+    bool intersects(float x, float y, float z) const;
+
     /**
      * Tests whether this frustum intersects the specified bounding sphere.
      *

+ 5 - 0
gameplay/src/Game.cpp

@@ -408,6 +408,11 @@ void Game::clear(ClearFlags flags, const Vector4& clearColor, float clearDepth,
     glClear(bits);
 }
 
+void Game::clear(ClearFlags flags, float red, float green, float blue, float alpha, float clearDepth, int clearStencil)
+{
+    clear(flags, Vector4(red, green, blue, alpha), clearDepth, clearStencil);
+}
+
 AudioListener* Game::getAudioListener()
 {
     if (_audioListener == NULL)

+ 13 - 0
gameplay/src/Game.h

@@ -196,6 +196,19 @@ public:
      */
     void clear(ClearFlags flags, const Vector4& clearColor, float clearDepth, int clearStencil);
 
+    /**
+     * Clears the specified resource buffers to the specified clear values. 
+     * 
+     * @param flags The flags indicating which buffers to be cleared.
+     * @param red The red channel.
+     * @param green The green channel.
+     * @param blue The blue channel.
+     * @param alpha The alpha channel.
+     * @param clearDepth The depth value to clear to when the flags includes the color buffer.
+     * @param clearStencil The stencil value to clear to when the flags includes the color buffer.
+     */
+    void clear(ClearFlags flags, float red, float green, float blue, float alpha, float clearDepth, int clearStencil);
+
     /**
      * Gets the audio controller for managing control of audio
      * associated with the game.

+ 20 - 0
gameplay/src/Light.cpp

@@ -47,16 +47,31 @@ Light* Light::createDirectional(const Vector3& color)
     return new Light(DIRECTIONAL, color);
 }
 
+Light* Light::createDirectional(float red, float green, float blue)
+{
+    return new Light(DIRECTIONAL, Vector3(red, green, blue));
+}
+
 Light* Light::createPoint(const Vector3& color, float range)
 {
     return new Light(POINT, color, range);
 }
 
+Light* Light::createPoint(float red, float green, float blue, float range)
+{
+    return new Light(POINT, Vector3(red, green, blue), range);
+}
+
 Light* Light::createSpot(const Vector3& color, float range, float innerAngle, float outerAngle)
 {
     return new Light(SPOT, color, range, innerAngle, outerAngle);
 }
 
+Light* Light::createSpot(float red, float green, float blue, float range, float innerAngle, float outerAngle)
+{
+    return new Light(SPOT, Vector3(red, green, blue), range, innerAngle, outerAngle);
+}
+
 Light::Type Light::getLightType() const
 {
     return _type;
@@ -115,6 +130,11 @@ void Light::setColor(const Vector3& color)
     }
 }
 
+void Light::setColor(float red, float green, float blue)
+{
+    setColor(Vector3(red, green, blue));
+}
+
 float Light::getRange()  const
 {
     GP_ASSERT(_type != DIRECTIONAL);

+ 52 - 0
gameplay/src/Light.h

@@ -35,9 +35,22 @@ public:
      * @param color Color of the light.
      * 
      * @return The new directional light.
+     * @script{create}
      */
     static Light* createDirectional(const Vector3& color);
 
+    /**
+     * Creates a directional light.
+     * 
+     * @param red The red channel.
+     * @param green The green channel.
+     * @param blue The blue channel.
+     * 
+     * @return The new directional light.
+     * @script{create}
+     */
+    static Light* createDirectional(float red, float green, float blue);
+
     /**
      * Creates a point light.
      * 
@@ -45,9 +58,23 @@ public:
      * @param range The light's range.
      * 
      * @return The new point light.
+     * @script{create}
      */
     static Light* createPoint(const Vector3& color, float range);
 
+    /**
+     * Creates a point light.
+     * 
+     * @param red The red channel.
+     * @param green The green channel.
+     * @param blue The blue channel.
+     * @param range The light's range.
+     * 
+     * @return The new point light.
+     * @script{create}
+     */
+    static Light* createPoint(float red, float green, float blue, float range);
+
     /**
      * Creates a spot light.
      * 
@@ -57,9 +84,25 @@ public:
      * @param outerAngle The light's outer angle (in radians).
      * 
      * @return The new spot light.
+     * @script{create}
      */
     static Light* createSpot(const Vector3& color, float range, float innerAngle, float outerAngle);
 
+    /**
+     * Creates a spot light.
+     * 
+     * @param red The red channel.
+     * @param green The green channel.
+     * @param blue The blue channel.
+     * @param range The light's range.
+     * @param innerAngle The light's inner angle (in radians).
+     * @param outerAngle The light's outer angle (in radians).
+     * 
+     * @return The new spot light.
+     * @script{create}
+     */
+    static Light* createSpot(float red, float green, float blue, float range, float innerAngle, float outerAngle);
+
     /**
      * Destructor.
      */
@@ -91,6 +134,15 @@ public:
      */
     void setColor(const Vector3& color);
 
+    /**
+     * Sets the light color.
+     * 
+     * @param red The red channel.
+     * @param green The green channel.
+     * @param blue The blue channel.
+     */
+    void setColor(float red, float green, float blue);
+
     /**
      * Returns the node associated with this light.
      * 

+ 19 - 19
gameplay/src/Material.cpp

@@ -127,25 +127,6 @@ Material* Material::create(const char* vshPath, const char* fshPath, const char*
     return material;
 }
 
-Material* Material::clone(NodeCloneContext &context) const
-{
-    Material* material = new Material();
-    RenderState::cloneInto(material, context);
-
-    for (std::vector<Technique*>::const_iterator it = _techniques.begin(); it != _techniques.end(); ++it)
-    {
-        const Technique* technique = *it;
-        GP_ASSERT(technique);
-        Technique* techniqueClone = technique->clone(material, context);
-        material->_techniques.push_back(techniqueClone);
-        if (_currentTechnique == technique)
-        {
-            material->_currentTechnique = techniqueClone;
-        }
-    }
-    return material;
-}
-
 unsigned int Material::getTechniqueCount() const
 {
     return _techniques.size();
@@ -187,6 +168,25 @@ void Material::setTechnique(const char* id)
     }
 }
 
+Material* Material::clone(NodeCloneContext &context) const
+{
+    Material* material = new Material();
+    RenderState::cloneInto(material, context);
+
+    for (std::vector<Technique*>::const_iterator it = _techniques.begin(); it != _techniques.end(); ++it)
+    {
+        const Technique* technique = *it;
+        GP_ASSERT(technique);
+        Technique* techniqueClone = technique->clone(material, context);
+        material->_techniques.push_back(techniqueClone);
+        if (_currentTechnique == technique)
+        {
+            material->_currentTechnique = techniqueClone;
+        }
+    }
+    return material;
+}
+
 bool Material::loadTechnique(Material* material, Properties* techniqueProperties)
 {
     GP_ASSERT(material);

+ 11 - 9
gameplay/src/Material.h

@@ -24,6 +24,7 @@ class Material : public RenderState
     friend class Pass;
     friend class RenderState;
     friend class Node;
+    friend class Model;
 
 public:
 
@@ -77,15 +78,6 @@ public:
      */
     static Material* create(const char* vshPath, const char* fshPath, const char* defines = NULL);
 
-    /**
-     * Clones this material.
-     * 
-     * @param context The clone context.
-     * 
-     * @return The newly created material.
-     */
-    Material* clone(NodeCloneContext &context) const;
-
     /**
      * Returns the number of techniques in the material.
      *
@@ -142,6 +134,16 @@ private:
      */
     ~Material();
 
+    /**
+     * Clones this material.
+     * 
+     * @param context The clone context.
+     * 
+     * @return The newly created material.
+     * @script{create}
+     */
+    Material* clone(NodeCloneContext &context) const;
+
     /**
      * Loads a technique from the given properties object into the specified material.
      */

+ 6 - 0
gameplay/src/Mesh.h

@@ -55,6 +55,7 @@ public:
      * @param dynamic true if the mesh is dynamic; false otherwise.
      * 
      * @return The created mesh.
+     * @script{create}
      */
     static Mesh* createMesh(const VertexFormat& vertexFormat, unsigned int vertexCount, bool dynamic = false);
 
@@ -71,6 +72,7 @@ public:
      * @param p4 The fourth point.
      * 
      * @return The created mesh.
+     * @script{create}
      */
     static Mesh* createQuad(const Vector3& p1, const Vector3& p2, const Vector3& p3, const Vector3& p4);
 
@@ -83,6 +85,7 @@ public:
      * @param height The height of the quad.
      * 
      * @return The newly created mesh.
+     * @script{create}
      */
     static Mesh* createQuad(float x, float y, float width, float height);
 
@@ -96,6 +99,7 @@ public:
      * normalized device coordinates for vertex positions.
      * 
      * @return The newly created mesh.
+     * @script{create}
      */
     static Mesh* createQuadFullscreen();
 
@@ -109,6 +113,7 @@ public:
      * @param pointCount The number of points.
      * 
      * @return The newly created mesh.
+     * @script{create}
      */
     static Mesh* createLines(Vector3* points, unsigned int pointCount);
 
@@ -120,6 +125,7 @@ public:
      * @param box The BoundingBox that will be used to create the mesh.
      * 
      * @return The newly created bounding box mesh.
+     * @script{create}
      */
     static Mesh* createBoundingBox(const BoundingBox& box);
 

+ 1 - 0
gameplay/src/Node.h

@@ -578,6 +578,7 @@ public:
      * Clones the node and all of its child nodes.
      * 
      * @return A new node.
+     * @script{create}
      */
     Node* clone() const;
 

+ 5 - 0
gameplay/src/PhysicsCharacter.cpp

@@ -202,6 +202,11 @@ void PhysicsCharacter::setVelocity(const Vector3& velocity)
     _moveVelocity.setValue(velocity.x, velocity.y, velocity.z);
 }
 
+void PhysicsCharacter::setVelocity(float x, float y, float z)
+{
+    _moveVelocity.setValue(x, y, z);
+}
+
 void PhysicsCharacter::rotate(const Vector3& axis, float angle)
 {
     GP_ASSERT(_node);

+ 14 - 0
gameplay/src/PhysicsCharacter.h

@@ -97,6 +97,20 @@ public:
      */
     void setVelocity(const Vector3& velocity);
 
+    /**
+     * Sets the velocity of the character.
+     *
+     * Calling this function sets the velocity (speed and direction) for the character.
+     * The velocity is maintained until this method is called again. The final velocity
+     * of the character is determined by product of the current velocity, right and
+     * forward vectors.
+     * 
+     * @param x The x coordinate of the velocity vector.
+     * @param y The y coordinate of the velocity vector.
+     * @param z The z coordinate of the velocity vector.
+     */
+    void setVelocity(float x, float y, float z);
+
     /**
      * Rotates the character.
      *

+ 36 - 0
gameplay/src/PhysicsRigidBody.h

@@ -168,6 +168,15 @@ public:
      */
     inline void setLinearVelocity(const Vector3& velocity);
 
+    /**
+     * Sets the rigid body's linear velocity.
+     * 
+     * @param x The x coordinate of the linear velocity vector.
+     * @param y The y coordinate of the linear velocity vector.
+     * @param z The z coordinate of the linear velocity vector.
+     */
+    inline void setLinearVelocity(float x, float y, float z);
+
     /**
      * Gets the rigid body's angular velocity.
      * 
@@ -182,6 +191,15 @@ public:
      */
     inline void setAngularVelocity(const Vector3& velocity);
 
+    /**
+     * Sets the rigid body's angular velocity.
+     * 
+     * @param x The x coordinate of the angular velocity vector.
+     * @param y The y coordinate of the angular velocity vector.
+     * @param z The z coordinate of the angular velocity vector.
+     */
+    inline void setAngularVelocity(float x, float y, float z);
+
     /**
      * Gets the rigid body's anisotropic friction.
      * 
@@ -196,6 +214,15 @@ public:
      */
     inline void setAnisotropicFriction(const Vector3& friction);
 
+    /**
+     * Sets the rigid body's anisotropic friction.
+     * 
+     * @param x The x coordinate of the anisotropic friction.
+     * @param y The y coordinate of the anisotropic friction.
+     * @param z The z coordinate of the anisotropic friction.
+     */
+    inline void setAnisotropicFriction(float x, float y, float z);
+
     /**
      * Gets the gravity that affects the rigid body (this can
      * be different from the global gravity; @see setGravity(Vector3)).
@@ -211,6 +238,15 @@ public:
      */
     inline void setGravity(const Vector3& gravity);
 
+    /**
+     * Sets the rigid body's gravity (this overrides the global gravity for this rigid body).
+     * 
+     * @param x The x coordinate of the gravity vector.
+     * @param y The y coordinate of the gravity vector.
+     * @param z The z coordinate of the gravity vector.
+     */
+    inline void setGravity(float x, float y, float z);
+
     /**
      * Sets whether the rigid body is a kinematic rigid body or not.
      * 

+ 24 - 0
gameplay/src/PhysicsRigidBody.inl

@@ -64,6 +64,12 @@ inline void PhysicsRigidBody::setLinearVelocity(const Vector3& velocity)
     _body->setLinearVelocity(BV(velocity));
 }
 
+inline void PhysicsRigidBody::setLinearVelocity(float x, float y, float z)
+{
+    GP_ASSERT(_body);
+    _body->setLinearVelocity(btVector3(x, y, z));
+}
+
 inline Vector3 PhysicsRigidBody::getAngularVelocity() const
 {
     GP_ASSERT(_body);
@@ -77,6 +83,12 @@ inline void PhysicsRigidBody::setAngularVelocity(const Vector3& velocity)
     _body->setAngularVelocity(BV(velocity));
 }
 
+inline void PhysicsRigidBody::setAngularVelocity(float x, float y, float z)
+{
+    GP_ASSERT(_body);
+    _body->setAngularVelocity(btVector3(x, y, z));
+}
+
 inline Vector3 PhysicsRigidBody::getAnisotropicFriction() const
 {
     GP_ASSERT(_body);
@@ -90,6 +102,12 @@ inline void PhysicsRigidBody::setAnisotropicFriction(const Vector3& friction)
     _body->setAnisotropicFriction(BV(friction));
 }
 
+inline void PhysicsRigidBody::setAnisotropicFriction(float x, float y, float z)
+{
+    GP_ASSERT(_body);
+    _body->setAnisotropicFriction(btVector3(x, y, z));
+}
+
 inline Vector3 PhysicsRigidBody::getGravity() const
 {
     GP_ASSERT(_body);
@@ -103,6 +121,12 @@ inline void PhysicsRigidBody::setGravity(const Vector3& gravity)
     _body->setGravity(BV(gravity));
 }
 
+inline void PhysicsRigidBody::setGravity(float x, float y, float z)
+{
+    GP_ASSERT(_body);
+    _body->setGravity(btVector3(x, y, z));
+}
+
 inline bool PhysicsRigidBody::isStatic() const
 {
     GP_ASSERT(_body);

+ 11 - 0
gameplay/src/Plane.cpp

@@ -18,6 +18,11 @@ Plane::Plane(const Vector3& normal, float distance)
     set(normal, distance);
 }
 
+Plane::Plane(float normalX, float normalY, float normalZ, float distance)
+{
+    set(Vector3(normalX, normalY, normalZ), distance);
+}
+
 Plane::Plane(const Plane& copy)
 {
     set(copy);
@@ -38,6 +43,12 @@ void Plane::setNormal(const Vector3& normal)
     normalize();
 }
 
+void Plane::setNormal(float x, float y, float z)
+{
+    _normal.set(x, y, z);
+    normalize();
+}
+
 float Plane::getDistance() const
 {
     return _distance;

+ 19 - 0
gameplay/src/Plane.h

@@ -49,6 +49,16 @@ public:
      */
     Plane(const Vector3& normal, float distance);
 
+    /**
+     * Constructs a new plane from the specified values.
+     * 
+     * @param normalX The x coordinate of the normal.
+     * @param normalY The y coordinate of the normal.
+     * @param normalZ The z coordinate of the normal.
+     * @param distance The distance from this plane along its (unit) normal to the origin.
+     */
+    Plane(float normalX, float normalY, float normalZ, float distance);
+
     /**
      * Constructs a new plane from the given plane.
      *
@@ -75,6 +85,15 @@ public:
      */
     void setNormal(const Vector3& normal);
 
+    /**
+     * Sets the plane's normal.
+     * 
+     * @param x The x coordinate of the normal.
+     * @param y The y coordinate of the normal.
+     * @param z The z coordinate of the normal.
+     */
+    void setNormal(float x, float y, float z);
+
     /**
      * Gets the plane's distance to the origin along its normal.
      *

+ 2 - 2
gameplay/src/PlatformAndroid.cpp

@@ -54,7 +54,7 @@ static double timespec2millis(struct timespec *a)
     return (1000.0 * a->tv_sec) + (0.000001 * a->tv_nsec);
 }
 
-extern void printError(const char* format, ...)
+extern void print(const char* format, ...)
 {
     GP_ASSERT(format);
     va_list argptr;
@@ -85,7 +85,7 @@ static EGLenum checkErrorEGL(const char* msg)
         "EGL power management event has occurred",
     };
     EGLenum error = eglGetError();
-    printError("%s: %s.", msg, errmsg[error - EGL_SUCCESS]);
+    print("%s: %s.", msg, errmsg[error - EGL_SUCCESS]);
     return error;
 }
 

+ 1 - 1
gameplay/src/PlatformMacOSX.mm

@@ -618,7 +618,7 @@ int getKey(unsigned short keyCode, unsigned int modifierFlags)
 namespace gameplay
 {
 
-extern void printError(const char* format, ...)
+extern void print(const char* format, ...)
 {
     GP_ASSERT(format);
     va_list argptr;

+ 1 - 1
gameplay/src/PlatformQNX.cpp

@@ -400,7 +400,7 @@ static int getUnicode(int qnxKeyCode)
     return qnxKeyCode;
 }
 
-extern void printError(const char* format, ...)
+extern void print(const char* format, ...)
 {
     GP_ASSERT(format);
     va_list argptr;

+ 2 - 2
gameplay/src/PlatformWin32.cpp

@@ -9,7 +9,7 @@
 #include <GL/wglew.h>
 #include <windowsx.h>
 
-using gameplay::printError;
+using gameplay::print;
 
 // Default to 720p
 static int __width = 1280;
@@ -444,7 +444,7 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 namespace gameplay
 {
 
-extern void printError(const char* format, ...)
+extern void print(const char* format, ...)
 {
     va_list argptr;
     va_start(argptr, format);

+ 2 - 2
gameplay/src/PlatformiOS.mm

@@ -107,7 +107,7 @@ int getKey(unichar keyCode);
         }
         else
         {
-            printError("Invalid OS Version: %s\n", (currSysVer == NULL?"NULL":[currSysVer cStringUsingEncoding:NSASCIIStringEncoding]));
+            print("Invalid OS Version: %s\n", (currSysVer == NULL?"NULL":[currSysVer cStringUsingEncoding:NSASCIIStringEncoding]));
             [self release];
             return nil;
         }
@@ -813,7 +813,7 @@ int getKey(unichar keyCode)
 namespace gameplay
 {
     
-extern void printError(const char* format, ...)
+extern void print(const char* format, ...)
 {
     GP_ASSERT(format);
     va_list argptr;

+ 16 - 0
gameplay/src/Ray.cpp

@@ -18,6 +18,11 @@ Ray::Ray(const Vector3& origin, const Vector3& direction)
     set(origin, direction);
 }
 
+Ray::Ray(float originX, float originY, float originZ, float dirX, float dirY, float dirZ)
+{
+    set(Vector3(originX, originY, originZ), Vector3(dirX, dirY, dirZ));
+}
+
 Ray::Ray(const Ray& copy)
 {
     set(copy);
@@ -37,6 +42,11 @@ void Ray::setOrigin(const Vector3& origin)
     _origin = origin;
 }
 
+void Ray::setOrigin(float x, float y, float z)
+{
+    _origin.set(x, y, z);
+}
+
 const Vector3& Ray::getDirection() const
 {
     return _direction;
@@ -48,6 +58,12 @@ void Ray::setDirection(const Vector3& direction)
     normalize();
 }
 
+void Ray::setDirection(float x, float y, float z)
+{
+    _direction.set(x, y, z);
+    normalize();
+}
+
 float Ray::intersects(const BoundingSphere& sphere) const
 {
     return sphere.intersects(*this);

+ 30 - 0
gameplay/src/Ray.h

@@ -39,6 +39,18 @@ public:
      */
     Ray(const Vector3& origin, const Vector3& direction);
 
+    /**
+     * Constructs a new ray initialized to the specified values.
+     * 
+     * @param originX The x coordinate of the origin.
+     * @param originY The y coordinate of the origin.
+     * @param originZ The z coordinate of the origin.
+     * @param dirX The x coordinate of the direction.
+     * @param dirY The y coordinate of the direction.
+     * @param dirZ The z coordinate of the direction.
+     */
+    Ray(float originX, float originY, float originZ, float dirX, float dirY, float dirZ);
+
     /**
      * Constructs a new ray from the given ray.
      *
@@ -65,6 +77,15 @@ public:
      */
     void setOrigin(const Vector3& origin);
 
+    /**
+     * Sets the ray's origin.
+     * 
+     * @param x The x coordinate of the origin.
+     * @param y The y coordinate of the origin.
+     * @param z The z coordinate of the origin.
+     */
+    void setOrigin(float x, float y, float z);
+
     /**
      * Gets the ray's direction.
      *
@@ -79,6 +100,15 @@ public:
      */
     void setDirection(const Vector3& direction);
 
+    /**
+     * Sets the ray's direction.
+     * 
+     * @param x The x coordinate of the direction.
+     * @param y The y coordinate of the direction.
+     * @param z The z coordinate of the direction.
+     */
+    void setDirection(float x, float y, float z);
+
     /**
      * Tests whether this ray intersects the specified bounding sphere.
      *

+ 5 - 5
gameplay/src/Ref.cpp

@@ -68,17 +68,17 @@ void Ref::printLeaks()
     // Dump Ref object memory leaks
     if (__refAllocationCount == 0)
     {
-        printError("[memory] All Ref objects successfully cleaned up (no leaks detected).\n");
+        print("[memory] All Ref objects successfully cleaned up (no leaks detected).\n");
     }
     else
     {
-        printError("[memory] WARNING: %d Ref objects still active in memory.\n", __refAllocationCount);
+        print("[memory] WARNING: %d Ref objects still active in memory.\n", __refAllocationCount);
         for (RefAllocationRecord* rec = __refAllocations; rec != NULL; rec = rec->next)
         {
             Ref* ref = rec->ref;
             GP_ASSERT(ref);
             const char* type = typeid(*ref).name();
-            printError("[memory] LEAK: Ref object '%s' still active with reference count %d.\n", (type ? type : ""), ref->getRefCount());
+            print("[memory] LEAK: Ref object '%s' still active with reference count %d.\n", (type ? type : ""), ref->getRefCount());
         }
     }
 }
@@ -105,14 +105,14 @@ void untrackRef(Ref* ref, void* record)
 {
     if (!record)
     {
-        printError("[memory] ERROR: Attempting to free null ref tracking record.\n");
+        print("[memory] ERROR: Attempting to free null ref tracking record.\n");
         return;
     }
 
     RefAllocationRecord* rec = (RefAllocationRecord*)record;
     if (rec->ref != ref)
     {
-        printError("[memory] CORRUPTION: Attempting to free Ref with invalid ref tracking record.\n");
+        print("[memory] CORRUPTION: Attempting to free Ref with invalid ref tracking record.\n");
         return;
     }
 

+ 2 - 0
gameplay/src/Scene.h

@@ -28,6 +28,7 @@ public:
      * Creates a new empty scene.
      * 
      * @return The newly created empty scene.
+     * @script{create}
      */
     static Scene* createScene();
 
@@ -37,6 +38,7 @@ public:
      * @param filePath The path to the '.scene' file to load from.
      * @return The loaded scene or <code>NULL</code> if the scene
      *      could not be loaded from the given file.
+     * @script{create}
      */
     static Scene* load(const char* filePath);
 

+ 40 - 8
gameplay/src/ScriptController.cpp

@@ -342,7 +342,7 @@ void ScriptController::loadScript(const char* path, bool forceReload)
     {
         const char* scriptContents = FileSystem::readAll(path);
         if (luaL_dostring(_lua, scriptContents))
-            GP_ERROR("Failed to run Lua script with error: '%s'.", lua_tostring(_lua, -1));
+            GP_WARN("Failed to run Lua script with error: '%s'.", lua_tostring(_lua, -1));
 
         SAFE_DELETE_ARRAY(scriptContents);
 
@@ -518,12 +518,12 @@ void ScriptController::setString(const char* name, const char* v)
 
 void ScriptController::print(const char* str)
 {
-    printError("%s", str);
+    gameplay::print("%s", str);
 }
 
 void ScriptController::print(const char* str1, const char* str2)
 {
-    printError("%s%s", str1, str2);
+    gameplay::print("%s%s", str1, str2);
 }
 
 ScriptController::ScriptController() : _lua(NULL)
@@ -540,10 +540,34 @@ ScriptController::~ScriptController()
 }
 
 static const char* lua_print_function = 
-    "function print(...)\n"
-    "    ScriptController.print(table.concat({...},\"\\t\"), \"\\n\")\n"
+    "function print(...)\n"
+    "    ScriptController.print(table.concat({...},\"\\t\"), \"\\n\")\n"
     "end\n";
 
+#ifndef WIN32
+static const char* lua_loadfile_function = 
+    "do\n"
+    "    local oldLoadfile = loadfile\n"
+    "    loadfile = function(filename)\n"
+    "        if filename ~= nil and not FileSystem.isAbsolutePath(filename) then\n"
+    "            filename = FileSystem.getResourcePath() .. filename\n"
+    "        end\n"
+    "        return oldLoadfile(filename)\n"
+    "    end\n"
+    "end\n";
+
+static const char* lua_dofile_function = 
+    "do\n"
+    "    local oldDofile = dofile\n"
+    "    dofile = function(filename)\n"
+    "        if filename ~= nil and not FileSystem.isAbsolutePath(filename) then\n"
+    "            filename = FileSystem.getResourcePath() .. filename\n"
+    "        end\n"
+    "        return oldDofile(filename)\n"
+    "    end\n"
+    "end\n";
+#endif
+
 void ScriptController::initialize()
 {
     _lua = luaL_newstate();
@@ -552,9 +576,17 @@ void ScriptController::initialize()
     luaL_openlibs(_lua);
     lua_RegisterAllBindings();
 
-    // Create our own print() function that uses gameplay::printError.
+    // Create our own print() function that uses gameplay::print.
     if (luaL_dostring(_lua, lua_print_function))
         GP_ERROR("Failed to load custom print() function with error: '%s'.", lua_tostring(_lua, -1));
+
+#ifndef WIN32
+    // Change the functions that read a file to use FileSystem.getResourcePath as their base path.
+    if (luaL_dostring(_lua, lua_loadfile_function))
+        GP_ERROR("Failed to load custom loadfile() function with error: '%s'.", lua_tostring(_lua, -1));
+    if (luaL_dostring(_lua, lua_dofile_function))
+        GP_ERROR("Failed to load custom dofile() function with error: '%s'.", lua_tostring(_lua, -1));
+#endif
 }
 
 void ScriptController::initializeGame()
@@ -748,7 +780,7 @@ void ScriptController::executeFunctionHelper(int resultCount, const char* func,
 
     // Perform the function call.
     if (lua_pcall(_lua, argumentCount, resultCount, 0) != 0)
-        GP_ERROR("Failed to call function '%s' with error '%s'.", func, lua_tostring(_lua, -1));
+        GP_WARN("Failed to call function '%s' with error '%s'.", func, lua_tostring(_lua, -1));
 }
 
 void ScriptController::registerCallback(ScriptCallback callback, std::string function)
@@ -1025,4 +1057,4 @@ template<> std::string ScriptController::executeFunction<std::string>(const char
     SCRIPT_EXECUTE_FUNCTION_PARAM_LIST(std::string, luaL_checkstring);
 }
 
-}
+}

+ 1 - 1
gameplay/src/ScriptController.h

@@ -839,4 +839,4 @@ template<> std::string ScriptController::executeFunction<std::string>(const char
 
 #include "ScriptController.inl"
 
-#endif
+#endif

+ 1 - 1
gameplay/src/lua/lua_Animation.cpp

@@ -150,7 +150,7 @@ int lua_Animation_createClip(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "AnimationClip");
                     lua_setmetatable(state, -2);
                 }

+ 99 - 3
gameplay/src/lua/lua_AudioListener.cpp

@@ -424,9 +424,49 @@ int lua_AudioListener_setOrientation(lua_State* state)
             }
             break;
         }
+        case 7:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 6);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 7);
+
+                AudioListener* instance = getInstance(state);
+                instance->setOrientation(param1, param2, param3, param4, param5, param6);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AudioListener_setOrientation - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 3 or 7).");
             lua_error(state);
             break;
         }
@@ -462,9 +502,37 @@ int lua_AudioListener_setPosition(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                AudioListener* instance = getInstance(state);
+                instance->setPosition(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AudioListener_setPosition - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -500,9 +568,37 @@ int lua_AudioListener_setVelocity(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                AudioListener* instance = getInstance(state);
+                instance->setVelocity(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AudioListener_setVelocity - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 29 - 1
gameplay/src/lua/lua_AudioSource.cpp

@@ -723,9 +723,37 @@ int lua_AudioSource_setVelocity(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                AudioSource* instance = getInstance(state);
+                instance->setVelocity(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AudioSource_setVelocity - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 92 - 2
gameplay/src/lua/lua_BoundingBox.cpp

@@ -172,9 +172,59 @@ int lua_BoundingBox__init(lua_State* state)
             }
             break;
         }
+        case 6:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 6);
+
+                void* returnPtr = (void*)new BoundingBox(param1, param2, param3, param4, param5, param6);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = true;
+                    luaL_getmetatable(state, "BoundingBox");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 0, 1 or 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 0, 1, 2 or 6).");
             lua_error(state);
             break;
         }
@@ -608,9 +658,49 @@ int lua_BoundingBox_set(lua_State* state)
             }
             break;
         }
+        case 7:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 6);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 7);
+
+                BoundingBox* instance = getInstance(state);
+                instance->set(param1, param2, param3, param4, param5, param6);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2, 3 or 7).");
             lua_error(state);
             break;
         }

+ 40 - 0
gameplay/src/lua/lua_FileSystem.cpp

@@ -18,6 +18,7 @@ void luaRegister_FileSystem()
     {
         {"fileExists", lua_FileSystem_static_fileExists},
         {"getResourcePath", lua_FileSystem_static_getResourcePath},
+        {"isAbsolutePath", lua_FileSystem_static_isAbsolutePath},
         {"loadResourceAliases", lua_FileSystem_static_loadResourceAliases},
         {"readAll", lua_FileSystem_static_readAll},
         {"resolvePath", lua_FileSystem_static_resolvePath},
@@ -143,6 +144,45 @@ int lua_FileSystem_static_getResourcePath(lua_State* state)
     return 0;
 }
 
+int lua_FileSystem_static_isAbsolutePath(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(1, false);
+
+                bool result = FileSystem::isAbsolutePath(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_FileSystem_static_isAbsolutePath - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_FileSystem_static_loadResourceAliases(lua_State* state)
 {
     // Get the number of parameters.

+ 1 - 0
gameplay/src/lua/lua_FileSystem.h

@@ -8,6 +8,7 @@ namespace gameplay
 int lua_FileSystem__gc(lua_State* state);
 int lua_FileSystem_static_fileExists(lua_State* state);
 int lua_FileSystem_static_getResourcePath(lua_State* state);
+int lua_FileSystem_static_isAbsolutePath(lua_State* state);
 int lua_FileSystem_static_loadResourceAliases(lua_State* state);
 int lua_FileSystem_static_readAll(lua_State* state);
 int lua_FileSystem_static_resolvePath(lua_State* state);

+ 127 - 1
gameplay/src/lua/lua_Font.cpp

@@ -688,6 +688,41 @@ int lua_Font_drawText(lua_State* state)
         case 8:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER &&
+                lua_type(state, 7) == LUA_TNUMBER &&
+                lua_type(state, 8) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                int param3 = (int)luaL_checkint(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 6);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 7);
+
+                // Get parameter 7 off the stack.
+                float param7 = (float)luaL_checknumber(state, 8);
+
+                Font* instance = getInstance(state);
+                instance->drawText(param1, param2, param3, param4, param5, param6, param7);
+                
+                return 0;
+            }
+            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                 (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
                 (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
                 (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL) &&
@@ -732,6 +767,45 @@ int lua_Font_drawText(lua_State* state)
         case 9:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER &&
+                lua_type(state, 7) == LUA_TNUMBER &&
+                lua_type(state, 8) == LUA_TNUMBER &&
+                lua_type(state, 9) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                int param3 = (int)luaL_checkint(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 6);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 7);
+
+                // Get parameter 7 off the stack.
+                float param7 = (float)luaL_checknumber(state, 8);
+
+                // Get parameter 8 off the stack.
+                unsigned int param8 = (unsigned int)luaL_checkunsigned(state, 9);
+
+                Font* instance = getInstance(state);
+                instance->drawText(param1, param2, param3, param4, param5, param6, param7, param8);
+                
+                return 0;
+            }
+            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                 (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
                 (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
                 (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL) &&
@@ -777,9 +851,61 @@ int lua_Font_drawText(lua_State* state)
             }
             break;
         }
+        case 10:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER &&
+                lua_type(state, 7) == LUA_TNUMBER &&
+                lua_type(state, 8) == LUA_TNUMBER &&
+                lua_type(state, 9) == LUA_TNUMBER &&
+                lua_type(state, 10) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                int param3 = (int)luaL_checkint(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 6);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 7);
+
+                // Get parameter 7 off the stack.
+                float param7 = (float)luaL_checknumber(state, 8);
+
+                // Get parameter 8 off the stack.
+                unsigned int param8 = (unsigned int)luaL_checkunsigned(state, 9);
+
+                // Get parameter 9 off the stack.
+                bool param9 = ScriptUtil::luaCheckBool(state, 10);
+
+                Font* instance = getInstance(state);
+                instance->drawText(param1, param2, param3, param4, param5, param6, param7, param8, param9);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Font_drawText - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2, 4, 5, 6, 7, 8 or 9).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2, 4, 5, 6, 7, 8, 9 or 10).");
             lua_error(state);
             break;
         }

+ 32 - 1
gameplay/src/lua/lua_Frustum.cpp

@@ -605,9 +605,40 @@ int lua_Frustum_intersects(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Frustum* instance = getInstance(state);
+                bool result = instance->intersects(param1, param2, param3);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Frustum_intersects - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 45 - 1
gameplay/src/lua/lua_Game.cpp

@@ -162,9 +162,53 @@ int lua_Game_clear(lua_State* state)
             }
             break;
         }
+        case 8:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER &&
+                lua_type(state, 7) == LUA_TNUMBER &&
+                lua_type(state, 8) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 6);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 7);
+
+                // Get parameter 7 off the stack.
+                int param7 = (int)luaL_checkint(state, 8);
+
+                Game* instance = getInstance(state);
+                instance->clear(param1, param2, param3, param4, param5, param6, param7);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_pushstring(state, "Invalid number of parameters (expected 5 or 8).");
             lua_error(state);
             break;
         }

+ 0 - 37
gameplay/src/lua/lua_Global.cpp

@@ -6,7 +6,6 @@ namespace gameplay
 
 void luaRegister_lua_Global()
 {
-    ScriptUtil::registerFunction("printError", lua__printError);
     ScriptUtil::setGlobalHierarchyPair("AnimationTarget", "Button");
     ScriptUtil::setGlobalHierarchyPair("AnimationTarget", "CheckBox");
     ScriptUtil::setGlobalHierarchyPair("AnimationTarget", "Container");
@@ -764,42 +763,6 @@ void luaRegister_lua_Global()
     }
 }
 
-int lua__printError(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(1, false);
-
-                printError(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua__printError - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 static const char* enumStringEmpty = "";
 
 const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value)

+ 0 - 3
gameplay/src/lua/lua_Global.h

@@ -44,9 +44,6 @@
 namespace gameplay
 {
 
-// Lua bindings for global functions.
-int lua__printError(lua_State* state);
-
 // Global enum to string conversion function (used to pass enums to Lua from C++).
 const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value);
 

+ 1 - 1
gameplay/src/lua/lua_Joint.cpp

@@ -410,7 +410,7 @@ int lua_Joint_clone(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Node");
                     lua_setmetatable(state, -2);
                 }

+ 165 - 7
gameplay/src/lua/lua_Light.cpp

@@ -576,9 +576,37 @@ int lua_Light_setColor(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Light* instance = getInstance(state);
+                instance->setColor(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Light_setColor - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -720,7 +748,45 @@ int lua_Light_static_createDirectional(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
+                    luaL_getmetatable(state, "Light");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Light_static_createDirectional - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                void* returnPtr = (void*)Light::createDirectional(param1, param2, param3);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = true;
                     luaL_getmetatable(state, "Light");
                     lua_setmetatable(state, -2);
                 }
@@ -740,7 +806,7 @@ int lua_Light_static_createDirectional(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_pushstring(state, "Invalid number of parameters (expected 1 or 3).");
             lua_error(state);
             break;
         }
@@ -772,7 +838,49 @@ int lua_Light_static_createPoint(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
+                    luaL_getmetatable(state, "Light");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Light_static_createPoint - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                void* returnPtr = (void*)Light::createPoint(param1, param2, param3, param4);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = true;
                     luaL_getmetatable(state, "Light");
                     lua_setmetatable(state, -2);
                 }
@@ -792,7 +900,7 @@ int lua_Light_static_createPoint(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -832,7 +940,57 @@ int lua_Light_static_createSpot(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
+                    luaL_getmetatable(state, "Light");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Light_static_createSpot - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 6:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 6);
+
+                void* returnPtr = (void*)Light::createSpot(param1, param2, param3, param4, param5, param6);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = true;
                     luaL_getmetatable(state, "Light");
                     lua_setmetatable(state, -2);
                 }
@@ -852,7 +1010,7 @@ int lua_Light_static_createSpot(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 4).");
+            lua_pushstring(state, "Invalid number of parameters (expected 4 or 6).");
             lua_error(state);
             break;
         }

+ 0 - 51
gameplay/src/lua/lua_Material.cpp

@@ -23,7 +23,6 @@ void luaRegister_Material()
     const luaL_Reg lua_members[] = 
     {
         {"addRef", lua_Material_addRef},
-        {"clone", lua_Material_clone},
         {"getParameter", lua_Material_getParameter},
         {"getRefCount", lua_Material_getRefCount},
         {"getStateBlock", lua_Material_getStateBlock},
@@ -127,56 +126,6 @@ int lua_Material_addRef(lua_State* state)
     return 0;
 }
 
-int lua_Material_clone(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                NodeCloneContext* param1 = ScriptUtil::getObjectPointer<NodeCloneContext>(2, "NodeCloneContext", true);
-
-                Material* instance = getInstance(state);
-                void* returnPtr = (void*)instance->clone(*param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Material");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Material_clone - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Material_getParameter(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Material.h

@@ -7,7 +7,6 @@ namespace gameplay
 // Lua bindings for Material.
 int lua_Material__gc(lua_State* state);
 int lua_Material_addRef(lua_State* state);
-int lua_Material_clone(lua_State* state);
 int lua_Material_getParameter(lua_State* state);
 int lua_Material_getRefCount(lua_State* state);
 int lua_Material_getStateBlock(lua_State* state);

+ 7 - 7
gameplay/src/lua/lua_Mesh.cpp

@@ -988,7 +988,7 @@ int lua_Mesh_static_createBoundingBox(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -1040,7 +1040,7 @@ int lua_Mesh_static_createLines(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -1092,7 +1092,7 @@ int lua_Mesh_static_createMesh(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -1130,7 +1130,7 @@ int lua_Mesh_static_createMesh(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -1190,7 +1190,7 @@ int lua_Mesh_static_createQuad(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -1223,7 +1223,7 @@ int lua_Mesh_static_createQuad(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -1266,7 +1266,7 @@ int lua_Mesh_static_createQuadFullscreen(lua_State* state)
             {
                 ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                 object->instance = returnPtr;
-                object->owns = false;
+                object->owns = true;
                 luaL_getmetatable(state, "Mesh");
                 lua_setmetatable(state, -2);
             }

+ 1 - 1
gameplay/src/lua/lua_Node.cpp

@@ -409,7 +409,7 @@ int lua_Node_clone(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Node");
                     lua_setmetatable(state, -2);
                 }

+ 29 - 1
gameplay/src/lua/lua_PhysicsCharacter.cpp

@@ -1167,9 +1167,37 @@ int lua_PhysicsCharacter_setVelocity(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                PhysicsCharacter* instance = getInstance(state);
+                instance->setVelocity(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsCharacter_setVelocity - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 116 - 4
gameplay/src/lua/lua_PhysicsRigidBody.cpp

@@ -1279,9 +1279,37 @@ int lua_PhysicsRigidBody_setAngularVelocity(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                PhysicsRigidBody* instance = getInstance(state);
+                instance->setAngularVelocity(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsRigidBody_setAngularVelocity - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -1317,9 +1345,37 @@ int lua_PhysicsRigidBody_setAnisotropicFriction(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                PhysicsRigidBody* instance = getInstance(state);
+                instance->setAnisotropicFriction(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsRigidBody_setAnisotropicFriction - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -1473,9 +1529,37 @@ int lua_PhysicsRigidBody_setGravity(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                PhysicsRigidBody* instance = getInstance(state);
+                instance->setGravity(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsRigidBody_setGravity - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -1549,9 +1633,37 @@ int lua_PhysicsRigidBody_setLinearVelocity(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                PhysicsRigidBody* instance = getInstance(state);
+                instance->setLinearVelocity(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsRigidBody_setLinearVelocity - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 72 - 2
gameplay/src/lua/lua_Plane.cpp

@@ -177,9 +177,51 @@ int lua_Plane__init(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                void* returnPtr = (void*)new Plane(param1, param2, param3, param4);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = true;
+                    luaL_getmetatable(state, "Plane");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Plane__init - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 0, 1 or 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 0, 1, 2 or 4).");
             lua_error(state);
             break;
         }
@@ -577,9 +619,37 @@ int lua_Plane_setNormal(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Plane* instance = getInstance(state);
+                instance->setNormal(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Plane_setNormal - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 109 - 3
gameplay/src/lua/lua_Ray.cpp

@@ -172,9 +172,59 @@ int lua_Ray__init(lua_State* state)
             }
             break;
         }
+        case 6:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 6 off the stack.
+                float param6 = (float)luaL_checknumber(state, 6);
+
+                void* returnPtr = (void*)new Ray(param1, param2, param3, param4, param5, param6);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = true;
+                    luaL_getmetatable(state, "Ray");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Ray__init - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 0, 1 or 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 0, 1, 2 or 6).");
             lua_error(state);
             break;
         }
@@ -447,9 +497,37 @@ int lua_Ray_setDirection(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Ray* instance = getInstance(state);
+                instance->setDirection(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Ray_setDirection - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }
@@ -485,9 +563,37 @@ int lua_Ray_setOrigin(lua_State* state)
             }
             break;
         }
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Ray* instance = getInstance(state);
+                instance->setOrigin(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Ray_setOrigin - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
             lua_error(state);
             break;
         }

+ 2 - 2
gameplay/src/lua/lua_Scene.cpp

@@ -912,7 +912,7 @@ int lua_Scene_static_createScene(lua_State* state)
             {
                 ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                 object->instance = returnPtr;
-                object->owns = false;
+                object->owns = true;
                 luaL_getmetatable(state, "Scene");
                 lua_setmetatable(state, -2);
             }
@@ -954,7 +954,7 @@ int lua_Scene_static_load(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Scene");
                     lua_setmetatable(state, -2);
                 }