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

Mesh and related classes ported to script binding generation

BearishSun 8 лет назад
Родитель
Сommit
3d8f1c0e2e
44 измененных файлов с 890 добавлено и 2036 удалено
  1. 21 15
      Source/BansheeCore/Include/BsCommonTypes.h
  2. 4 4
      Source/BansheeCore/Include/BsMesh.h
  3. 8 5
      Source/BansheeCore/Include/BsMeshBase.h
  4. 1 1
      Source/BansheeCore/Include/BsMeshData.h
  5. 15 4
      Source/BansheeCore/Include/BsMorphShapes.h
  6. 7 10
      Source/BansheeCore/Include/BsRendererMeshData.h
  7. 2 1
      Source/BansheeCore/Include/BsSkeleton.h
  8. 1 1
      Source/BansheeCore/Include/BsSubMesh.h
  9. 1 1
      Source/MBansheeEditor/Inspectors/BoneInspector.cs
  10. 0 97
      Source/MBansheeEngine/Animation/MorphShapes.cs
  11. 0 71
      Source/MBansheeEngine/Animation/Skeleton.cs
  12. 0 3
      Source/MBansheeEngine/MBansheeEngine.csproj
  13. 2 228
      Source/MBansheeEngine/Rendering/Mesh.cs
  14. 0 252
      Source/MBansheeEngine/Utility/MeshData.cs
  15. 3 1
      Source/SBansheeEditor/Include/BsScriptGizmos.h
  16. 4 3
      Source/SBansheeEditor/Source/BsScriptGizmos.cpp
  17. 11 15
      Source/SBansheeEngine/CMakeSources.cmake
  18. 87 0
      Source/SBansheeEngine/Include/BsMeshDataEx.h
  19. 105 0
      Source/SBansheeEngine/Include/BsMeshEx.h
  20. 0 32
      Source/SBansheeEngine/Include/BsScriptBoneWeight.h
  21. 64 64
      Source/SBansheeEngine/Include/BsScriptD6Joint.h
  22. 0 1
      Source/SBansheeEngine/Include/BsScriptEnginePrerequisites.h
  23. 32 32
      Source/SBansheeEngine/Include/BsScriptFixedJoint.h
  24. 52 52
      Source/SBansheeEngine/Include/BsScriptHingeJoint.h
  25. 0 96
      Source/SBansheeEngine/Include/BsScriptMesh.h
  26. 0 75
      Source/SBansheeEngine/Include/BsScriptMeshData.h
  27. 0 67
      Source/SBansheeEngine/Include/BsScriptMorphShapes.h
  28. 0 62
      Source/SBansheeEngine/Include/BsScriptSkeleton.h
  29. 48 48
      Source/SBansheeEngine/Include/BsScriptSliderJoint.h
  30. 46 46
      Source/SBansheeEngine/Include/BsScriptSphericalJoint.h
  31. 42 0
      Source/SBansheeEngine/Include/BsSkeletonEx.h
  32. 205 0
      Source/SBansheeEngine/Source/BsMeshDataEx.cpp
  33. 104 0
      Source/SBansheeEngine/Source/BsMeshEx.cpp
  34. 1 1
      Source/SBansheeEngine/Source/BsScriptAssemblyManager.cpp
  35. 0 1
      Source/SBansheeEngine/Source/BsScriptAudioClip.cpp
  36. 0 27
      Source/SBansheeEngine/Source/BsScriptBoneWeight.cpp
  37. 0 1
      Source/SBansheeEngine/Source/BsScriptBuiltin.cpp
  38. 0 238
      Source/SBansheeEngine/Source/BsScriptMesh.cpp
  39. 0 309
      Source/SBansheeEngine/Source/BsScriptMeshData.cpp
  40. 0 87
      Source/SBansheeEngine/Source/BsScriptMorphShapes.cpp
  41. 3 2
      Source/SBansheeEngine/Source/BsScriptPhysicsMesh.cpp
  42. 2 1
      Source/SBansheeEngine/Source/BsScriptRenderable.cpp
  43. 0 82
      Source/SBansheeEngine/Source/BsScriptSkeleton.cpp
  44. 19 0
      Source/SBansheeEngine/Source/BsSkeletonEx.cpp

+ 21 - 15
Source/BansheeCore/Include/BsCommonTypes.h

@@ -115,21 +115,27 @@ namespace bs
 	};
 
 	/** Describes operation that will be used for rendering a certain set of vertices. */
-	enum DrawOperationType
-	{
-		DOT_POINT_LIST = 1, /**< Each vertex represents a point. */
-		DOT_LINE_LIST = 2, /**< Each sequential pair of vertices represent a line. */
-		DOT_LINE_STRIP = 3, /**< Each vertex (except the first) forms a line with the previous vertex. */
-		DOT_TRIANGLE_LIST = 4, /**< Each sequential 3-tuple of vertices represent a triangle. */
-		DOT_TRIANGLE_STRIP = 5, /**< Each vertex (except the first two) form a triangle with the previous two vertices. */
-		DOT_TRIANGLE_FAN = 6 /**< Each vertex (except the first two) form a triangle with the first vertex and previous vertex. */
-	};
-
-	/**	Type of the indices used, used for determining size. */
-	enum IndexType
-	{
-		IT_16BIT, /**< 16-bit indices. */
-		IT_32BIT /**< 32-bit indices. */
+	enum BS_SCRIPT_EXPORT(n:MeshTopology,m:Rendering) DrawOperationType
+	{
+		/** Each vertex represents a point. */
+		DOT_POINT_LIST		BS_SCRIPT_EXPORT(n:PointList)		= 1,
+		/** Each sequential pair of vertices represent a line. */
+		DOT_LINE_LIST		BS_SCRIPT_EXPORT(n:LineList)		= 2,
+		/** Each vertex (except the first) forms a line with the previous vertex. */
+		DOT_LINE_STRIP		BS_SCRIPT_EXPORT(n:LineStrip)		= 3,
+		/** Each sequential 3-tuple of vertices represent a triangle. */
+		DOT_TRIANGLE_LIST	BS_SCRIPT_EXPORT(n:TriangleList)	= 4,
+		/** Each vertex (except the first two) form a triangle with the previous two vertices. */
+		DOT_TRIANGLE_STRIP	BS_SCRIPT_EXPORT(n:TriangleStrip)	= 5,
+		/** Each vertex (except the first two) form a triangle with the first vertex and previous vertex. */
+		DOT_TRIANGLE_FAN	BS_SCRIPT_EXPORT(n:TriangleFan)		= 6
+	};
+
+	/**	Type of mesh indices used, used for determining maximum number of vertices in a mesh. */
+	enum BS_SCRIPT_EXPORT() IndexType
+	{
+		IT_16BIT	BS_SCRIPT_EXPORT(n:Index16),	/**< 16-bit indices. */
+		IT_32BIT	BS_SCRIPT_EXPORT(n:Index32)		/**< 32-bit indices. */
 	};
 
 	/** These values represent a hint to the driver when locking a hardware buffer. */

+ 4 - 4
Source/BansheeCore/Include/BsMesh.h

@@ -58,12 +58,10 @@ namespace bs
 	};
 
 	/**
-	 * Primary class for holding geometry. Stores data in the form of a vertex buffers and optionally index buffer, which 
+	 * Primary class for holding geometry. Stores data in the form of vertex buffers and optionally an index buffer, which 
 	 * may be bound to the pipeline for drawing. May contain multiple sub-meshes.
-	 *
-	 * @note	Sim thread.
 	 */
-	class BS_CORE_EXPORT Mesh : public MeshBase
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) Mesh : public MeshBase
 	{
 	public:
 		virtual ~Mesh();
@@ -120,9 +118,11 @@ namespace bs
 		void readCachedData(MeshData& data);
 
 		/** Gets the skeleton required for animation of this mesh, if any is available. */
+		BS_SCRIPT_EXPORT(pr:getter,n:Skeleton)
 		SPtr<Skeleton> getSkeleton() const { return mSkeleton; }
 
 		/** Returns an object containing all shapes used for morph animation, if any are available. */
+		BS_SCRIPT_EXPORT(pr:getter,n:MorphShapes)
 		SPtr<MorphShapes> getMorphShapes() const { return mMorphShapes; }
 
 		/** Retrieves a core implementation of a mesh usable only from the core thread. */

+ 8 - 5
Source/BansheeCore/Include/BsMeshBase.h

@@ -17,12 +17,15 @@ namespace bs
 	 * Planned usage for the mesh. These options usually affect performance and you should specify static if you don't plan
 	 * on modifying the mesh often, otherwise specify dynamic.
 	 */
-	enum MeshUsage
+	enum BS_SCRIPT_EXPORT(m:Rendering) MeshUsage
 	{
-		MU_STATIC, /**< Specify for a mesh that is not often updated from the CPU. */
-		MU_DYNAMIC, /**< Specify for a mesh that is often updated from the CPU. */
-		/** All mesh data will also be cached in CPU memory, making it available for fast read access from the CPU. */
-		MU_CPUCACHED = 0x1000, 
+		MU_STATIC		BS_SCRIPT_EXPORT(n:Static), /**< Specify for a mesh that is not often updated from the CPU. */
+		MU_DYNAMIC		BS_SCRIPT_EXPORT(n:Dynamic), /**< Specify for a mesh that is often updated from the CPU. */
+		/** 
+		 * All mesh data will also be cached in CPU memory, making it available for fast read access from the CPU. Can be 
+		 * combined with other usage flags. 
+		 */
+		MU_CPUCACHED	BS_SCRIPT_EXPORT(n:CPUCached) = 0x1000, 
 	};
 
 	/** Properties of a Mesh. Shared between sim and core thread versions of a Mesh. */

+ 1 - 1
Source/BansheeCore/Include/BsMeshData.h

@@ -78,7 +78,7 @@ namespace bs
 	};
 
 	/** Contains per-vertex bone weights and indexes used for skinning, for up to four bones. */
-	struct BoneWeight
+	struct BS_SCRIPT_EXPORT(pl:true,m:Utility) BoneWeight
 	{
 		int index0;
 		int index1;

+ 15 - 4
Source/BansheeCore/Include/BsMorphShapes.h

@@ -29,15 +29,17 @@ namespace bs
 	 * A set of vertices representing a single shape in a morph target animation. Vertices are represented as a difference
 	 * between base and target shape.
 	 */
-	class BS_CORE_EXPORT MorphShape : public IReflectable
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Animation) MorphShape : public IReflectable
 	{
 	public:
 		MorphShape(const String& name, float weight, const Vector<MorphVertex>& vertices);
 
 		/** Returns the name of the shape. */
+		BS_SCRIPT_EXPORT(pr:getter,n:Name)
 		const String& getName() const { return mName; }
 
 		/** Returns the weight of the shape, determining how are different shapes within a channel blended. */
+		BS_SCRIPT_EXPORT(pr:getter,n:Weight)
 		float getWeight() const { return mWeight; }
 
 		/** Returns a reference to all of the shape's vertices. Contains only vertices that differ from the base. */
@@ -75,10 +77,11 @@ namespace bs
 	 * determines at what point is that shape blended. As the channel percent moves from 0 to 1, different shapes will be
 	 * blended with those before or after them, depending on their weight.
 	 */
-	class BS_CORE_EXPORT MorphChannel : public IReflectable
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Animation) MorphChannel : public IReflectable
 	{
 	public:
-		/** Returns the name of the channel. */
+		/** Returns the unique name of the channel. */
+		BS_SCRIPT_EXPORT(pr:getter,n:Name)
 		const String& getName() const { return mName; }
 
 		/** Returns the number of available morph shapes. */
@@ -87,6 +90,10 @@ namespace bs
 		/** Returns the morph shape at the specified index. */
 		SPtr<MorphShape> getShape(UINT32 idx) const { return mShapes[idx]; }
 
+		/** Returns all morph shapes within this channel, in order from lowest to highest. */
+		BS_SCRIPT_EXPORT(pr:getter,n:Shapes)
+		const Vector<SPtr<MorphShape>>& getShapes() const { return mShapes; }
+
 		/** Creates a new channel from a set of morph shapes. */
 		static SPtr<MorphChannel> create(const String& name, const Vector<SPtr<MorphShape>>& shapes);
 
@@ -118,7 +125,7 @@ namespace bs
 	 * which are blended together depending on frame animation. Each channel is then additively blended together depending
 	 * on some weight.
 	 */
-	class BS_CORE_EXPORT MorphShapes : public IReflectable // Note: Must be immutable in order to be usable on multiple threads
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Animation) MorphShapes : public IReflectable // Note: Must be immutable in order to be usable on multiple threads
 	{
 	public:
 		/** Returns the number of available morph channels. */
@@ -127,6 +134,10 @@ namespace bs
 		/** Returns the morph channel at the specified index. */
 		SPtr<MorphChannel> getChannel(UINT32 idx) const { return mChannels[idx]; }
 
+		/** Returns a list of all morph channels in the morph animation. */
+		BS_SCRIPT_EXPORT(pr:getter,n:Channels)
+		const Vector<SPtr<MorphChannel>>& getChannels() const { return mChannels; }
+
 		/** Returns the number of vertices per morph shape. */
 		UINT32 getNumVertices() const { return mNumVertices; }
 

+ 7 - 10
Source/BansheeCore/Include/BsRendererMeshData.h

@@ -12,8 +12,11 @@ namespace bs
 	 *  @{
 	 */
 
-	/**	Available vertex layouts (Combinations other than those provided are allowed). */
-	enum class VertexLayout
+	/**
+	 * Available vertex layouts that specify what data is provided per-vertex in a mesh. Combinations other than those
+	 * provided are allowed.
+	 */
+	enum class BS_SCRIPT_EXPORT(m:Rendering) VertexLayout
 	{
 		Position = 0x01,
 		Color = 0x02,
@@ -35,14 +38,8 @@ namespace bs
 		PNTU = Position | Normal | Tangent | UV0,
 	};
 
-	/**
-	 * Wrapper around MeshData that constructs the default mesh data structure expected by the renderer and other engine 
-	 * systems. Data will be compressed and uncompressed when written to and read to as needed to comply with wanted format.
-	 *			
-	 * @note	This is the default implementation while the Renderer plugins can override it by overriding
-	 *			createMeshData() method in their Renderer implementation.
-	 */
-	class BS_CORE_EXPORT RendererMeshData
+	/** Contains mesh vertex and index data used for initializing, updating and reading mesh data from Mesh. */
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(n:MeshData) RendererMeshData
 	{
 	public:
 		/**

+ 2 - 1
Source/BansheeCore/Include/BsSkeleton.h

@@ -106,7 +106,7 @@ namespace bs
 	 * Contains information about bones required for skeletal animation. Allows caller to evaluate a set of animation
 	 * clips at a specific time and output the relevant skeleton pose.
 	 */
-	class BS_CORE_EXPORT Skeleton : public IReflectable // Note: Must be immutable in order to be usable on multiple threads
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Animation) Skeleton : public IReflectable // Note: Must be immutable in order to be usable on multiple threads
 	{
 	public:
 		~Skeleton();
@@ -146,6 +146,7 @@ namespace bs
 			const AnimationStateLayer* layers, UINT32 numLayers);
 
 		/** Returns the total number of bones in the skeleton. */
+		BS_SCRIPT_EXPORT(pr:getter,n:NumBones)
 		UINT32 getNumBones() const { return mNumBones; }
 
 		/** Returns information about a bone at the provided index. */

+ 1 - 1
Source/BansheeCore/Include/BsSubMesh.h

@@ -11,7 +11,7 @@ namespace bs
 	 */
 
 	/**	Data about a sub-mesh range and the type of primitives contained in the range. */
-	struct BS_CORE_EXPORT SubMesh
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(pl:true,m:Rendering) SubMesh
 	{
 		SubMesh()
 			: indexOffset(0), indexCount(0), drawOp(DOT_TRIANGLE_LIST)

+ 1 - 1
Source/MBansheeEditor/Inspectors/BoneInspector.cs

@@ -120,7 +120,7 @@ namespace BansheeEditor
             Skeleton skeleton = mesh.Skeleton;
             string[] boneNames = new string[skeleton.NumBones];
             for (int i = 0; i < boneNames.Length; i++)
-                boneNames[i] = skeleton.GetBoneInfo(i).Name;
+                boneNames[i] = skeleton.GetBoneInfo(i).name;
 
             return boneNames;
         }

+ 0 - 97
Source/MBansheeEngine/Animation/MorphShapes.cs

@@ -1,97 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /** @addtogroup Animation
-     *  @{
-     */
-
-    /// <summary>
-    /// Name and weight of a single shape in a morph target animation. Each shape internally represents a set of vertices
-    /// that describe the morph shape.
-    /// </summary>
-    public class MorphShape
-    {
-        /// <summary>
-        /// Unique name of the shape within a channel.
-        /// </summary>
-        public string Name { get; }
-
-        /// <summary>
-        /// Weight of the shape, determining how are different shapes within a channel blended.
-        /// </summary>
-        public float Weight { get; }
-
-        /// <summary>
-        /// Constructor for internal runtime use.
-        /// </summary>
-        /// <param name="name">Unique name of the shape within a channel.</param>
-        /// <param name="weight">Weight in range [0, 1]. Determines how are sequential shapes animated between within a
-        ///                      morph channel.e.g. if there is a shape A with weight 0.3 and shape B with weight 0.8
-        ///                      then shape A will be displayed first and then be blended towards shape B as time passes.
-        ///                      </param>
-        private MorphShape(string name, float weight)
-        {
-            Name = name;
-            Weight = weight;
-        }
-    }
-
-    /// <summary>
-    /// A collection of morph shapes that are sequentially blended together. Each shape has a weight in range [0, 1] which
-    /// determines at what point is that shape blended. As the channel percent moves from 0 to 1, different shapes will be
-    /// blended with those before or after them, depending on their weight.
-    /// </summary>
-    public class MorphChannel
-    {
-        /// <summary>
-        /// Unique name of the channel, within a single morph animation.
-        /// </summary>
-        public string Name { get; }
-
-        /// <summary>
-        /// All morph shapes within a channel, in order from lowest to highest weight.
-        /// </summary>
-        public MorphShape[] Shapes { get; }
-
-        /// <summary>
-        /// Constructor for internal runtime use.
-        /// </summary>
-        /// <param name="name">Unique name of the channel, within a single morph animation.</param>
-        /// <param name="shapes">A set of shapes beloning to a channel.</param>
-        private MorphChannel(string name, MorphShape[] shapes)
-        {
-            Name = name;
-            Shapes = shapes;
-        }
-    }
-
-    /// <summary>
-    /// Contains a set of morph shapes, used for morph target animation. Each morph shape contains a single possible shape
-    /// that can be added on top of the base shape in order to create the animation.
-    /// </summary>
-    public class MorphShapes : ScriptObject
-    {
-        /// <summary>
-        /// Constructor for internal runtime use only.
-        /// </summary>
-        private MorphShapes()
-        { }
-
-        /// <summary>
-        /// Returns a list of all available morph channels.
-        /// </summary>
-        public MorphChannel[] Channels
-        {
-            get { return Internal_GetChannels(mCachedPtr); }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern MorphChannel[] Internal_GetChannels(IntPtr instance);
-    }
-
-    /** @} */
-}

+ 0 - 71
Source/MBansheeEngine/Animation/Skeleton.cs

@@ -1,71 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /** @addtogroup Animation
-     *  @{
-     */
-
-    /// <summary>
-    /// Contains information about bones required for skeletal animation.
-    /// </summary>
-    public class Skeleton : ScriptObject
-    {
-        /// <summary>
-        /// Constructor for internal runtime use only.
-        /// </summary>
-        private Skeleton()
-        { }
-
-        /// <summary>
-        /// Returns the total number of bones in the skeleton.
-        /// </summary>
-        /// <returns>Number of bones.</returns>
-        public int NumBones
-        {
-            get { return Internal_GetNumBones(mCachedPtr); }
-        }
-
-        /// <summary>
-        /// Returns information about a bone at the provided index.
-        /// </summary>
-        /// <param name="boneIdx">Index of the bone to retrieve information for.</param>
-        /// <returns>Information about the bone, or null if index was out of range.</returns>
-        public BoneInfo GetBoneInfo(int boneIdx)
-        {
-            return Internal_GetBoneInfo(mCachedPtr, boneIdx);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetNumBones(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern BoneInfo Internal_GetBoneInfo(IntPtr thisPtr, int boneIdx);
-    }
-
-    /// <summary>
-    /// Contains internal information about a single bone in a <see cref="Skeleton"/>.
-    /// </summary>
-    public class BoneInfo
-    {
-        /// <summary>
-        /// Unique name of the bone.
-        /// </summary>
-        public string Name;
-
-        /// <summary>
-        /// Index of the parent bone (within the relevant <see cref="Skeleton"/> object). -1 if root bone.
-        /// </summary>
-        public int Parent;
-
-        /// <summary>
-        /// Inverse transform of the pose the skeleton was initially created in.
-        /// </summary>
-        public Matrix4 InvBindPose;
-    }
-
-    /** @} */
-}

+ 0 - 3
Source/MBansheeEngine/MBansheeEngine.csproj

@@ -49,8 +49,6 @@
     <Compile Include="Animation\AnimationCurves.cs" />
     <Compile Include="Animation\Bone.cs" />
     <Compile Include="Animation\Interop\NativeAnimation.cs" />
-    <Compile Include="Animation\MorphShapes.cs" />
-    <Compile Include="Animation\Skeleton.cs" />
     <Compile Include="Audio\Audio.cs" />
     <Compile Include="Audio\AudioClip.cs" />
     <Compile Include="Audio\AudioListener.cs" />
@@ -127,7 +125,6 @@
     <Compile Include="Math\Rect2I.cs" />
     <Compile Include="Math\Vector2I.cs" />
     <Compile Include="Rendering\Mesh.cs" />
-    <Compile Include="Utility\MeshData.cs" />
     <Compile Include="Scene\MissingComponent.cs" />
     <Compile Include="Utility\PathEx.cs" />
     <Compile Include="Physics\BoxCollider.cs" />

+ 2 - 228
Source/MBansheeEngine/Rendering/Mesh.cs

@@ -10,114 +10,8 @@ namespace BansheeEngine
      *  @{
      */
 
-    /// <summary>
-    /// Primary class for holding geometry. Stores data in the form of a vertex buffers and optionally index buffer, 
-    /// which may be bound to the pipeline for drawing. May contain multiple sub-meshes.
-    /// </summary>
-    public class Mesh : Resource
+    public partial class Mesh
     {
-        /// <summary>
-        /// Constructor for internal use by the runtime.
-        /// </summary>
-        private Mesh()
-        { }
-
-        /// <summary>
-        /// Creates a new mesh with enough space to hold the a number of primitives using the specified layout. All indices
-        /// will be part of a single sub-mesh.
-        /// </summary>
-        /// <param name="numVertices">Number of vertices in the mesh.</param>
-        /// <param name="numIndices">Number of indices in the mesh. </param>
-        /// <param name="topology">Determines how should the provided indices be interpreted by the pipeline. Default option
-        ///                        is a triangle list, where three indices represent a single triangle.</param>
-        /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param>
-        /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param>
-        /// <param name="index">Size of indices, use smaller size for better performance, however be careful not to go over
-        ///                     the number of vertices limited by the size.</param>
-        public Mesh(int numVertices, int numIndices, MeshTopology topology = MeshTopology.TriangleList,
-            MeshUsage usage = MeshUsage.Default, VertexType vertex = VertexType.Position, 
-            IndexType index = IndexType.Index32)
-        {
-            SubMesh[] subMeshes = {new SubMesh(0, numIndices, topology)};
-
-            Internal_CreateInstance(this, numVertices, numIndices, subMeshes, usage, vertex, index);
-        }
-
-        /// <summary>
-        /// Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can
-        /// be references by multiple sub-meshes.
-        /// </summary>
-        /// <param name="numVertices">Number of vertices in the mesh.</param>
-        /// <param name="numIndices">Number of indices in the mesh. </param>
-        /// <param name="subMeshes">Defines how are indices separated into sub-meshes, and how are those sub-meshes rendered.
-        ///                         Sub-meshes may be rendered independently.</param>
-        /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param>
-        /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param>
-        /// <param name="index">Size of indices, use smaller size for better performance, however be careful not to go over
-        ///                     the number of vertices limited by the size.</param>
-        public Mesh(int numVertices, int numIndices, SubMesh[] subMeshes, MeshUsage usage = MeshUsage.Default,
-            VertexType vertex = VertexType.Position, IndexType index = IndexType.Index32)
-        {
-            Internal_CreateInstance(this, numVertices, numIndices, subMeshes, usage, vertex, index);
-        }
-
-        /// <summary>
-        /// Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
-        /// by the mesh data exactly. Mesh will have no sub-meshes.
-        /// </summary>
-        /// <param name="data">Vertex and index data to initialize the mesh with.</param>
-        /// <param name="topology">Determines how should the provided indices be interpreted by the pipeline. Default option
-        ///                        is a triangle list, where three indices represent a single triangle.</param>
-        /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param>
-        public Mesh(MeshData data, MeshTopology topology = MeshTopology.TriangleList, MeshUsage usage = MeshUsage.Default)
-        {
-            int numIndices = 0;
-            IntPtr dataPtr = IntPtr.Zero;
-
-            if (data != null)
-            {
-                numIndices = data.IndexCount;
-                dataPtr = data.GetCachedPtr();
-            }
-
-            SubMesh[] subMeshes = { new SubMesh(0, numIndices, topology) };
-
-            Internal_CreateInstanceMeshData(this, dataPtr, subMeshes, usage);
-        }
-
-        /// <summary>
-        /// Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
-        /// by the mesh data exactly. Mesh will have specified the sub-meshes.
-        /// </summary>
-        /// <param name="data">Vertex and index data to initialize the mesh with.</param>
-        /// <param name="subMeshes">Defines how are indices separated into sub-meshes, and how are those sub-meshes rendered.
-        ///                         Sub-meshes may be rendered independently.</param>
-        /// <param name="usage">Optimizes performance depending on planned usage of the mesh.</param>
-        public Mesh(MeshData data, SubMesh[] subMeshes, MeshUsage usage = MeshUsage.Default)
-        {
-            IntPtr dataPtr = IntPtr.Zero;
-            if (data != null)
-                dataPtr = data.GetCachedPtr();
-
-            Internal_CreateInstanceMeshData(this, dataPtr, subMeshes, usage);
-        }
-
-        /// <summary>
-        /// Returns the number of sub-meshes contained in the mesh.
-        /// </summary>
-        public int SubMeshCount
-        {
-            get { return Internal_GetSubMeshCount(mCachedPtr); }
-        }
-
-        /// <summary>
-        /// Returns all sub-meshes contained in the mesh.
-        /// </summary>
-        public SubMesh[] SubMeshes
-        {
-            get { return Internal_GetSubMeshes(mCachedPtr); }
-        }
-
         /// <summary>
         /// Returns local bounds of the geometry contained in the vertex buffers for all sub-meshes.
         /// </summary>
@@ -128,131 +22,11 @@ namespace BansheeEngine
                 AABox box;
                 Sphere sphere;
 
-                Internal_GetBounds(mCachedPtr, out box, out sphere);
+                Internal_getBounds(mCachedPtr, out box, out sphere);
 
                 return new Bounds(box, sphere);
             }
         }
-
-        /// <summary>
-        /// Accesses the vertex and index data of the mesh. If reading, mesh must have been created with the 
-        /// <see cref="MeshUsage.CPUCached"/> flag. If writing the caller must ensure the data matches mesh's vertex/index
-        /// counts, vertex layout and index format.
-        /// </summary>
-        public MeshData MeshData
-        {
-            get { return Internal_GetMeshData(mCachedPtr); }
-            set
-            {
-                IntPtr meshDataPtr = IntPtr.Zero;
-                if (value != null)
-                    meshDataPtr = value.GetCachedPtr();
-
-                Internal_SetMeshData(mCachedPtr, meshDataPtr);
-            }
-        }
-
-        /// <summary>
-        /// Gets the skeleton required for animation of this mesh, if any is available.
-        /// </summary>
-        public Skeleton Skeleton
-        {
-            get { return Internal_GetSkeleton(mCachedPtr); }
-        }
-
-        /// <summary>
-        /// Returns an object containing all shapes used for morph animation, if any are available.
-        /// </summary>
-        public MorphShapes MorphShapes
-        {
-            get { return Internal_GetMorphShapes(mCachedPtr); }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(Mesh instance, int numVertices,
-            int numIndices, SubMesh[] subMeshes, MeshUsage usage, VertexType vertex, IndexType index);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstanceMeshData(Mesh instance, IntPtr data, SubMesh[] subMeshes, 
-            MeshUsage usage);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SubMesh[] Internal_GetSubMeshes(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetSubMeshCount(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Skeleton Internal_GetSkeleton(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern MorphShapes Internal_GetMorphShapes(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetBounds(IntPtr thisPtr, out AABox box, out Sphere sphere);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern MeshData Internal_GetMeshData(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetMeshData(IntPtr thisPtr, IntPtr value);
-    }
-
-    /// <summary>
-    /// Data about a sub-mesh range and the type of primitives contained in the range.
-    /// </summary>
-    [StructLayout(LayoutKind.Sequential)]
-    public struct SubMesh // Note: Must match C++ class SubMesh
-    {
-        public SubMesh(int indexOffset, int indexCount, MeshTopology topology = MeshTopology.TriangleList)
-        {
-            IndexOffset = indexOffset;
-            IndexCount = indexCount;
-            Topology = topology;
-        }
-
-        public int IndexOffset;
-        public int IndexCount;
-        public MeshTopology Topology;
-    }
-
-    /// <summary>
-    /// Determines how are mesh indices interpreted by the renderer.
-    /// </summary>
-    public enum MeshTopology // Note: Must match C++ class MeshTopology
-    {
-        PointList = 1,
-        LineList = 2,
-        LineStrip = 3,
-        TriangleList = 4,
-        TriangleStrip = 5,
-        TriangleFan = 6
-    }
-
-    /// <summary>
-    /// Planned usage for the mesh that allow various optimizations.
-    /// </summary>
-    public enum MeshUsage // Note: Must match C++ enum MeshUsage
-    {
-        /// <summary>
-        /// Specify for a mesh that is not often updated from the CPU.
-        /// </summary>
-        Default = 0x1,
-
-        /// <summary>
-        /// Specify for a mesh that is often updated from the CPU.
-        /// </summary>
-        Dynamic = 0x2,
-
-        /// <summary>
-        /// All mesh data will also be cached in CPU memory, making it available for fast read access from the CPU.
-        /// </summary>
-        CPUCached = 0x1000,
-
-        /// <summary>
-        /// Allows the CPU to directly read the mesh data buffers from the GPU.
-        /// </summary>
-        CPUReadable = 0x2000 
     }
 
     /** @} */

+ 0 - 252
Source/MBansheeEngine/Utility/MeshData.cs

@@ -1,252 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace BansheeEngine
-{
-    /** @addtogroup Utility
-     *  @{
-     */
-
-    /// <summary>
-    /// Contains mesh vertex and index data used for initializing, updating and reading mesh data from Mesh.
-    /// </summary>
-    public class MeshData : ScriptObject
-    {
-        /// <summary>
-        /// Constructor for internal runtime use only.
-        /// </summary>
-        private MeshData()
-        { }
-
-        /// <summary>
-        /// Creates a new mesh data that can hold number of vertices described by the provided vertex layout as well as a 
-        /// number of indices of the provided type.
-        /// </summary>
-        /// <param name="numVertices">Number of vertices in the mesh.</param>
-        /// <param name="numIndices">Number of indices in the mesh. </param>
-        /// <param name="vertex">Controls how are vertices organized in the vertex buffer and what data they contain.</param>
-        /// <param name="index">Size of indices, use smaller size for better performance, however be careful not to go over
-        ///                     the number of vertices limited by the size.</param>
-        public MeshData(int numVertices, int numIndices, VertexType vertex = VertexType.Position,
-            IndexType index = IndexType.Index32)
-        {
-            Internal_CreateInstance(this, numVertices, numIndices, vertex, index);
-        }
-
-        /// <summary>
-        /// An array of all vertex positions. Only valid if the vertex layout contains vertex positions.
-        /// </summary>
-        public Vector3[] Positions
-        {
-            get { return Internal_GetPositions(mCachedPtr); }
-            set { Internal_SetPositions(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all vertex normals. Only valid if the vertex layout contains vertex normals.
-        /// </summary>
-        public Vector3[] Normals
-        {
-            get { return Internal_GetNormals(mCachedPtr); }
-            set { Internal_SetNormals(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all vertex tangents. Only valid if the vertex layout contains vertex tangents.
-        /// </summary>
-        public Vector4[] Tangents
-        {
-            get { return Internal_GetTangents(mCachedPtr); }
-            set { Internal_SetTangents(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all vertex colors. Only valid if the vertex layout contains vertex colors.
-        /// </summary>
-        public Color[] Colors
-        {
-            get { return Internal_GetColors(mCachedPtr); }
-            set { Internal_SetColors(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all vertex texture coordinates in the UV0 channel. Only valid if the vertex layout contains UV0 
-        /// coordinates.
-        /// </summary>
-        public Vector2[] UV
-        {
-            get { return UV0; }
-            set { UV0 = value; }
-        }
-
-        /// <summary>
-        /// An array of all vertex texture coordinates in the UV0 channel. Only valid if the vertex layout contains UV0 
-        /// coordinates.
-        /// </summary>
-        public Vector2[] UV0
-        {
-            get { return Internal_GetUV0(mCachedPtr); }
-            set { Internal_SetUV0(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all vertex texture coordinates in the UV1 channel. Only valid if the vertex layout contains UV1
-        /// coordinates.
-        /// </summary>
-        public Vector2[] UV1
-        {
-            get { return Internal_GetUV1(mCachedPtr); }
-            set { Internal_SetUV0(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all vertex bone weights. Only valid if the vertex layout contains bone weights.
-        /// </summary>
-        public BoneWeight[] BoneWeights
-        {
-            get { return Internal_GetBoneWeights(mCachedPtr); }
-            set { Internal_SetBoneWeights(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// An array of all indices. Make sure that individual entries do not go over the index count as required by
-        /// active index type.
-        /// </summary>
-        public int[] Indices
-        {
-            get { return Internal_GetIndices(mCachedPtr); }
-            set { Internal_SetIndices(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Number of vertices contained by this object.
-        /// </summary>
-        public int VertexCount
-        {
-            get { return Internal_GetVertexCount(mCachedPtr); }
-        }
-
-        /// <summary>
-        /// Number of indices contained by this object.
-        /// </summary>
-        public int IndexCount
-        {
-            get { return Internal_GetIndexCount(mCachedPtr); }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(MeshData instance, int numVertices, 
-            int numIndices, VertexType vertex, IndexType index);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Vector3[] Internal_GetPositions(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPositions(IntPtr thisPtr, Vector3[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Vector3[] Internal_GetNormals(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetNormals(IntPtr thisPtr, Vector3[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Vector4[] Internal_GetTangents(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTangents(IntPtr thisPtr, Vector4[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Color[] Internal_GetColors(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetColors(IntPtr thisPtr, Color[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Vector2[] Internal_GetUV0(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetUV0(IntPtr thisPtr, Vector2[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern Vector2[] Internal_GetUV1(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetUV1(IntPtr thisPtr, Vector2[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern BoneWeight[] Internal_GetBoneWeights(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetBoneWeights(IntPtr thisPtr, BoneWeight[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int[] Internal_GetIndices(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetIndices(IntPtr thisPtr, int[] value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetVertexCount(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetIndexCount(IntPtr thisPtr);
-    }
-
-    /// <summary>
-    /// Available vertex layouts that specify what data is provided per-vertex in a mesh. Combinations other than those 
-    /// provided are allowed.
-    /// </summary>
-    public enum VertexType // Note: Must match C++ enum VertexLayout
-    {
-        Position = 0x01,
-        Color = 0x02,
-        Normal = 0x04,
-        Tangent = 0x08,
-        BlendWeights = 0x10,
-        UV0 = 0x20,
-        UV1 = 0x40,
-        PC = Position | Color,
-        PU = Position | UV0,
-        PCU = Position | Color | UV0,
-        PCN = Position | Color | Normal,
-        PCNU = Position | Color | Normal | UV0,
-        PCNT = Position | Color | Normal | Tangent,
-        PCNTU = Position | Color | Normal | Tangent | UV0,
-        PN = Position | Normal,
-        PNU = Position | Normal | UV0,
-        PNT = Position | Normal | Tangent,
-        PNTU = Position | Normal | Tangent | UV0,
-    }
-
-    /// <summary>
-    /// Determines the size of a single index in a mesh.
-    /// </summary>
-    public enum IndexType // Note: Must match C++ enum ScriptIndexType
-    {
-        Index16,
-        Index32
-    }
-
-    /// <summary>
-    /// Contains per-vertex bone weights and indexes used for skinning, for up to four bones.
-    /// </summary>
-    [StructLayout(LayoutKind.Sequential)]
-    public struct BoneWeight // Note: Must match C++ class BoneWeight
-    {
-        public int index0;
-        public int index1;
-        public int index2;
-        public int index3;
-
-        public float weight0;
-        public float weight1;
-        public float weight2;
-        public float weight3;
-    }
-
-    /** @} */
-}

+ 3 - 1
Source/SBansheeEditor/Include/BsScriptGizmos.h

@@ -10,6 +10,8 @@
 
 namespace bs
 {
+	class ScriptRendererMeshData;
+
 	/** @addtogroup ScriptInteropEditor
 	 *  @{
 	 */
@@ -40,7 +42,7 @@ namespace bs
 		static void internal_DrawLineList(MonoArray* linePoints);
 		static void internal_DrawWireDisc(Vector3* position, Vector3* normal, float radius);
 		static void internal_DrawWireArc(Vector3* position, Vector3* normal, float radius, float startAngle, float amountAngle);
-		static void internal_DrawWireMesh(ScriptMeshData* meshData);
+		static void internal_DrawWireMesh(ScriptRendererMeshData* meshData);
 		static void internal_DrawFrustum(Vector3* position, float aspect, Degree* FOV, float near, float far);
 		static void internal_DrawIcon(Vector3* position, MonoObject* image, bool fixedScale);
 		static void internal_DrawText(Vector3* position, MonoString* text, ScriptFont* font, int size);

+ 4 - 3
Source/SBansheeEditor/Source/BsScriptGizmos.cpp

@@ -7,7 +7,8 @@
 #include "BsGizmoManager.h"
 #include "BsMonoUtil.h"
 #include "BsScriptFont.h"
-#include "BsScriptMeshData.h"
+
+#include "BsScriptRendererMeshData.generated.h"
 
 namespace bs
 {
@@ -123,11 +124,11 @@ namespace bs
 		GizmoManager::instance().drawWireArc(*position, *normal, radius, Degree(startAngle), Degree(amountAngle));
 	}
 
-	void ScriptGizmos::internal_DrawWireMesh(ScriptMeshData* meshData)
+	void ScriptGizmos::internal_DrawWireMesh(ScriptRendererMeshData* meshData)
 	{
 		if (meshData != nullptr)
 		{
-			SPtr<MeshData> nativeMeshData = meshData->getInternalValue()->getData();
+			SPtr<MeshData> nativeMeshData = meshData->getInternal()->getData();
 			GizmoManager::instance().drawWireMesh(nativeMeshData);
 		}
 	}

+ 11 - 15
Source/SBansheeEngine/CMakeSources.cmake

@@ -77,7 +77,6 @@ set(BS_SBANSHEEENGINE_SRC_WRAPPERS_PHYSICS
 )
 
 set(BS_SBANSHEEENGINE_INC_WRAPPERS
-	"Include/BsScriptBoneWeight.h"
 	"Include/BsScriptBuiltin.h"
 	"Include/BsScriptCamera.h"
 	"Include/BsScriptColor.h"
@@ -96,8 +95,6 @@ set(BS_SBANSHEEENGINE_INC_WRAPPERS
 	"Include/BsScriptLogEntry.h"
 	"Include/BsScriptManagedResource.h"
 	"Include/BsScriptMaterial.h"
-	"Include/BsScriptMesh.h"
-	"Include/BsScriptMeshData.h"
 	"Include/BsScriptPhysicsMaterial.h"
 	"Include/BsScriptPhysicsMesh.h"
 	"Include/BsScriptPixelUtility.h"
@@ -139,8 +136,6 @@ set(BS_SBANSHEEENGINE_INC_WRAPPERS
 	"Include/BsScriptAnimation.h"
 	"Include/BsScriptAnimationCurve.h"
 	"Include/BsScriptAnimationCurves.h"
-	"Include/BsScriptSkeleton.h"
-	"Include/BsScriptMorphShapes.h"
 	"Include/BsScriptManagedComponent.h"
 )
 
@@ -188,11 +183,11 @@ set(BS_SBANSHEEENGINE_INC_WRAPPERS_PHYSICS
 	"Include/BsScriptCharacterController.h"
 	"Include/BsScriptJoint.h"
 	"Include/BsScriptDistanceJoint.h"
-	"Source/BsScriptHingeJoint.h"
-	"Source/BsScriptSliderJoint.h"
-	"Source/BsScriptSphericalJoint.h"
-	"Source/BsScriptFixedJoint.h"
-	"Source/BsScriptD6Joint.h"
+	"Include/BsScriptHingeJoint.h"
+	"Include/BsScriptSliderJoint.h"
+	"Include/BsScriptSphericalJoint.h"
+	"Include/BsScriptFixedJoint.h"
+	"Include/BsScriptD6Joint.h"
 	"Include/BsScriptPhysics.h"
 )
 
@@ -209,7 +204,6 @@ set(BS_SBANSHEEENGINE_SRC_SERIALIZATION
 )
 
 set(BS_SBANSHEEENGINE_SRC_WRAPPERS
-	"Source/BsScriptBoneWeight.cpp"
 	"Source/BsScriptBuiltin.cpp"
 	"Source/BsScriptCamera.cpp"
 	"Source/BsScriptColor.cpp"
@@ -228,8 +222,6 @@ set(BS_SBANSHEEENGINE_SRC_WRAPPERS
 	"Source/BsScriptLogEntry.cpp"
 	"Source/BsScriptManagedResource.cpp"
 	"Source/BsScriptMaterial.cpp"
-	"Source/BsScriptMesh.cpp"
-	"Source/BsScriptMeshData.cpp"
 	"Source/BsScriptPhysicsMaterial.cpp"
 	"Source/BsScriptPhysicsMesh.cpp"
 	"Source/BsScriptPixelUtility.cpp"
@@ -271,8 +263,6 @@ set(BS_SBANSHEEENGINE_SRC_WRAPPERS
 	"Source/BsScriptAnimation.cpp"
 	"Source/BsScriptAnimationCurve.cpp"
 	"Source/BsScriptAnimationCurves.cpp"
-	"Source/BsScriptSkeleton.cpp"
-	"Source/BsScriptMorphShapes.cpp"
 	"Source/BsScriptManagedComponent.cpp"
 )
 
@@ -316,12 +306,18 @@ set(BS_SBANSHEEENGINE_INC_EXTENSIONS
 	"Include/BsPixelDataEx.h"
 	"Include/BsAsyncOpEx.h"
 	"Include/BsTextureEx.h"
+	"Include/BsMeshDataEx.h"
+	"Include/BsMeshEx.h"
+	"Include/BsSkeletonEx.h"
 )
 
 set(BS_SBANSHEEENGINE_SRC_EXTENSIONS
 	"Source/BsPixelDataEx.cpp"
 	"Source/BsAsyncOpEx.cpp"
 	"Source/BsTextureEx.cpp"
+	"Source/BsMeshDataEx.cpp"
+	"Source/BsMeshEx.cpp"
+	"Source/BsSkeletonEx.cpp"
 )
 
 source_group("Header Files" FILES ${BS_SBANSHEEENGINE_INC_NOFILTER})

+ 87 - 0
Source/SBansheeEngine/Include/BsMeshDataEx.h

@@ -0,0 +1,87 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsRendererMeshData.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Extension class for RendererMeshData, for adding additional functionality for the script version of the class. */
+	class BS_SCRIPT_EXPORT(e:RendererMeshData) MeshDataEx
+	{
+	public:
+		BS_SCRIPT_EXPORT(ec:RendererMeshData)
+		static SPtr<RendererMeshData> create(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, 
+			IndexType indexType = IT_32BIT);
+
+		/** An array of all vertex positions. Only valid if the vertex layout contains vertex positions. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:Positions)
+		static Vector<Vector3> getPositions(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:Positions)
+		static void setPositions(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector3>& value);
+
+		/** An array of all vertex normals. Only valid if the vertex layout contains vertex normals. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:Normals)
+		static Vector<Vector3> getNormals(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:Normals)
+		static void setNormals(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector3>& value);
+
+		/** An array of all vertex tangents. Only valid if the vertex layout contains vertex tangents. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:Tangents)
+		static Vector<Vector4> getTangents(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:Tangents)
+		static void setTangents(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector4>& value);
+
+		/** An array of all vertex colors. Only valid if the vertex layout contains vertex colors. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:Colors)
+		static Vector<Color> getColors(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:Colors)
+		static void setColors(const SPtr<RendererMeshData>& thisPtr, const Vector<Color>& value);
+
+		/** 
+		 * An array of all vertex texture coordinates in the UV0 channel. Only valid if the vertex layout contains UV0
+		 * coordinates.
+		 */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:UV0)
+		static Vector<Vector2> getUV0(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:UV0)
+		static void setUV0(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector2>& value);
+
+		/** 
+		 * An array of all vertex texture coordinates in the UV1 channel. Only valid if the vertex layout contains UV1
+		 * coordinates.
+		 */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:UV1)
+		static Vector<Vector2> getUV1(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:UV1)
+		static void setUV1(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector2>& value);
+
+		/** An array of all vertex bone weights. Only valid if the vertex layout contains bone weights. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:BoneWeights)
+		static Vector<BoneWeight> getBoneWeights(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:BoneWeights)
+		static void setBoneWeights(const SPtr<RendererMeshData>& thisPtr, const Vector<BoneWeight>& value);
+
+		/** An array of all indices. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:Indices)
+		static Vector<UINT32> getIndices(const SPtr<RendererMeshData>& thisPtr);
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:setter,n:Indices)
+		static void setIndices(const SPtr<RendererMeshData>& thisPtr, const Vector<UINT32>& value);
+
+		/** Returns the number of vertices contained in the mesh. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:VertexCount)
+		static int getVertexCount(const SPtr<RendererMeshData>& thisPtr);
+
+		/** Returns the number of indices contained in the mesh. */
+		BS_SCRIPT_EXPORT(e:RendererMeshData,pr:getter,n:IndexCount)
+		static int getIndexCount(const SPtr<RendererMeshData>& thisPtr);
+	};
+
+	/** @} */
+}

+ 105 - 0
Source/SBansheeEngine/Include/BsMeshEx.h

@@ -0,0 +1,105 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptResource.h"
+#include "BsMesh.h"
+#include "BsRendererMeshData.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Extension class for Mesh, for adding additional functionality for the script version of the class. */
+	class BS_SCRIPT_EXPORT(e:Mesh) MeshEx
+	{
+	public:
+		/**
+		 * Creates a new mesh with enough space to hold the a number of primitives using the specified layout. All indices
+		 * will be part of a single sub-mesh.
+		 * 
+		 * @param[in]	numVertices		Number of vertices in the mesh.
+		 * @param[in]	numIndices		Number of indices in the mesh. Must be a multiple of primitive size as specified
+		 *								by provided topology.
+		 * @param[in]	topology		Determines how should the provided indices be interpreted by the pipeline. Default
+		 *								option is a triangle list, where three indices represent a single triangle.
+		 * @param[in]	usage			Optimizes performance depending on planned usage of the mesh.
+		 * @param[in]	vertex			Controls how are vertices organized in the vertex buffer and what data they contain.
+		 * @param[in]	index			Size of indices, use smaller size for better performance, however be careful not to
+		 *								go over the number of vertices limited by the data type size.
+		 */
+		BS_SCRIPT_EXPORT(ec:Mesh)
+		static HMesh create(int numVertices, int numIndices, DrawOperationType topology = DOT_TRIANGLE_LIST,
+			MeshUsage usage = MU_STATIC, VertexLayout vertex = VertexLayout::Position, IndexType index = IT_32BIT);
+
+		/**
+		 * Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can
+		 * be referenced by multiple sub-meshes.
+		 * 
+		 * @param[in]	numVertices		Number of vertices in the mesh.
+		 * @param[in]	numIndices		Number of indices in the mesh. Must be a multiple of primitive size as specified
+		 *								by provided topology.
+		 * @param[in]	subMeshes		Defines how are indices separated into sub-meshes, and how are those sub-meshes
+		 *								rendered. Sub-meshes may be rendered independently, each with a different material.
+		 * @param[in]	usage			Optimizes performance depending on planned usage of the mesh.
+		 * @param[in]	vertex			Controls how are vertices organized in the vertex buffer and what data they contain.
+		 * @param[in]	index			Size of indices, use smaller size for better performance, however be careful not to
+		 *								go over the number of vertices limited by the data type size.
+		 */
+		BS_SCRIPT_EXPORT(ec:Mesh)
+		static HMesh create(int numVertices, int numIndices, const Vector<SubMesh>& subMeshes, 
+			MeshUsage usage = MU_STATIC, VertexLayout vertex = VertexLayout::Position, IndexType index = IT_32BIT);
+
+		/**
+		 * Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
+		 * by the mesh data exactly. Mesh will have no sub-meshes.
+		 * 
+		 * @param[in]	data			Vertex and index data to initialize the mesh with.
+		 * @param[in]	topology		Determines how should the provided indices be interpreted by the pipeline. Default
+		 *								option is a triangle list, where three indices represent a single triangle.
+		 * @param[in]	usage			Optimizes performance depending on planned usage of the mesh.
+		 */
+		BS_SCRIPT_EXPORT(ec:Mesh)
+		static HMesh create(const SPtr<RendererMeshData>& data, DrawOperationType topology = DOT_TRIANGLE_LIST, 
+			MeshUsage usage = MU_STATIC);
+
+		/**
+		 * Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can
+		 * be referenced by multiple sub-meshes.
+		 * 
+		 * @param[in]	data			Vertex and index data to initialize the mesh with.
+		 * @param[in]	subMeshes		Defines how are indices separated into sub-meshes, and how are those sub-meshes
+		 *								rendered. Sub-meshes may be rendered independently, each with a different material.
+		 * @param[in]	usage			Optimizes performance depending on planned usage of the mesh.
+		 */
+		BS_SCRIPT_EXPORT(ec:Mesh)
+		static HMesh create(const SPtr<RendererMeshData>& data, const Vector<SubMesh>& subMeshes, 
+			MeshUsage usage = MU_STATIC);
+
+		/** Returns all sub-meshes contained in the mesh. */
+		BS_SCRIPT_EXPORT(e:Mesh,pr:getter,n:SubMeshes)
+		static Vector<SubMesh> getSubMeshes(const HMesh& thisPtr);
+		
+		/** Returns the number of sub-meshes contained in this mesh. */
+		BS_SCRIPT_EXPORT(e:Mesh,pr:getter,n:SubMeshCount)
+		static UINT32 getSubMeshCount(const HMesh& thisPtr);
+		
+		BS_SCRIPT_EXPORT(e:Mesh,in:true)
+		static void getBounds(const HMesh& thisPtr, AABox* box, Sphere* sphere);
+		
+		/**
+		 * Accesses the vertex and index data of the mesh. If reading, mesh must have been created with the
+		 * MeshUsage::CPUCached flag. If writing the caller must ensure the data matches mesh's vertex/index counts, vertex
+		 * layout and index format.
+		 */
+		BS_SCRIPT_EXPORT(e:Mesh,pr:getter,n:MeshData)
+		static SPtr<RendererMeshData> getMeshData(const HMesh& thisPtr);
+		BS_SCRIPT_EXPORT(e:Mesh,pr:setter,n:MeshData)
+		static void setMeshData(const HMesh& thisPtr, const SPtr<RendererMeshData>& value);
+	};
+
+	/** @} */
+}

+ 0 - 32
Source/SBansheeEngine/Include/BsScriptBoneWeight.h

@@ -1,32 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsMeshData.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for BoneWeight. */
-	class BS_SCR_BE_EXPORT ScriptBoneWeight : public ScriptObject <ScriptBoneWeight>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "BoneWeight")
-
-		/**	Unboxes a boxed managed BoneWeight struct and returns the native version of the structure. */
-		static BoneWeight unbox(MonoObject* obj);
-
-		/** Boxes a native BoneWeight struct and returns a managed object containing it. */
-		static MonoObject* box(const BoneWeight& value);
-
-	private:
-		ScriptBoneWeight(MonoObject* instance);
-	};
-
-	/** @} */
-}

+ 64 - 64
Source/SBansheeEngine/Source/BsScriptD6Joint.h → Source/SBansheeEngine/Include/BsScriptD6Joint.h

@@ -1,65 +1,65 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-#include "BsD6Joint.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	struct ScriptD6JointData;
-
-	/** Interop class between C++ & CLR for D6Joint. */
-	class BS_SCR_BE_EXPORT ScriptD6Joint : public TScriptJoint<ScriptD6Joint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeD6Joint")
-	private:
-		ScriptD6Joint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native D6 joint wrapped by this object. */
-		D6Joint* getD6Joint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptD6JointData* data);
-		static void internal_SetMotion(ScriptD6Joint* thisPtr, D6Joint::Axis axis, D6Joint::Motion motion);
-		static float internal_GetTwist(ScriptD6Joint* thisPtr);
-		static float internal_GetSwingY(ScriptD6Joint* thisPtr);
-		static float internal_GetSwingZ(ScriptD6Joint* thisPtr);
-		static void internal_SetLimitLinear(ScriptD6Joint* thisPtr, MonoObject* limit);
-		static void internal_SetLimitTwist(ScriptD6Joint* thisPtr, MonoObject* limit);
-		static void internal_SetLimitSwing(ScriptD6Joint* thisPtr, MonoObject* limit);
-		static void internal_SetDrive(ScriptD6Joint* thisPtr, D6Joint::DriveType type, MonoObject* drive);
-		static void internal_SetDrivePosition(ScriptD6Joint* thisPtr, Vector3* position);
-		static void internal_SetDriveRotation(ScriptD6Joint* thisPtr, Quaternion* rotation);
-		static void internal_SetDriveLinearVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
-		static void internal_SetDriveAngularVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
-	};
-
-	/** Used for passing common Joint initialization data between native and managed code. */
-	struct ScriptD6JointData // Note: Must match C# struct ScriptD6JointData
-	{
-		MonoObject* linearLimit;
-		MonoObject* twistLimit;
-		MonoObject* swingLimit;
-		MonoArray* motion;
-		MonoArray* drives;
-		Vector3 drivePosition;
-		Quaternion driveRotation;
-		Vector3 driveLinearVelocity;
-		Vector3 driveAngularVelocity;
-
-		/** Converts this structure into a descriptor used for initializing a joint. */
-		void toDesc(D6_JOINT_DESC& desc) const;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+#include "BsD6Joint.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	struct ScriptD6JointData;
+
+	/** Interop class between C++ & CLR for D6Joint. */
+	class BS_SCR_BE_EXPORT ScriptD6Joint : public TScriptJoint<ScriptD6Joint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeD6Joint")
+	private:
+		ScriptD6Joint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native D6 joint wrapped by this object. */
+		D6Joint* getD6Joint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptD6JointData* data);
+		static void internal_SetMotion(ScriptD6Joint* thisPtr, D6Joint::Axis axis, D6Joint::Motion motion);
+		static float internal_GetTwist(ScriptD6Joint* thisPtr);
+		static float internal_GetSwingY(ScriptD6Joint* thisPtr);
+		static float internal_GetSwingZ(ScriptD6Joint* thisPtr);
+		static void internal_SetLimitLinear(ScriptD6Joint* thisPtr, MonoObject* limit);
+		static void internal_SetLimitTwist(ScriptD6Joint* thisPtr, MonoObject* limit);
+		static void internal_SetLimitSwing(ScriptD6Joint* thisPtr, MonoObject* limit);
+		static void internal_SetDrive(ScriptD6Joint* thisPtr, D6Joint::DriveType type, MonoObject* drive);
+		static void internal_SetDrivePosition(ScriptD6Joint* thisPtr, Vector3* position);
+		static void internal_SetDriveRotation(ScriptD6Joint* thisPtr, Quaternion* rotation);
+		static void internal_SetDriveLinearVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
+		static void internal_SetDriveAngularVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
+	};
+
+	/** Used for passing common Joint initialization data between native and managed code. */
+	struct ScriptD6JointData // Note: Must match C# struct ScriptD6JointData
+	{
+		MonoObject* linearLimit;
+		MonoObject* twistLimit;
+		MonoObject* swingLimit;
+		MonoArray* motion;
+		MonoArray* drives;
+		Vector3 drivePosition;
+		Quaternion driveRotation;
+		Vector3 driveLinearVelocity;
+		Vector3 driveAngularVelocity;
+
+		/** Converts this structure into a descriptor used for initializing a joint. */
+		void toDesc(D6_JOINT_DESC& desc) const;
+	};
+
+	/** @} */
 }

+ 0 - 1
Source/SBansheeEngine/Include/BsScriptEnginePrerequisites.h

@@ -86,7 +86,6 @@ namespace bs
 	class ScriptRenderTarget;
 	class ScriptRenderTexture2D;
 	class ScriptCamera;
-	class ScriptMeshData;
 	class ManagedComponent;
 	class ManagedSerializableFieldData;
 	class ManagedSerializableFieldKey;

+ 32 - 32
Source/SBansheeEngine/Source/BsScriptFixedJoint.h → Source/SBansheeEngine/Include/BsScriptFixedJoint.h

@@ -1,33 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/** Interop class between C++ & CLR for FixedJoint. */
-	class BS_SCR_BE_EXPORT ScriptFixedJoint : public TScriptJoint<ScriptFixedJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeFixedJoint")
-	private:
-		ScriptFixedJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native fixed joint wrapped by this object. */
-		FixedJoint* getFixedJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData);
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for FixedJoint. */
+	class BS_SCR_BE_EXPORT ScriptFixedJoint : public TScriptJoint<ScriptFixedJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeFixedJoint")
+	private:
+		ScriptFixedJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native fixed joint wrapped by this object. */
+		FixedJoint* getFixedJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData);
+	};
+
+	/** @} */
 }

+ 52 - 52
Source/SBansheeEngine/Source/BsScriptHingeJoint.h → Source/SBansheeEngine/Include/BsScriptHingeJoint.h

@@ -1,53 +1,53 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-#include "BsHingeJoint.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	struct ScriptHingeJointData;
-
-	/** Interop class between C++ & CLR for HingeJoint. */
-	class BS_SCR_BE_EXPORT ScriptHingeJoint : public TScriptJoint<ScriptHingeJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeHingeJoint")
-	private:
-		ScriptHingeJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native hinge joint wrapped by this object. */
-		HingeJoint* getHingeJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptHingeJointData* data);
-		static float internal_GetAngle(ScriptHingeJoint* thisPtr);
-		static float internal_GetSpeed(ScriptHingeJoint* thisPtr);
-		static void internal_SetLimit(ScriptHingeJoint* thisPtr, MonoObject* limit);
-		static void internal_SetDrive(ScriptHingeJoint* thisPtr, MonoObject* drive);
-		static void internal_SetEnableLimit(ScriptHingeJoint* thisPtr, bool value);
-		static void internal_SetEnableDrive(ScriptHingeJoint* thisPtr, bool value);
-	};
-
-	/** Used for passing common Joint initialization data between native and managed code. */
-	struct ScriptHingeJointData // Note: Must match C# struct ScriptHingeJointData
-	{
-		MonoObject* limit;
-		MonoObject* drive;
-		HingeJoint::Flag flags;
-
-		/** Converts this structure into a descriptor used for initializing a joint. */
-		void toDesc(HINGE_JOINT_DESC& desc) const;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+#include "BsHingeJoint.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	struct ScriptHingeJointData;
+
+	/** Interop class between C++ & CLR for HingeJoint. */
+	class BS_SCR_BE_EXPORT ScriptHingeJoint : public TScriptJoint<ScriptHingeJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeHingeJoint")
+	private:
+		ScriptHingeJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native hinge joint wrapped by this object. */
+		HingeJoint* getHingeJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptHingeJointData* data);
+		static float internal_GetAngle(ScriptHingeJoint* thisPtr);
+		static float internal_GetSpeed(ScriptHingeJoint* thisPtr);
+		static void internal_SetLimit(ScriptHingeJoint* thisPtr, MonoObject* limit);
+		static void internal_SetDrive(ScriptHingeJoint* thisPtr, MonoObject* drive);
+		static void internal_SetEnableLimit(ScriptHingeJoint* thisPtr, bool value);
+		static void internal_SetEnableDrive(ScriptHingeJoint* thisPtr, bool value);
+	};
+
+	/** Used for passing common Joint initialization data between native and managed code. */
+	struct ScriptHingeJointData // Note: Must match C# struct ScriptHingeJointData
+	{
+		MonoObject* limit;
+		MonoObject* drive;
+		HingeJoint::Flag flags;
+
+		/** Converts this structure into a descriptor used for initializing a joint. */
+		void toDesc(HINGE_JOINT_DESC& desc) const;
+	};
+
+	/** @} */
 }

+ 0 - 96
Source/SBansheeEngine/Include/BsScriptMesh.h

@@ -1,96 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptResource.h"
-#include "BsScriptMeshData.h"
-#include "BsMesh.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**
-	 * Possible mesh toplogy values. 
-	 *
-	 * @note	Must match C# enum MeshTopology.
-	 */
-	enum class MeshTopology
-	{
-		PointList = 1,
-		LineList = 2,
-		LineStrip = 3,
-		TriangleList = 4,
-		TriangleStrip = 5,
-		TriangleFan = 6
-	};
-
-	/**	Contains data about a portion of a mesh inside MeshData. */
-	struct BS_SCR_BE_EXPORT SubMeshData
-	{
-		UINT32 indexOffset;
-		UINT32 indexCount;
-		MeshTopology topology;
-	};
-
-	/**	Interop class between C++ & CLR for SubMesh. */
-	class BS_SCR_BE_EXPORT ScriptSubMesh : public ScriptObject < ScriptSubMesh >
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SubMesh")
-
-		/** Unboxes a boxed managed SubMesh struct and returns the native version of the structure. */
-		static SubMeshData unbox(MonoObject* obj);
-
-		/** Boxes a native SubMesh struct and returns a managed object containing it. */
-		static MonoObject* box(const SubMeshData& value);
-
-	private:
-		ScriptSubMesh(MonoObject* instance);
-	};
-
-	/**	Interop class between C++ & CLR for Mesh. */
-	class BS_SCR_BE_EXPORT ScriptMesh : public TScriptResource<ScriptMesh, Mesh>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Mesh")
-
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
-	private:
-		friend class ScriptResourceManager;
-		friend class BuiltinResourceTypes;
-
-		ScriptMesh(MonoObject* instance, const HMesh& mesh);
-
-		/** Converts the C# MeshTopology enum to DrawOperationType enum used by engine internals. */
-		static DrawOperationType meshTopologyToDrawOp(MeshTopology topology);
-
-		/** Converts the DrawOperationType enum used by engine internals to C# MeshTopology enum. */
-		static MeshTopology drawOpToMeshTopology(DrawOperationType drawOp);
-		
-		/** Converts a managed array of SubMeshData%es into an array of SubMesh%es used by engine internals. */
-		static Vector<SubMesh> monoToNativeSubMeshes(MonoArray* subMeshes);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, int numVertices,
-			int numIndices, MonoArray* subMeshes, MeshUsage usage, VertexLayout vertex, ScriptIndexType index);
-		static void internal_CreateInstanceMeshData(MonoObject* instance, ScriptMeshData* data, MonoArray* subMeshes,
-			MeshUsage usage);
-		static MonoArray* internal_GetSubMeshes(ScriptMesh* thisPtr);
-		static UINT32 internal_GetSubMeshCount(ScriptMesh* thisPtr);
-		static MonoObject* internal_GetSkeleton(ScriptMesh* thisPtr);
-		static MonoObject* internal_GetMorphShapes(ScriptMesh* thisPtr);
-		static void internal_GetBounds(ScriptMesh* thisPtr, AABox* box, Sphere* sphere);
-		static MonoObject* internal_GetMeshData(ScriptMesh* thisPtr);
-		static void internal_SetMeshData(ScriptMesh* thisPtr, ScriptMeshData* value);
-	};
-
-	/** @} */
-}

+ 0 - 75
Source/SBansheeEngine/Include/BsScriptMeshData.h

@@ -1,75 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsRendererMeshData.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Valid index types for mesh indices. */
-	// Note: Do not modify, it must match the layout of C# enum IndexType
-	enum class ScriptIndexType
-	{
-		Index16,
-		Index32
-	};
-
-	/**	Interop class between C++ & CLR for RendererMeshData. */
-	class BS_SCR_BE_EXPORT ScriptMeshData : public ScriptObject <ScriptMeshData>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "MeshData")
-
-		/**	Returns the internal wrapped mesh data. */
-		SPtr<RendererMeshData> getInternalValue() const { return mMeshData; }
-
-		/**	Creates a new managed MeshData object from the provided native render mesh data. */
-		static MonoObject* create(const SPtr<RendererMeshData>& meshData);
-
-		/**	Creates a new managed MeshData object from the provided native mesh data. */
-		static MonoObject* create(const SPtr<MeshData>& meshData);
-	private:
-		ScriptMeshData(MonoObject* managedInstance);
-		~ScriptMeshData();
-
-		/**	Initializes the object. Must be called after construction and before use. */
-		void initialize(const SPtr<RendererMeshData>& meshData);
-
-		/**	Checks is the underlying mesh data of the provided object locked. When locked mesh data cannot be accessed. */
-		static bool checkIsLocked(ScriptMeshData* thisPtr);
-
-		SPtr<RendererMeshData> mMeshData;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, int numVertices,
-			int numIndices, VertexLayout vertex, ScriptIndexType index);
-		static MonoArray* internal_GetPositions(ScriptMeshData* thisPtr);
-		static void internal_SetPositions(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetNormals(ScriptMeshData* thisPtr);
-		static void internal_SetNormals(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetTangents(ScriptMeshData* thisPtr);
-		static void internal_SetTangents(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetColors(ScriptMeshData* thisPtr);
-		static void internal_SetColors(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetUV0(ScriptMeshData* thisPtr);
-		static void internal_SetUV0(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetUV1(ScriptMeshData* thisPtr);
-		static void internal_SetUV1(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetBoneWeights(ScriptMeshData* thisPtr);
-		static void internal_SetBoneWeights(ScriptMeshData* thisPtr, MonoArray* value);
-		static MonoArray* internal_GetIndices(ScriptMeshData* thisPtr);
-		static void internal_SetIndices(ScriptMeshData* thisPtr, MonoArray* value);
-		static int internal_GetVertexCount(ScriptMeshData* thisPtr);
-		static int internal_GetIndexCount(ScriptMeshData* thisPtr);
-	};
-
-	/** @} */
-}

+ 0 - 67
Source/SBansheeEngine/Include/BsScriptMorphShapes.h

@@ -1,67 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsAnimation.h"
-
-namespace bs
-{
-	class ScriptAnimationClip;
-
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for MorphShapes. */
-	class BS_SCR_BE_EXPORT ScriptMorphShapes : public ScriptObject <ScriptMorphShapes>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "MorphShapes")
-
-		/**	Returns the native wrapped object. */
-		SPtr<MorphShapes> getInternal() const { return mMorphShapes; }
-
-		/** Creates a managed object from the native morph shapes object. */
-		static MonoObject* create(const SPtr<MorphShapes>& morphShapes);
-
-	private:
-		ScriptMorphShapes(MonoObject* managedInstance, const SPtr<MorphShapes>& morphShapes);
-
-		SPtr<MorphShapes> mMorphShapes;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoArray* internal_GetChannels(ScriptMorphShapes* thisPtr);
-	};
-
-	/**	Interop class between C++ & CLR for MorphChannel. */
-	class BS_SCR_BE_EXPORT ScriptMorphChannel : public ScriptObject<ScriptMorphChannel>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "MorphChannel")
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(const SPtr<MorphChannel>& value);
-
-	private:
-		ScriptMorphChannel(MonoObject* instance);
-	};
-
-	/**	Interop class between C++ & CLR for MorphShape. */
-	class BS_SCR_BE_EXPORT ScriptMorphShape : public ScriptObject<ScriptMorphShape>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "MorphShape")
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(const SPtr<MorphShape>& value);
-
-	private:
-		ScriptMorphShape(MonoObject* instance);
-	};
-
-	/** @} */
-}

+ 0 - 62
Source/SBansheeEngine/Include/BsScriptSkeleton.h

@@ -1,62 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsSkeleton.h"
-
-namespace bs
-{
-	class ScriptAnimationClip;
-
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for Skeleton. */
-	class BS_SCR_BE_EXPORT ScriptSkeleton : public ScriptObject <ScriptSkeleton>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Skeleton")
-
-		/**	Returns the native wrapped animation. */
-		SPtr<Skeleton> getInternal() const { return mSkeleton; }
-
-		/**	Creates a new managed Skeleton instance wrapping the provided native skeleton. */
-		static MonoObject* create(const SPtr<Skeleton>& skeleton);
-
-	private:
-		ScriptSkeleton(MonoObject* managedInstance, const SPtr<Skeleton>& skeleton);
-
-		SPtr<Skeleton> mSkeleton;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static int internal_GetNumBones(ScriptSkeleton* thisPtr);
-		static MonoObject* internal_GetBoneInfo(ScriptSkeleton* thisPtr, UINT32 boneIdx);
-	};
-
-	/** Helper class for dealing with SkeletonBoneInfo structure. */
-	class BS_SCR_BE_EXPORT ScriptBoneInfo : public ScriptObject<ScriptBoneInfo>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "BoneInfo")
-
-		/** Converts native bone info to its native counterpart. */
-		static MonoObject* toManaged(const SkeletonBoneInfo& boneInfo, const Matrix4& invBindPose);
-
-	private:
-		ScriptBoneInfo(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoField* sNameField;
-		static MonoField* sParentField;
-		static MonoField* sInvBindPoseField;
-	};
-	
-	/** @} */
-}

+ 48 - 48
Source/SBansheeEngine/Source/BsScriptSliderJoint.h → Source/SBansheeEngine/Include/BsScriptSliderJoint.h

@@ -1,49 +1,49 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	struct ScriptSliderJointData;
-
-	/** Interop class between C++ & CLR for SliderJoint. */
-	class BS_SCR_BE_EXPORT ScriptSliderJoint : public TScriptJoint<ScriptSliderJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSliderJoint")
-	private:
-		ScriptSliderJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native slider joint wrapped by this object. */
-		SliderJoint* getSliderJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptSliderJointData* data);
-		static float internal_GetPosition(ScriptSliderJoint* thisPtr);
-		static float internal_GetSpeed(ScriptSliderJoint* thisPtr);
-		static void internal_SetLimit(ScriptSliderJoint* thisPtr, MonoObject* limit);
-		static void internal_SetEnableLimit(ScriptSliderJoint* thisPtr, bool enable);
-	};
-
-	/** Used for passing common Joint initialization data between native and managed code. */
-	struct ScriptSliderJointData // Note: Must match C# struct ScriptSliderJointData
-	{
-		MonoObject* limit;
-		bool enableLimit;
-
-		/** Converts this structure into a descriptor used for initializing a joint. */
-		void toDesc(SLIDER_JOINT_DESC& desc) const;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	struct ScriptSliderJointData;
+
+	/** Interop class between C++ & CLR for SliderJoint. */
+	class BS_SCR_BE_EXPORT ScriptSliderJoint : public TScriptJoint<ScriptSliderJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSliderJoint")
+	private:
+		ScriptSliderJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native slider joint wrapped by this object. */
+		SliderJoint* getSliderJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptSliderJointData* data);
+		static float internal_GetPosition(ScriptSliderJoint* thisPtr);
+		static float internal_GetSpeed(ScriptSliderJoint* thisPtr);
+		static void internal_SetLimit(ScriptSliderJoint* thisPtr, MonoObject* limit);
+		static void internal_SetEnableLimit(ScriptSliderJoint* thisPtr, bool enable);
+	};
+
+	/** Used for passing common Joint initialization data between native and managed code. */
+	struct ScriptSliderJointData // Note: Must match C# struct ScriptSliderJointData
+	{
+		MonoObject* limit;
+		bool enableLimit;
+
+		/** Converts this structure into a descriptor used for initializing a joint. */
+		void toDesc(SLIDER_JOINT_DESC& desc) const;
+	};
+
+	/** @} */
 }

+ 46 - 46
Source/SBansheeEngine/Source/BsScriptSphericalJoint.h → Source/SBansheeEngine/Include/BsScriptSphericalJoint.h

@@ -1,47 +1,47 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	struct ScriptSphericalJointData;
-
-	/** Interop class between C++ & CLR for SphericalJoint. */
-	class BS_SCR_BE_EXPORT ScriptSphericalJoint : public TScriptJoint<ScriptSphericalJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSphericalJoint")
-	private:
-		ScriptSphericalJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native spherical joint wrapped by this object. */
-		SphericalJoint* getSphericalJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptSphericalJointData* data);
-		static void internal_SetLimit(ScriptSphericalJoint* thisPtr, MonoObject* limit);
-		static void internal_SetEnableLimit(ScriptSphericalJoint* thisPtr, bool enable);
-	};
-
-	/** Used for passing common Joint initialization data between native and managed code. */
-	struct ScriptSphericalJointData // Note: Must match C# struct ScriptSphericalJointData
-	{
-		MonoObject* limit;
-		bool enableLimit;
-
-		/** Converts this structure into a descriptor used for initializing a joint. */
-		void toDesc(SPHERICAL_JOINT_DESC& desc) const;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	struct ScriptSphericalJointData;
+
+	/** Interop class between C++ & CLR for SphericalJoint. */
+	class BS_SCR_BE_EXPORT ScriptSphericalJoint : public TScriptJoint<ScriptSphericalJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSphericalJoint")
+	private:
+		ScriptSphericalJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native spherical joint wrapped by this object. */
+		SphericalJoint* getSphericalJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptCommonJointData* commonData, ScriptSphericalJointData* data);
+		static void internal_SetLimit(ScriptSphericalJoint* thisPtr, MonoObject* limit);
+		static void internal_SetEnableLimit(ScriptSphericalJoint* thisPtr, bool enable);
+	};
+
+	/** Used for passing common Joint initialization data between native and managed code. */
+	struct ScriptSphericalJointData // Note: Must match C# struct ScriptSphericalJointData
+	{
+		MonoObject* limit;
+		bool enableLimit;
+
+		/** Converts this structure into a descriptor used for initializing a joint. */
+		void toDesc(SPHERICAL_JOINT_DESC& desc) const;
+	};
+
+	/** @} */
 }

+ 42 - 0
Source/SBansheeEngine/Include/BsSkeletonEx.h

@@ -0,0 +1,42 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptResource.h"
+#include "BsSkeleton.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Contains internal information about a single bone in a Skeleton. */
+	struct BS_SCRIPT_EXPORT(n:BoneInfo,pl:true) SkeletonBoneInfoEx
+	{
+		/** Unique name of the bone. */
+		String name;
+
+		/** Index of the parent bone (within the relevant Skeleton object). -1 if root bone. */
+		int parent;
+
+		/** Inverse transform of the pose the skeleton was initially created in. */
+		Matrix4 invBindPose;
+	};
+
+	/** Extension class for Skeleton, for adding additional functionality for the script version of the class. */
+	class BS_SCRIPT_EXPORT(e:Skeleton) SkeletonEx
+	{
+	public:
+		/** Returns information about a bone at the provided index.
+		 *
+		 * @param[in] boneIdx	Index of the bone to retrieve information for.
+		 * @return				Information about the bone at the specified index.
+		 */
+		BS_SCRIPT_EXPORT(e:Skeleton,n:GetBoneInfo)
+		static SkeletonBoneInfoEx getBoneInfo(const SPtr<Skeleton>& thisPtr, int boneIdx);
+	};
+
+	/** @} */
+}

+ 205 - 0
Source/SBansheeEngine/Source/BsMeshDataEx.cpp

@@ -0,0 +1,205 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsMeshDataEx.h"
+#include "BsPixelUtil.h"
+#include "BsVector2.h"
+
+namespace bs
+{
+	template<int Semantic>
+	struct TVertexDataAccessor
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size) { }
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size) { }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::Position >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getPositions((Vector3*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setPositions((Vector3*)buffer, size); }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::Normal >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getNormals((Vector3*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setNormals((Vector3*)buffer, size); }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::Tangent >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getTangents((Vector4*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setTangents((Vector4*)buffer, size); }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::Color >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getColors((Color*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setColors((Color*)buffer, size); }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::UV0 >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getUV0((Vector2*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setUV0((Vector2*)buffer, size); }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::UV1 >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getUV1((Vector2*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setUV1((Vector2*)buffer, size); }
+	};
+
+	template<>
+	struct TVertexDataAccessor < (int)VertexLayout::BoneWeights >
+	{
+		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->getBoneWeights((BoneWeight*)buffer, size); }
+
+		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
+		{ meshData->setBoneWeights((BoneWeight*)buffer, size); }
+	};
+
+	template<int Semantic, class TNative>
+	Vector<TNative> getVertexDataArray(const SPtr<RendererMeshData>& meshData)
+	{
+		UINT32 numElements = meshData->getData()->getNumVertices();
+		Vector<TNative> output(numElements);
+
+		TVertexDataAccessor<Semantic>::get(meshData, (UINT8*)output.data(), numElements * sizeof(TNative));
+		return output;
+	}
+
+	template<int Semantic, class TNative>
+	void setVertexDataArray(const SPtr<RendererMeshData>& meshData, const Vector<TNative>& input)
+	{
+		UINT32 numElements = meshData->getData()->getNumVertices();
+
+		TVertexDataAccessor<Semantic>::set(meshData, (UINT8*)input.data(), numElements * sizeof(TNative));
+	}
+
+	SPtr<RendererMeshData> MeshDataEx::create(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, IndexType indexType)
+	{
+		return RendererMeshData::create(numVertices, numIndices, layout, indexType);
+	}
+
+	Vector<Vector3> MeshDataEx::getPositions(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::Position, Vector3>(thisPtr);
+	}
+
+	void MeshDataEx::setPositions(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector3>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::Position>(thisPtr, value);
+	}
+
+	Vector<Vector3> MeshDataEx::getNormals(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::Normal, Vector3>(thisPtr);
+	}
+
+	void MeshDataEx::setNormals(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector3>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::Normal>(thisPtr, value);
+	}
+
+	Vector<Vector4> MeshDataEx::getTangents(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::Tangent, Vector4>(thisPtr);
+	}
+
+	void MeshDataEx::setTangents(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector4>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::Tangent>(thisPtr, value);
+	}
+
+	Vector<Color> MeshDataEx::getColors(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::Color, Color>(thisPtr);
+	}
+
+	void MeshDataEx::setColors(const SPtr<RendererMeshData>& thisPtr, const Vector<Color>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::Color>(thisPtr, value);
+	}
+
+	Vector<Vector2> MeshDataEx::getUV0(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::UV0, Vector2>(thisPtr);
+	}
+
+	void MeshDataEx::setUV0(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector2>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::UV0>(thisPtr, value);
+	}
+
+	Vector<Vector2> MeshDataEx::getUV1(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::UV1, Vector2>(thisPtr);
+	}
+
+	void MeshDataEx::setUV1(const SPtr<RendererMeshData>& thisPtr, const Vector<Vector2>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::UV1>(thisPtr, value);
+	}
+
+	Vector<BoneWeight> MeshDataEx::getBoneWeights(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return getVertexDataArray<(int)VertexLayout::BoneWeights, BoneWeight>(thisPtr);
+	}
+
+	void MeshDataEx::setBoneWeights(const SPtr<RendererMeshData>& thisPtr, const Vector<BoneWeight>& value)
+	{
+		setVertexDataArray<(int)VertexLayout::BoneWeights>(thisPtr, value);
+	}
+
+	Vector<UINT32> MeshDataEx::getIndices(const SPtr<RendererMeshData>& thisPtr)
+	{
+		UINT32 numElements = thisPtr->getData()->getNumIndices();
+
+		Vector<UINT32> output(numElements);
+		thisPtr->getIndices(output.data(), numElements * sizeof(UINT32));
+
+		return output;
+	}
+
+	void MeshDataEx::setIndices(const SPtr<RendererMeshData>& thisPtr, const Vector<UINT32>& value)
+	{
+		UINT32 numElements = thisPtr->getData()->getNumIndices();
+
+		thisPtr->setIndices((UINT32*)value.data(), numElements * sizeof(UINT32));
+	}
+
+	int MeshDataEx::getVertexCount(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return (int)thisPtr->getData()->getNumVertices();
+	}
+
+	int MeshDataEx::getIndexCount(const SPtr<RendererMeshData>& thisPtr)
+	{
+		return (int)thisPtr->getData()->getNumIndices();
+	}
+}

+ 104 - 0
Source/SBansheeEngine/Source/BsMeshEx.cpp

@@ -0,0 +1,104 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsMeshEx.h"
+#include "BsCoreThread.h"
+
+namespace bs
+{
+	HMesh MeshEx::create(int numVertices, int numIndices, DrawOperationType topology, MeshUsage usage, 
+		VertexLayout vertex, IndexType index)
+	{
+		MESH_DESC desc;
+		desc.numVertices = numVertices;
+		desc.numIndices = numIndices;
+		desc.vertexDesc = RendererMeshData::vertexLayoutVertexDesc(vertex);
+		desc.subMeshes = { SubMesh(0, numIndices, topology) };
+		desc.usage = usage;
+		desc.indexType = index;
+
+		return Mesh::create(desc);
+	}
+
+	HMesh MeshEx::create(int numVertices, int numIndices, const Vector<SubMesh>& subMeshes, MeshUsage usage,
+		VertexLayout vertex, IndexType index)
+	{
+		MESH_DESC desc;
+		desc.numVertices = numVertices;
+		desc.numIndices = numIndices;
+		desc.vertexDesc = RendererMeshData::vertexLayoutVertexDesc(vertex);
+		desc.subMeshes = subMeshes;
+		desc.usage = usage;
+		desc.indexType = index;
+
+		return Mesh::create(desc);
+	}
+
+	HMesh MeshEx::create(const SPtr<RendererMeshData>& data, DrawOperationType topology, MeshUsage usage)
+	{
+		SPtr<MeshData> meshData;
+		if (data != nullptr)
+			meshData = data->getData();
+
+		UINT32 numIndices = 0;
+		if (meshData != nullptr)
+			numIndices = meshData->getNumIndices();
+
+		MESH_DESC desc;
+		desc.subMeshes = { SubMesh(0, numIndices, topology) };
+		desc.usage = usage;
+
+		return Mesh::create(meshData, desc);
+	}
+
+	HMesh MeshEx::create(const SPtr<RendererMeshData>& data, const Vector<SubMesh>& subMeshes, MeshUsage usage)
+	{
+		SPtr<MeshData> meshData;
+		if (data != nullptr)
+			meshData = data->getData();
+
+		MESH_DESC desc;
+		desc.subMeshes = subMeshes;
+		desc.usage = usage;
+
+		return Mesh::create(meshData, desc);
+	}
+
+	Vector<SubMesh> MeshEx::getSubMeshes(const HMesh& thisPtr)
+	{
+		UINT32 numSubMeshes = thisPtr->getProperties().getNumSubMeshes();
+		Vector<SubMesh> output(numSubMeshes);
+		for (UINT32 i = 0; i < numSubMeshes; i++)
+			output[i] = thisPtr->getProperties().getSubMesh(i);
+
+		return output;
+	}
+
+	UINT32 MeshEx::getSubMeshCount(const HMesh& thisPtr)
+	{
+		return thisPtr->getProperties().getNumSubMeshes();
+	}
+
+	void MeshEx::getBounds(const HMesh& thisPtr, AABox* box, Sphere* sphere)
+	{
+		Bounds bounds = thisPtr->getProperties().getBounds();
+		*box = bounds.getBox();
+		*sphere = bounds.getSphere();
+	}
+
+	SPtr<RendererMeshData> MeshEx::getMeshData(const HMesh& thisPtr)
+	{
+		SPtr<MeshData> meshData = thisPtr->allocBuffer();
+		thisPtr->readCachedData(*meshData);
+
+		return RendererMeshData::create(meshData);
+	}
+
+	void MeshEx::setMeshData(const HMesh& thisPtr, const SPtr<RendererMeshData>& value)
+	{
+		if (value != nullptr)
+		{
+			SPtr<MeshData> meshData = value->getData();
+			thisPtr->writeData(meshData, true);
+		}
+	}
+}

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptAssemblyManager.cpp

@@ -39,7 +39,6 @@
 #include "BsScriptShader.h"
 #include "BsScriptShaderInclude.h"
 #include "BsScriptMaterial.h"
-#include "BsScriptMesh.h"
 #include "BsScriptFont.h"
 #include "BsScriptPrefab.h"
 #include "BsScriptStringTable.h"
@@ -50,6 +49,7 @@
 #include "BsScriptAnimationClip.h"
 #include "BsBuiltinResourceLookup.h"
 
+#include "BsScriptMesh.generated.h"
 
 namespace bs
 {

+ 0 - 1
Source/SBansheeEngine/Source/BsScriptAudioClip.cpp

@@ -3,7 +3,6 @@
 #include "BsScriptAudioClip.h"
 #include "BsScriptResourceManager.h"
 #include "BsScriptMeta.h"
-#include "BsScriptMeshData.h"
 #include "BsMonoClass.h"
 
 namespace bs

+ 0 - 27
Source/SBansheeEngine/Source/BsScriptBoneWeight.cpp

@@ -1,27 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsScriptBoneWeight.h"
-#include "BsMonoManager.h"
-#include "BsMonoClass.h"
-#include "BsMonoUtil.h"
-
-namespace bs
-{
-	ScriptBoneWeight::ScriptBoneWeight(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptBoneWeight::initRuntimeData()
-	{ }
-
-	MonoObject* ScriptBoneWeight::box(const BoneWeight& value)
-	{
-		// We're casting away const but it's fine since structs are passed by value anyway
-		return MonoUtil::box(metaData.scriptClass->_getInternalClass(), (void*)&value);
-	}
-
-	BoneWeight ScriptBoneWeight::unbox(MonoObject* obj)
-	{
-		return *(BoneWeight*)MonoUtil::unbox(obj);
-	}
-}

+ 0 - 1
Source/SBansheeEngine/Source/BsScriptBuiltin.cpp

@@ -8,7 +8,6 @@
 #include "BsBuiltinResources.h"
 #include "BsScriptSpriteTexture.h"
 #include "BsScriptShader.h"
-#include "BsScriptMesh.h"
 #include "BsScriptFont.h"
 #include "BsScriptResourceManager.h"
 

+ 0 - 238
Source/SBansheeEngine/Source/BsScriptMesh.cpp

@@ -1,238 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsScriptMesh.h"
-#include "BsScriptResourceManager.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoArray.h"
-#include "BsMonoManager.h"
-#include "BsCoreThread.h"
-#include "BsScriptSkeleton.h"
-#include "BsScriptMorphShapes.h"
-
-namespace bs
-{
-	ScriptSubMesh::ScriptSubMesh(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptSubMesh::initRuntimeData()
-	{ }
-
-	MonoObject* ScriptSubMesh::box(const SubMeshData& value)
-	{
-		// We're casting away const but it's fine since structs are passed by value anyway
-		return MonoUtil::box(metaData.scriptClass->_getInternalClass(), (void*)&value);
-	}
-
-	SubMeshData ScriptSubMesh::unbox(MonoObject* obj)
-	{
-		return *(SubMeshData*)MonoUtil::unbox(obj);
-	}
-
-	ScriptMesh::ScriptMesh(MonoObject* instance, const HMesh& mesh)
-		:TScriptResource(instance, mesh)
-	{
-
-	}
-
-	void ScriptMesh::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptMesh::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_CreateInstanceMeshData", &ScriptMesh::internal_CreateInstanceMeshData);
-		metaData.scriptClass->addInternalCall("Internal_GetSubMeshes", &ScriptMesh::internal_GetSubMeshes);
-		metaData.scriptClass->addInternalCall("Internal_GetSubMeshCount", &ScriptMesh::internal_GetSubMeshCount);
-		metaData.scriptClass->addInternalCall("Internal_GetSkeleton", &ScriptMesh::internal_GetSkeleton);
-		metaData.scriptClass->addInternalCall("Internal_GetMorphShapes", &ScriptMesh::internal_GetMorphShapes);
-		metaData.scriptClass->addInternalCall("Internal_GetBounds", &ScriptMesh::internal_GetBounds);
-		metaData.scriptClass->addInternalCall("Internal_GetMeshData", &ScriptMesh::internal_GetMeshData);
-		metaData.scriptClass->addInternalCall("Internal_SetMeshData", &ScriptMesh::internal_SetMeshData);
-	}
-
-	void ScriptMesh::internal_CreateInstance(MonoObject* instance, int numVertices, int numIndices, 
-		MonoArray* subMeshes, MeshUsage usage, VertexLayout vertex, ScriptIndexType index)
-	{
-		IndexType indexType = IT_16BIT;
-		if (index == ScriptIndexType::Index32)
-			indexType = IT_32BIT;
-
-		MESH_DESC desc;
-		desc.numVertices = numVertices;
-		desc.numIndices = numIndices;
-		desc.vertexDesc = RendererMeshData::vertexLayoutVertexDesc(vertex);
-		desc.subMeshes = monoToNativeSubMeshes(subMeshes);
-		desc.usage = usage;
-		desc.indexType = indexType;
-
-		HMesh mesh = Mesh::create(desc);
-		ScriptResourceBase* scriptInstance = ScriptResourceManager::instance().createBuiltinScriptResource(mesh, instance);
-	}
-
-	void ScriptMesh::internal_CreateInstanceMeshData(MonoObject* instance, ScriptMeshData* data, MonoArray* subMeshes,
-		MeshUsage usage)
-	{
-		SPtr<MeshData> meshData;
-		if (data != nullptr)
-			meshData = data->getInternalValue()->getData();
-
-		MESH_DESC desc;
-		desc.subMeshes = monoToNativeSubMeshes(subMeshes);
-		desc.usage = usage;
-
-		HMesh mesh = Mesh::create(meshData, desc);
-		ScriptResourceBase* scriptInstance = ScriptResourceManager::instance().createBuiltinScriptResource(mesh, instance);
-	}
-
-	MonoArray* ScriptMesh::internal_GetSubMeshes(ScriptMesh* thisPtr)
-	{
-		HMesh mesh = thisPtr->getHandle();
-
-		UINT32 numSubMeshes = mesh->getProperties().getNumSubMeshes();
-		ScriptArray subMeshArray = ScriptArray::create<ScriptSubMesh>(numSubMeshes);
-
-		for (UINT32 i = 0; i < numSubMeshes; i++)
-		{
-			SubMesh curSubMesh = mesh->getProperties().getSubMesh(i);
-
-			SubMeshData data;
-			data.indexOffset = curSubMesh.indexOffset;
-			data.indexCount = curSubMesh.indexCount;
-			data.topology = drawOpToMeshTopology(curSubMesh.drawOp);
-
-			subMeshArray.set(i, data);
-		}
-
-		return subMeshArray.getInternal();
-	}
-
-	UINT32 ScriptMesh::internal_GetSubMeshCount(ScriptMesh* thisPtr)
-	{
-		HMesh mesh = thisPtr->getHandle();
-
-		return mesh->getProperties().getNumSubMeshes();
-	}
-
-	MonoObject* ScriptMesh::internal_GetSkeleton(ScriptMesh* thisPtr)
-	{
-		HMesh mesh = thisPtr->getHandle();
-
-		SPtr<Skeleton> skeleton = mesh->getSkeleton();
-		if (skeleton == nullptr)
-			return nullptr;
-
-		return ScriptSkeleton::create(skeleton);
-	}
-
-	MonoObject* ScriptMesh::internal_GetMorphShapes(ScriptMesh* thisPtr)
-	{
-		HMesh mesh = thisPtr->getHandle();
-
-		SPtr<MorphShapes> morphShapes = mesh->getMorphShapes();
-		if (morphShapes == nullptr)
-			return nullptr;
-
-		return ScriptMorphShapes::create(morphShapes);
-	}
-
-	void ScriptMesh::internal_GetBounds(ScriptMesh* thisPtr, AABox* box, Sphere* sphere)
-	{
-		HMesh mesh = thisPtr->getHandle();
-
-		Bounds bounds = mesh->getProperties().getBounds();
-		*box = bounds.getBox();
-		*sphere = bounds.getSphere();
-	}
-
-	MonoObject* ScriptMesh::internal_GetMeshData(ScriptMesh* thisPtr)
-	{
-		HMesh mesh = thisPtr->getHandle();
-
-		SPtr<MeshData> meshData = mesh->allocBuffer();
-		mesh->readCachedData(*meshData);
-
-		return ScriptMeshData::create(meshData);
-	}
-
-	void ScriptMesh::internal_SetMeshData(ScriptMesh* thisPtr, ScriptMeshData* value)
-	{
-		HMesh mesh = thisPtr->getHandle();
-		if (value != nullptr)
-		{
-			SPtr<MeshData> meshData = value->getInternalValue()->getData();
-			mesh->writeData(meshData, true);
-		}
-	}
-
-	MonoObject* ScriptMesh::createInstance()
-	{
-		return metaData.scriptClass->createInstance();
-	}
-
-	DrawOperationType ScriptMesh::meshTopologyToDrawOp(MeshTopology topology)
-	{
-		switch (topology)
-		{
-		case MeshTopology::PointList:
-			return DOT_POINT_LIST;
-		case MeshTopology::LineList:
-			return DOT_LINE_LIST;
-		case MeshTopology::LineStrip:
-			return DOT_LINE_STRIP;
-		case MeshTopology::TriangleList:
-			return DOT_TRIANGLE_LIST;
-		case MeshTopology::TriangleStrip:
-			return DOT_TRIANGLE_STRIP;
-		case MeshTopology::TriangleFan:
-			return DOT_TRIANGLE_FAN;
-		}
-
-		return DOT_TRIANGLE_LIST;
-	}
-
-	MeshTopology ScriptMesh::drawOpToMeshTopology(DrawOperationType drawOp)
-	{
-		switch (drawOp)
-		{
-		case DOT_POINT_LIST:
-			return MeshTopology::PointList;
-		case DOT_LINE_LIST:
-			return MeshTopology::TriangleList;
-		case DOT_LINE_STRIP:
-			return MeshTopology::TriangleStrip;
-		case DOT_TRIANGLE_LIST:
-			return MeshTopology::TriangleList;
-		case DOT_TRIANGLE_STRIP:
-			return MeshTopology::TriangleStrip;
-		case DOT_TRIANGLE_FAN:
-			return MeshTopology::TriangleFan;
-		}
-
-		return MeshTopology::TriangleList;
-	}
-
-	Vector<SubMesh> ScriptMesh::monoToNativeSubMeshes(MonoArray* subMeshes)
-	{
-		Vector<SubMesh> nativeSubMeshes;
-
-		if (subMeshes != nullptr)
-		{
-			ScriptArray subMeshArray(subMeshes);
-
-			UINT32 numSubMeshes = subMeshArray.size();
-			for (UINT32 i = 0; i < numSubMeshes; i++)
-			{
-				SubMeshData curData = subMeshArray.get<SubMeshData>(i);
-
-				SubMesh subMesh;
-				subMesh.indexOffset = curData.indexOffset;
-				subMesh.indexCount = curData.indexCount;
-				subMesh.drawOp = meshTopologyToDrawOp(curData.topology);
-
-				nativeSubMeshes.push_back(subMesh);
-			}
-		}
-
-		return nativeSubMeshes;
-	}
-}

+ 0 - 309
Source/SBansheeEngine/Source/BsScriptMeshData.cpp

@@ -1,309 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsScriptMeshData.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoUtil.h"
-#include "BsScriptColor.h"
-#include "BsScriptVector.h"
-#include "BsScriptBoneWeight.h"
-#include "BsVertexDataDesc.h"
-#include "BsPixelUtil.h"
-
-namespace bs
-{
-	template<int Semantic>
-	struct TVertexDataAccessor
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size) { }
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size) { }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::Position >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getPositions((Vector3*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setPositions((Vector3*)buffer, size); }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::Normal >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getNormals((Vector3*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setNormals((Vector3*)buffer, size); }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::Tangent >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getTangents((Vector4*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setTangents((Vector4*)buffer, size); }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::Color >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getColors((Color*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setColors((Color*)buffer, size); }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::UV0 >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getUV0((Vector2*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setUV0((Vector2*)buffer, size); }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::UV1 >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getUV1((Vector2*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setUV1((Vector2*)buffer, size); }
-	};
-
-	template<>
-	struct TVertexDataAccessor < (int)VertexLayout::BoneWeights >
-	{
-		static void get(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->getBoneWeights((BoneWeight*)buffer, size); }
-
-		static void set(const SPtr<RendererMeshData>& meshData, UINT8* buffer, UINT32 size)
-		{ meshData->setBoneWeights((BoneWeight*)buffer, size); }
-	};
-
-	template<int Semantic, class TNative, class TScript>
-	MonoArray* getVertexDataArray(ScriptMeshData* scriptMeshData)
-	{
-		SPtr<RendererMeshData> meshData = scriptMeshData->getInternalValue();
-		UINT32 numElements = meshData->getData()->getNumVertices();
-
-		ScriptArray outArray = ScriptArray::create<TScript>(numElements);
-		TVertexDataAccessor<Semantic>::get(meshData, (UINT8*)outArray.getRawPtr<TNative>(), numElements * sizeof(TNative));
-
-		return outArray.getInternal();
-	}
-
-	template<int Semantic, class TNative, class TScript>
-	void setVertexDataArray(ScriptMeshData* scriptMeshData, MonoArray* array)
-	{
-		if (array == nullptr)
-			return;
-
-		SPtr<RendererMeshData> meshData = scriptMeshData->getInternalValue();
-		UINT32 numElements = meshData->getData()->getNumVertices();
-
-		ScriptArray inArray(array);
-		TVertexDataAccessor<Semantic>::set(meshData, (UINT8*)inArray.getRawPtr<TNative>(), numElements * sizeof(TNative));
-	}
-
-	ScriptMeshData::ScriptMeshData(MonoObject* managedInstance)
-		:ScriptObject(managedInstance)
-	{
-
-	}
-
-	ScriptMeshData::~ScriptMeshData()
-	{
-
-	}
-
-	void ScriptMeshData::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptMeshData::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetPositions", &ScriptMeshData::internal_GetPositions);
-		metaData.scriptClass->addInternalCall("Internal_SetPositions", &ScriptMeshData::internal_SetPositions);
-		metaData.scriptClass->addInternalCall("Internal_GetNormals", &ScriptMeshData::internal_GetNormals);
-		metaData.scriptClass->addInternalCall("Internal_SetNormals", &ScriptMeshData::internal_SetNormals);
-		metaData.scriptClass->addInternalCall("Internal_GetTangents", &ScriptMeshData::internal_GetTangents);
-		metaData.scriptClass->addInternalCall("Internal_SetTangents", &ScriptMeshData::internal_SetTangents);
-		metaData.scriptClass->addInternalCall("Internal_GetColors", &ScriptMeshData::internal_GetColors);
-		metaData.scriptClass->addInternalCall("Internal_SetColors", &ScriptMeshData::internal_SetColors);
-		metaData.scriptClass->addInternalCall("Internal_GetUV0", &ScriptMeshData::internal_GetUV0);
-		metaData.scriptClass->addInternalCall("Internal_SetUV0", &ScriptMeshData::internal_SetUV0);
-		metaData.scriptClass->addInternalCall("Internal_GetUV1", &ScriptMeshData::internal_GetUV1);
-		metaData.scriptClass->addInternalCall("Internal_SetUV1", &ScriptMeshData::internal_SetUV1);
-		metaData.scriptClass->addInternalCall("Internal_GetBoneWeights", &ScriptMeshData::internal_GetBoneWeights);
-		metaData.scriptClass->addInternalCall("Internal_SetBoneWeights", &ScriptMeshData::internal_SetBoneWeights);
-		metaData.scriptClass->addInternalCall("Internal_GetIndices", &ScriptMeshData::internal_GetIndices);
-		metaData.scriptClass->addInternalCall("Internal_SetIndices", &ScriptMeshData::internal_SetIndices);
-		metaData.scriptClass->addInternalCall("Internal_GetVertexCount", &ScriptMeshData::internal_GetVertexCount);
-		metaData.scriptClass->addInternalCall("Internal_GetIndexCount", &ScriptMeshData::internal_GetIndexCount);
-	}
-
-	void ScriptMeshData::initialize(const SPtr<RendererMeshData>& meshData)
-	{
-		mMeshData = meshData;
-	}
-
-	MonoObject* ScriptMeshData::create(const SPtr<RendererMeshData>& meshData)
-	{
-		MonoObject* meshDataObj = metaData.scriptClass->createInstance();
-
-		ScriptMeshData* scriptMeshData = new (bs_alloc<ScriptMeshData>()) ScriptMeshData(meshDataObj);
-		scriptMeshData->initialize(meshData);
-
-		return meshDataObj;
-	}
-
-	MonoObject* ScriptMeshData::create(const SPtr<MeshData>& meshData)
-	{
-		MonoObject* meshDataObj = metaData.scriptClass->createInstance();
-
-		SPtr<RendererMeshData> defaultMeshData = RendererMeshData::create(meshData);
-		ScriptMeshData* scriptMeshData = new (bs_alloc<ScriptMeshData>()) ScriptMeshData(meshDataObj);
-		scriptMeshData->initialize(defaultMeshData);
-
-		return meshDataObj;
-	}
-
-	void ScriptMeshData::internal_CreateInstance(MonoObject* instance, int numVertices,
-		int numIndices, VertexLayout vertex, ScriptIndexType index)
-	{
-		IndexType indexType = IT_16BIT;
-		if (index == ScriptIndexType::Index32)
-			indexType = IT_32BIT;
-
-		SPtr<RendererMeshData> meshData = RendererMeshData::create(numVertices, numIndices, vertex, indexType);
-
-		ScriptMeshData* scriptMeshData = new (bs_alloc<ScriptMeshData>()) ScriptMeshData(instance);
-		scriptMeshData->initialize(meshData);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetPositions(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::Position, Vector3, ScriptVector3>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetPositions(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::Position, Vector3, ScriptVector3>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetNormals(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::Normal, Vector3, ScriptVector3>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetNormals(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::Normal, Vector3, ScriptVector3>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetTangents(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::Tangent, Vector4, ScriptVector4>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetTangents(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::Tangent, Vector4, ScriptVector4>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetColors(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::Color, Color, ScriptColor>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetColors(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::Color, Color, ScriptColor>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetUV0(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::UV0, Vector2, ScriptVector2>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetUV0(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::UV0, Vector2, ScriptVector2>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetUV1(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::UV1, Vector2, ScriptVector2>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetUV1(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::UV1, Vector2, ScriptVector2>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetBoneWeights(ScriptMeshData* thisPtr)
-	{
-		return getVertexDataArray<(int)VertexLayout::BoneWeights, BoneWeight, ScriptBoneWeight>(thisPtr);
-	}
-
-	void ScriptMeshData::internal_SetBoneWeights(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		setVertexDataArray<(int)VertexLayout::BoneWeights, BoneWeight, ScriptBoneWeight>(thisPtr, value);
-	}
-
-	MonoArray* ScriptMeshData::internal_GetIndices(ScriptMeshData* thisPtr)
-	{
-		SPtr<RendererMeshData> meshData = thisPtr->getInternalValue();
-		UINT32 numElements = meshData->getData()->getNumIndices();
-
-		ScriptArray outArray = ScriptArray::create<UINT32>(numElements);
-		meshData->getIndices(outArray.getRawPtr<UINT32>(), numElements * sizeof(UINT32));
-
-		return outArray.getInternal();
-	}
-
-	void ScriptMeshData::internal_SetIndices(ScriptMeshData* thisPtr, MonoArray* value)
-	{
-		if (value == nullptr)
-			return;
-
-		SPtr<RendererMeshData> meshData = thisPtr->getInternalValue();
-		UINT32 numElements = meshData->getData()->getNumIndices();
-
-		ScriptArray inArray(value);
-		meshData->setIndices(inArray.getRawPtr<UINT32>(), numElements * sizeof(UINT32));
-	}
-
-	int ScriptMeshData::internal_GetVertexCount(ScriptMeshData* thisPtr)
-	{
-		SPtr<RendererMeshData> meshData = thisPtr->getInternalValue();
-
-		return (int)meshData->getData()->getNumVertices();
-	}
-
-	int ScriptMeshData::internal_GetIndexCount(ScriptMeshData* thisPtr)
-	{
-		SPtr<RendererMeshData> meshData = thisPtr->getInternalValue();
-
-		return (int)meshData->getData()->getNumIndices();
-	}
-
-	bool ScriptMeshData::checkIsLocked(ScriptMeshData* thisPtr)
-	{
-		if (thisPtr->mMeshData->getData()->isLocked())
-		{
-			LOGWRN("Attempting to access a locked mesh data buffer.");
-			return true;
-		}
-
-		return false;
-	}
-}

+ 0 - 87
Source/SBansheeEngine/Source/BsScriptMorphShapes.cpp

@@ -1,87 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsScriptMorphShapes.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoMethod.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoUtil.h"
-#include "BsMorphShapes.h"
-
-using namespace std::placeholders;
-
-namespace bs
-{
-	ScriptMorphShapes::ScriptMorphShapes(MonoObject* managedInstance, const SPtr<MorphShapes>& morphShapes)
-		:ScriptObject(managedInstance), mMorphShapes(morphShapes)
-	{ }
-
-	void ScriptMorphShapes::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_GetChannels", &ScriptMorphShapes::internal_GetChannels);
-	}
-
-	MonoObject* ScriptMorphShapes::create(const SPtr<MorphShapes>& morphShapes)
-	{
-		MonoObject* instance = metaData.scriptClass->createInstance();
-
-		new (bs_alloc<ScriptMorphShapes>()) ScriptMorphShapes(instance, morphShapes);
-		return instance;
-	}
-
-	MonoArray* ScriptMorphShapes::internal_GetChannels(ScriptMorphShapes* thisPtr)
-	{
-		SPtr<MorphShapes> morphShapes = thisPtr->getInternal();
-
-		UINT32 numChannels = morphShapes->getNumChannels();
-		ScriptArray scriptArray = ScriptArray::create<ScriptMorphChannel>(numChannels);
-
-		for (UINT32 i = 0; i < numChannels; i++)
-		{
-			MonoObject* monoChannel = ScriptMorphChannel::toManaged(morphShapes->getChannel(i));
-			scriptArray.set(i, monoChannel);
-		}
-
-		return scriptArray.getInternal();
-	}
-
-	ScriptMorphChannel::ScriptMorphChannel(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptMorphChannel::initRuntimeData()
-	{ }
-
-	MonoObject* ScriptMorphChannel::toManaged(const SPtr<MorphChannel>& value)
-	{
-		MonoString* monoName = MonoUtil::stringToMono(value->getName());
-
-		UINT32 numShapes = value->getNumShapes();
-		ScriptArray shapeArray = ScriptArray::create<ScriptMorphShape>(numShapes);
-		for(UINT32 i = 0; i < numShapes; i++)
-		{
-			MonoObject* managedShape = ScriptMorphShape::toManaged(value->getShape(i));
-			shapeArray.set(i, managedShape);
-		}
-
-		void* params[2] = { monoName, shapeArray.getInternal() };
-		return metaData.scriptClass->createInstance("string,MorphShape[]", params);
-	}
-
-	ScriptMorphShape::ScriptMorphShape(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptMorphShape::initRuntimeData()
-	{ }
-
-	MonoObject* ScriptMorphShape::toManaged(const SPtr<MorphShape>& value)
-	{
-		MonoString* monoName = MonoUtil::stringToMono(value->getName());
-		float weight = value->getWeight();
-
-		void* params[2] = { monoName, &weight };
-		return metaData.scriptClass->createInstance("string,single", params);
-	}
-}

+ 3 - 2
Source/SBansheeEngine/Source/BsScriptPhysicsMesh.cpp

@@ -3,10 +3,11 @@
 #include "BsScriptPhysicsMesh.h"
 #include "BsScriptResourceManager.h"
 #include "BsScriptMeta.h"
-#include "BsScriptMeshData.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 
+#include "BsScriptRendererMeshData.generated.h"
+
 namespace bs
 {
 	ScriptPhysicsMesh::ScriptPhysicsMesh(MonoObject* instance, const HPhysicsMesh& mesh)
@@ -26,7 +27,7 @@ namespace bs
 		HPhysicsMesh mesh = thisPtr->getHandle();
 
 		SPtr<MeshData> meshData = mesh->getMeshData();
-		return ScriptMeshData::create(meshData);
+		return ScriptRendererMeshData::create(RendererMeshData::create(meshData));
 	}
 
 	int ScriptPhysicsMesh::internal_GetMeshType(ScriptPhysicsMesh* thisPtr)

+ 2 - 1
Source/SBansheeEngine/Source/BsScriptRenderable.cpp

@@ -11,11 +11,12 @@
 #include "BsScriptSceneObject.h"
 #include "BsSceneObject.h"
 #include "BsSceneManager.h"
-#include "BsScriptMesh.h"
 #include "BsScriptAnimation.h"
 #include "BsScriptMaterial.h"
 #include "BsScriptResourceManager.h"
 
+#include "BsScriptMesh.generated.h"
+
 namespace bs
 {
 	ScriptRenderable::ScriptRenderable(MonoObject* managedInstance, const HSceneObject& parentSO)

+ 0 - 82
Source/SBansheeEngine/Source/BsScriptSkeleton.cpp

@@ -1,82 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsScriptSkeleton.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoMethod.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoUtil.h"
-
-using namespace std::placeholders;
-
-namespace bs
-{
-	ScriptSkeleton::ScriptSkeleton(MonoObject* managedInstance, const SPtr<Skeleton>& skeleton)
-		:ScriptObject(managedInstance), mSkeleton(skeleton)
-	{
-
-	}
-
-	void ScriptSkeleton::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_GetNumBones", &ScriptSkeleton::internal_GetNumBones);
-		metaData.scriptClass->addInternalCall("Internal_GetBoneInfo", &ScriptSkeleton::internal_GetBoneInfo);
-	}
-
-	MonoObject* ScriptSkeleton::create(const SPtr<Skeleton>& skeleton)
-	{
-		MonoObject* instance = metaData.scriptClass->createInstance();
-
-		new (bs_alloc<ScriptSkeleton>()) ScriptSkeleton(instance, skeleton);
-		return instance;
-	}
-
-	int ScriptSkeleton::internal_GetNumBones(ScriptSkeleton* thisPtr)
-	{
-		return thisPtr->getInternal()->getNumBones();
-	}
-
-	MonoObject* ScriptSkeleton::internal_GetBoneInfo(ScriptSkeleton* thisPtr, UINT32 boneIdx)
-	{
-		SPtr<Skeleton> skeleton = thisPtr->getInternal();
-
-		UINT32 numBones = skeleton->getNumBones();
-		if (boneIdx >= numBones)
-			return nullptr;
-
-		const SkeletonBoneInfo& boneInfo = skeleton->getBoneInfo(boneIdx);
-		const Matrix4& invBindPose = skeleton->getInvBindPose(boneIdx);
-
-		return ScriptBoneInfo::toManaged(boneInfo, invBindPose);
-	}
-	
-	MonoField* ScriptBoneInfo::sNameField = nullptr;
-	MonoField* ScriptBoneInfo::sParentField = nullptr;
-	MonoField* ScriptBoneInfo::sInvBindPoseField = nullptr;
-
-	ScriptBoneInfo::ScriptBoneInfo(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptBoneInfo::initRuntimeData()
-	{
-		sNameField = metaData.scriptClass->getField("Name");
-		sParentField = metaData.scriptClass->getField("Parent");
-		sInvBindPoseField = metaData.scriptClass->getField("InvBindPose");
-	}
-
-	MonoObject* ScriptBoneInfo::toManaged(const SkeletonBoneInfo& boneInfo, const Matrix4& invBindPose)
-	{
-		MonoString* monoName = MonoUtil::stringToMono(boneInfo.name);
-		int parentIdx = boneInfo.parent;
-		Matrix4 monoInvBindPose = invBindPose;
-
-		MonoObject* instance = metaData.scriptClass->createInstance();
-		sNameField->set(instance, monoName);
-		sParentField->set(instance, &parentIdx);
-		sInvBindPoseField->set(instance, &monoInvBindPose);
-
-		return instance;
-	}
-}

+ 19 - 0
Source/SBansheeEngine/Source/BsSkeletonEx.cpp

@@ -0,0 +1,19 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsSkeletonEx.h"
+
+using namespace std::placeholders;
+
+namespace bs
+{
+	SkeletonBoneInfoEx SkeletonEx::getBoneInfo(const SPtr<Skeleton>& thisPtr, int boneIdx)
+	{
+		const SkeletonBoneInfo& boneInfo = thisPtr->getBoneInfo(boneIdx);
+		SkeletonBoneInfoEx boneInfoEx;
+		boneInfoEx.name = boneInfo.name;
+		boneInfoEx.parent = boneInfo.parent;
+		boneInfoEx.invBindPose = thisPtr->getInvBindPose(boneIdx);
+
+		return boneInfoEx;
+	}
+}