Browse Source

Merged all Node drawable to inherit from new Drawable base class

seanpaultaylor 11 years ago
parent
commit
f9d3270806
72 changed files with 751 additions and 3398 deletions
  1. 2 0
      gameplay/CMakeLists.txt
  2. 1 0
      gameplay/android/jni/Android.mk
  3. 5 0
      gameplay/gameplay.pro
  4. 3 1
      gameplay/gameplay.vcxproj
  5. 8 0
      gameplay/gameplay.xcodeproj/project.pbxproj
  6. 1 0
      gameplay/src/AnimationTarget.cpp
  7. 2 2
      gameplay/src/AudioSource.cpp
  8. 2 3
      gameplay/src/AudioSource.h
  9. 7 5
      gameplay/src/Bundle.cpp
  10. 1 0
      gameplay/src/Bundle.h
  11. 1 1
      gameplay/src/Camera.cpp
  12. 1 4
      gameplay/src/Camera.h
  13. 28 0
      gameplay/src/Drawable.cpp
  14. 67 0
      gameplay/src/Drawable.h
  15. 1 0
      gameplay/src/Font.cpp
  16. 8 11
      gameplay/src/Form.cpp
  17. 9 13
      gameplay/src/Form.h
  18. 1 0
      gameplay/src/Game.cpp
  19. 1 4
      gameplay/src/Gamepad.cpp
  20. 1 0
      gameplay/src/Joint.cpp
  21. 1 1
      gameplay/src/Light.cpp
  22. 1 2
      gameplay/src/Light.h
  23. 1 0
      gameplay/src/MeshSkin.cpp
  24. 1 1
      gameplay/src/MeshSkin.h
  25. 10 16
      gameplay/src/Model.cpp
  26. 20 33
      gameplay/src/Model.h
  27. 175 377
      gameplay/src/Node.cpp
  28. 81 269
      gameplay/src/Node.h
  29. 41 54
      gameplay/src/ParticleEmitter.cpp
  30. 21 30
      gameplay/src/ParticleEmitter.h
  31. 0 25
      gameplay/src/PhysicsCollisionObject.cpp
  32. 0 44
      gameplay/src/PhysicsCollisionObject.h
  33. 3 2
      gameplay/src/PhysicsCollisionShape.cpp
  34. 1 1
      gameplay/src/PhysicsConstraint.h
  35. 15 12
      gameplay/src/PhysicsController.cpp
  36. 6 4
      gameplay/src/PhysicsRigidBody.cpp
  37. 0 1
      gameplay/src/PhysicsVehicle.h
  38. 1 1
      gameplay/src/PhysicsVehicleWheel.h
  39. 16 6
      gameplay/src/RenderState.cpp
  40. 4 3
      gameplay/src/Scene.cpp
  41. 7 4
      gameplay/src/Scene.h
  42. 24 19
      gameplay/src/SceneLoader.cpp
  43. 0 1
      gameplay/src/ScriptController.h
  44. 28 45
      gameplay/src/Sprite.cpp
  45. 7 21
      gameplay/src/Sprite.h
  46. 17 15
      gameplay/src/Terrain.cpp
  47. 53 57
      gameplay/src/Terrain.h
  48. 4 2
      gameplay/src/TerrainPatch.cpp
  49. 21 41
      gameplay/src/Text.cpp
  50. 8 19
      gameplay/src/Text.h
  51. 0 1
      gameplay/src/TextBox.h
  52. 24 41
      gameplay/src/TileSet.cpp
  53. 8 21
      gameplay/src/TileSet.h
  54. 1 0
      gameplay/src/gameplay.h
  55. 0 352
      gameplay/src/lua/lua_Joint.cpp
  56. 0 7
      gameplay/src/lua/lua_Joint.h
  57. 1 353
      gameplay/src/lua/lua_Node.cpp
  58. 0 8
      gameplay/src/lua/lua_Node.h
  59. 0 83
      gameplay/src/lua/lua_ParticleEmitter.cpp
  60. 0 2
      gameplay/src/lua/lua_ParticleEmitter.h
  61. 0 225
      gameplay/src/lua/lua_PhysicsCharacter.cpp
  62. 0 5
      gameplay/src/lua/lua_PhysicsCharacter.h
  63. 0 225
      gameplay/src/lua/lua_PhysicsCollisionObject.cpp
  64. 0 5
      gameplay/src/lua/lua_PhysicsCollisionObject.h
  65. 0 225
      gameplay/src/lua/lua_PhysicsGhostObject.cpp
  66. 0 5
      gameplay/src/lua/lua_PhysicsGhostObject.h
  67. 0 225
      gameplay/src/lua/lua_PhysicsRigidBody.cpp
  68. 0 5
      gameplay/src/lua/lua_PhysicsRigidBody.h
  69. 0 225
      gameplay/src/lua/lua_PhysicsVehicle.cpp
  70. 0 5
      gameplay/src/lua/lua_PhysicsVehicle.h
  71. 0 225
      gameplay/src/lua/lua_PhysicsVehicleWheel.cpp
  72. 0 5
      gameplay/src/lua/lua_PhysicsVehicleWheel.h

+ 2 - 0
gameplay/CMakeLists.txt

@@ -57,6 +57,8 @@ set(GAMEPLAY_SRC
     src/DebugNew.h
     src/DepthStencilTarget.cpp
     src/DepthStencilTarget.h
+    src/Drawable.cpp
+    src/Drawable.h
     src/Effect.cpp
     src/Effect.h
     src/FileSystem.cpp

+ 1 - 0
gameplay/android/jni/Android.mk

@@ -42,6 +42,7 @@ LOCAL_SRC_FILES := \
     Curve.cpp \
     DebugNew.cpp \
     DepthStencilTarget.cpp \
+    Drawable.cpp \
     Effect.cpp \
     FileSystem.cpp \
     FlowLayout.cpp \

+ 5 - 0
gameplay/gameplay.pro

@@ -38,6 +38,7 @@ SOURCES += src/AbsoluteLayout.cpp \
     src/ControlFactory.cpp \
     src/Curve.cpp \
     src/DepthStencilTarget.cpp \
+    src/Drawable.cpp \
     src/Effect.cpp \
     src/FileSystem.cpp \
     src/FlowLayout.cpp \
@@ -292,6 +293,7 @@ HEADERS += src/AbsoluteLayout.h \
     src/ControlFactory.h \
     src/Curve.h \
     src/DepthStencilTarget.h \
+    src/Drawable.h \
     src/Effect.h \
     src/FileSystem.h \
     src/FlowLayout.h \
@@ -357,15 +359,18 @@ HEADERS += src/AbsoluteLayout.h \
     src/ScriptController.h \
     src/ScriptTarget.h \
     src/Slider.h \
+    src/Sprite.h \
     src/SpriteBatch.h \
     src/Stream.h \
     src/Technique.h \
     src/Terrain.h \
     src/TerrainPatch.h \
+    src/Text.h \
     src/TextBox.h \
     src/Texture.h \
     src/Theme.h \
     src/ThemeStyle.h \
+    src/TileSet.h \
     src/TimeListener.h \
     src/Touch.h \
     src/Transform.h \

+ 3 - 1
gameplay/gameplay.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="DebugMem|x64">
@@ -41,6 +41,7 @@
     <ClCompile Include="src\Curve.cpp" />
     <ClCompile Include="src\DebugNew.cpp" />
     <ClCompile Include="src\DepthStencilTarget.cpp" />
+    <ClCompile Include="src\Drawable.cpp” />
     <ClCompile Include="src\Effect.cpp" />
     <ClCompile Include="src\FileSystem.cpp" />
     <ClCompile Include="src\FlowLayout.cpp" />
@@ -285,6 +286,7 @@
     <ClInclude Include="src\Curve.h" />
     <ClInclude Include="src\DebugNew.h" />
     <ClInclude Include="src\DepthStencilTarget.h" />
+    <ClInclude Include="src\Drawable.h” />
     <ClInclude Include="src\Effect.h" />
     <ClInclude Include="src\FileSystem.h" />
     <ClInclude Include="src\FlowLayout.h" />

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

@@ -484,6 +484,8 @@
 		42CC5A1B1809A4EF00AAD8AD /* VertexFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42CC55651809A4EE00AAD8AD /* VertexFormat.cpp */; };
 		42CC5A1E1809A4EF00AAD8AD /* VerticalLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42CC55671809A4EE00AAD8AD /* VerticalLayout.cpp */; };
 		42CC5A1F1809A4EF00AAD8AD /* VerticalLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42CC55671809A4EE00AAD8AD /* VerticalLayout.cpp */; };
+		42D9299B1A6051EC0073258D /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42D929991A6051EC0073258D /* Drawable.cpp */; };
+		42D9299C1A6051EC0073258D /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42D929991A6051EC0073258D /* Drawable.cpp */; };
 		42ECC3FA1A4EF5A00036C839 /* Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42ECC3F81A4EF5A00036C839 /* Text.cpp */; };
 		42ECC3FB1A4EF5A00036C839 /* Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42ECC3F81A4EF5A00036C839 /* Text.cpp */; };
 		5B21E99616153890006EBEAC /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B21E99516153890006EBEAC /* IOKit.framework */; };
@@ -1009,6 +1011,8 @@
 		42CC55661809A4EE00AAD8AD /* VertexFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexFormat.h; path = src/VertexFormat.h; sourceTree = SOURCE_ROOT; };
 		42CC55671809A4EE00AAD8AD /* VerticalLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VerticalLayout.cpp; path = src/VerticalLayout.cpp; sourceTree = SOURCE_ROOT; };
 		42CC55681809A4EE00AAD8AD /* VerticalLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VerticalLayout.h; path = src/VerticalLayout.h; sourceTree = SOURCE_ROOT; };
+		42D929991A6051EC0073258D /* Drawable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Drawable.cpp; path = src/Drawable.cpp; sourceTree = SOURCE_ROOT; };
+		42D9299A1A6051EC0073258D /* Drawable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Drawable.h; path = src/Drawable.h; sourceTree = SOURCE_ROOT; };
 		42ECC3F81A4EF5A00036C839 /* Text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Text.cpp; path = src/Text.cpp; sourceTree = SOURCE_ROOT; };
 		42ECC3F91A4EF5A00036C839 /* Text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Text.h; path = src/Text.h; sourceTree = SOURCE_ROOT; };
 		5B04C5CA14BFCFE100EB0071 /* libgameplay.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgameplay.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1412,6 +1416,8 @@
 				42CC532B1809A4EB00AAD8AD /* DebugNew.h */,
 				42CC532C1809A4EB00AAD8AD /* DepthStencilTarget.cpp */,
 				42CC532D1809A4EB00AAD8AD /* DepthStencilTarget.h */,
+				42D929991A6051EC0073258D /* Drawable.cpp */,
+				42D9299A1A6051EC0073258D /* Drawable.h */,
 				42CC532E1809A4EB00AAD8AD /* Effect.cpp */,
 				42CC532F1809A4EB00AAD8AD /* Effect.h */,
 				42CC53301809A4EB00AAD8AD /* FileSystem.cpp */,
@@ -1855,6 +1861,7 @@
 				42CC560A1809A4EF00AAD8AD /* HeightField.cpp in Sources */,
 				420BBE321817416F00C7B720 /* lua_RenderStateStateBlock.cpp in Sources */,
 				420BBC3E1817416F00C7B720 /* lua_AnimationClip.cpp in Sources */,
+				42D9299B1A6051EC0073258D /* Drawable.cpp in Sources */,
 				420BBE521817416F00C7B720 /* lua_ScreenDisplayer.cpp in Sources */,
 				42CC55AE1809A4EF00AAD8AD /* BoundingSphere.cpp in Sources */,
 				420BBED61817416F00C7B720 /* lua_VerticalLayout.cpp in Sources */,
@@ -2105,6 +2112,7 @@
 				42CC592B1809A4EF00AAD8AD /* ParticleEmitter.cpp in Sources */,
 				420BBE331817416F00C7B720 /* lua_RenderStateStateBlock.cpp in Sources */,
 				420BBC3F1817416F00C7B720 /* lua_AnimationClip.cpp in Sources */,
+				42D9299C1A6051EC0073258D /* Drawable.cpp in Sources */,
 				42CC560B1809A4EF00AAD8AD /* HeightField.cpp in Sources */,
 				420BBE531817416F00C7B720 /* lua_ScreenDisplayer.cpp in Sources */,
 				42CC55AF1809A4EF00AAD8AD /* BoundingSphere.cpp in Sources */,

+ 1 - 0
gameplay/src/AnimationTarget.cpp

@@ -3,6 +3,7 @@
 #include "Animation.h"
 #include "Game.h"
 #include "Node.h"
+#include "MaterialParameter.h"
 
 #define ANIMATION_TARGET_INDEFINITE_STR "INDEFINITE"
 

+ 2 - 2
gameplay/src/AudioSource.cpp

@@ -293,7 +293,7 @@ void AudioSource::transformChanged(Transform* transform, long cookie)
     }
 }
 
-AudioSource* AudioSource::clone(NodeCloneContext &context) const
+AudioSource* AudioSource::clone(NodeCloneContext& context)
 {
     GP_ASSERT(_buffer);
 
@@ -301,7 +301,7 @@ AudioSource* AudioSource::clone(NodeCloneContext &context) const
     AL_CHECK( alGenSources(1, &alSource) );
     if (AL_LAST_ERROR())
     {
-        GP_ERROR("Error generating audio source.");
+        GP_ERROR("Unable to cloning audio.");
         return NULL;
     }
     AudioSource* audioClone = new AudioSource(_buffer, alSource);

+ 2 - 3
gameplay/src/AudioSource.h

@@ -3,7 +3,7 @@
 
 #include "Vector3.h"
 #include "Ref.h"
-#include "Node.h"
+#include "Transform.h"
 
 namespace gameplay
 {
@@ -200,10 +200,9 @@ private:
      * Clones the audio source and returns a new audio source.
      * 
      * @param context The clone context.
-     * 
      * @return The newly created audio source.
      */
-    AudioSource* clone(NodeCloneContext &context) const;
+    AudioSource* clone(NodeCloneContext& context);
 
     bool streamDataIfNeeded();
 

+ 7 - 5
gameplay/src/Bundle.cpp

@@ -680,9 +680,12 @@ bool Bundle::skipNode()
     }
 
     // Skip over the node's camera, light, and model attachments.
-    Camera* camera = readCamera(); SAFE_RELEASE(camera);
-    Light* light = readLight(); SAFE_RELEASE(light);
-    Model* model = readModel(id); SAFE_RELEASE(model);
+    Camera* camera = readCamera();
+    SAFE_RELEASE(camera);
+    Light* light = readLight();
+    SAFE_RELEASE(light);
+    Model* model = readModel(id);
+    SAFE_RELEASE(model);
 
     return true;
 }
@@ -820,10 +823,9 @@ Node* Bundle::readNode(Scene* sceneContext, Node* nodeContext)
     Model* model = readModel(node->getId());
     if (model)
     {
-        node->setModel(model);
+        node->setDrawable(model);
         SAFE_RELEASE(model);
     }
-
     return node;
 }
 

+ 1 - 0
gameplay/src/Bundle.h

@@ -5,6 +5,7 @@
 #include "Font.h"
 #include "Node.h"
 #include "Game.h"
+#include "MeshSkin.h"
 
 namespace gameplay
 {

+ 1 - 1
gameplay/src/Camera.cpp

@@ -430,7 +430,7 @@ void Camera::pickRay(const Rectangle& viewport, float x, float y, Ray* dst) cons
     dst->set(nearPoint, direction);
 }
 
-Camera* Camera::clone(NodeCloneContext &context) const
+Camera* Camera::clone(NodeCloneContext& context)
 {
     Camera* cameraClone = NULL;
     if (getCameraType() == PERSPECTIVE)

+ 1 - 4
gameplay/src/Camera.h

@@ -346,7 +346,7 @@ private:
      * @param context The clone context.
      * @return The newly created camera.
      */
-    Camera* clone(NodeCloneContext &context) const;
+    Camera* clone(NodeCloneContext& context);
 
     /**
      * Sets the node associated with this camera.
@@ -358,9 +358,6 @@ private:
      */
     void transformChanged(Transform* transform, long cookie);
 
-    /**
-     *
-     */
     void cameraChanged();
 
     Camera::Type _type;

+ 28 - 0
gameplay/src/Drawable.cpp

@@ -0,0 +1,28 @@
+#include "Base.h"
+#include "Drawable.h"
+#include "Node.h"
+
+
+namespace gameplay
+{
+
+Drawable::Drawable()
+    : _node(NULL)
+{
+}
+
+Drawable::~Drawable()
+{
+}
+
+Node* Drawable::getNode() const
+{
+    return _node;
+}
+
+void Drawable::setNode(Node* node)
+{
+    _node = node;
+}
+
+}

+ 67 - 0
gameplay/src/Drawable.h

@@ -0,0 +1,67 @@
+#ifndef DRAWABLE_H_
+#define DRAWABLE_H_
+
+namespace gameplay
+{
+
+class Node;
+class NodeCloneContext;
+
+/**
+ * Defines a drawable object that can be attached to a Node.
+ */
+class Drawable
+{
+public:
+
+    friend class Node;
+
+    /**
+     * Constructor.
+     */
+    Drawable();
+
+    /**
+     * Destructor.
+     */
+    virtual ~Drawable();
+
+    /**
+     * Draws the object.
+     *
+     * @param wireframe true if you want to request to draw the wireframe only.
+     * @return The number of graphics draw calls required to draw the object.
+     */
+
+    virtual unsigned int draw(bool wireframe = false) = 0;
+
+    /**
+     * Gets the node this drawable is attached to.
+     *
+     * @return The node this drawable is attached to.
+     */
+    Node* getNode() const;
+
+protected:
+
+    /**
+     * Clones the drawable and returns a new drawable.
+     *
+     * @param context The clone context.
+     * @return The newly created drawable.
+     */
+    virtual Drawable* clone(NodeCloneContext& context) = 0;
+
+    /**
+     * Sets the node this drawable is attached to.
+     *
+     * @param node The node this drawable is attached to.
+     */
+    virtual void setNode(Node* node);
+
+    Node* _node;
+};
+
+}
+
+#endif

+ 1 - 0
gameplay/src/Font.cpp

@@ -4,6 +4,7 @@
 #include "Game.h"
 #include "FileSystem.h"
 #include "Bundle.h"
+#include "Material.h"
 
 // Default font shaders
 #define FONT_VSH "res/shaders/font.vert"

+ 8 - 11
gameplay/src/Form.cpp

@@ -42,7 +42,7 @@ struct FormInit
 };
 static FormInit __init;
 
-Form::Form() : _node(NULL), _batched(true)
+Form::Form() : Drawable(), _batched(true)
 {
 }
 
@@ -180,14 +180,6 @@ bool Form::isForm() const
     return true;
 }
 
-void Form::setNode(Node* node)
-{
-    if (_node != node)
-    {
-        _node = node;
-    }
-}
-
 static unsigned int nextPowerOfTwo(unsigned int v)
 {
     if (!((v & (v - 1)) == 0))
@@ -241,7 +233,7 @@ const Matrix& Form::getProjectionMatrix() const
     return  _projectionMatrix;
 }
 
-unsigned int Form::draw()
+unsigned int Form::draw(bool wireframe)
 {
     if (!_visible || _absoluteClipBounds.width == 0 || _absoluteClipBounds.height == 0)
         return 0;
@@ -281,10 +273,15 @@ unsigned int Form::draw()
         _batches.clear();
         drawCalls = batchCount;
     }
-
     return drawCalls;
 }
 
+Drawable* Form::clone(NodeCloneContext& context)
+{
+    // TODO:
+    return NULL;
+}
+
 bool Form::isBatchingEnabled() const
 {
     return _batched;

+ 9 - 13
gameplay/src/Form.h

@@ -10,6 +10,7 @@
 #include "Mouse.h"
 #include "Gamepad.h"
 #include "FrameBuffer.h"
+#include "Drawable.h"
 
 namespace gameplay
 {
@@ -23,7 +24,7 @@ class Theme;
  *
  * @see http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
  */
-class Form : public Container
+class Form : public Drawable, public Container
 {
     friend class Platform;
     friend class Game;
@@ -99,7 +100,7 @@ public:
      * Child controls should override this function to return the correct type name.
      *
      * @return The type name of this class: "Form"
-     * @see ScriptTarget::getTypeName()
+     * @see ScriptTarget::getTypeName
      */
     const char* getTypeName() const;
 
@@ -108,15 +109,6 @@ public:
      */
     bool isForm() const;
 
-    /**
-     * Attach this form to a node.
-     *
-     * A form can be drawn as part of the 3-dimensional world if it is attached to a node.
-     *
-     * @param node The node to attach this form to.
-     */
-    void setNode(Node* node);
-
     /**
      * @see Control::update
      */
@@ -127,7 +119,7 @@ public:
      *
      * @return The nubmer of draw calls issued to draw the form.
      */
-    unsigned int draw();
+    unsigned int draw(bool wireframe = false);
 
     /**
      * Determines whether batching is enabled for this form.
@@ -165,6 +157,11 @@ private:
      */
     virtual ~Form();
 
+    /**
+     * @see Drawable::clone
+     */
+    Drawable* clone(NodeCloneContext &context);
+
     /**
      * @see Control::initialize
      */
@@ -279,7 +276,6 @@ private:
 
     static bool pollGamepad(Gamepad* gamepad);
 
-    Node* _node;                        // Node for transforming this Form in world-space.
     Matrix _projectionMatrix;           // Projection matrix to be set on SpriteBatch objects when rendering the form
     std::vector<SpriteBatch*> _batches;
     bool _batched;

+ 1 - 0
gameplay/src/Game.cpp

@@ -7,6 +7,7 @@
 #include "SceneLoader.h"
 #include "ControlFactory.h"
 #include "Theme.h"
+#include "Form.h"
 
 /** @script{ignore} */
 GLenum __gl_error_code = GL_NO_ERROR;

+ 1 - 4
gameplay/src/Gamepad.cpp

@@ -51,10 +51,7 @@ Gamepad::Gamepad(GamepadHandle handle, unsigned int buttonCount, unsigned int jo
 
 Gamepad::~Gamepad()
 {
-    if (_form)
-    {
-        SAFE_RELEASE(_form);
-    }
+    SAFE_RELEASE(_form);
 }
 
 Gamepad* Gamepad::add(GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount, const char* name)

+ 1 - 0
gameplay/src/Joint.cpp

@@ -1,6 +1,7 @@
 #include "Base.h"
 #include "Joint.h"
 #include "MeshSkin.h"
+#include "Model.h"
 
 namespace gameplay
 {

+ 1 - 1
gameplay/src/Light.cpp

@@ -322,7 +322,7 @@ float Light::getOuterAngleCos()  const
     return _spot->outerAngleCos;
 }
 
-Light* Light::clone(NodeCloneContext &context) const
+Light* Light::clone(NodeCloneContext &context)
 {
     Light* lightClone = NULL;
     switch (_type)

+ 1 - 2
gameplay/src/Light.h

@@ -299,10 +299,9 @@ private:
      * Clones the light and returns a new light.
      * 
      * @param context The clone context.
-     * 
      * @return The newly created light.
      */
-    Light* clone(NodeCloneContext &context) const;
+    Light* clone(NodeCloneContext& context);
 
     Light::Type _type;
     

+ 1 - 0
gameplay/src/MeshSkin.cpp

@@ -1,6 +1,7 @@
 #include "Base.h"
 #include "MeshSkin.h"
 #include "Joint.h"
+#include "Model.h"
 
 // The number of rows in each palette matrix.
 #define PALETTE_ROWS 3

+ 1 - 1
gameplay/src/MeshSkin.h

@@ -9,8 +9,8 @@ namespace gameplay
 
 class Bundle;
 class Model;
-class Joint;
 class Node;
+class Joint;
 
 /**
  * Defines the skin for a mesh.

+ 10 - 16
gameplay/src/Model.cpp

@@ -9,8 +9,13 @@
 namespace gameplay
 {
 
-Model::Model(Mesh* mesh) :
-    _mesh(mesh), _material(NULL), _partCount(0), _partMaterials(NULL), _node(NULL), _skin(NULL)
+Model::Model() : Drawable(),
+    _mesh(NULL), _material(NULL), _partCount(0), _partMaterials(NULL), _skin(NULL)
+{
+}
+
+Model::Model(Mesh* mesh) : Drawable(),
+    _mesh(mesh), _material(NULL), _partCount(0), _partMaterials(NULL), _skin(NULL)
 {
     GP_ASSERT(mesh);
     _partCount = mesh->getPartCount();
@@ -19,7 +24,6 @@ Model::Model(Mesh* mesh) :
 Model::~Model()
 {
     SAFE_RELEASE(_material);
-
     if (_partMaterials)
     {
         for (unsigned int i = 0; i < _partCount; ++i)
@@ -28,9 +32,7 @@ Model::~Model()
         }
         SAFE_DELETE_ARRAY(_partMaterials);
     }
-
     SAFE_RELEASE(_mesh);
-
     SAFE_DELETE(_skin);
 }
 
@@ -60,7 +62,6 @@ Material* Model::getMaterial(int partIndex)
 
     if (partIndex < 0)
         return _material;
-
     if (partIndex >= (int)_partCount)
         return NULL;
 
@@ -69,7 +70,6 @@ Material* Model::getMaterial(int partIndex)
     {
         m = _partMaterials[partIndex];
     }
-
     if (m == NULL)
     {
         // Return the shared material.
@@ -156,7 +156,6 @@ void Model::setMaterial(Material* material, int partIndex)
                 SAFE_RELEASE(b);
             }
         }
-
         // Apply node binding for the new material.
         if (_node)
         {
@@ -227,14 +226,9 @@ void Model::setSkin(MeshSkin* skin)
     }
 }
 
-Node* Model::getNode() const
-{
-    return _node;
-}
-
 void Model::setNode(Node* node)
 {
-    _node = node;
+    Drawable::setNode(node);
 
     // Re-bind node related material parameters
     if (node)
@@ -397,11 +391,11 @@ void Model::setMaterialNodeBinding(Material *material)
 
     if (_node)
     {
-        material->setNodeBinding(_node);
+        material->setNodeBinding(getNode());
     }
 }
 
-Model* Model::clone(NodeCloneContext &context)
+Drawable* Model::clone(NodeCloneContext& context)
 {
     Model* model = Model::create(getMesh());
     if (!model)

+ 20 - 33
gameplay/src/Model.h

@@ -4,14 +4,14 @@
 #include "Mesh.h"
 #include "MeshSkin.h"
 #include "Material.h"
+#include "Drawable.h"
 
 namespace gameplay
 {
 
 class Bundle;
 class MeshSkin;
-class Node;
-class NodeCloneContext;
+
 
 /**
  * Defines a Model or mesh renderer which is an instance of a Mesh. 
@@ -19,7 +19,7 @@ class NodeCloneContext;
  * A model has a mesh that can be drawn with the specified materials for
  * each of the mesh parts within it.
  */
-class Model : public Ref
+class Model : public Ref, public Drawable
 {
     friend class Node;
     friend class Scene;
@@ -131,27 +131,23 @@ public:
     MeshSkin* getSkin() const;
 
     /**
-     * Returns the node that is associated with this model.
-     *
-     * @return The node that is associated with this model.
-     */
-    Node* getNode() const;
-
-    /**
-     * Draws this mesh instance.
+     * @see Drawable::draw
      *
-     * This method binds the vertex buffer and index buffers for the Mesh and
-     * all of its MeshParts and draws the mesh geometry. Any other state
-     * necessary to render the Mesh, such as rendering states, shader state,
-     * and so on, should be set up before calling this method.
-     *
-     * @param wireframe If true, draw the model in wireframe mode.
-     * @return The number of draw calls (mesh parts).
+     * Binds the vertex buffer and index buffers for the Mesh and
+     * all of its MeshPart's and draws the mesh geometry.
+     * Any other state necessary to render the Mesh, such as
+     * rendering states, shader state, and so on, should be set
+     * up before calling this method.
      */
     unsigned int draw(bool wireframe = false);
 
 private:
 
+    /**
+     * Constructor.
+     */
+    Model();
+
     /**
      * Constructor.
      */
@@ -168,15 +164,15 @@ private:
     Model& operator=(const Model&);
     
     /**
-     * Sets the node that is associated with this model.
-     *
-     * This method is automatically called when a model is attached to a node
-     * and therefore should not normally be called explicitly.
-     *
-     * @param node The node that is associated with this model.
+     * @see Drawable::setNode
      */
     void setNode(Node* node);
 
+    /**
+     * @see Drawable::clone
+     */
+    Drawable* clone(NodeCloneContext& context);
+
     /**
      * Sets the MeshSkin for this model.
      *
@@ -189,21 +185,12 @@ private:
      */
     void setMaterialNodeBinding(Material *m);
 
-    /**
-     * Clones the model and returns a new model.
-     *
-     * @param context The clone context.
-     * @return The new cloned model.
-     */
-    Model* clone(NodeCloneContext &context);
-
     void validatePartCount();
 
     Mesh* _mesh;
     Material* _material;
     unsigned int _partCount;
     Material** _partMaterials;
-    Node* _node;
     MeshSkin* _skin;
 };
 

+ 175 - 377
gameplay/src/Node.cpp

@@ -10,6 +10,8 @@
 #include "PhysicsCharacter.h"
 #include "Terrain.h"
 #include "Game.h"
+#include "Drawable.h"
+#include "Form.h"
 
 // Node dirty flags
 #define NODE_DIRTY_WORLD 1
@@ -20,13 +22,11 @@ namespace gameplay
 {
 
 Node::Node(const char* id)
-    : _scene(NULL), _firstChild(NULL), _nextSibling(NULL), _prevSibling(NULL), _parent(NULL), _childCount(0),
-       _enabled(true), _tags(NULL), _camera(NULL), _light(NULL), _model(NULL), _sprite(NULL), _tileset(NULL), _text(NULL),
-        _form(NULL), _particleEmitter(NULL), _terrain(NULL), _audioSource(NULL), _collisionObject(NULL), _agent(NULL),
-       _dirtyBits(NODE_DIRTY_ALL), _notifyHierarchyChanged(true), _userData(NULL)
+    : _scene(NULL), _firstChild(NULL), _nextSibling(NULL), _prevSibling(NULL), _parent(NULL), _childCount(0), _enabled(true), _tags(NULL),
+      _drawable(NULL), _camera(NULL), _light(NULL), _audioSource(NULL), _collisionObject(NULL), _agent(NULL),
+      _dirtyBits(NODE_DIRTY_ALL), _notifyHierarchyChanged(true)
 {
     GP_REGISTER_SCRIPT_EVENTS();
-
     if (id)
     {
         _id = id;
@@ -37,38 +37,18 @@ Node::~Node()
 {
     removeAllChildren();
 
-    if (_model)
-        _model->setNode(NULL);
+    if (_drawable)
+        _drawable->setNode(NULL);
     if (_audioSource)
         _audioSource->setNode(NULL);
-    if (_particleEmitter)
-        _particleEmitter->setNode(NULL);
-    if (_form)
-        _form->setNode(NULL);
-
+    Ref* ref = dynamic_cast<Ref*>(_drawable);
+    SAFE_RELEASE(ref);
     SAFE_RELEASE(_camera);
     SAFE_RELEASE(_light);
-    SAFE_RELEASE(_model);
-    SAFE_RELEASE(_terrain);
     SAFE_RELEASE(_audioSource);
-    SAFE_RELEASE(_particleEmitter);
-    SAFE_RELEASE(_sprite);
-    SAFE_RELEASE(_tileset);
-    SAFE_RELEASE(_text);
-    SAFE_RELEASE(_form);
     SAFE_DELETE(_collisionObject);
     SAFE_DELETE(_tags);
-
     setAgent(NULL);
-
-    // Cleanup user data
-    if (_userData)
-    {
-        // Call custom cleanup callback if specified
-        if (_userData->cleanupCallback)
-            _userData->cleanupCallback(_userData->pointer);
-        SAFE_DELETE(_userData);
-    }
 }
 
 Node* Node::create(const char* id)
@@ -232,130 +212,43 @@ Node* Node::getParent() const
     return _parent;
 }
 
-bool Node::hasTag(const char* name) const
-{
-    GP_ASSERT(name);
-
-    return (_tags ? _tags->find(name) != _tags->end() : false);
-}
-
-const char* Node::getTag(const char* name) const
-{
-    GP_ASSERT(name);
-
-    if (!_tags)
-        return NULL;
-
-    std::map<std::string, std::string>::const_iterator itr = _tags->find(name);
-    return (itr == _tags->end() ? NULL : itr->second.c_str());
-}
-
-void Node::setTag(const char* name, const char* value)
-{
-    GP_ASSERT(name);
-
-    if (value == NULL)
-    {
-        // Removing tag
-        if (_tags)
-        {
-            _tags->erase(name);
-            if (_tags->size() == 0)
-                SAFE_DELETE(_tags);
-        }
-    }
-    else
-    {
-        // Setting tag
-        if (_tags == NULL)
-            _tags = new std::map<std::string, std::string>();
-
-        (*_tags)[name] = value;
-    }
-}
-
-void* Node::getUserPointer() const
-{
-    return (_userData ? _userData->pointer : NULL);
-}
-
-void Node::setUserPointer(void* pointer, void (*cleanupCallback)(void*))
+unsigned int Node::getChildCount() const
 {
-    // If existing user pointer is being changed, call cleanup function to free previous pointer
-    if (_userData && _userData->pointer && _userData->cleanupCallback && pointer != _userData->pointer)
-    {
-        _userData->cleanupCallback(_userData->pointer);
-    }
-
-    if (pointer)
-    {
-        // Assign user pointer
-        if (_userData == NULL)
-            _userData = new UserData();
-
-        _userData->pointer = pointer;
-        _userData->cleanupCallback = cleanupCallback;
-    }
-    else
-    {
-        // Clear user pointer
-        SAFE_DELETE(_userData);
-    }
+    return _childCount;
 }
 
-void Node::setEnabled(bool enabled)
+Node* Node::getRootNode() const
 {
-    if (_enabled != enabled)
+    Node* n = const_cast<Node*>(this);
+    while (n->getParent())
     {
-        if (_collisionObject)
-            _collisionObject->setEnabled(enabled);
-
-        _enabled = enabled;
+        n = n->getParent();
     }
-}
-
-bool Node::isEnabled() const
-{
-    return _enabled;
-}
-
-bool Node::isEnabledInHierarchy() const
-{
-    if (!_enabled)
-       return false;
-   Node* node = _parent;
-   while (node)
-   {
-       if (!node->_enabled)
-           return false;
-       node = node->_parent;
-   }
-   return true;
-}
-
-unsigned int Node::getChildCount() const
-{
-    return _childCount;
+    return n;
 }
 
 Node* Node::findNode(const char* id, bool recursive, bool exactMatch) const
 {
     GP_ASSERT(id);
 
-    // If the node has a model with a mesh skin, search the skin's hierarchy as well.
+    // If the drawable is a model with a mesh skin, search the skin's hierarchy as well.
     Node* rootNode = NULL;
-    if (_model != NULL && _model->getSkin() != NULL && (rootNode = _model->getSkin()->_rootNode) != NULL)
+    Model* model = dynamic_cast<Model*>(_drawable);
+    if (model)
     {
-        if ((exactMatch && rootNode->_id == id) || (!exactMatch && rootNode->_id.find(id) == 0))
-            return rootNode;
-        
-        Node* match = rootNode->findNode(id, true, exactMatch);
-        if (match)
+        if (model->getSkin() != NULL && (rootNode = model->getSkin()->_rootNode) != NULL)
         {
-            return match;
+            if ((exactMatch && rootNode->_id == id) || (!exactMatch && rootNode->_id.find(id) == 0))
+                return rootNode;
+
+            Node* match = rootNode->findNode(id, true, exactMatch);
+            if (match)
+            {
+                return match;
+            }
         }
     }
-    
+
     // Search immediate children first.
     for (Node* child = getFirstChild(); child != NULL; child = child->getNextSibling())
     {
@@ -380,22 +273,26 @@ Node* Node::findNode(const char* id, bool recursive, bool exactMatch) const
     }
 
     return NULL;
-}   
+}
 
 unsigned int Node::findNodes(const char* id, std::vector<Node*>& nodes, bool recursive, bool exactMatch) const
 {
     GP_ASSERT(id);
-    
+
     unsigned int count = 0;
 
-    // If the node has a model with a mesh skin, search the skin's hierarchy as well.
+    // If the drawable is a model with a mesh skin, search the skin's hierarchy as well.
     Node* rootNode = NULL;
-    if (_model != NULL && _model->getSkin() != NULL && (rootNode = _model->getSkin()->_rootNode) != NULL)
+    Model* model = dynamic_cast<Model*>(_drawable);
+    if (model)
     {
-        if ((exactMatch && rootNode->_id == id) || (!exactMatch && rootNode->_id.find(id) == 0))
+        if (model->getSkin() != NULL && (rootNode = model->getSkin()->_rootNode) != NULL)
         {
-            nodes.push_back(rootNode);
-            ++count;
+            if ((exactMatch && rootNode->_id == id) || (!exactMatch && rootNode->_id.find(id) == 0))
+            {
+                nodes.push_back(rootNode);
+                ++count;
+            }
         }
         count += rootNode->findNodes(id, nodes, true, exactMatch);
     }
@@ -439,14 +336,83 @@ Scene* Node::getScene() const
     return NULL;
 }
 
-Node* Node::getRootNode() const
+bool Node::hasTag(const char* name) const
 {
-    Node* n = const_cast<Node*>(this);
-    while (n->getParent())
+    GP_ASSERT(name);
+
+    return (_tags ? _tags->find(name) != _tags->end() : false);
+}
+
+const char* Node::getTag(const char* name) const
+{
+    GP_ASSERT(name);
+
+    if (!_tags)
+        return NULL;
+
+    std::map<std::string, std::string>::const_iterator itr = _tags->find(name);
+    return (itr == _tags->end() ? NULL : itr->second.c_str());
+}
+
+void Node::setTag(const char* name, const char* value)
+{
+    GP_ASSERT(name);
+
+    if (value == NULL)
     {
-        n = n->getParent();
+        // Removing tag
+        if (_tags)
+        {
+            _tags->erase(name);
+            if (_tags->size() == 0)
+            {
+                SAFE_DELETE(_tags);
+            }
+        }
     }
-    return n;
+    else
+    {
+        // Setting tag
+        if (_tags == NULL)
+        {
+            _tags = new std::map<std::string, std::string>();
+        }
+        (*_tags)[name] = value;
+    }
+}
+
+void Node::setEnabled(bool enabled)
+{
+    if (_enabled != enabled)
+    {
+        if (_collisionObject)
+        {
+            _collisionObject->setEnabled(enabled);
+        }
+        _enabled = enabled;
+    }
+}
+
+bool Node::isEnabled() const
+{
+    return _enabled;
+}
+
+bool Node::isEnabledInHierarchy() const
+{
+    if (!_enabled)
+       return false;
+
+   Node* node = _parent;
+   while (node)
+   {
+       if (!node->_enabled)
+       {
+           return false;
+       }
+       node = node->_parent;
+   }
+   return true;
 }
 
 void Node::update(float elapsedTime)
@@ -454,9 +420,10 @@ void Node::update(float elapsedTime)
     for (Node* node = _firstChild; node != NULL; node = node->_nextSibling)
     {
         if (node->isEnabled())
+        {
             node->update(elapsedTime);
+        }
     }
-
     fireScriptEvent<void>(GP_GET_SCRIPT_EVENT(Node, update), dynamic_cast<void*>(this), elapsedTime);
 }
 
@@ -502,9 +469,7 @@ const Matrix& Node::getWorldMatrix() const
 const Matrix& Node::getWorldViewMatrix() const
 {
     static Matrix worldView;
-
     Matrix::multiply(getViewMatrix(), getWorldMatrix(), &worldView);
-
     return worldView;
 }
 
@@ -590,18 +555,15 @@ const Matrix& Node::getInverseViewProjectionMatrix() const
     {
         return camera->getInverseViewProjectionMatrix();
     }
-
     return Matrix::identity();
 }
 
 const Matrix& Node::getWorldViewProjectionMatrix() const
 {
-    static Matrix worldViewProj;
-
     // Always re-calculate worldViewProjection matrix since it's extremely difficult
     // to track whether the camera has changed (it may frequently change every frame).
+    static Matrix worldViewProj;
     Matrix::multiply(getViewProjectionMatrix(), getWorldMatrix(), &worldViewProj);
-
     return worldViewProj;
 }
 
@@ -736,7 +698,7 @@ Animation* Node::getAnimation(const char* id) const
         return animation;
     
     // See if this node has a model, then drill down.
-    Model* model = this->getModel();
+    Model* model = dynamic_cast<Model*>(_drawable);
     if (model)
     {
         // Check to see if there's any animations with the ID on the joints.
@@ -770,7 +732,7 @@ Animation* Node::getAnimation(const char* id) const
     }
 
     // look through form for animations.
-    Form* form = this->getForm();
+    Form* form = dynamic_cast<Form*>(_drawable);
     if (form)
     {
         animation = form->getAnimation(id);
@@ -841,181 +803,34 @@ void Node::setLight(Light* light)
     }
 }
 
-Model* Node::getModel() const
+Drawable* Node::getDrawable() const
 {
-    return _model;
+    return _drawable;
 }
 
-void Node::setModel(Model* model)
+void Node::setDrawable(Drawable* drawable)
 {
-    if (_model != model)
+    if (_drawable != drawable)
     {
-        if (_model)
-        {
-            _model->setNode(NULL);
-            SAFE_RELEASE(_model);
-        }
-
-        _model = model;
-
-        if (_model)
+        if (_drawable)
         {
-            _model->addRef();
-            _model->setNode(this);
+            _drawable->setNode(NULL);
+            Ref* ref = dynamic_cast<Ref*>(_drawable);
+            if (ref)
+                ref->release();
         }
-    }
-}
 
-Sprite* Node::getSprite() const
-{
-    return _sprite;
-}
+        _drawable = drawable;
 
-void Node::setSprite(Sprite* sprite)
-{
-    if (_sprite != sprite)
-    {
-        if (_sprite)
-        {
-            _sprite->setNode(NULL);
-            SAFE_RELEASE(_sprite);
-        }
-        
-        _sprite = sprite;
-        
-        if (_sprite)
+        if (_drawable)
         {
-            _sprite->addRef();
-            _sprite->setNode(this);
+            Ref* ref = dynamic_cast<Ref*>(_drawable);
+            if (ref)
+                ref->addRef();
+            _drawable->setNode(this);
         }
     }
-}
-
-TileSet* Node::getTileSet() const
-{
-    return _tileset;
-}
-
-void Node::setTileSet(TileSet* tileset)
-{
-    if (_tileset != tileset)
-    {
-        if (_tileset)
-        {
-            _tileset->setNode(NULL);
-            SAFE_RELEASE(_tileset);
-        }
-        
-        _tileset = tileset;
-        
-        if (_tileset)
-        {
-            _tileset->addRef();
-            _tileset->setNode(this);
-        }
-    }
-}
-
-Text* Node::getText() const
-{
-    return _text;
-}
-
-void Node::setText(Text* text)
-{
-    if (_text != text)
-    {
-        if (_text)
-        {
-            _text->setNode(NULL);
-            SAFE_RELEASE(_text);
-        }
-        
-        _text = text;
-        
-        if (_text)
-        {
-            _text->addRef();
-            _text->setNode(this);
-        }
-    }
-}
-    
-Form* Node::getForm() const
-{
-    return _form;
-}
-
-void Node::setForm(Form* form)
-{
-    if (_form != form)
-    {
-        if (_form)
-        {
-            _form->setNode(NULL);
-            SAFE_RELEASE(_form);
-        }
-
-        _form = form;
-
-        if (_form)
-        {
-            _form->addRef();
-            _form->setNode(this);
-        }
-    }
-}
-
-ParticleEmitter* Node::getParticleEmitter() const
-{
-    return _particleEmitter;
-}
-
-void Node::setParticleEmitter(ParticleEmitter* emitter)
-{
-    if (_particleEmitter != emitter)
-    {
-        if (_particleEmitter)
-        {
-            _particleEmitter->setNode(NULL);
-            SAFE_RELEASE(_particleEmitter);
-        }
-        
-        _particleEmitter = emitter;
-        
-        if (_particleEmitter)
-        {
-            _particleEmitter->addRef();
-            _particleEmitter->setNode(this);
-        }
-    }
-}
-    
-Terrain* Node::getTerrain() const
-{
-    return _terrain;
-}
-
-void Node::setTerrain(Terrain* terrain)
-{
-    if (_terrain != terrain)
-    {
-        if (_terrain)
-        {
-            _terrain->setNode(NULL);
-            SAFE_RELEASE(_terrain);
-        }
-
-        _terrain = terrain;
-
-        if (_terrain)
-        {
-            _terrain->addRef();
-            _terrain->setNode(this);
-        }
-
-        setBoundsDirty();
-    }
+    setBoundsDirty();
 }
 
 const BoundingSphere& Node::getBoundingSphere() const
@@ -1027,23 +842,25 @@ const BoundingSphere& Node::getBoundingSphere() const
         const Matrix& worldMatrix = getWorldMatrix();
 
         // Start with our local bounding sphere
-        // TODO: Incorporate bounds from entities other than mesh (i.e. emitters, audiosource, etc)
+        // TODO: Incorporate bounds from entities other than mesh (i.e. particleemitters, audiosource, etc)
         bool empty = true;
-        if (_terrain)
+        Terrain* terrain = dynamic_cast<Terrain*>(_drawable);
+        if (terrain)
         {
-            _bounds.set(_terrain->getBoundingBox());
+            _bounds.set(terrain->getBoundingBox());
             empty = false;
         }
-        if (_model && _model->getMesh())
+        Model* model = dynamic_cast<Model*>(_drawable);
+        if (model && model->getMesh())
         {
             if (empty)
             {
-                _bounds.set(_model->getMesh()->getBoundingSphere());
+                _bounds.set(model->getMesh()->getBoundingSphere());
                 empty = false;
             }
             else
             {
-                _bounds.merge(_model->getMesh()->getBoundingSphere());
+                _bounds.merge(model->getMesh()->getBoundingSphere());
             }
         }
         if (_light)
@@ -1077,7 +894,7 @@ const BoundingSphere& Node::getBoundingSphere() const
         if (!empty)
         {
             bool applyWorldTransform = true;
-            if (_model && _model->getSkin())
+            if (model && model->getSkin())
             {
                 // Special case: If the root joint of our mesh skin is parented by any nodes, 
                 // multiply the world matrix of the root joint's parent by this node's
@@ -1087,8 +904,8 @@ const BoundingSphere& Node::getBoundingSphere() const
                 // since joint parent nodes that are not in the matrix palette do not need to
                 // be considered as directly transforming vertices on the GPU (they can instead
                 // be applied directly to the bounding volume transformation below).
-                GP_ASSERT(_model->getSkin()->getRootJoint());
-                Node* jointParent = _model->getSkin()->getRootJoint()->getParent();
+                GP_ASSERT(model->getSkin()->getRootJoint());
+                Node* jointParent = model->getSkin()->getRootJoint()->getParent();
                 if (jointParent)
                 {
                     // TODO: Should we protect against the case where joints are nested directly
@@ -1158,72 +975,53 @@ Node* Node::cloneRecursive(NodeCloneContext &context) const
     return copy;
 }
 
-void Node::cloneInto(Node* node, NodeCloneContext &context) const
+void Node::cloneInto(Node* node, NodeCloneContext& context) const
 {
     GP_ASSERT(node);
-    Transform::cloneInto(node, context);
 
-    // TODO: Clone the rest of the node data.
+    Transform::cloneInto(node, context);
 
+    if (Drawable* drawable = getDrawable())
+    {
+        Drawable* clone = drawable->clone(context);
+        node->setDrawable(clone);
+        Ref* ref = dynamic_cast<Ref*>(clone);
+        if (ref)
+            ref->release();
+    }
     if (Camera* camera = getCamera())
     {
-        Camera* cameraClone = camera->clone(context);
-        node->setCamera(cameraClone);
-        cameraClone->release();
+        Camera* clone = camera->clone(context);
+        node->setCamera(clone);
+        Ref* ref = dynamic_cast<Ref*>(clone);
+        if (ref)
+            ref->release();
     }
     if (Light* light = getLight())
     {
-        Light* lightClone = light->clone(context);
-        node->setLight(lightClone);
-        lightClone->release();
+        Light* clone = light->clone(context);
+        node->setLight(clone);
+        Ref* ref = dynamic_cast<Ref*>(clone);
+        if (ref)
+            ref->release();
     }
     if (AudioSource* audio = getAudioSource())
     {
-        AudioSource* audioClone = audio->clone(context);
-        node->setAudioSource(audioClone);
-        audioClone->release();
-    }
-    if (Model* model = getModel())
-    {
-        Model* modelClone = model->clone(context);
-        node->setModel(modelClone);
-        modelClone->release();
-    }
-    if (ParticleEmitter* emitter = getParticleEmitter())
-    {
-        ParticleEmitter* emitterClone = emitter->clone();
-        node->setParticleEmitter(emitterClone);
-        emitterClone->release();
+        AudioSource* clone = audio->clone(context);
+        node->setAudioSource(clone);
+        Ref* ref = dynamic_cast<Ref*>(clone);
+        if (ref)
+            ref->release();
     }
-    if (Sprite* sprite = getSprite())
-    {
-        Sprite* spriteClone = sprite->clone(context);
-        node->setSprite(spriteClone);
-        spriteClone->release();
-    }
-    if (TileSet* tileset = getTileSet())
-    {
-        TileSet* tilesetClone = tileset->clone(context);
-        node->setTileSet(tilesetClone);
-        tilesetClone->release();
-    }
-    if (Text* text = getText())
+    if (_tags)
     {
-        Text* textClone = text->clone(context);
-        node->setText(textClone);
-        textClone->release();
+        node->_tags = new std::map<std::string, std::string>(_tags->begin(), _tags->end());
     }
-    
+
     node->_world = _world;
     node->_bounds = _bounds;
 
-    // Note: Do not clone _userData - we can't make any assumptions about its content and how it's managed,
-    // so it's the caller's responsibility to clone user data if needed.
-
-    if (_tags)
-    {
-        node->_tags = new std::map<std::string, std::string>(_tags->begin(), _tags->end());
-    }
+    // TODO: Clone the rest of the node data.
 }
 
 AudioSource* Node::getAudioSource() const

+ 81 - 269
gameplay/src/Node.h

@@ -3,14 +3,14 @@
 
 #include "Transform.h"
 #include "ScriptTarget.h"
-#include "Camera.h"
-#include "Light.h"
 #include "Model.h"
 #include "Sprite.h"
 #include "TileSet.h"
 #include "Text.h"
 #include "Form.h"
 #include "ParticleEmitter.h"
+#include "Camera.h"
+#include "Light.h"
 #include "PhysicsRigidBody.h"
 #include "PhysicsCollisionObject.h"
 #include "BoundingBox.h"
@@ -20,15 +20,11 @@ namespace gameplay
 {
 
 class Scene;
-class Model;
-class Sprite;
-class TileSet;
-class Text;
-class Form;
-class ParticleEmitter;
-class Terrain;
+class Camera;
+class Light;
 class AudioSource;
 class AIAgent;
+class Drawable;
 
 /**
  * Defines a hierarchical structure of objects in 3D transformation spaces.
@@ -148,9 +144,58 @@ public:
     Node* getParent() const;
 
     /**
-     * Sets a custom tag on this Node.
+     * Returns the number of direct children of this item.
+     *
+     * @return The number of children.
+     */
+    unsigned int getChildCount() const;
+
+    /**
+     * Gets the top level node in this node's parent hierarchy.
+     */
+    Node* getRootNode() const;
+
+    /**
+     * Returns the first child node that matches the given ID.
+     *
+     * This method checks the specified ID against its immediate child nodes
+     * but does not check the ID against itself.
+     * If recursive is true, it also traverses the Node's hierarchy with a breadth first search.
+     *
+     * @param id The ID of the child to find.
+     * @param recursive True to search recursively all the node's children, false for only direct children.
+     * @param exactMatch true if only nodes whose ID exactly matches the specified ID are returned,
+     *        or false if nodes that start with the given ID are returned.
+     *
+     * @return The Node found or NULL if not found.
+     */
+    Node* findNode(const char* id, bool recursive = true, bool exactMatch = true) const;
+
+    /**
+     * Returns all child nodes that match the given ID.
+     *
+     * @param id The ID of the node to find.
+     * @param nodes A vector of nodes to be populated with matches.
+     * @param recursive true if a recursive search should be performed, false otherwise.
+     * @param exactMatch true if only nodes whose ID exactly matches the specified ID are returned,
+     *        or false if nodes that start with the given ID are returned.
+     *
+     * @return The number of matches found.
+     * @script{ignore}
+     */
+    unsigned int findNodes(const char* id, std::vector<Node*>& nodes, bool recursive = true, bool exactMatch = true) const;
+
+    /**
+     * Gets the scene this node is currenlty within.
+     *
+     * @return The scene.
+     */
+    virtual Scene* getScene() const;
+
+    /**
+     * Sets a tag on this Node.
      *
-     * Custom tags can be used for a variety of purposes within a game. For example,
+     * tags can be used for a variety of purposes within a game. For example,
      * a tag called "transparent" can be added to nodes, to indicate which nodes in
      * a scene are transparent. This tag can then be read during rendering to sort
      * transparent and opaque objects for correct drawing order.
@@ -180,37 +225,6 @@ public:
      */
     bool hasTag(const char* name) const;
 
-    /**
-     * Returns the user pointer for this node.
-     *
-     * @return The user pointer for this node.
-     * @see setUserPointer(void*)
-     * @script{ignore}
-     */
-    void* getUserPointer() const;
-
-    /**
-     * Sets the user pointer for this node.
-     *
-     * The user pointer is initially NULL and can be set to anything.
-     * This is normally used to store game-specific data, such as
-     * game state for a particular node.  For example, attributes
-     * for a game character, such as hit points, stamina, etc can
-     * be defined in a game structure and stored in this field.
-     *
-     * When a node is deleted, the (optional) cleanup callback
-     * function passed to this function is called to allow the
-     * user to free any memory associated with the user pointer.
-     *
-     * @param pointer User pointer.
-     * @param cleanupCallback Optional callback that is called when the
-     *      Node is being destroyed (or when the user pointer changes),
-     *      to allow the user to cleanup any memory associated with the
-     *      user pointer.
-     * @script{ignore}
-     */
-    void setUserPointer(void* pointer, void (*cleanupCallback)(void*) = NULL);
-
     /**
      * Sets if the node is enabled in the scene.
      *
@@ -226,61 +240,12 @@ public:
     bool isEnabled() const;
 
     /**
-     * Gets if the node either inherently enabled.
+     * Gets if the node inherently enabled.
      *
      * @return if components attached on this node should be running.
      */
     bool isEnabledInHierarchy() const;
 
-    /**
-     * Returns the number of direct children of this item.
-     *
-     * @return The number of children.
-     */
-    unsigned int getChildCount() const;
-
-    /**
-     * Returns the first child node that matches the given ID.
-     *
-     * This method checks the specified ID against its immediate child nodes
-     * but does not check the ID against itself.
-     * If recursive is true, it also traverses the Node's hierarchy with a breadth first search.
-     *
-     * @param id The ID of the child to find.
-     * @param recursive True to search recursively all the node's children, false for only direct children.
-     * @param exactMatch true if only nodes whose ID exactly matches the specified ID are returned,
-     *        or false if nodes that start with the given ID are returned.
-     *
-     * @return The Node found or NULL if not found.
-     */
-    Node* findNode(const char* id, bool recursive = true, bool exactMatch = true) const;
-
-    /**
-     * Returns all child nodes that match the given ID.
-     *
-     * @param id The ID of the node to find.
-     * @param nodes A vector of nodes to be populated with matches.
-     * @param recursive true if a recursive search should be performed, false otherwise.
-     * @param exactMatch true if only nodes whose ID exactly matches the specified ID are returned,
-     *        or false if nodes that start with the given ID are returned.
-     *
-     * @return The number of matches found.
-     * @script{ignore}
-     */
-    unsigned int findNodes(const char* id, std::vector<Node*>& nodes, bool recursive = true, bool exactMatch = true) const;
-
-    /**
-     * Gets the scene.
-     *
-     * @return The scene.
-     */
-    virtual Scene* getScene() const;
-
-    /**
-     * Gets the top level node in this node's parent hierarchy.
-     */
-    Node* getRootNode() const;
-
     /**
      * Called to update the state of this Node.
      *
@@ -448,6 +413,25 @@ public:
      */
     Animation* getAnimation(const char* id = NULL) const;
 
+    /**
+     * Gets the drawable object attached to this node.
+     *
+     * Use Drawable::getType() then static_cast to the associate Type for specialization.
+     *
+     * @return The model attached to this node.
+     */
+    Drawable* getDrawable() const;
+
+    /**
+     * Set the drawable object to be attached to this node.
+     *
+     * This will increase the reference count of the new drawble and decrease
+     * the reference count of the old drawable.
+     *
+     * @param model The new model. May be NULL.
+     */
+    void setDrawable(Drawable* drawable);
+
     /**
      * Gets the camera attached to this node.
      *
@@ -482,122 +466,6 @@ public:
      */
     void setLight(Light* light);
 
-    /**
-     * Gets the model attached to this node.
-     *
-     * @return The model attached to this node.
-     */
-    Model* getModel() const;
-
-    /**
-     * Attaches a model to this node.
-     *
-     * This will increase the reference count of the new model and decrease
-     * the reference count of the old model.
-     *
-     * @param model The new model. May be NULL.
-     */
-    void setModel(Model* model);
-    
-    /**
-     * Gets the sprite attached to this node.
-     *
-     * @return The sprite attached to this node
-     */
-    Sprite* getSprite() const;
-    
-    /**
-     * Attaches a sprite to this node.
-     *
-     * This will increase the reference count of the new sprite and decrease
-     * the reference count of the old sprite.
-     *
-     * @param sprite The new sprite. May be NULL.
-     */
-    void setSprite(Sprite* sprite);
-    
-    /**
-     * Gets the tileset attached to this node.
-     *
-     * @return The tileset attached to this node
-     */
-    TileSet* getTileSet() const;
-    
-    /**
-     * Attaches a tileset to this node.
-     *
-     * This will increase the reference count of the new tileset and decrease
-     * the reference count of the old tileset.
-     *
-     * @param tileset The new tileset. May be NULL.
-     */
-    void setTileSet(TileSet* tileset);
-    
-    /**
-     * Gets the tileset attached to this node.
-     *
-     * @return The tileset attached to this node
-     */
-    Text* getText() const;
-    
-    /**
-     * Attaches text to this node.
-     *
-     * This will increase the reference count of the new text and decrease
-     * the reference count of the old text.
-     *
-     * @param tileset The new tileset. May be NULL.
-     */
-    void setText(Text* text);
-
-    /**
-     * Gets the form attached to this node.
-     *
-     * @return The form attached to this node.
-     */
-    Form* getForm() const;
-
-    /**
-     * Attaches a form to this node.
-     *
-     * @param form The new form. May be NULL.
-     */
-    void setForm(Form* form);
-    
-    /**
-     * Returns the pointer to this node's particle emitter.
-     *
-     * @return The pointer to this node's particle emitter or NULL.
-     */
-    ParticleEmitter* getParticleEmitter() const;
-    
-    /**
-     * Attaches a particle emitter to this node.
-     *
-     * This will increase the reference count of the new particle emitter and decrease
-     * the reference count of the old particle emitter.
-     *
-     * @param emitter The new particle emitter. May be NULL.
-     */
-    void setParticleEmitter(ParticleEmitter* emitter);
-    
-    /**
-     * Gets the terrain attached to this node.
-     *
-     * @return The terrain attached to this node.
-     */
-    Terrain* getTerrain() const;
-    
-    /**
-     * Attaches a terrain to this node.
-     *
-     * This will increase the reference count of the new terrain and decrease
-     * the reference count of the old terrain.
-     *
-     * @param terrain The new terrain. May be NULL.
-     */
-    void setTerrain(Terrain* terrain);
-
     /**
      * Gets the audio source attached to this node.
      *
@@ -805,27 +673,6 @@ private:
 
 protected:
 
-    /**
-     * Defines a pointer and cleanup callback to custom user data that can be store in a Node.
-     */
-    struct UserData
-    {
-        /**
-         * Constructor.
-         */
-        UserData() : pointer(NULL), cleanupCallback(NULL) {}
-
-        /**
-         * A pointer to custom user data.
-         */
-        void* pointer;
-
-        /**
-         * Cleanup callback.
-         */
-        void (*cleanupCallback)(void*);
-    };
-
     /**
      * The Scene this node belongs to.
      */
@@ -872,6 +719,11 @@ protected:
      */
     std::map<std::string, std::string>* _tags;
 
+    /**
+     * Drawable objects attached to the Node.
+     */
+    Drawable* _drawable;
+
     /**
      * Camera attached to the Node.
      */
@@ -882,41 +734,6 @@ protected:
      */
     Light* _light;
 
-    /**
-     * Model attached to the Node.
-     */
-    Model* _model;
-
-    /**
-     * Sprite attached to the Node.
-     */
-    Sprite* _sprite;
-    
-    /**
-     * TileSet attached to the Node.
-     */
-    TileSet* _tileset;
-    
-    /**
-     * Text attached to the Node.
-     */
-    Text* _text;
-    
-    /**
-     * Form attached to the Node.
-     */
-    Form* _form;
-    
-    /**
-     * Pointer to the ParticleEmitter attached to the Node.
-     */
-    ParticleEmitter* _particleEmitter;
-    
-    /**
-     * Pointer to the Terrain attached to the Node.
-     */
-    Terrain* _terrain;
-
     /**
      * Pointer to the AudioSource attached to the Node.
      */
@@ -951,11 +768,6 @@ protected:
      * The Bounding Sphere containing the Node.
      */
     mutable BoundingSphere _bounds;
-
-    /**
-     * Pointer to custom UserData and cleanup call back that can be stored in a Node.
-     */
-    UserData* _userData;
 };
 
 /**

+ 41 - 54
gameplay/src/ParticleEmitter.cpp

@@ -14,7 +14,7 @@
 namespace gameplay
 {
 
-ParticleEmitter::ParticleEmitter(unsigned int particleCountMax) :
+ParticleEmitter::ParticleEmitter(unsigned int particleCountMax) : Drawable(),
     _particleCountMax(particleCountMax), _particleCount(0), _particles(NULL),
     _emissionRate(PARTICLE_EMISSION_RATE), _started(false), _ellipsoid(false),
     _sizeStartMin(1.0f), _sizeStartMax(1.0f), _sizeEndMin(1.0f), _sizeEndMax(1.0f),
@@ -28,7 +28,7 @@ ParticleEmitter::ParticleEmitter(unsigned int particleCountMax) :
     _rotationAxis(Vector3::zero()), _rotation(Matrix::identity()),
     _spriteBatch(NULL), _spriteBlendMode(BLEND_ALPHA),  _spriteTextureWidth(0), _spriteTextureHeight(0), _spriteTextureWidthRatio(0), _spriteTextureHeightRatio(0), _spriteTextureCoords(NULL),
     _spriteAnimated(false),  _spriteLooped(false), _spriteFrameCount(1), _spriteFrameRandomOffset(0),_spriteFrameDuration(0L), _spriteFrameDurationSecs(0.0f), _spritePercentPerFrame(0.0f),
-    _node(NULL), _orbitPosition(false), _orbitVelocity(false), _orbitAcceleration(false),
+    _orbitPosition(false), _orbitVelocity(false), _orbitAcceleration(false),
     _timePerEmission(PARTICLE_EMISSION_RATE_TIME_INTERVAL), _emitTime(0), _lastUpdated(0)
 {
     GP_ASSERT(particleCountMax);
@@ -193,13 +193,11 @@ ParticleEmitter* ParticleEmitter::create(Properties* properties)
     emitter->setAcceleration(acceleration, accelerationVar);
     emitter->setRotationPerParticle(rotationPerParticleSpeedMin, rotationPerParticleSpeedMax);
     emitter->setRotation(rotationSpeedMin, rotationSpeedMax, rotationAxis, rotationAxisVar);
-
     emitter->setSpriteAnimated(spriteAnimated);
     emitter->setSpriteLooped(spriteLooped);
     emitter->setSpriteFrameRandomOffset(spriteFrameRandomOffset);
     emitter->setSpriteFrameDuration(spriteFrameDuration);
     emitter->setSpriteFrameCoords(spriteFrameCount, spriteWidth, spriteHeight);
-
     emitter->setOrbit(orbitPosition, orbitVelocity, orbitAcceleration);
 
     return emitter;
@@ -724,16 +722,6 @@ unsigned int ParticleEmitter::getSpriteFrameCount() const
     return _spriteFrameCount;
 }
 
-Node* ParticleEmitter::getNode() const
-{
-    return _node;
-}
-
-void ParticleEmitter::setNode(Node* node)
-{
-    _node = node;
-}
-
 void ParticleEmitter::setOrbit(bool orbitPosition, bool orbitVelocity, bool orbitAcceleration)
 {
     _orbitPosition = orbitPosition;
@@ -991,7 +979,7 @@ void ParticleEmitter::update(float elapsedTime)
     }
 }
 
-unsigned int ParticleEmitter::draw()
+unsigned int ParticleEmitter::draw(bool wireframe)
 {
     if (!isActive())
         return 0;
@@ -1038,47 +1026,46 @@ unsigned int ParticleEmitter::draw()
     return 1;
 }
 
-ParticleEmitter* ParticleEmitter::clone()
+Drawable* ParticleEmitter::clone(NodeCloneContext& context)
 {
     // Create a clone of this emitter
-    ParticleEmitter* emitter = ParticleEmitter::create(_spriteBatch->getSampler()->getTexture(),
-                                                       _spriteBlendMode, _particleCountMax);
-
-    // Copy all properties to the clone
-    emitter->setEmissionRate(_emissionRate);
-    emitter->_ellipsoid = _ellipsoid;
-    emitter->_sizeStartMin = _sizeStartMin;
-    emitter->_sizeStartMax = _sizeStartMax;
-    emitter->_sizeEndMin = _sizeEndMin;
-    emitter->_sizeEndMax = _sizeEndMax;
-    emitter->_energyMin = _energyMin;
-    emitter->_energyMax = _energyMax;
-    emitter->_colorStart = _colorStart;
-    emitter->_colorStartVar = _colorStartVar;
-    emitter->_colorEnd = _colorEnd;
-    emitter->_colorEndVar = _colorEndVar;
-    emitter->_position = _position;
-    emitter->_positionVar = _positionVar;
-    emitter->_velocity = _velocity;
-    emitter->_velocityVar = _velocityVar;
-    emitter->_acceleration = _acceleration;
-    emitter->_accelerationVar = _accelerationVar;
-    emitter->_rotationPerParticleSpeedMin = _rotationPerParticleSpeedMin;
-    emitter->_rotationPerParticleSpeedMax = _rotationPerParticleSpeedMax;
-    emitter->_rotationSpeedMin = _rotationSpeedMin;
-    emitter->_rotationSpeedMax = _rotationSpeedMax;
-    emitter->_rotationAxis = _rotationAxis;
-    emitter->_rotationAxisVar = _rotationAxisVar;
-    emitter->setSpriteTexCoords(_spriteFrameCount, _spriteTextureCoords);
-    emitter->_spriteAnimated = _spriteAnimated;
-    emitter->_spriteLooped = _spriteLooped;
-    emitter->_spriteFrameRandomOffset = _spriteFrameRandomOffset;
-    emitter->setSpriteFrameDuration(_spriteFrameDuration);
-    emitter->_orbitPosition = _orbitPosition;
-    emitter->_orbitVelocity = _orbitVelocity;
-    emitter->_orbitAcceleration = _orbitAcceleration;
-
-    return emitter;
+    ParticleEmitter* clone = ParticleEmitter::create(_spriteBatch->getSampler()->getTexture(),
+                                                     _spriteBlendMode, _particleCountMax);
+    // Clone properties
+    clone->setEmissionRate(_emissionRate);
+    clone->_ellipsoid = _ellipsoid;
+    clone->_sizeStartMin = _sizeStartMin;
+    clone->_sizeStartMax = _sizeStartMax;
+    clone->_sizeEndMin = _sizeEndMin;
+    clone->_sizeEndMax = _sizeEndMax;
+    clone->_energyMin = _energyMin;
+    clone->_energyMax = _energyMax;
+    clone->_colorStart = _colorStart;
+    clone->_colorStartVar = _colorStartVar;
+    clone->_colorEnd = _colorEnd;
+    clone->_colorEndVar = _colorEndVar;
+    clone->_position = _position;
+    clone->_positionVar = _positionVar;
+    clone->_velocity = _velocity;
+    clone->_velocityVar = _velocityVar;
+    clone->_acceleration = _acceleration;
+    clone->_accelerationVar = _accelerationVar;
+    clone->_rotationPerParticleSpeedMin = _rotationPerParticleSpeedMin;
+    clone->_rotationPerParticleSpeedMax = _rotationPerParticleSpeedMax;
+    clone->_rotationSpeedMin = _rotationSpeedMin;
+    clone->_rotationSpeedMax = _rotationSpeedMax;
+    clone->_rotationAxis = _rotationAxis;
+    clone->_rotationAxisVar = _rotationAxisVar;
+    clone->setSpriteTexCoords(_spriteFrameCount, _spriteTextureCoords);
+    clone->_spriteAnimated = _spriteAnimated;
+    clone->_spriteLooped = _spriteLooped;
+    clone->_spriteFrameRandomOffset = _spriteFrameRandomOffset;
+    clone->setSpriteFrameDuration(_spriteFrameDuration);
+    clone->_orbitPosition = _orbitPosition;
+    clone->_orbitVelocity = _orbitVelocity;
+    clone->_orbitAcceleration = _orbitAcceleration;
+
+    return clone;
 }
 
 }

+ 21 - 30
gameplay/src/ParticleEmitter.h

@@ -9,6 +9,7 @@
 #include "Rectangle.h"
 #include "SpriteBatch.h"
 #include "Properties.h"
+#include "Drawable.h"
 
 namespace gameplay
 {
@@ -138,7 +139,7 @@ class Node;
  *
  * @see http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-Particles
  */
-class ParticleEmitter : public Ref
+class ParticleEmitter : public Ref, public Drawable
 {
     friend class Node;
 
@@ -654,13 +655,6 @@ public:
      */
     unsigned int getSpriteFrameCount() const;
 
-    /**
-     * Gets the node that this emitter is attached to.
-     *
-     * @return The node that this emitter is attached to.
-     */
-    Node* getNode() const;
-
     /**
      * Sets whether the vector properties of newly emitted particles are rotated around the node's position
      * by the node's rotation matrix.
@@ -692,23 +686,6 @@ public:
      */
     bool getOrbitAcceleration() const;
 
-    /**
-     * Updates the particles currently being emitted.
-     *
-     * @param elapsedTime The amount of time that has passed since the last call to update(), in milliseconds.
-     */
-    void update(float elapsedTime);
-
-    /**
-     * Draws the particles currently being emitted.
-     */
-    unsigned int draw();
-
-    /**
-     * Gets a blend mode from a corresponding string.
-     */
-    static ParticleEmitter::BlendMode getBlendModeFromString(const char* src);
-
     /**
      * Sets the texture blend mode for this particle emitter.
      *
@@ -724,11 +701,18 @@ public:
     BlendMode getBlendMode() const;
 
     /**
-     * Clones the particle emitter and returns a new emitter.
-     * 
-     * @return The new cloned particle emitter.
+     * Updates the particles currently being emitted.
+     *
+     * @param elapsedTime The amount of time that has passed since the last call to update(), in milliseconds.
      */
-    ParticleEmitter* clone();
+    void update(float elapsedTime);
+
+    /**
+     * @see Drawable::draw
+     *
+     * Draws the particles currently being emitted.
+     */
+    unsigned int draw(bool wireframe = false);
 
 private:
 
@@ -742,6 +726,11 @@ private:
      */
     ~ParticleEmitter();
 
+    /**
+     * @see Drawable::clone
+     */
+    Drawable* clone(NodeCloneContext& context);
+
     /**
      * Creates an uninitialized ParticleEmitter.
      *
@@ -778,6 +767,9 @@ private:
     // Generates a color within the domain defined by a base vector and its variance.
     void generateColor(const Vector4& base, const Vector4& variance, Vector4* dst);
 
+    // Gets the blend mode from string.
+    static ParticleEmitter::BlendMode getBlendModeFromString(const char* src);
+
     /**
      * Defines the data for a single particle in the system.
      */
@@ -847,7 +839,6 @@ private:
     long _spriteFrameDuration;
     float _spriteFrameDurationSecs;
     float _spritePercentPerFrame;
-    Node* _node;
     bool _orbitPosition;
     bool _orbitVelocity;
     bool _orbitAcceleration;

+ 0 - 25
gameplay/src/PhysicsCollisionObject.cpp

@@ -188,31 +188,6 @@ bool PhysicsCollisionObject::collidesWith(PhysicsCollisionObject* object) const
     return callback.result;
 }
 
-PhysicsRigidBody* PhysicsCollisionObject::asRigidBody()
-{
-    return getType() == RIGID_BODY ? static_cast<PhysicsRigidBody*>(this) : NULL;
-}
-
-PhysicsCharacter* PhysicsCollisionObject::asCharacter()
-{
-    return getType() == CHARACTER ? static_cast<PhysicsCharacter*>(this) : NULL;
-}
-
-PhysicsGhostObject* PhysicsCollisionObject::asGhostObject()
-{
-    return getType() == GHOST_OBJECT ? static_cast<PhysicsGhostObject*>(this) : NULL;
-}
-
-PhysicsVehicle* PhysicsCollisionObject::asVehicle()
-{
-    return getType() == VEHICLE ? static_cast<PhysicsVehicle*>(this) : NULL;
-}
-
-PhysicsVehicleWheel* PhysicsCollisionObject::asVehicleWheel()
-{
-    return getType() == VEHICLE_WHEEL ? static_cast<PhysicsVehicleWheel*>(this) : NULL;
-}
-
 PhysicsCollisionObject::CollisionPair::CollisionPair(PhysicsCollisionObject* objectA, PhysicsCollisionObject* objectB)
     : objectA(objectA), objectB(objectB)
 {

+ 0 - 44
gameplay/src/PhysicsCollisionObject.h

@@ -262,50 +262,6 @@ public:
      */
     bool collidesWith(PhysicsCollisionObject* object) const;
 
-    /**
-     * Returns this collision object as a physics rigid body.
-     *
-     * If this collision object is not of type RIGID_BODY, this method returns NULL.
-     *
-     * @return This collision object cast to a PhysicsRigidBody.
-     */
-    PhysicsRigidBody* asRigidBody();
-
-    /**
-     * Returns this collision object as a physics character.
-     *
-     * If this collision object is not of type CHARACTER, this method returns NULL.
-     *
-     * @return This collision object cast to a PhysicsCharacter.
-     */
-    PhysicsCharacter* asCharacter();
-
-    /**
-     * Returns this collision object as a physics ghost object.
-     *
-     * If this collision object is not of type GHOST_OBJECT, this method returns NULL.
-     *
-     * @return This collision object cast to a PhysicsGhostObject.
-     */
-    PhysicsGhostObject* asGhostObject();
-
-    /**
-     * Returns this collision object as a physics vehicle.
-     *
-     * If this collision object is not of type VEHICLE, this method returns NULL.
-     *
-     * @return This collision object cast to a PhysicsVehicle.
-     */
-    PhysicsVehicle* asVehicle();
-
-    /**
-     * Returns this collision object as a physics vehicle wheel.
-     *
-     * If this collision object is not of type VEHICLE_WHEEL, this method returns NULL.
-     *
-     * @return This collision object cast to a PhysicsVehicleWheel.
-     */
-    PhysicsVehicleWheel* asVehicleWheel();
 
 protected:
 

+ 3 - 2
gameplay/src/PhysicsCollisionShape.cpp

@@ -5,6 +5,7 @@
 #include "Properties.h"
 #include "FileSystem.h"
 #include "HeightField.h"
+#include "Terrain.h"
 
 namespace gameplay
 {
@@ -288,7 +289,7 @@ PhysicsCollisionShape::Definition PhysicsCollisionShape::Definition::create(Node
     case SHAPE_MESH:
         {
             // Mesh is required on node.
-            Mesh* nodeMesh = node->getModel() ? node->getModel()->getMesh() : NULL;
+            Mesh* nodeMesh = node->getDrawable() ? dynamic_cast<Model*>(node->getDrawable())->getMesh() : NULL;
             if (nodeMesh == NULL)
             {
                 GP_ERROR("Cannot create mesh collision object for node without model/mesh.");
@@ -317,7 +318,7 @@ PhysicsCollisionShape::Definition PhysicsCollisionShape::Definition::create(Node
             if (imagePath == NULL)
             {
                 // Node requires a valid terrain
-                if (node->getTerrain() == NULL)
+                if (dynamic_cast<Terrain*>(node->getDrawable()) == NULL)
                 {
                     GP_ERROR("Heightfield collision objects can only be specified on nodes that have a valid terrain, or that specify an image path.");
                 }

+ 1 - 1
gameplay/src/PhysicsConstraint.h

@@ -6,8 +6,8 @@
 
 namespace gameplay
 {
-    class Node;
     class PhysicsRigidBody;
+    class Node;
 
 /**
  * Defines the base class for physics constraints.

+ 15 - 12
gameplay/src/PhysicsController.cpp

@@ -719,15 +719,16 @@ static void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
     GP_ASSERT(node);
     GP_ASSERT(out);
 
-    if (node->getModel())
+    Model* model = dynamic_cast<Model*>(node->getDrawable());
+    if (model != NULL)
     {
-        GP_ASSERT(node->getModel()->getMesh());
+        GP_ASSERT(model->getMesh());
 
         if (merge)
-            out->merge(node->getModel()->getMesh()->getBoundingBox());
+            out->merge(model->getMesh()->getBoundingBox());
         else
         {
-            out->set(node->getModel()->getMesh()->getBoundingBox());
+            out->set(model->getMesh()->getBoundingBox());
             merge = true;
         }
     }
@@ -745,15 +746,16 @@ static void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = fals
     GP_ASSERT(node);
     GP_ASSERT(out);
 
-    if (node->getModel())
+    Model* model = dynamic_cast<Model*>(node->getDrawable());
+    if (model != NULL)
     {
-        GP_ASSERT(node->getModel()->getMesh());
+        GP_ASSERT(model->getMesh());
 
         if (merge)
-            out->merge(node->getModel()->getMesh()->getBoundingSphere());
+            out->merge(model->getMesh()->getBoundingSphere());
         else
         {
-            out->set(node->getModel()->getMesh()->getBoundingSphere());
+            out->set(model->getMesh()->getBoundingSphere());
             merge = true;
         }
     }
@@ -892,10 +894,10 @@ PhysicsCollisionShape* PhysicsController::createShape(Node* node, const PhysicsC
             else
             {
                 // Build the heightfield from an attached terrain's height array
-                if (node->getTerrain() == NULL)
+                if (dynamic_cast<Terrain*>(node->getDrawable()) == NULL)
                     GP_ERROR("Empty heightfield collision shapes can only be used on nodes that have an attached Terrain.");
                 else
-                    collisionShape = createHeightfield(node, node->getTerrain()->_heightfield, centerOfMassOffset);
+                    collisionShape = createHeightfield(node, dynamic_cast<Terrain*>(node->getDrawable())->_heightfield, centerOfMassOffset);
             }
         }
         break;
@@ -1037,9 +1039,10 @@ PhysicsCollisionShape* PhysicsController::createHeightfield(Node* node, HeightFi
     node->getWorldMatrix().getScale(&scale);
 
     // If the node has a terrain, apply the terrain's local scale to the world scale
-    if (node->getTerrain())
+    Terrain* terrain = dynamic_cast<Terrain*>(node->getDrawable());
+    if (terrain != NULL)
     {
-        const Vector3& tScale = node->getTerrain()->_localScale;
+        const Vector3& tScale = terrain->_localScale;
         scale.set(scale.x * tScale.x, scale.y * tScale.y, scale.z * tScale.z);
     }
 

+ 6 - 4
gameplay/src/PhysicsRigidBody.cpp

@@ -286,8 +286,9 @@ float PhysicsRigidBody::getHeight(float x, float z) const
 
     // If our node has a terrain, call getHeight() on it since we need to factor in local
     // scaling on the terrain into the height calculation.
-    if (_node->getTerrain())
-        return _node->getTerrain()->getHeight(x, z);
+    Terrain* terrain = dynamic_cast<Terrain*>(_node->getDrawable());
+    if (terrain)
+        return terrain->getHeight(x, z);
 
     // This function is only supported for heightfield rigid bodies.
     if (_collisionShape->getType() != PhysicsCollisionShape::SHAPE_HEIGHTFIELD)
@@ -374,9 +375,10 @@ void PhysicsRigidBody::transformChanged(Transform* transform, long cookie)
         _node->getWorldMatrix().getScale(&scale);
 
         // If the node has a terrain attached, factor in the terrain local scaling as well for the collision shape
-        if (_node->getTerrain())
+        Terrain* terrain = dynamic_cast<Terrain*>(_node->getDrawable());
+        if (terrain)
         {
-            const Vector3& tScale = _node->getTerrain()->_localScale;
+            const Vector3& tScale = terrain->_localScale;
             scale.set(scale.x * tScale.x, scale.y * tScale.y, scale.z * tScale.z);
         }
 

+ 0 - 1
gameplay/src/PhysicsVehicle.h

@@ -7,7 +7,6 @@
 namespace gameplay
 {
 
-class Node;
 class PhysicsVehicleWheel;
 
 /**

+ 1 - 1
gameplay/src/PhysicsVehicleWheel.h

@@ -3,11 +3,11 @@
 
 #include "PhysicsCollisionObject.h"
 #include "PhysicsRigidBody.h"
+#include "Node.h"
 
 namespace gameplay
 {
 
-class Node;
 class PhysicsVehicle;
 
 /**

+ 16 - 6
gameplay/src/RenderState.cpp

@@ -373,16 +373,26 @@ Vector3 RenderState::autoBindingGetCameraViewPosition() const
 
 const Vector4* RenderState::autoBindingGetMatrixPalette() const
 {
-    Model* model = _nodeBinding ? _nodeBinding->getModel() : NULL;
-    MeshSkin* skin = model ? model->getSkin() : NULL;
-    return skin ? skin->getMatrixPalette() : NULL;
+    Model* model = dynamic_cast<Model*>(_nodeBinding->getDrawable());
+    if (model)
+    {
+        MeshSkin* skin = model->getSkin();
+        if (skin)
+            skin->getMatrixPalette();
+    }
+    return NULL;
 }
 
 unsigned int RenderState::autoBindingGetMatrixPaletteSize() const
 {
-    Model* model = _nodeBinding ? _nodeBinding->getModel() : NULL;
-    MeshSkin* skin = model ? model->getSkin() : NULL;
-    return skin ? skin->getMatrixPaletteSize() : 0;
+    Model* model = dynamic_cast<Model*>(_nodeBinding->getDrawable());
+    if (model)
+    {
+        MeshSkin* skin = model->getSkin();
+        if (skin)
+            skin->getMatrixPaletteSize();
+    }
+    return 0;
 }
 
 const Vector3& RenderState::autoBindingGetAmbientColor() const

+ 4 - 3
gameplay/src/Scene.cpp

@@ -207,9 +207,10 @@ void Scene::visitNode(Node* node, const char* visitMethod)
     // since we don't add joint hierarcies directly to the scene. If joints are never
     // visited, it's possible that nodes embedded within the joint hierarchy that contain
     // models will never get visited (and therefore never get drawn).
-    if (node->_model && node->_model->_skin && node->_model->_skin->_rootNode)
+    Model* model = dynamic_cast<Model*>(node->getDrawable());
+    if (model && model->_skin && model->_skin->_rootNode)
     {
-        visitNode(node->_model->_skin->_rootNode, visitMethod);
+        visitNode(model->_skin->_rootNode, visitMethod);
     }
 
     // Recurse for all children.
@@ -446,7 +447,7 @@ bool Scene::isNodeVisible(Node* node)
     if (!node->isEnabled())
         return false;
 
-    if (node->getForm() || node->getParticleEmitter() || node->getTerrain() || node->getLight() || node->getCamera())
+    if (node->getDrawable() || node->getLight() || node->getCamera())
     {
         return true;
     }

+ 7 - 4
gameplay/src/Scene.h

@@ -5,6 +5,7 @@
 #include "MeshBatch.h"
 #include "ScriptController.h"
 #include "Light.h"
+#include "Model.h"
 
 namespace gameplay
 {
@@ -346,9 +347,10 @@ void Scene::visitNode(Node* node, T* instance, bool (T::*visitMethod)(Node*))
     // since we don't add joint hierarchies directly to the scene. If joints are never
     // visited, it's possible that nodes embedded within the joint hierarchy that contain
     // models will never get visited (and therefore never get drawn).
-    if (node->_model && node->_model->_skin && node->_model->_skin->_rootNode)
+    Model* model = dynamic_cast<Model*>(node->getDrawable());
+    if (model && model->_skin && model->_skin->_rootNode)
     {
-        visitNode(node->_model->_skin->_rootNode, instance, visitMethod);
+        visitNode(model->_skin->_rootNode, instance, visitMethod);
     }
 
     // Recurse for all children.
@@ -369,9 +371,10 @@ void Scene::visitNode(Node* node, T* instance, bool (T::*visitMethod)(Node*,C),
     // since we don't add joint hierarchies directly to the scene. If joints are never
     // visited, it's possible that nodes embedded within the joint hierarchy that contain
     // models will never get visited (and therefore never get drawn).
-    if (node->_model && node->_model->_skin && node->_model->_skin->_rootNode)
+    Model* model = dynamic_cast<Model*>(node->getDrawable());
+    if (model && model->_skin && model->_skin->_rootNode)
     {
-        visitNode(node->_model->_skin->_rootNode, instance, visitMethod, cookie);
+        visitNode(model->_skin->_rootNode, instance, visitMethod, cookie);
     }
 
     // Recurse for all children.

+ 24 - 19
gameplay/src/SceneLoader.cpp

@@ -4,6 +4,10 @@
 #include "Bundle.h"
 #include "SceneLoader.h"
 #include "Terrain.h"
+#include "ParticleEmitter.h"
+#include "Sprite.h"
+#include "Text.h"
+#include "TileSet.h"
 #include "Light.h"
 
 namespace gameplay
@@ -277,30 +281,31 @@ void SceneLoader::applyNodeProperty(SceneNode& sceneNode, Node* node, const Prop
         }
         case SceneNodeProperty::MATERIAL:
         {
-            if (!node->getModel())
+            Model* model = dynamic_cast<Model*>(node->getDrawable());
+            if (model)
             {
-                GP_ERROR("Attempting to set a material on node '%s', which has no model.", sceneNode._nodeID);
-                return;
+                Material* material = Material::create(p);
+                model->setMaterial(material, snp._index);
+                SAFE_RELEASE(material);
             }
             else
             {
-                Material* material = Material::create(p);
-                node->getModel()->setMaterial(material, snp._index);
-                SAFE_RELEASE(material);
+                GP_ERROR("Attempting to set a material on node '%s', which has no model.", sceneNode._nodeID);
+                return;
             }
             break;
         }
         case SceneNodeProperty::PARTICLE:
         {
             ParticleEmitter* particleEmitter = ParticleEmitter::create(p);
-            node->setParticleEmitter(particleEmitter);
+            node->setDrawable(particleEmitter);
             SAFE_RELEASE(particleEmitter);
             break;
         }
         case SceneNodeProperty::TERRAIN:
         {
             Terrain* terrain = Terrain::create(p);
-            node->setTerrain(terrain);
+            node->setDrawable(terrain);
             SAFE_RELEASE(terrain);
             break;
         }
@@ -348,26 +353,26 @@ void SceneLoader::applyNodeProperty(SceneNode& sceneNode, Node* node, const Prop
                     }
                     else
                     {
-                        if (!modelNode->getModel())
+                        if ( dynamic_cast<Model*>(modelNode->getDrawable()) == NULL)
                         {
                             GP_ERROR("Node '%s' does not have a model; attempting to use its model for collision object creation.", name);
                         }
                         else
                         {
                             // Temporarily set rigidBody model on model so it's used during collision object creation.
-                            Model* model = node->getModel();
-                        
+                            Model* model = dynamic_cast<Model*>(node->getDrawable());
+
                             // Up ref count to prevent node from releasing the model when we swap it.
                             if (model)
-                                model->addRef(); 
-                        
+                                model->addRef();
+
                             // Create collision object with new rigidBodyModel (aka collisionMesh) set.
-                            node->setModel(modelNode->getModel());
+                            node->setDrawable(dynamic_cast<Model*>(modelNode->getDrawable()));
                             node->setCollisionObject(p);
 
                             // Restore original model.
-                            node->setModel(model);
-                        
+                            node->setDrawable(model);
+
                             // Decrement temporarily added reference.
                             if (model)
                                 model->release();
@@ -382,21 +387,21 @@ void SceneLoader::applyNodeProperty(SceneNode& sceneNode, Node* node, const Prop
         case SceneNodeProperty::SPRITE:
         {
             Sprite* sprite = Sprite::create(p);
-            node->setSprite(sprite);
+            node->setDrawable(sprite);
             SAFE_RELEASE(sprite);
             break;
         }
         case SceneNodeProperty::TILESET:
         {
             TileSet* tileset = TileSet::create(p);
-            node->setTileSet(tileset);
+            node->setDrawable(tileset);
             SAFE_RELEASE(tileset);
             break;
         }
         case SceneNodeProperty::TEXT:
         {
             Text* text = Text::create(p);
-            node->setText(text);
+            node->setDrawable(text);
             SAFE_RELEASE(text);
             break;
         }

+ 0 - 1
gameplay/src/ScriptController.h

@@ -3,7 +3,6 @@
 
 #include "Script.h"
 #include "Game.h"
-#include "Control.h"
 
 namespace gameplay
 {

+ 28 - 45
gameplay/src/Sprite.cpp

@@ -5,19 +5,17 @@
 namespace gameplay
 {
 
-Sprite::Sprite()
-    : _width(0), _height(0), _offset(OFFSET_BOTTOM_LEFT), _anchor(Vector2(0.5f, 0.5f)), _flipFlags(FLIP_NONE),
-      _frames(NULL), _frameCount(1), _frameStride(0), _framePadding(1), _frameIndex(0),
-      _opacity(1.0f), _color(Vector4::one()), _blendMode(BLEND_ALPHA), _batch(NULL), _node(NULL)
+Sprite::Sprite() : Drawable(),
+    _width(0), _height(0), _offset(OFFSET_BOTTOM_LEFT), _anchor(Vector2(0.5f, 0.5f)), _flipFlags(FLIP_NONE),
+    _frames(NULL), _frameCount(1), _frameStride(0), _framePadding(1), _frameIndex(0),
+    _opacity(1.0f), _color(Vector4::one()), _blendMode(BLEND_ALPHA), _batch(NULL)
 {
 }
 
 Sprite::~Sprite()
 {
-    if (_frames)
-        SAFE_DELETE_ARRAY(_frames);
-    if (_batch)
-        SAFE_DELETE(_batch);
+    SAFE_DELETE_ARRAY(_frames);
+    SAFE_DELETE(_batch);
 }
 
 Sprite& Sprite::operator=(const Sprite& sprite)
@@ -278,7 +276,7 @@ Material* Sprite::getMaterial() const
     return _batch->getMaterial();
 }
 
-unsigned int Sprite::draw()
+unsigned int Sprite::draw(bool wireframe)
 {
     // Apply scene camera projection and translation offsets
     Vector3 position = Vector3::zero();
@@ -361,30 +359,13 @@ unsigned int Sprite::draw()
     
     return 1;
 }
-
-Node* Sprite::getNode() const
-{
-    return _node;
-}
     
-void Sprite::setNode(Node* node)
-{
-    _node = node;
-}
-    
-Sprite* Sprite::clone(NodeCloneContext &context)
-{
-    Sprite* copy = new Sprite();
-    cloneInto(copy, context);
-    return copy;
-}
-
-void Sprite::cloneInto(Sprite* sprite, NodeCloneContext &context) const
+Drawable* Sprite::clone(NodeCloneContext& context)
 {
-    GP_ASSERT(sprite);
+    Sprite* spriteClone = new Sprite();
 
     // Clone animations
-    AnimationTarget::cloneInto(static_cast<AnimationTarget*>(sprite), context);
+    AnimationTarget::cloneInto(static_cast<AnimationTarget*>(spriteClone), context);
 
     // Get copied node if it exists
     if (Node* node = getNode())
@@ -392,26 +373,28 @@ void Sprite::cloneInto(Sprite* sprite, NodeCloneContext &context) const
         Node* clonedNode = context.findClonedNode(node);
         if (clonedNode)
         {
-            sprite->setNode(clonedNode);
+            spriteClone->setNode(clonedNode);
         }
     }
 
     // Clone properties
-    sprite->_width = _width;
-    sprite->_height = _height;
-    sprite->_offset = _offset;
-    sprite->_anchor = _anchor;
-    sprite->_flipFlags = _flipFlags;
-    sprite->_opacity = _opacity;
-    sprite->_color = _color;
-    sprite->_blendMode = _blendMode;
-    sprite->_frames = new Rectangle[_frameCount];
-    memcpy(sprite->_frames, _frames, sizeof(Rectangle) * _frameCount);
-    sprite->_frameCount = _frameCount;
-    sprite->_frameStride = _frameStride;
-    sprite->_framePadding = _framePadding;
-    sprite->_frameIndex = _frameIndex;
-    sprite->_batch = _batch;
+    spriteClone->_width = _width;
+    spriteClone->_height = _height;
+    spriteClone->_offset = _offset;
+    spriteClone->_anchor = _anchor;
+    spriteClone->_flipFlags = _flipFlags;
+    spriteClone->_opacity = _opacity;
+    spriteClone->_color = _color;
+    spriteClone->_blendMode = _blendMode;
+    spriteClone->_frames = new Rectangle[_frameCount];
+    memcpy(spriteClone->_frames, _frames, sizeof(Rectangle) * _frameCount);
+    spriteClone->_frameCount = _frameCount;
+    spriteClone->_frameStride = _frameStride;
+    spriteClone->_framePadding = _framePadding;
+    spriteClone->_frameIndex = _frameIndex;
+    spriteClone->_batch = _batch;
+
+    return spriteClone;
 }
 
 unsigned int Sprite::getAnimationPropertyComponentCount(int propertyId) const

+ 7 - 21
gameplay/src/Sprite.h

@@ -2,13 +2,13 @@
 #define SPRITE_H_
 
 #include "Ref.h"
+#include "Drawable.h"
 #include "AnimationTarget.h"
 #include "Properties.h"
 #include "Rectangle.h"
 #include "Vector4.h"
 #include "SpriteBatch.h"
 #include "Effect.h"
-#include "Node.h"
 
 namespace gameplay
 {
@@ -26,7 +26,7 @@ namespace gameplay
  * Sprites can be animated using the animation system.
  * Sprites can have physics applied to them via their node binding.
  */
-class Sprite : public Ref, public AnimationTarget
+class Sprite : public Ref, public Drawable, public AnimationTarget
 {
     friend class Node;
     
@@ -329,18 +329,9 @@ public:
     Material* getMaterial() const;
 
     /**
-     * Gets the node that this sprite is attached to.
-     *
-     * @return The node that this sprite is attached to.
-     */
-    Node* getNode() const;
-
-    /**
-     * Draw the sprite.
-     *
-     * @return The number of draw calls.
+     * @see Drawable::draw
      */
-    unsigned int draw();
+    unsigned int draw(bool wireframe = false);
 
 protected:
     
@@ -360,9 +351,9 @@ protected:
     Sprite& operator=(const Sprite& sprite);
 
     /**
-     * Sets the node this sprite is attached to.
+     * @see Drawable::clone
      */
-    void setNode(Node* node);
+    Drawable* clone(NodeCloneContext& context);
     
     /**
      * @see AnimationTarget::getAnimationPropertyComponentCount
@@ -378,11 +369,7 @@ protected:
      * @see AnimationTarget::setAnimationProperty
      */
     void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
-    
-    Sprite* clone(NodeCloneContext &context);
-    
-    void cloneInto(Sprite* sprite, NodeCloneContext &context) const;
-    
+
     float _width;
     float _height;
     Offset _offset;
@@ -397,7 +384,6 @@ protected:
     float _opacity;
     Vector4 _color;
     BlendMode _blendMode;
-    Node* _node;
 };
 
 }

+ 17 - 15
gameplay/src/Terrain.cpp

@@ -27,8 +27,9 @@ static const unsigned int DIRTY_FLAG_INVERSE_WORLD = 1;
 
 static float getDefaultHeight(unsigned int width, unsigned int height);
 
-Terrain::Terrain() :
-    _heightfield(NULL), _node(NULL), _normalMap(NULL), _flags(FRUSTUM_CULLING | LEVEL_OF_DETAIL), _dirtyFlags(DIRTY_FLAG_INVERSE_WORLD)
+Terrain::Terrain() : Drawable(),
+    _heightfield(NULL), _normalMap(NULL), _flags(FRUSTUM_CULLING | LEVEL_OF_DETAIL),
+    _dirtyFlags(DIRTY_FLAG_INVERSE_WORLD)
 {
 }
 
@@ -376,26 +377,22 @@ Terrain* Terrain::create(HeightField* heightfield, const Vector3& scale,
 
 void Terrain::setNode(Node* node)
 {
+
     if (_node != node)
     {
         if (_node)
-        {
             _node->removeListener(this);
-        }
 
-        _node = node;
+        Drawable::setNode(node);
 
         if (_node)
-        {
             _node->addListener(this);
-        }
 
         // Update patch node bindings
         for (size_t i = 0, count = _patches.size(); i < count; ++i)
         {
             _patches[i]->updateNodeBindings();
         }
-
         _dirtyFlags |= DIRTY_FLAG_INVERSE_WORLD;
     }
 }
@@ -412,10 +409,13 @@ const Matrix& Terrain::getInverseWorldMatrix() const
         _dirtyFlags &= ~DIRTY_FLAG_INVERSE_WORLD;
 
         if (_node)
+        {
             _inverseWorldMatrix.set(_node->getWorldMatrix());
+        }
         else
+        {
             _inverseWorldMatrix = Matrix::identity();
-
+        }
         // Apply local scale and invert
         _inverseWorldMatrix.scale(_localScale);
         _inverseWorldMatrix.invert();
@@ -441,15 +441,9 @@ bool Terrain::setLayer(int index, const char* texturePath, const Vector2& textur
                 result = false;
         }
     }
-
     return result;
 }
 
-Node* Terrain::getNode() const
-{
-    return _node;
-}
-
 bool Terrain::isFlagSet(Flags flag) const
 {
     return (_flags & flag) == flag;
@@ -480,7 +474,9 @@ void Terrain::setFlag(Flags flag, bool on)
     {
         // Dirty all materials since they need to be updated to support debug drawing
         for (size_t i = 0, count = _patches.size(); i < count; ++i)
+        {
             _patches[i]->setMaterialDirty();
+        }
     }
 }
 
@@ -542,6 +538,12 @@ unsigned int Terrain::draw(bool wireframe)
     return visibleCount;
 }
 
+Drawable* Terrain::clone(NodeCloneContext& context)
+{
+    // TODO:
+    return NULL;
+}
+
 static float getDefaultHeight(unsigned int width, unsigned int height)
 {
     // When terrain height is not specified, we'll use a default height of ~ 0.3 of the image dimensions

+ 53 - 57
gameplay/src/Terrain.h

@@ -1,6 +1,8 @@
 #ifndef TERRAIN_H_
 #define TERRAIN_H_
 
+#include "Ref.h"
+#include "Drawable.h"
 #include "Transform.h"
 #include "Properties.h"
 #include "HeightField.h"
@@ -11,7 +13,6 @@
 namespace gameplay
 {
 
-class Node;
 class TerrainPatch;
 class TerrainAutoBindingResolver;
 
@@ -80,7 +81,7 @@ class TerrainAutoBindingResolver;
  *
  * @see http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-Terrain
  */
-class Terrain : public Ref, private Transform::Listener
+class Terrain : public Ref, public Drawable, private Transform::Listener
 {
     friend class Node;
     friend class PhysicsController;
@@ -175,13 +176,6 @@ public:
                            unsigned int detailLevels = 1, float skirtScale = 0.0f, const char* normalMapPath = NULL,
                            const char* materialPath = NULL);
 
-    /**
-     * Returns the node that this terrain is bound to.
-     *
-     * @return The node this terrain is bound to, or NULL if the terrain is not bound to a node.
-     */
-    Node* getNode() const;
-
     /**
      * Determines if the specified terrain flag is currently set.
      */
@@ -229,53 +223,61 @@ public:
     float getHeight(float x, float z) const;
 
     /**
-     * Draws the terrain.
+     * Sets the detail textures information for a terrain layer.
+     *
+     * A detail layer includes a color texture, a repeat count across the terrain for the texture and
+     * a region of the texture to use.
+     *
+     * Optionally, a layer can also include a blend texture, which is used to instruct the terrain how
+     * to blend the new layer with the layer underneath it. Blend maps use only a single channel of a
+     * texture and are best supplied by packing the blend map for a layer into the alpha channel of
+     * the color texture. Blend maps are always stretched over the entire terrain
      *
-     * @param wireframe True to draw the terrain as wireframe, false to draw it solid (default).
-     * @return The number of draw calls taken to drawn the terrain
+     * The lowest/base layer of the terrain should not include a blend map, since there is no lower
+     * level to blend with. All other layers should normally include a blend map. However, since no
+     * blend map will result in the texture completely masking the layer underneath it.
+     *
+     * Detail layers can be applied globally (to the entire terrain), or to one or more specific
+     * patches in the terrain. Patches are specified by row and column number, which is dependent
+     * on the patch size configuration of your terrain. For layers that span the entire terrain,
+     * the repeat count is relative to the entire terrain. For layers that span only specific
+     * patches, the repeat count is relative to those patches only.
+     *
+     * @param index Layer index number. Layer indexes do not necessarily need to be sequential and
+     *      are used simply to uniquely identify layers, where higher numbers specify higher-level
+     *      layers.
+     * @param texturePath Path to the color texture for this layer.
+     * @param textureRepeat Repeat count for the color texture across the terrain or patches.
+     * @param blendPath Path to the blend texture for this layer (optional).
+     * @param blendChannel Channel of the blend texture to sample for the blend map (0 == R, 1 == G, 2 == B, 3 == A).
+     * @param row Specifies the row index of patches to use this layer (optional, -1 means all rows).
+     * @param column Specifies the column index of patches to use this layer (optional, -1 means all columns).
+     *
+     * @return True if the layer was successfully set, false otherwise. The most common reason for failure is an
+     *      invalid texture path.
+     *
+     * @script{ignore}
+     */
+    bool setLayer(int index, const char* texturePath, const Vector2& textureRepeat = Vector2::one(),
+                  const char* blendPath = NULL, int blendChannel = 0,
+                  int row = -1, int column = -1);
+
+    /**
+     * @see Drawable#draw
      */
     unsigned int draw(bool wireframe = false);
 
+protected:
+
     /**
-    * Sets the detail textures information for a terrain layer.
-    *
-    * A detail layer includes a color texture, a repeat count across the terrain for the texture and
-    * a region of the texture to use.
-    *
-    * Optionally, a layer can also include a blend texture, which is used to instruct the terrain how
-    * to blend the new layer with the layer underneath it. Blend maps use only a single channel of a
-    * texture and are best supplied by packing the blend map for a layer into the alpha channel of
-    * the color texture. Blend maps are always stretched over the entire terrain
-    *
-    * The lowest/base layer of the terrain should not include a blend map, since there is no lower
-    * level to blend with. All other layers should normally include a blend map. However, since no
-    * blend map will result in the texture completely masking the layer underneath it.
-    *
-    * Detail layers can be applied globally (to the entire terrain), or to one or more specific
-    * patches in the terrain. Patches are specified by row and column number, which is dependent
-    * on the patch size configuration of your terrain. For layers that span the entire terrain,
-    * the repeat count is relative to the entire terrain. For layers that span only specific
-    * patches, the repeat count is relative to those patches only.
-    *
-    * @param index Layer index number. Layer indexes do not necessarily need to be sequential and
-    *      are used simply to uniquely identify layers, where higher numbers specify higher-level
-    *      layers.
-    * @param texturePath Path to the color texture for this layer.
-    * @param textureRepeat Repeat count for the color texture across the terrain or patches.
-    * @param blendPath Path to the blend texture for this layer (optional).
-    * @param blendChannel Channel of the blend texture to sample for the blend map (0 == R, 1 == G, 2 == B, 3 == A).
-    * @param row Specifies the row index of patches to use this layer (optional, -1 means all rows).
-    * @param column Specifies the column index of patches to use this layer (optional, -1 means all columns).
-    *
-    * @return True if the layer was successfully set, false otherwise. The most common reason for failure is an
-    *      invalid texture path.
-    *
-    * @script{ignore}
-    */
-    bool setLayer(int index,
-        const char* texturePath, const Vector2& textureRepeat = Vector2::one(),
-        const char* blendPath = NULL, int blendChannel = 0,
-        int row = -1, int column = -1);
+     * @see Drawable::setNode
+     */
+    void setNode(Node* node);
+
+    /**
+     * @see Drawable::clone
+     */
+    Drawable* clone(NodeCloneContext& context);
 
 private:
 
@@ -311,11 +313,6 @@ private:
      */
     static Terrain* create(const char* path, Properties* properties);
 
-    /**
-     * Sets the node that the terrain is attached to.
-     */
-    void setNode(Node* node);
-
     /**
      * @see Transform::Listener::transformChanged.
      */
@@ -334,7 +331,6 @@ private:
 
     std::string _materialPath;
     HeightField* _heightfield;
-    Node* _node;
     Vector3 _localScale;
     std::vector<TerrainPatch*> _patches;
     Texture::Sampler* _normalMap;

+ 4 - 2
gameplay/src/TerrainPatch.cpp

@@ -711,11 +711,13 @@ bool TerrainAutoBindingResolver::resolveAutoBinding(const char* autoBinding, Nod
     {
         static TerrainPatch* getPatch(Node* node)
         {
-            Terrain* terrain = node->getTerrain();
+            Terrain* terrain = dynamic_cast<Terrain*>(node->getDrawable());
             if (terrain)
             {
                 if (__currentPatchIndex >= 0 && __currentPatchIndex < (int)terrain->_patches.size())
+                {
                     return terrain->_patches[__currentPatchIndex];
+                }
             }
             return NULL;
         }
@@ -730,7 +732,7 @@ bool TerrainAutoBindingResolver::resolveAutoBinding(const char* autoBinding, Nod
     }
     else if (strcmp(autoBinding, "TERRAIN_NORMAL_MAP") == 0)
     {
-        Terrain* terrain = node->getTerrain();
+        Terrain* terrain = dynamic_cast<Terrain*>(node->getDrawable());
         if (terrain && terrain->_normalMap)
             parameter->setValue(terrain->_normalMap);
         return true;

+ 21 - 41
gameplay/src/Text.cpp

@@ -9,14 +9,13 @@ namespace gameplay
 Text::Text() :
     _font(NULL), _text(""), _size(0), _width(0), _height(0), _wrap(true), _rightToLeft(false),
     _align(Font::ALIGN_TOP_LEFT), _clip(Rectangle(0, 0, 0, 0)),
-    _opacity(1.0f), _color(Vector4::one()), _node(NULL)
+    _opacity(1.0f), _color(Vector4::one())
 {
 }
 
 Text::~Text()
 {
-    if (_font)
-        SAFE_RELEASE(_font);
+    SAFE_RELEASE(_font);
 }
     
 Text& Text::operator=(const Text& text)
@@ -153,7 +152,25 @@ const Vector4& Text::getColor() const
     return _color;
 }
     
-unsigned int Text::draw()
+Drawable* Text::clone(NodeCloneContext& context)
+{
+    Text* textClone = new Text();
+    textClone->_font = _font;
+    _font->addRef();
+    textClone->_text = _text;
+    textClone->_size = _size;
+    textClone->_width = _width;
+    textClone->_height = _height;
+    textClone->_wrap = _wrap;
+    textClone->_rightToLeft = _rightToLeft;
+    textClone->_align = _align;
+    textClone->_clip = _clip;
+    textClone->_opacity = _opacity;
+    textClone->_color = _color;
+    return textClone;
+}
+
+unsigned int Text::draw(bool wireframe)
 {
     // Apply scene camera projection and translation offsets
     Rectangle viewport = Game::getInstance()->getViewport();
@@ -196,16 +213,6 @@ unsigned int Text::draw()
     return 1;
 }
     
-Node* Text::getNode() const
-{
-    return _node;
-}
-
-void Text::setNode(Node* node)
-{
-    _node = node;
-}
-    
 unsigned int Text::getAnimationPropertyComponentCount(int propertyId) const
 {
     switch (propertyId)
@@ -259,31 +266,4 @@ void Text::setAnimationPropertyValue(int propertyId, AnimationValue* value, floa
     }
 }
 
-Text* Text::clone(NodeCloneContext &context)
-{
-    Text* copy = new Text();
-    cloneInto(copy, context);
-    return copy;
-}
-
-void Text::cloneInto(Text* text, NodeCloneContext &context) const
-{
-    GP_ASSERT(text);
-    
-    // Clone properties
-    text->_font = _font;
-    _font->addRef();
-    text->_text = _text;
-    text->_size = _size;
-    text->_width = _width;
-    text->_height = _height;
-    text->_wrap = _wrap;
-    text->_rightToLeft = _rightToLeft;
-    text->_align = _align;
-    text->_clip = _clip;
-    text->_opacity = _opacity;
-    text->_color = _color;
-    text->_node = _node;
-}
-
 }

+ 8 - 19
gameplay/src/Text.h

@@ -8,7 +8,7 @@
 #include "Vector2.h"
 #include "Vector4.h"
 #include "Effect.h"
-#include "Node.h"
+#include "Drawable.h"
 
 namespace gameplay
 {
@@ -18,7 +18,7 @@ namespace gameplay
  *
  * Text can be attached to a node.
  */
-class Text : public Ref, public AnimationTarget
+class Text : public Ref, public Drawable, public AnimationTarget
 {
     friend class Node;
     
@@ -202,20 +202,14 @@ public:
      * @return The color(RGBA) for the sprite.
      */
     const Vector4& getColor() const;
-    
-    /**
-     * Gets the node that this sprite is attached to.
-     *
-     * @return The node that this sprite is attached to.
-     */
-    Node* getNode() const;
-   
+
     /**
-     * Draws the text.
+     * @see Drawable::draw
      */
-    unsigned int draw();
+    unsigned int draw(bool wireframe = false);
     
 protected:
+
     /**
      * Constructor
      */
@@ -232,9 +226,9 @@ protected:
     Text& operator=(const Text& text);
     
     /**
-     * Sets the node this sprite is attached to.
+     * @see Drawable::clone
      */
-    void setNode(Node* node);
+    Drawable* clone(NodeCloneContext &context);
     
     /**
      * @see AnimationTarget::getAnimationPropertyComponentCount
@@ -251,10 +245,6 @@ protected:
      */
     void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
     
-    Text* clone(NodeCloneContext &context);
-    
-    void cloneInto(Text* text, NodeCloneContext &context) const;
-
     Font* _font;
     std::string _text;
     unsigned int _size;
@@ -266,7 +256,6 @@ protected:
     Rectangle _clip;
     float _opacity;
     Vector4 _color;
-    Node* _node;
 };
     
 }

+ 0 - 1
gameplay/src/TextBox.h

@@ -2,7 +2,6 @@
 #define TEXTBOX_H_
 
 #include <string>
-
 #include "Label.h"
 
 namespace gameplay

+ 24 - 41
gameplay/src/TileSet.cpp

@@ -6,19 +6,17 @@
 namespace gameplay
 {
   
-TileSet::TileSet()
-    : _tiles(NULL), _tileWidth(0), _tileHeight(0),
-      _rowCount(0), _columnCount(0), _width(0), _height(0),
-      _opacity(1.0f), _color(Vector4::one()), _batch(NULL), _node(NULL)
+TileSet::TileSet() : Drawable(),
+    _tiles(NULL), _tileWidth(0), _tileHeight(0),
+    _rowCount(0), _columnCount(0), _width(0), _height(0),
+    _opacity(1.0f), _color(Vector4::one()), _batch(NULL)
 {
 }
 
 TileSet::~TileSet()
 {
-    if (_tiles)
-        SAFE_DELETE_ARRAY(_tiles);
-    if (_batch)
-        SAFE_DELETE(_batch);
+    SAFE_DELETE_ARRAY(_tiles);
+    SAFE_DELETE(_batch);
 }
     
 TileSet& TileSet::operator=(const TileSet& set)
@@ -143,8 +141,8 @@ const Vector4& TileSet::getColor() const
 {
     return _color;
 }
-    
-unsigned int TileSet::draw()
+
+unsigned int TileSet::draw(bool wireframe)
 {
     // Apply scene camera projection and translation offsets
     Vector3 position = Vector3::zero();
@@ -201,41 +199,26 @@ unsigned int TileSet::draw()
     _batch->finish();
     return 1;
 }
-    
-Node* TileSet::getNode() const
-{
-    return _node;
-}
 
-void TileSet::setNode(Node* node)
+Drawable* TileSet::clone(NodeCloneContext& context)
 {
-    _node = node;
-}
+    TileSet* tilesetClone = new TileSet();
 
-TileSet* TileSet::clone(NodeCloneContext &context)
-{
-    TileSet* copy = new TileSet();
-    cloneInto(copy, context);
-    return copy;
-}
-
-void TileSet::cloneInto(TileSet* tileset, NodeCloneContext &context) const
-{
-    GP_ASSERT(tileset);
-    
     // Clone properties
-    tileset->_tiles = new Vector2[tileset->_rowCount * tileset->_columnCount];
-    memset(tileset->_tiles, -1, sizeof(float) * tileset->_rowCount * tileset->_columnCount * 2);
-    memcpy(tileset->_tiles, _tiles, sizeof(Vector2) * tileset->_rowCount * tileset->_columnCount);
-    tileset->_tileWidth = _tileWidth;
-    tileset->_tileHeight = _tileHeight;
-    tileset->_rowCount = _rowCount;
-    tileset->_columnCount = _columnCount;
-    tileset->_width = _tileWidth * _columnCount;
-    tileset->_height = _tileHeight * _rowCount;
-    tileset->_opacity = _opacity;
-    tileset->_color = _color;
-    tileset->_batch = _batch;
+    tilesetClone->_tiles = new Vector2[tilesetClone->_rowCount * tilesetClone->_columnCount];
+    memset(tilesetClone->_tiles, -1, sizeof(float) * tilesetClone->_rowCount * tilesetClone->_columnCount * 2);
+    memcpy(tilesetClone->_tiles, _tiles, sizeof(Vector2) * tilesetClone->_rowCount * tilesetClone->_columnCount);
+    tilesetClone->_tileWidth = _tileWidth;
+    tilesetClone->_tileHeight = _tileHeight;
+    tilesetClone->_rowCount = _rowCount;
+    tilesetClone->_columnCount = _columnCount;
+    tilesetClone->_width = _tileWidth * _columnCount;
+    tilesetClone->_height = _tileHeight * _rowCount;
+    tilesetClone->_opacity = _opacity;
+    tilesetClone->_color = _color;
+    tilesetClone->_batch = _batch;
+
+    return tilesetClone;
 }
 
 }

+ 8 - 21
gameplay/src/TileSet.h

@@ -2,11 +2,12 @@
 #define TILESET_H__
 
 #include "Ref.h"
+#include "Drawable.h"
 #include "Properties.h"
 #include "Vector2.h"
 #include "Vector4.h"
+#include "SpriteBatch.h"
 #include "Effect.h"
-#include "Node.h"
 
 namespace gameplay
 {
@@ -26,10 +27,10 @@ namespace gameplay
  *
  * The tile set does not support rotation or scaling.
  */
-class TileSet : public Ref
+class TileSet : public Ref, public Drawable
 {
     friend class Node;
-    
+
 public:
 
     /**
@@ -145,20 +146,11 @@ public:
      * @return The color(RGBA) for the sprite.
      */
     const Vector4& getColor() const;
-    
-    /**
-     * Gets the node that this sprite is attached to.
-     *
-     * @return The node that this sprite is attached to.
-     */
-    Node* getNode() const;
    
     /**
-     * Draws the TileSet.
-     *
-     * @return The number of draw calls made.
+     * @see Drawable::draw
      */
-    unsigned int draw();
+    unsigned int draw(bool wireframe = false);
     
 protected:
     /**
@@ -177,14 +169,10 @@ protected:
     TileSet& operator=(const TileSet& set);
     
     /**
-     * Sets the node this sprite is attached to.
+     * @see Drawable::clone
      */
-    void setNode(Node* node);
+    Drawable* clone(NodeCloneContext &context);
     
-    TileSet* clone(NodeCloneContext &context);
-    
-    void cloneInto(TileSet* tileset, NodeCloneContext &context) const;
-
     Vector2* _tiles;
     float _tileWidth;
     float _tileHeight;
@@ -195,7 +183,6 @@ protected:
     SpriteBatch* _batch;
     float _opacity;
     Vector4 _color;
-    Node* _node;
 };
     
 }

+ 1 - 0
gameplay/src/gameplay.h

@@ -37,6 +37,7 @@
 #include "RenderState.h"
 #include "VertexFormat.h"
 #include "VertexAttributeBinding.h"
+#include "Drawable.h"
 #include "Model.h"
 #include "Camera.h"
 #include "Light.h"

+ 0 - 352
gameplay/src/lua/lua_Joint.cpp

@@ -55,7 +55,6 @@ void luaRegister_Joint()
         {"getCollisionObject", lua_Joint_getCollisionObject},
         {"getDownVector", lua_Joint_getDownVector},
         {"getFirstChild", lua_Joint_getFirstChild},
-        {"getForm", lua_Joint_getForm},
         {"getForwardVector", lua_Joint_getForwardVector},
         {"getForwardVectorView", lua_Joint_getForwardVectorView},
         {"getForwardVectorWorld", lua_Joint_getForwardVectorWorld},
@@ -68,10 +67,8 @@ void luaRegister_Joint()
         {"getLeftVector", lua_Joint_getLeftVector},
         {"getLight", lua_Joint_getLight},
         {"getMatrix", lua_Joint_getMatrix},
-        {"getModel", lua_Joint_getModel},
         {"getNextSibling", lua_Joint_getNextSibling},
         {"getParent", lua_Joint_getParent},
-        {"getParticleEmitter", lua_Joint_getParticleEmitter},
         {"getPreviousSibling", lua_Joint_getPreviousSibling},
         {"getProjectionMatrix", lua_Joint_getProjectionMatrix},
         {"getRefCount", lua_Joint_getRefCount},
@@ -86,7 +83,6 @@ void luaRegister_Joint()
         {"getScene", lua_Joint_getScene},
         {"getScriptEvent", lua_Joint_getScriptEvent},
         {"getTag", lua_Joint_getTag},
-        {"getTerrain", lua_Joint_getTerrain},
         {"getTranslation", lua_Joint_getTranslation},
         {"getTranslationView", lua_Joint_getTranslationView},
         {"getTranslationWorld", lua_Joint_getTranslationWorld},
@@ -128,19 +124,15 @@ void luaRegister_Joint()
         {"setCamera", lua_Joint_setCamera},
         {"setCollisionObject", lua_Joint_setCollisionObject},
         {"setEnabled", lua_Joint_setEnabled},
-        {"setForm", lua_Joint_setForm},
         {"setId", lua_Joint_setId},
         {"setIdentity", lua_Joint_setIdentity},
         {"setLight", lua_Joint_setLight},
-        {"setModel", lua_Joint_setModel},
-        {"setParticleEmitter", lua_Joint_setParticleEmitter},
         {"setRotation", lua_Joint_setRotation},
         {"setScale", lua_Joint_setScale},
         {"setScaleX", lua_Joint_setScaleX},
         {"setScaleY", lua_Joint_setScaleY},
         {"setScaleZ", lua_Joint_setScaleZ},
         {"setTag", lua_Joint_setTag},
-        {"setTerrain", lua_Joint_setTerrain},
         {"setTranslation", lua_Joint_setTranslation},
         {"setTranslationX", lua_Joint_setTranslationX},
         {"setTranslationY", lua_Joint_setTranslationY},
@@ -1740,50 +1732,6 @@ int lua_Joint_getFirstChild(lua_State* state)
     return 0;
 }
 
-int lua_Joint_getForm(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_TUSERDATA))
-            {
-                Joint* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getForm());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Form");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Joint_getForm - 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_Joint_getForwardVector(lua_State* state)
 {
     // Get the number of parameters.
@@ -2357,50 +2305,6 @@ int lua_Joint_getMatrix(lua_State* state)
     return 0;
 }
 
-int lua_Joint_getModel(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_TUSERDATA))
-            {
-                Joint* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getModel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Model");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Joint_getModel - 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_Joint_getNextSibling(lua_State* state)
 {
     // Get the number of parameters.
@@ -2489,50 +2393,6 @@ int lua_Joint_getParent(lua_State* state)
     return 0;
 }
 
-int lua_Joint_getParticleEmitter(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_TUSERDATA))
-            {
-                Joint* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getParticleEmitter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "ParticleEmitter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Joint_getParticleEmitter - 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_Joint_getPreviousSibling(lua_State* state)
 {
     // Get the number of parameters.
@@ -3232,50 +3092,6 @@ int lua_Joint_getTag(lua_State* state)
     return 0;
 }
 
-int lua_Joint_getTerrain(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_TUSERDATA))
-            {
-                Joint* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getTerrain());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Terrain");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Joint_getTerrain - 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_Joint_getTranslation(lua_State* state)
 {
     // Get the number of parameters.
@@ -5503,48 +5319,6 @@ int lua_Joint_setEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Joint_setForm(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<Form> param1 = gameplay::ScriptUtil::getObjectPointer<Form>(2, "Form", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Form'.");
-                    lua_error(state);
-                }
-
-                Joint* instance = getInstance(state);
-                instance->setForm(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joint_setForm - 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_Joint_setId(lua_State* state)
 {
     // Get the number of parameters.
@@ -5655,90 +5429,6 @@ int lua_Joint_setLight(lua_State* state)
     return 0;
 }
 
-int lua_Joint_setModel(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<Model> param1 = gameplay::ScriptUtil::getObjectPointer<Model>(2, "Model", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Model'.");
-                    lua_error(state);
-                }
-
-                Joint* instance = getInstance(state);
-                instance->setModel(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joint_setModel - 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_Joint_setParticleEmitter(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<ParticleEmitter> param1 = gameplay::ScriptUtil::getObjectPointer<ParticleEmitter>(2, "ParticleEmitter", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'ParticleEmitter'.");
-                    lua_error(state);
-                }
-
-                Joint* instance = getInstance(state);
-                instance->setParticleEmitter(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joint_setParticleEmitter - 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_Joint_setRotation(lua_State* state)
 {
     // Get the number of parameters.
@@ -6112,48 +5802,6 @@ int lua_Joint_setTag(lua_State* state)
     return 0;
 }
 
-int lua_Joint_setTerrain(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<Terrain> param1 = gameplay::ScriptUtil::getObjectPointer<Terrain>(2, "Terrain", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Terrain'.");
-                    lua_error(state);
-                }
-
-                Joint* instance = getInstance(state);
-                instance->setTerrain(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joint_setTerrain - 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_Joint_setTranslation(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 7
gameplay/src/lua/lua_Joint.h

@@ -46,10 +46,8 @@ int lua_Joint_getInverseViewProjectionMatrix(lua_State* state);
 int lua_Joint_getLeftVector(lua_State* state);
 int lua_Joint_getLight(lua_State* state);
 int lua_Joint_getMatrix(lua_State* state);
-int lua_Joint_getModel(lua_State* state);
 int lua_Joint_getNextSibling(lua_State* state);
 int lua_Joint_getParent(lua_State* state);
-int lua_Joint_getParticleEmitter(lua_State* state);
 int lua_Joint_getPreviousSibling(lua_State* state);
 int lua_Joint_getProjectionMatrix(lua_State* state);
 int lua_Joint_getRefCount(lua_State* state);
@@ -64,7 +62,6 @@ int lua_Joint_getScaleZ(lua_State* state);
 int lua_Joint_getScene(lua_State* state);
 int lua_Joint_getScriptEvent(lua_State* state);
 int lua_Joint_getTag(lua_State* state);
-int lua_Joint_getTerrain(lua_State* state);
 int lua_Joint_getTranslation(lua_State* state);
 int lua_Joint_getTranslationView(lua_State* state);
 int lua_Joint_getTranslationWorld(lua_State* state);
@@ -106,19 +103,15 @@ int lua_Joint_setAudioSource(lua_State* state);
 int lua_Joint_setCamera(lua_State* state);
 int lua_Joint_setCollisionObject(lua_State* state);
 int lua_Joint_setEnabled(lua_State* state);
-int lua_Joint_setForm(lua_State* state);
 int lua_Joint_setId(lua_State* state);
 int lua_Joint_setIdentity(lua_State* state);
 int lua_Joint_setLight(lua_State* state);
-int lua_Joint_setModel(lua_State* state);
-int lua_Joint_setParticleEmitter(lua_State* state);
 int lua_Joint_setRotation(lua_State* state);
 int lua_Joint_setScale(lua_State* state);
 int lua_Joint_setScaleX(lua_State* state);
 int lua_Joint_setScaleY(lua_State* state);
 int lua_Joint_setScaleZ(lua_State* state);
 int lua_Joint_setTag(lua_State* state);
-int lua_Joint_setTerrain(lua_State* state);
 int lua_Joint_setTranslation(lua_State* state);
 int lua_Joint_setTranslationX(lua_State* state);
 int lua_Joint_setTranslationY(lua_State* state);

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

@@ -54,7 +54,6 @@ void luaRegister_Node()
         {"getCollisionObject", lua_Node_getCollisionObject},
         {"getDownVector", lua_Node_getDownVector},
         {"getFirstChild", lua_Node_getFirstChild},
-        {"getForm", lua_Node_getForm},
         {"getForwardVector", lua_Node_getForwardVector},
         {"getForwardVectorView", lua_Node_getForwardVectorView},
         {"getForwardVectorWorld", lua_Node_getForwardVectorWorld},
@@ -66,10 +65,8 @@ void luaRegister_Node()
         {"getLeftVector", lua_Node_getLeftVector},
         {"getLight", lua_Node_getLight},
         {"getMatrix", lua_Node_getMatrix},
-        {"getModel", lua_Node_getModel},
         {"getNextSibling", lua_Node_getNextSibling},
         {"getParent", lua_Node_getParent},
-        {"getParticleEmitter", lua_Node_getParticleEmitter},
         {"getPreviousSibling", lua_Node_getPreviousSibling},
         {"getProjectionMatrix", lua_Node_getProjectionMatrix},
         {"getRefCount", lua_Node_getRefCount},
@@ -84,7 +81,6 @@ void luaRegister_Node()
         {"getScene", lua_Node_getScene},
         {"getScriptEvent", lua_Node_getScriptEvent},
         {"getTag", lua_Node_getTag},
-        {"getTerrain", lua_Node_getTerrain},
         {"getTranslation", lua_Node_getTranslation},
         {"getTranslationView", lua_Node_getTranslationView},
         {"getTranslationWorld", lua_Node_getTranslationWorld},
@@ -126,19 +122,15 @@ void luaRegister_Node()
         {"setCamera", lua_Node_setCamera},
         {"setCollisionObject", lua_Node_setCollisionObject},
         {"setEnabled", lua_Node_setEnabled},
-        {"setForm", lua_Node_setForm},
         {"setId", lua_Node_setId},
         {"setIdentity", lua_Node_setIdentity},
         {"setLight", lua_Node_setLight},
-        {"setModel", lua_Node_setModel},
-        {"setParticleEmitter", lua_Node_setParticleEmitter},
         {"setRotation", lua_Node_setRotation},
         {"setScale", lua_Node_setScale},
         {"setScaleX", lua_Node_setScaleX},
         {"setScaleY", lua_Node_setScaleY},
         {"setScaleZ", lua_Node_setScaleZ},
         {"setTag", lua_Node_setTag},
-        {"setTerrain", lua_Node_setTerrain},
         {"setTranslation", lua_Node_setTranslation},
         {"setTranslationX", lua_Node_setTranslationX},
         {"setTranslationY", lua_Node_setTranslationY},
@@ -1739,50 +1731,6 @@ int lua_Node_getFirstChild(lua_State* state)
     return 0;
 }
 
-int lua_Node_getForm(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_TUSERDATA))
-            {
-                Node* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getForm());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Form");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Node_getForm - 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_Node_getForwardVector(lua_State* state)
 {
     // Get the number of parameters.
@@ -2312,50 +2260,6 @@ int lua_Node_getMatrix(lua_State* state)
     return 0;
 }
 
-int lua_Node_getModel(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_TUSERDATA))
-            {
-                Node* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getModel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Model");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Node_getModel - 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_Node_getNextSibling(lua_State* state)
 {
     // Get the number of parameters.
@@ -2442,51 +2346,7 @@ int lua_Node_getParent(lua_State* state)
         }
     }
     return 0;
-}
-
-int lua_Node_getParticleEmitter(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_TUSERDATA))
-            {
-                Node* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getParticleEmitter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "ParticleEmitter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Node_getParticleEmitter - 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_Node_getPreviousSibling(lua_State* state)
 {
@@ -3187,50 +3047,6 @@ int lua_Node_getTag(lua_State* state)
     return 0;
 }
 
-int lua_Node_getTerrain(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_TUSERDATA))
-            {
-                Node* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->getTerrain());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Terrain");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Node_getTerrain - 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_Node_getTranslation(lua_State* state)
 {
     // Get the number of parameters.
@@ -5458,48 +5274,6 @@ int lua_Node_setEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Node_setForm(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<Form> param1 = gameplay::ScriptUtil::getObjectPointer<Form>(2, "Form", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Form'.");
-                    lua_error(state);
-                }
-
-                Node* instance = getInstance(state);
-                instance->setForm(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Node_setForm - 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_Node_setId(lua_State* state)
 {
     // Get the number of parameters.
@@ -5610,90 +5384,6 @@ int lua_Node_setLight(lua_State* state)
     return 0;
 }
 
-int lua_Node_setModel(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<Model> param1 = gameplay::ScriptUtil::getObjectPointer<Model>(2, "Model", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Model'.");
-                    lua_error(state);
-                }
-
-                Node* instance = getInstance(state);
-                instance->setModel(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Node_setModel - 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_Node_setParticleEmitter(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<ParticleEmitter> param1 = gameplay::ScriptUtil::getObjectPointer<ParticleEmitter>(2, "ParticleEmitter", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'ParticleEmitter'.");
-                    lua_error(state);
-                }
-
-                Node* instance = getInstance(state);
-                instance->setParticleEmitter(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Node_setParticleEmitter - 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_Node_setRotation(lua_State* state)
 {
     // Get the number of parameters.
@@ -6067,48 +5757,6 @@ int lua_Node_setTag(lua_State* state)
     return 0;
 }
 
-int lua_Node_setTerrain(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_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                gameplay::ScriptUtil::LuaArray<Terrain> param1 = gameplay::ScriptUtil::getObjectPointer<Terrain>(2, "Terrain", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Terrain'.");
-                    lua_error(state);
-                }
-
-                Node* instance = getInstance(state);
-                instance->setTerrain(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Node_setTerrain - 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_Node_setTranslation(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 8
gameplay/src/lua/lua_Node.h

@@ -33,7 +33,6 @@ int lua_Node_getChildCount(lua_State* state);
 int lua_Node_getCollisionObject(lua_State* state);
 int lua_Node_getDownVector(lua_State* state);
 int lua_Node_getFirstChild(lua_State* state);
-int lua_Node_getForm(lua_State* state);
 int lua_Node_getForwardVector(lua_State* state);
 int lua_Node_getForwardVectorView(lua_State* state);
 int lua_Node_getForwardVectorWorld(lua_State* state);
@@ -45,10 +44,8 @@ int lua_Node_getInverseViewProjectionMatrix(lua_State* state);
 int lua_Node_getLeftVector(lua_State* state);
 int lua_Node_getLight(lua_State* state);
 int lua_Node_getMatrix(lua_State* state);
-int lua_Node_getModel(lua_State* state);
 int lua_Node_getNextSibling(lua_State* state);
 int lua_Node_getParent(lua_State* state);
-int lua_Node_getParticleEmitter(lua_State* state);
 int lua_Node_getPreviousSibling(lua_State* state);
 int lua_Node_getProjectionMatrix(lua_State* state);
 int lua_Node_getRefCount(lua_State* state);
@@ -63,7 +60,6 @@ int lua_Node_getScaleZ(lua_State* state);
 int lua_Node_getScene(lua_State* state);
 int lua_Node_getScriptEvent(lua_State* state);
 int lua_Node_getTag(lua_State* state);
-int lua_Node_getTerrain(lua_State* state);
 int lua_Node_getTranslation(lua_State* state);
 int lua_Node_getTranslationView(lua_State* state);
 int lua_Node_getTranslationWorld(lua_State* state);
@@ -105,19 +101,15 @@ int lua_Node_setAudioSource(lua_State* state);
 int lua_Node_setCamera(lua_State* state);
 int lua_Node_setCollisionObject(lua_State* state);
 int lua_Node_setEnabled(lua_State* state);
-int lua_Node_setForm(lua_State* state);
 int lua_Node_setId(lua_State* state);
 int lua_Node_setIdentity(lua_State* state);
 int lua_Node_setLight(lua_State* state);
-int lua_Node_setModel(lua_State* state);
-int lua_Node_setParticleEmitter(lua_State* state);
 int lua_Node_setRotation(lua_State* state);
 int lua_Node_setScale(lua_State* state);
 int lua_Node_setScaleX(lua_State* state);
 int lua_Node_setScaleY(lua_State* state);
 int lua_Node_setScaleZ(lua_State* state);
 int lua_Node_setTag(lua_State* state);
-int lua_Node_setTerrain(lua_State* state);
 int lua_Node_setTranslation(lua_State* state);
 int lua_Node_setTranslationX(lua_State* state);
 int lua_Node_setTranslationY(lua_State* state);

+ 0 - 83
gameplay/src/lua/lua_ParticleEmitter.cpp

@@ -19,7 +19,6 @@ void luaRegister_ParticleEmitter()
     const luaL_Reg lua_members[] = 
     {
         {"addRef", lua_ParticleEmitter_addRef},
-        {"clone", lua_ParticleEmitter_clone},
         {"draw", lua_ParticleEmitter_draw},
         {"emitOnce", lua_ParticleEmitter_emitOnce},
         {"getAcceleration", lua_ParticleEmitter_getAcceleration},
@@ -93,7 +92,6 @@ void luaRegister_ParticleEmitter()
     const luaL_Reg lua_statics[] = 
     {
         {"create", lua_ParticleEmitter_static_create},
-        {"getBlendModeFromString", lua_ParticleEmitter_static_getBlendModeFromString},
         {NULL, NULL}
     };
     std::vector<std::string> scopePath;
@@ -178,50 +176,6 @@ int lua_ParticleEmitter_addRef(lua_State* state)
     return 0;
 }
 
-int lua_ParticleEmitter_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 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                ParticleEmitter* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->clone());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "ParticleEmitter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_ParticleEmitter_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 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_ParticleEmitter_draw(lua_State* state)
 {
     // Get the number of parameters.
@@ -2997,43 +2951,6 @@ int lua_ParticleEmitter_static_create(lua_State* state)
     return 0;
 }
 
-int lua_ParticleEmitter_static_getBlendModeFromString(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 = gameplay::ScriptUtil::getString(1, false);
-
-                ParticleEmitter::BlendMode result = ParticleEmitter::getBlendModeFromString(param1);
-
-                // Push the return value onto the stack.
-                lua_pushnumber(state, (int)result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_ParticleEmitter_static_getBlendModeFromString - 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_ParticleEmitter_stop(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 2
gameplay/src/lua/lua_ParticleEmitter.h

@@ -8,7 +8,6 @@ namespace gameplay
 // Lua bindings for ParticleEmitter.
 int lua_ParticleEmitter__gc(lua_State* state);
 int lua_ParticleEmitter_addRef(lua_State* state);
-int lua_ParticleEmitter_clone(lua_State* state);
 int lua_ParticleEmitter_draw(lua_State* state);
 int lua_ParticleEmitter_emitOnce(lua_State* state);
 int lua_ParticleEmitter_getAcceleration(lua_State* state);
@@ -76,7 +75,6 @@ int lua_ParticleEmitter_setTexture(lua_State* state);
 int lua_ParticleEmitter_setVelocity(lua_State* state);
 int lua_ParticleEmitter_start(lua_State* state);
 int lua_ParticleEmitter_static_create(lua_State* state);
-int lua_ParticleEmitter_static_getBlendModeFromString(lua_State* state);
 int lua_ParticleEmitter_stop(lua_State* state);
 int lua_ParticleEmitter_update(lua_State* state);
 

+ 0 - 225
gameplay/src/lua/lua_PhysicsCharacter.cpp

@@ -27,11 +27,6 @@ void luaRegister_PhysicsCharacter()
     const luaL_Reg lua_members[] = 
     {
         {"addCollisionListener", lua_PhysicsCharacter_addCollisionListener},
-        {"asCharacter", lua_PhysicsCharacter_asCharacter},
-        {"asGhostObject", lua_PhysicsCharacter_asGhostObject},
-        {"asRigidBody", lua_PhysicsCharacter_asRigidBody},
-        {"asVehicle", lua_PhysicsCharacter_asVehicle},
-        {"asVehicleWheel", lua_PhysicsCharacter_asVehicleWheel},
         {"collidesWith", lua_PhysicsCharacter_collidesWith},
         {"getCollisionShape", lua_PhysicsCharacter_getCollisionShape},
         {"getCurrentVelocity", lua_PhysicsCharacter_getCurrentVelocity},
@@ -182,226 +177,6 @@ int lua_PhysicsCharacter_addCollisionListener(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsCharacter_asCharacter(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_TUSERDATA))
-            {
-                PhysicsCharacter* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asCharacter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsCharacter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCharacter_asCharacter - 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_PhysicsCharacter_asGhostObject(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_TUSERDATA))
-            {
-                PhysicsCharacter* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asGhostObject());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsGhostObject");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCharacter_asGhostObject - 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_PhysicsCharacter_asRigidBody(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_TUSERDATA))
-            {
-                PhysicsCharacter* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asRigidBody());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCharacter_asRigidBody - 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_PhysicsCharacter_asVehicle(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_TUSERDATA))
-            {
-                PhysicsCharacter* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicle());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicle");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCharacter_asVehicle - 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_PhysicsCharacter_asVehicleWheel(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_TUSERDATA))
-            {
-                PhysicsCharacter* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicleWheel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicleWheel");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCharacter_asVehicleWheel - 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_PhysicsCharacter_collidesWith(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 5
gameplay/src/lua/lua_PhysicsCharacter.h

@@ -7,11 +7,6 @@ namespace gameplay
 
 // Lua bindings for PhysicsCharacter.
 int lua_PhysicsCharacter_addCollisionListener(lua_State* state);
-int lua_PhysicsCharacter_asCharacter(lua_State* state);
-int lua_PhysicsCharacter_asGhostObject(lua_State* state);
-int lua_PhysicsCharacter_asRigidBody(lua_State* state);
-int lua_PhysicsCharacter_asVehicle(lua_State* state);
-int lua_PhysicsCharacter_asVehicleWheel(lua_State* state);
 int lua_PhysicsCharacter_collidesWith(lua_State* state);
 int lua_PhysicsCharacter_getCollisionShape(lua_State* state);
 int lua_PhysicsCharacter_getCurrentVelocity(lua_State* state);

+ 0 - 225
gameplay/src/lua/lua_PhysicsCollisionObject.cpp

@@ -22,11 +22,6 @@ void luaRegister_PhysicsCollisionObject()
     const luaL_Reg lua_members[] = 
     {
         {"addCollisionListener", lua_PhysicsCollisionObject_addCollisionListener},
-        {"asCharacter", lua_PhysicsCollisionObject_asCharacter},
-        {"asGhostObject", lua_PhysicsCollisionObject_asGhostObject},
-        {"asRigidBody", lua_PhysicsCollisionObject_asRigidBody},
-        {"asVehicle", lua_PhysicsCollisionObject_asVehicle},
-        {"asVehicleWheel", lua_PhysicsCollisionObject_asVehicleWheel},
         {"collidesWith", lua_PhysicsCollisionObject_collidesWith},
         {"getCollisionShape", lua_PhysicsCollisionObject_getCollisionShape},
         {"getNode", lua_PhysicsCollisionObject_getNode},
@@ -201,226 +196,6 @@ int lua_PhysicsCollisionObject_addCollisionListener(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsCollisionObject_asCharacter(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_TUSERDATA))
-            {
-                PhysicsCollisionObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asCharacter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsCharacter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCollisionObject_asCharacter - 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_PhysicsCollisionObject_asGhostObject(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_TUSERDATA))
-            {
-                PhysicsCollisionObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asGhostObject());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsGhostObject");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCollisionObject_asGhostObject - 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_PhysicsCollisionObject_asRigidBody(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_TUSERDATA))
-            {
-                PhysicsCollisionObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asRigidBody());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCollisionObject_asRigidBody - 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_PhysicsCollisionObject_asVehicle(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_TUSERDATA))
-            {
-                PhysicsCollisionObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicle());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicle");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCollisionObject_asVehicle - 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_PhysicsCollisionObject_asVehicleWheel(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_TUSERDATA))
-            {
-                PhysicsCollisionObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicleWheel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicleWheel");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsCollisionObject_asVehicleWheel - 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_PhysicsCollisionObject_collidesWith(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 5
gameplay/src/lua/lua_PhysicsCollisionObject.h

@@ -8,11 +8,6 @@ namespace gameplay
 // Lua bindings for PhysicsCollisionObject.
 int lua_PhysicsCollisionObject__gc(lua_State* state);
 int lua_PhysicsCollisionObject_addCollisionListener(lua_State* state);
-int lua_PhysicsCollisionObject_asCharacter(lua_State* state);
-int lua_PhysicsCollisionObject_asGhostObject(lua_State* state);
-int lua_PhysicsCollisionObject_asRigidBody(lua_State* state);
-int lua_PhysicsCollisionObject_asVehicle(lua_State* state);
-int lua_PhysicsCollisionObject_asVehicleWheel(lua_State* state);
 int lua_PhysicsCollisionObject_collidesWith(lua_State* state);
 int lua_PhysicsCollisionObject_getCollisionShape(lua_State* state);
 int lua_PhysicsCollisionObject_getNode(lua_State* state);

+ 0 - 225
gameplay/src/lua/lua_PhysicsGhostObject.cpp

@@ -26,11 +26,6 @@ void luaRegister_PhysicsGhostObject()
     const luaL_Reg lua_members[] = 
     {
         {"addCollisionListener", lua_PhysicsGhostObject_addCollisionListener},
-        {"asCharacter", lua_PhysicsGhostObject_asCharacter},
-        {"asGhostObject", lua_PhysicsGhostObject_asGhostObject},
-        {"asRigidBody", lua_PhysicsGhostObject_asRigidBody},
-        {"asVehicle", lua_PhysicsGhostObject_asVehicle},
-        {"asVehicleWheel", lua_PhysicsGhostObject_asVehicleWheel},
         {"collidesWith", lua_PhysicsGhostObject_collidesWith},
         {"getCollisionShape", lua_PhysicsGhostObject_getCollisionShape},
         {"getNode", lua_PhysicsGhostObject_getNode},
@@ -168,226 +163,6 @@ int lua_PhysicsGhostObject_addCollisionListener(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsGhostObject_asCharacter(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_TUSERDATA))
-            {
-                PhysicsGhostObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asCharacter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsCharacter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsGhostObject_asCharacter - 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_PhysicsGhostObject_asGhostObject(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_TUSERDATA))
-            {
-                PhysicsGhostObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asGhostObject());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsGhostObject");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsGhostObject_asGhostObject - 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_PhysicsGhostObject_asRigidBody(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_TUSERDATA))
-            {
-                PhysicsGhostObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asRigidBody());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsGhostObject_asRigidBody - 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_PhysicsGhostObject_asVehicle(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_TUSERDATA))
-            {
-                PhysicsGhostObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicle());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicle");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsGhostObject_asVehicle - 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_PhysicsGhostObject_asVehicleWheel(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_TUSERDATA))
-            {
-                PhysicsGhostObject* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicleWheel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicleWheel");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsGhostObject_asVehicleWheel - 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_PhysicsGhostObject_collidesWith(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 5
gameplay/src/lua/lua_PhysicsGhostObject.h

@@ -7,11 +7,6 @@ namespace gameplay
 
 // Lua bindings for PhysicsGhostObject.
 int lua_PhysicsGhostObject_addCollisionListener(lua_State* state);
-int lua_PhysicsGhostObject_asCharacter(lua_State* state);
-int lua_PhysicsGhostObject_asGhostObject(lua_State* state);
-int lua_PhysicsGhostObject_asRigidBody(lua_State* state);
-int lua_PhysicsGhostObject_asVehicle(lua_State* state);
-int lua_PhysicsGhostObject_asVehicleWheel(lua_State* state);
 int lua_PhysicsGhostObject_collidesWith(lua_State* state);
 int lua_PhysicsGhostObject_getCollisionShape(lua_State* state);
 int lua_PhysicsGhostObject_getNode(lua_State* state);

+ 0 - 225
gameplay/src/lua/lua_PhysicsRigidBody.cpp

@@ -33,11 +33,6 @@ void luaRegister_PhysicsRigidBody()
         {"applyImpulse", lua_PhysicsRigidBody_applyImpulse},
         {"applyTorque", lua_PhysicsRigidBody_applyTorque},
         {"applyTorqueImpulse", lua_PhysicsRigidBody_applyTorqueImpulse},
-        {"asCharacter", lua_PhysicsRigidBody_asCharacter},
-        {"asGhostObject", lua_PhysicsRigidBody_asGhostObject},
-        {"asRigidBody", lua_PhysicsRigidBody_asRigidBody},
-        {"asVehicle", lua_PhysicsRigidBody_asVehicle},
-        {"asVehicleWheel", lua_PhysicsRigidBody_asVehicleWheel},
         {"collidesWith", lua_PhysicsRigidBody_collidesWith},
         {"getAngularDamping", lua_PhysicsRigidBody_getAngularDamping},
         {"getAngularFactor", lua_PhysicsRigidBody_getAngularFactor},
@@ -432,226 +427,6 @@ int lua_PhysicsRigidBody_applyTorqueImpulse(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsRigidBody_asCharacter(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_TUSERDATA))
-            {
-                PhysicsRigidBody* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asCharacter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsCharacter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsRigidBody_asCharacter - 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_PhysicsRigidBody_asGhostObject(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_TUSERDATA))
-            {
-                PhysicsRigidBody* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asGhostObject());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsGhostObject");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsRigidBody_asGhostObject - 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_PhysicsRigidBody_asRigidBody(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_TUSERDATA))
-            {
-                PhysicsRigidBody* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asRigidBody());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsRigidBody_asRigidBody - 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_PhysicsRigidBody_asVehicle(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_TUSERDATA))
-            {
-                PhysicsRigidBody* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicle());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicle");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsRigidBody_asVehicle - 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_PhysicsRigidBody_asVehicleWheel(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_TUSERDATA))
-            {
-                PhysicsRigidBody* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicleWheel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicleWheel");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsRigidBody_asVehicleWheel - 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_PhysicsRigidBody_collidesWith(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 5
gameplay/src/lua/lua_PhysicsRigidBody.h

@@ -11,11 +11,6 @@ int lua_PhysicsRigidBody_applyForce(lua_State* state);
 int lua_PhysicsRigidBody_applyImpulse(lua_State* state);
 int lua_PhysicsRigidBody_applyTorque(lua_State* state);
 int lua_PhysicsRigidBody_applyTorqueImpulse(lua_State* state);
-int lua_PhysicsRigidBody_asCharacter(lua_State* state);
-int lua_PhysicsRigidBody_asGhostObject(lua_State* state);
-int lua_PhysicsRigidBody_asRigidBody(lua_State* state);
-int lua_PhysicsRigidBody_asVehicle(lua_State* state);
-int lua_PhysicsRigidBody_asVehicleWheel(lua_State* state);
 int lua_PhysicsRigidBody_collidesWith(lua_State* state);
 int lua_PhysicsRigidBody_getAngularDamping(lua_State* state);
 int lua_PhysicsRigidBody_getAngularFactor(lua_State* state);

+ 0 - 225
gameplay/src/lua/lua_PhysicsVehicle.cpp

@@ -24,11 +24,6 @@ void luaRegister_PhysicsVehicle()
     {
         {"addCollisionListener", lua_PhysicsVehicle_addCollisionListener},
         {"addWheel", lua_PhysicsVehicle_addWheel},
-        {"asCharacter", lua_PhysicsVehicle_asCharacter},
-        {"asGhostObject", lua_PhysicsVehicle_asGhostObject},
-        {"asRigidBody", lua_PhysicsVehicle_asRigidBody},
-        {"asVehicle", lua_PhysicsVehicle_asVehicle},
-        {"asVehicleWheel", lua_PhysicsVehicle_asVehicleWheel},
         {"collidesWith", lua_PhysicsVehicle_collidesWith},
         {"getBoostGain", lua_PhysicsVehicle_getBoostGain},
         {"getBoostSpeed", lua_PhysicsVehicle_getBoostSpeed},
@@ -234,226 +229,6 @@ int lua_PhysicsVehicle_addWheel(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicle_asCharacter(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_TUSERDATA))
-            {
-                PhysicsVehicle* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asCharacter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsCharacter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicle_asCharacter - 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_PhysicsVehicle_asGhostObject(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_TUSERDATA))
-            {
-                PhysicsVehicle* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asGhostObject());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsGhostObject");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicle_asGhostObject - 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_PhysicsVehicle_asRigidBody(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_TUSERDATA))
-            {
-                PhysicsVehicle* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asRigidBody());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicle_asRigidBody - 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_PhysicsVehicle_asVehicle(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_TUSERDATA))
-            {
-                PhysicsVehicle* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicle());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicle");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicle_asVehicle - 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_PhysicsVehicle_asVehicleWheel(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_TUSERDATA))
-            {
-                PhysicsVehicle* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicleWheel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicleWheel");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicle_asVehicleWheel - 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_PhysicsVehicle_collidesWith(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 5
gameplay/src/lua/lua_PhysicsVehicle.h

@@ -8,11 +8,6 @@ namespace gameplay
 // Lua bindings for PhysicsVehicle.
 int lua_PhysicsVehicle_addCollisionListener(lua_State* state);
 int lua_PhysicsVehicle_addWheel(lua_State* state);
-int lua_PhysicsVehicle_asCharacter(lua_State* state);
-int lua_PhysicsVehicle_asGhostObject(lua_State* state);
-int lua_PhysicsVehicle_asRigidBody(lua_State* state);
-int lua_PhysicsVehicle_asVehicle(lua_State* state);
-int lua_PhysicsVehicle_asVehicleWheel(lua_State* state);
 int lua_PhysicsVehicle_collidesWith(lua_State* state);
 int lua_PhysicsVehicle_getBoostGain(lua_State* state);
 int lua_PhysicsVehicle_getBoostSpeed(lua_State* state);

+ 0 - 225
gameplay/src/lua/lua_PhysicsVehicleWheel.cpp

@@ -22,11 +22,6 @@ void luaRegister_PhysicsVehicleWheel()
     const luaL_Reg lua_members[] = 
     {
         {"addCollisionListener", lua_PhysicsVehicleWheel_addCollisionListener},
-        {"asCharacter", lua_PhysicsVehicleWheel_asCharacter},
-        {"asGhostObject", lua_PhysicsVehicleWheel_asGhostObject},
-        {"asRigidBody", lua_PhysicsVehicleWheel_asRigidBody},
-        {"asVehicle", lua_PhysicsVehicleWheel_asVehicle},
-        {"asVehicleWheel", lua_PhysicsVehicleWheel_asVehicleWheel},
         {"collidesWith", lua_PhysicsVehicleWheel_collidesWith},
         {"getCollisionShape", lua_PhysicsVehicleWheel_getCollisionShape},
         {"getFrictionBreakout", lua_PhysicsVehicleWheel_getFrictionBreakout},
@@ -190,226 +185,6 @@ int lua_PhysicsVehicleWheel_addCollisionListener(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicleWheel_asCharacter(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_TUSERDATA))
-            {
-                PhysicsVehicleWheel* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asCharacter());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsCharacter");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicleWheel_asCharacter - 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_PhysicsVehicleWheel_asGhostObject(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_TUSERDATA))
-            {
-                PhysicsVehicleWheel* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asGhostObject());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsGhostObject");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicleWheel_asGhostObject - 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_PhysicsVehicleWheel_asRigidBody(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_TUSERDATA))
-            {
-                PhysicsVehicleWheel* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asRigidBody());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicleWheel_asRigidBody - 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_PhysicsVehicleWheel_asVehicle(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_TUSERDATA))
-            {
-                PhysicsVehicleWheel* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicle());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicle");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicleWheel_asVehicle - 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_PhysicsVehicleWheel_asVehicleWheel(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_TUSERDATA))
-            {
-                PhysicsVehicleWheel* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->asVehicleWheel());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsVehicleWheel");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsVehicleWheel_asVehicleWheel - 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_PhysicsVehicleWheel_collidesWith(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 5
gameplay/src/lua/lua_PhysicsVehicleWheel.h

@@ -7,11 +7,6 @@ namespace gameplay
 
 // Lua bindings for PhysicsVehicleWheel.
 int lua_PhysicsVehicleWheel_addCollisionListener(lua_State* state);
-int lua_PhysicsVehicleWheel_asCharacter(lua_State* state);
-int lua_PhysicsVehicleWheel_asGhostObject(lua_State* state);
-int lua_PhysicsVehicleWheel_asRigidBody(lua_State* state);
-int lua_PhysicsVehicleWheel_asVehicle(lua_State* state);
-int lua_PhysicsVehicleWheel_asVehicleWheel(lua_State* state);
 int lua_PhysicsVehicleWheel_collidesWith(lua_State* state);
 int lua_PhysicsVehicleWheel_getCollisionShape(lua_State* state);
 int lua_PhysicsVehicleWheel_getFrictionBreakout(lua_State* state);