Browse Source

Add GraphicsImporters

-DynamicModelProcessor
Base Processor to customize the build in Model. It allows to modify
VertexBuffer & IndexBuffers, make them Dynamic and/or WriteOnly.
Nikos Kastellanos 8 years ago
parent
commit
2357002f7a
32 changed files with 1280 additions and 0 deletions
  1. 13 0
      Aether.Extras.PORTABLE.sln
  2. 13 0
      Aether.Extras.WINDOWS.MG.sln
  3. 31 0
      Aether.Extras.WINDOWS.XNA.sln
  4. 40 0
      Content.Pipeline/GraphicsImporters/Graphics/DynamicIndexBufferContent.cs
  5. 79 0
      Content.Pipeline/GraphicsImporters/Graphics/DynamicModelContent.cs
  6. 63 0
      Content.Pipeline/GraphicsImporters/Graphics/DynamicModelMeshContent.cs
  7. 79 0
      Content.Pipeline/GraphicsImporters/Graphics/DynamicModelMeshPartContent.cs
  8. 43 0
      Content.Pipeline/GraphicsImporters/Graphics/DynamicVertexBufferContent.cs
  9. 71 0
      Content.Pipeline/GraphicsImporters/GraphicsImporters.PORTABLE.csproj
  10. 67 0
      Content.Pipeline/GraphicsImporters/GraphicsImporters.WINDOWS.MG.csproj
  11. 64 0
      Content.Pipeline/GraphicsImporters/GraphicsImporters.WINDOWS.XNA.csproj
  12. 114 0
      Content.Pipeline/GraphicsImporters/Processors/DynamicModelProcessor.cs
  13. 22 0
      Content.Pipeline/GraphicsImporters/Properties/AssemblyInfo.cs
  14. 71 0
      Content.Pipeline/GraphicsImporters/Serialization/DynamicIndexBufferWriter.cs
  15. 134 0
      Content.Pipeline/GraphicsImporters/Serialization/DynamicModelWriter.cs
  16. 50 0
      Content.Pipeline/GraphicsImporters/Serialization/DynamicVertexBufferWriter.cs
  17. 5 0
      Content.Pipeline/GraphicsImporters/packages.config
  18. 54 0
      Graphics/Aether.Graphics.PORTABLE.csproj
  19. 58 0
      Graphics/Aether.Graphics.WINDOWS.MG.csproj
  20. 69 0
      Graphics/Aether.Graphics.WINDOWS.XNA.csproj
  21. 53 0
      Graphics/ContentReaders/DynamicIndexBufferReader.cs
  22. 49 0
      Graphics/ContentReaders/DynamicVertexBufferReader.cs
  23. 30 0
      Graphics/Properties/AssemblyInfo.cs
  24. 4 0
      Graphics/packages.config
  25. 2 0
      README.md
  26. BIN
      bin/Release/Portable/Aether.Content.Pipeline.GraphicsImporters.dll
  27. BIN
      bin/Release/Portable/Aether.Graphics.dll
  28. BIN
      bin/Release/Windows.XNA/Aether.Content.Pipeline.GraphicsImporters.dll
  29. BIN
      bin/Release/Windows.XNA/Aether.Graphics.dll
  30. BIN
      bin/Release/Windows/Aether.Content.Pipeline.GraphicsImporters.dll
  31. BIN
      bin/Release/Windows/Aether.Graphics.dll
  32. 2 0
      packages/repositories.config

+ 13 - 0
Aether.Extras.PORTABLE.sln

@@ -7,6 +7,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aether.Content.Pipeline", "
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RawModelProcessor.PORTABLE", "Content.Pipeline\RawModelProcessor\RawModelProcessor.PORTABLE.csproj", "{C3218A39-5491-44BF-B820-754832E318DB}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsImporters.PORTABLE", "Content.Pipeline\GraphicsImporters\GraphicsImporters.PORTABLE.csproj", "{0A079394-D331-433A-94DF-AA25B6522279}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Graphics.PORTABLE", "Graphics\Aether.Graphics.PORTABLE.csproj", "{3E3BB349-662A-4628-B033-154CB8CD2F2A}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -17,11 +21,20 @@ Global
 		{C3218A39-5491-44BF-B820-754832E318DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C3218A39-5491-44BF-B820-754832E318DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{C3218A39-5491-44BF-B820-754832E318DB}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0A079394-D331-433A-94DF-AA25B6522279}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0A079394-D331-433A-94DF-AA25B6522279}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0A079394-D331-433A-94DF-AA25B6522279}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0A079394-D331-433A-94DF-AA25B6522279}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3E3BB349-662A-4628-B033-154CB8CD2F2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3E3BB349-662A-4628-B033-154CB8CD2F2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3E3BB349-662A-4628-B033-154CB8CD2F2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3E3BB349-662A-4628-B033-154CB8CD2F2A}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
 		{C3218A39-5491-44BF-B820-754832E318DB} = {717F89BC-8423-4E7C-A834-460CFD62B1E3}
+		{0A079394-D331-433A-94DF-AA25B6522279} = {717F89BC-8423-4E7C-A834-460CFD62B1E3}
 	EndGlobalSection
 EndGlobal

+ 13 - 0
Aether.Extras.WINDOWS.MG.sln

@@ -9,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDSImporter.WINDOWS.MG", "C
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RawModelProcessor.WINDOWS.MG", "Content.Pipeline\RawModelProcessor\RawModelProcessor.WINDOWS.MG.csproj", "{48E4029A-115C-4DC2-AF3A-0AB94F36BFC0}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsImporters.WINDOWS.MG", "Content.Pipeline\GraphicsImporters\GraphicsImporters.WINDOWS.MG.csproj", "{400DC7B2-739D-4156-916D-2F2E1920310D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Graphics.WINDOWS.MG", "Graphics\Aether.Graphics.WINDOWS.MG.csproj", "{0A4ED2DF-9CDD-4C98-83AA-1898A394AC27}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -23,6 +27,14 @@ Global
 		{48E4029A-115C-4DC2-AF3A-0AB94F36BFC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{48E4029A-115C-4DC2-AF3A-0AB94F36BFC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{48E4029A-115C-4DC2-AF3A-0AB94F36BFC0}.Release|Any CPU.Build.0 = Release|Any CPU
+		{400DC7B2-739D-4156-916D-2F2E1920310D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{400DC7B2-739D-4156-916D-2F2E1920310D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{400DC7B2-739D-4156-916D-2F2E1920310D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{400DC7B2-739D-4156-916D-2F2E1920310D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0A4ED2DF-9CDD-4C98-83AA-1898A394AC27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0A4ED2DF-9CDD-4C98-83AA-1898A394AC27}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0A4ED2DF-9CDD-4C98-83AA-1898A394AC27}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0A4ED2DF-9CDD-4C98-83AA-1898A394AC27}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -30,5 +42,6 @@ Global
 	GlobalSection(NestedProjects) = preSolution
 		{26C387C6-7313-47D4-A05F-14639AB02D70} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
 		{48E4029A-115C-4DC2-AF3A-0AB94F36BFC0} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
+		{400DC7B2-739D-4156-916D-2F2E1920310D} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
 	EndGlobalSection
 EndGlobal

+ 31 - 0
Aether.Extras.WINDOWS.XNA.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsImporters.WINDOWS.XNA", "Content.Pipeline\GraphicsImporters\GraphicsImporters.WINDOWS.XNA.csproj", "{565ACF47-7E36-435E-8727-2AFB39E61134}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Graphics.WINDOWS.XNA", "Graphics\Aether.Graphics.WINDOWS.XNA.csproj", "{838D803F-F140-4763-A378-56DC27EDD5F3}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aether.Content.Pipeline", "Aether.Content.Pipeline", "{F6B6E505-6037-49E4-9060-8B29A7B99BC1}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{565ACF47-7E36-435E-8727-2AFB39E61134}.Debug|x86.ActiveCfg = Debug|x86
+		{565ACF47-7E36-435E-8727-2AFB39E61134}.Debug|x86.Build.0 = Debug|x86
+		{565ACF47-7E36-435E-8727-2AFB39E61134}.Release|x86.ActiveCfg = Release|x86
+		{565ACF47-7E36-435E-8727-2AFB39E61134}.Release|x86.Build.0 = Release|x86
+		{838D803F-F140-4763-A378-56DC27EDD5F3}.Debug|x86.ActiveCfg = Debug|x86
+		{838D803F-F140-4763-A378-56DC27EDD5F3}.Debug|x86.Build.0 = Debug|x86
+		{838D803F-F140-4763-A378-56DC27EDD5F3}.Release|x86.ActiveCfg = Release|x86
+		{838D803F-F140-4763-A378-56DC27EDD5F3}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{565ACF47-7E36-435E-8727-2AFB39E61134} = {F6B6E505-6037-49E4-9060-8B29A7B99BC1}
+	EndGlobalSection
+EndGlobal

+ 40 - 0
Content.Pipeline/GraphicsImporters/Graphics/DynamicIndexBufferContent.cs

@@ -0,0 +1,40 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace tainicom.Aether.Content.Pipeline.Graphics
+{
+    public class DynamicIndexBufferContent: Collection<int>
+    {
+        protected internal Collection<int> Source { get; protected set; }
+
+        public bool IsWriteOnly = false;
+                
+        public int Count { get { return Source.Count; } }
+        
+        public DynamicIndexBufferContent(Collection<int> source)
+        {
+            Source = source;
+        }
+
+        public new IEnumerator<int> GetEnumerator()
+        {
+            return Source.GetEnumerator();
+        }       
+    }
+}

+ 79 - 0
Content.Pipeline/GraphicsImporters/Graphics/DynamicModelContent.cs

@@ -0,0 +1,79 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Content.Pipeline.Processors;
+
+namespace tainicom.Aether.Content.Pipeline.Graphics 
+{    
+    public class DynamicModelContent
+    {
+        [Flags]
+        public enum BufferType : int
+        {
+            /// <summary>
+            /// Use the default BufferReader
+            /// </summary>
+            Default = int.MinValue,
+
+            /// <summary>
+            /// Deserialize a Dynamic Buffer
+            /// </summary> 
+            Dynamic = 0,
+            
+            /// <summary>
+            /// Deserialize a Dynamic Buffer with BufferUsage.WriteOnly
+            /// </summary>
+            DynamicWriteOnly = 0x01,
+        }
+
+        protected internal ModelContent Source { get; protected set; }
+        public BufferType VertexBufferType = BufferType.Dynamic;
+        public BufferType IndexBufferType = BufferType.Dynamic;
+        
+        // Summary:
+        //     Gets the collection of bones that are referenced by this model.
+        public ModelBoneContentCollection Bones { get { return Source.Bones; } }
+        
+        // Summary:
+        //     Gets the collection of meshes that are associated with this model.
+        [ContentSerializerIgnore]
+        public List<DynamicModelMeshContent> Meshes { get; private set; }
+
+        // Summary:
+        //     Gets the root bone of this model
+        [ContentSerializerIgnore]
+        public ModelBoneContent Root { get { return Source.Root; } }
+        
+        // Summary:
+        //     Gets a user defined tag object.
+        [ContentSerializer(SharedResource = true)]
+        public object Tag { get { return Source.Tag; } set { Source.Tag = value; } }
+
+        public DynamicModelContent(ModelContent source)
+        {
+            this.Source = source;
+
+            //deep clone Meshes
+            Meshes = new List<DynamicModelMeshContent>(source.Meshes.Count);
+            foreach(var mesh in source.Meshes)
+                Meshes.Add(new DynamicModelMeshContent(mesh));
+        }
+
+    }
+}

+ 63 - 0
Content.Pipeline/GraphicsImporters/Graphics/DynamicModelMeshContent.cs

@@ -0,0 +1,63 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Content.Pipeline.Processors;
+
+namespace tainicom.Aether.Content.Pipeline.Graphics
+{
+    public class DynamicModelMeshContent
+    {   
+        protected internal ModelMeshContent Source { get; protected set; }
+        
+        // Summary:
+        //     Gets the mesh name.
+        public string Name { get { return Source.Name; } }
+
+        // Summary:
+        //     Gets the parent bone.
+        [ContentSerializerIgnore]
+        public ModelBoneContent ParentBone { get { return Source.ParentBone; } }
+
+        // Summary:
+        //     Gets the bounding sphere for this mesh.
+        public BoundingSphere BoundingSphere { get { return Source.BoundingSphere; } }
+
+        // Summary:
+        //     Gets the children mesh parts associated with this mesh.
+        [ContentSerializerIgnore]
+        public List<DynamicModelMeshPartContent> MeshParts { get; private set; }
+        
+        // Summary:
+        //     Gets a user defined tag object.
+        [ContentSerializer(SharedResource = true)]
+        public object Tag { get { return Source.Tag; } set { Source.Tag = value; } }
+
+
+        public DynamicModelMeshContent(ModelMeshContent source)
+        {
+            this.Source = source;
+            
+            //deep clone MeshParts
+            MeshParts = new List<DynamicModelMeshPartContent>(source.MeshParts.Count);
+            foreach (var mesh in source.MeshParts)
+                MeshParts.Add(new DynamicModelMeshPartContent(mesh));
+        }
+
+    }
+}

+ 79 - 0
Content.Pipeline/GraphicsImporters/Graphics/DynamicModelMeshPartContent.cs

@@ -0,0 +1,79 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System.Collections.ObjectModel;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
+using Microsoft.Xna.Framework.Content.Pipeline.Processors;
+
+namespace tainicom.Aether.Content.Pipeline.Graphics
+{
+    public class DynamicModelMeshPartContent
+    {
+        protected internal ModelMeshPartContent Source { get; protected set; }
+
+        // Summary:
+        //     Gets the offset, in bytes, from the first index of the of vertex buffer for this mesh part.
+        public int VertexOffset { get; set; }
+        
+        // Summary:
+        //     Gets the number of vertices used in this mesh part.
+        public int NumVertices { get; set; }
+        
+        // Summary:
+        //     Gets the location in the index buffer at which to start reading vertices.
+        public int StartIndex { get; set; }
+        
+        // Summary:
+        //     Gets the number of primitives to render for this mesh part.
+        public int PrimitiveCount { get; set; }
+
+
+        // Summary:
+        //     Gets the vertex buffer associated with this mesh part.
+        [ContentSerializerIgnore]
+        public VertexBufferContent VertexBuffer { get; set; }
+
+        // Summary:
+        //     Gets the index buffer associated with this mesh part.
+        [ContentSerializerIgnore]
+        public Collection<int> IndexBuffer { get; set; }
+
+        // Summary:
+        //     Gets the material of this mesh part.
+        [ContentSerializer(SharedResource = true)]
+        public MaterialContent Material { get; set; }
+
+        // Summary:
+        //     Gets a user defined tag object.
+        [ContentSerializer(SharedResource = true)]
+        public object Tag { get; set; }
+
+
+        public DynamicModelMeshPartContent(ModelMeshPartContent source)
+        {
+            this.Source = source;
+            this.VertexOffset = source.VertexOffset;
+            this.NumVertices = source.NumVertices;
+            this.StartIndex = source.StartIndex;
+            this.PrimitiveCount = source.PrimitiveCount;
+            this.VertexBuffer = source.VertexBuffer;
+            this.IndexBuffer = source.IndexBuffer;
+            this.Material = source.Material;
+            this.Tag = Tag;
+        }
+    }
+}

+ 43 - 0
Content.Pipeline/GraphicsImporters/Graphics/DynamicVertexBufferContent.cs

@@ -0,0 +1,43 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using Microsoft.Xna.Framework.Content.Pipeline.Processors;
+
+namespace tainicom.Aether.Content.Pipeline.Graphics
+{
+    public class DynamicVertexBufferContent: VertexBufferContent 
+    {
+        protected internal VertexBufferContent Source { get; protected set; }
+
+        public bool IsWriteOnly = false;
+                
+        public VertexDeclarationContent VertexDeclaration { get { return Source.VertexDeclaration; } }
+
+        public byte[] VertexData { get { return Source.VertexData; } }
+
+        public DynamicVertexBufferContent(VertexBufferContent source):base()
+        {
+            Source = source;
+        }
+
+        public DynamicVertexBufferContent(VertexBufferContent source, int size):base(size)
+        {
+            Source = source;
+        }
+
+
+    }
+}

+ 71 - 0
Content.Pipeline/GraphicsImporters/GraphicsImporters.PORTABLE.csproj

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{0A079394-D331-433A-94DF-AA25B6522279}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Content.Pipeline</RootNamespace>
+    <AssemblyName>Aether.Content.Pipeline.GraphicsImporters</AssemblyName>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\Debug\Portable\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\bin\Release\Portable\</OutputPath>
+    <DefineConstants>TRACE;PORTABLE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MonoGame.Framework, Version=3.1.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\MonoGame.Framework.Portable.3.2.99.1-Beta\lib\portable-net40+sl50+win+wpa81+wp80+MonoAndroid10+MonoTouch10\MonoGame.Framework.dll</HintPath>
+      <SpecificVersion>False</SpecificVersion>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="MonoGame.Framework.Content.Pipeline, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\MonoGame.Framework.Content.Pipeline.Portable.3.2.99.1-Beta\lib\portable-net40+sl50+win+wpa81+wp80+MonoAndroid10+MonoTouch10\MonoGame.Framework.Content.Pipeline.dll</HintPath>
+      <SpecificVersion>False</SpecificVersion>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Graphics\DynamicIndexBufferContent.cs" />
+    <Compile Include="Graphics\DynamicModelContent.cs" />
+    <Compile Include="Graphics\DynamicModelMeshContent.cs" />
+    <Compile Include="Graphics\DynamicModelMeshPartContent.cs" />
+    <Compile Include="Graphics\DynamicVertexBufferContent.cs" />
+    <Compile Include="Processors\DynamicModelProcessor.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Serialization\DynamicIndexBufferWriter.cs" />
+    <Compile Include="Serialization\DynamicModelWriter.cs" />
+    <Compile Include="Serialization\DynamicVertexBufferWriter.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 67 - 0
Content.Pipeline/GraphicsImporters/GraphicsImporters.WINDOWS.MG.csproj

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{400DC7B2-739D-4156-916D-2F2E1920310D}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Content.Pipeline</RootNamespace>
+    <AssemblyName>Aether.Content.Pipeline.GraphicsImporters</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\Debug\Windows\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\bin\Release\Windows\</OutputPath>
+    <DefineConstants>TRACE;WINDOWS MG</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MonoGame.Framework, Version=3.1.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\MonoGame.Framework.Portable.3.2.99.1-Beta\lib\portable-net40+sl40+win+wp80\MonoGame.Framework.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="MonoGame.Framework.Content.Pipeline, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\MonoGame.Framework.Content.Pipeline.Portable.3.2.99.1-Beta\lib\portable-net45+win+wpa81+Xamarin.iOS10+MonoAndroid10+MonoTouch10\MonoGame.Framework.Content.Pipeline.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Graphics\DynamicIndexBufferContent.cs" />
+    <Compile Include="Graphics\DynamicModelContent.cs" />
+    <Compile Include="Graphics\DynamicModelMeshContent.cs" />
+    <Compile Include="Graphics\DynamicModelMeshPartContent.cs" />
+    <Compile Include="Graphics\DynamicVertexBufferContent.cs" />
+    <Compile Include="Processors\DynamicModelProcessor.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Serialization\DynamicIndexBufferWriter.cs" />
+    <Compile Include="Serialization\DynamicModelWriter.cs" />
+    <Compile Include="Serialization\DynamicVertexBufferWriter.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 64 - 0
Content.Pipeline/GraphicsImporters/GraphicsImporters.WINDOWS.XNA.csproj

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <ProjectGuid>{565ACF47-7E36-435E-8727-2AFB39E61134}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Content.Pipeline</RootNamespace>
+    <AssemblyName>Aether.Content.Pipeline.GraphicsImporters</AssemblyName>
+    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+    <XnaPlatform>Windows</XnaPlatform>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\Debug\Windows.XNA\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;WINDOWS XNA</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\bin\Release\Windows.XNA\</OutputPath>
+    <DefineConstants>TRACE;WINDOWS XNA</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Graphics\DynamicIndexBufferContent.cs" />
+    <Compile Include="Graphics\DynamicModelMeshContent.cs" />
+    <Compile Include="Graphics\DynamicModelMeshPartContent.cs" />
+    <Compile Include="Processors\DynamicModelProcessor.cs" />
+    <Compile Include="Graphics\DynamicModelContent.cs" />
+    <Compile Include="Serialization\DynamicIndexBufferWriter.cs" />
+    <Compile Include="Serialization\DynamicModelWriter.cs" />
+    <Compile Include="Graphics\DynamicVertexBufferContent.cs" />
+    <Compile Include="Serialization\DynamicVertexBufferWriter.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.ContentPipelineExtensions.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+     Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 114 - 0
Content.Pipeline/GraphicsImporters/Processors/DynamicModelProcessor.cs

@@ -0,0 +1,114 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using Microsoft.Xna.Framework.Content.Pipeline;
+using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
+using Microsoft.Xna.Framework.Content.Pipeline.Processors;
+using tainicom.Aether.Content.Pipeline.Graphics;
+
+namespace tainicom.Aether.Content.Pipeline.Serialization
+{
+    [ContentProcessor(DisplayName = "DynamicModel - Aether")]
+    public class DynamicModelProcessor : ModelProcessor, IContentProcessor
+    {
+        DynamicModelContent.BufferType _vertexBufferType = DynamicModelContent.BufferType.Dynamic;
+        DynamicModelContent.BufferType _indexBufferType = DynamicModelContent.BufferType.Dynamic;
+
+        // used to avoid creating clones/duplicates of the same VertexBufferContent
+        Dictionary<VertexBufferContent, DynamicVertexBufferContent> _vertexBufferCache = new Dictionary<VertexBufferContent, DynamicVertexBufferContent>();
+        // used to avoid creating clones/duplicates of the same Index Buffer
+        Dictionary<Collection<int>, DynamicIndexBufferContent> _indexBufferCache = new Dictionary<Collection<int>, DynamicIndexBufferContent>();
+
+#if WINDOWS
+        // override OutputType
+        [Browsable(false)]
+#endif
+        Type IContentProcessor.OutputType { get { return typeof(DynamicModelContent); } }
+        
+        [DefaultValue(DynamicModelContent.BufferType.Dynamic)]
+        public virtual DynamicModelContent.BufferType VertexBufferType
+        {
+            get { return  _vertexBufferType; }
+            set { _vertexBufferType = value; }
+        }
+        
+        [DefaultValue(DynamicModelContent.BufferType.Dynamic)]
+        public virtual DynamicModelContent.BufferType IndexBufferType
+        {
+            get { return  _indexBufferType; }
+            set { _indexBufferType = value; }
+        }
+
+        public DynamicModelProcessor()
+        {
+        }
+
+        object IContentProcessor.Process(object input, ContentProcessorContext context)
+        {
+            var model = Process((NodeContent)input, context);
+            var dynamicModel = new DynamicModelContent(model);
+            
+            foreach(var mesh in dynamicModel.Meshes)
+            {
+                foreach(var part in mesh.MeshParts)
+                {
+                    ProcessVertexBuffer(dynamicModel, context, part);
+                    ProcessIndexBuffer(dynamicModel, context, part);
+                }
+            }
+
+            return dynamicModel;
+        }
+
+        protected virtual void ProcessVertexBuffer(DynamicModelContent dynamicModel, ContentProcessorContext context, DynamicModelMeshPartContent part)
+        {
+            if(VertexBufferType != DynamicModelContent.BufferType.Default)
+            {
+                // Replace the default VertexBufferContent with CpuAnimatedVertexBufferContent.
+                DynamicVertexBufferContent vb;
+                if (!_vertexBufferCache.TryGetValue(part.VertexBuffer, out vb))
+                {
+                    vb = new DynamicVertexBufferContent(part.VertexBuffer);
+                    vb.IsWriteOnly = (VertexBufferType == DynamicModelContent.BufferType.DynamicWriteOnly);
+                    _vertexBufferCache[part.VertexBuffer] = vb;
+                }
+                part.VertexBuffer = vb;
+            }
+        }
+
+        protected virtual void ProcessIndexBuffer(DynamicModelContent dynamicModel, ContentProcessorContext context, DynamicModelMeshPartContent part)
+        {
+            if(IndexBufferType != DynamicModelContent.BufferType.Default)
+            {
+                DynamicIndexBufferContent ib;
+                if (!_indexBufferCache.TryGetValue(part.IndexBuffer, out ib))
+                {
+                    ib = new DynamicIndexBufferContent(part.IndexBuffer);
+                    ib.IsWriteOnly = (IndexBufferType == DynamicModelContent.BufferType.DynamicWriteOnly);
+                    _indexBufferCache[part.IndexBuffer] = ib;
+                }
+                part.IndexBuffer = ib;
+            }
+        }
+        
+        
+        
+    }
+}

+ 22 - 0
Content.Pipeline/GraphicsImporters/Properties/AssemblyInfo.cs

@@ -0,0 +1,22 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Aether.Content.Pipeline.Graphics")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Aether.Content.Pipeline.Graphics")]
+[assembly: AssemblyCopyright("Copyright ©  Kastellanos Nikolaos 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
Content.Pipeline/GraphicsImporters/Serialization/DynamicIndexBufferWriter.cs

@@ -0,0 +1,71 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System;
+using Microsoft.Xna.Framework.Content.Pipeline;
+using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
+using tainicom.Aether.Content.Pipeline.Graphics;
+
+namespace tainicom.Aether.Content.Pipeline.Serialization
+{
+    [ContentTypeWriter]
+    class DynamicIndexBufferWriter : ContentTypeWriter<DynamicIndexBufferContent>
+    {
+        protected override void Write(ContentWriter output, DynamicIndexBufferContent buffer)
+        {   
+            WriteIndexBuffer(output, buffer);
+
+            output.Write(buffer.IsWriteOnly);
+
+            return;
+        }
+
+        private static void WriteIndexBuffer(ContentWriter output, DynamicIndexBufferContent buffer)
+        {
+            // check if the buffer contains values greater than UInt16.MaxValue
+            var is16Bit = true;
+            foreach(var index in buffer)
+            {
+                if(index > UInt16.MaxValue)
+                {
+                    is16Bit = false;
+                    break;
+                }
+            }
+            
+           var stride  = (is16Bit) ? 2 : 4;
+
+            output.Write(is16Bit); // Is 16 bit
+            output.Write((UInt32)(buffer.Count*stride)); // Data size
+            if (is16Bit)
+            {
+	            foreach (var item in buffer)
+	                output.Write((UInt16)item);
+            }
+            else
+            {
+	            foreach (var item in buffer)
+	                output.Write(item);
+            }
+        }
+        
+        public override string GetRuntimeReader(TargetPlatform targetPlatform)
+        {
+            return "tainicom.Aether.Graphics.Content.DynamicIndexBufferReader, Aether.Graphics";
+        }
+        
+    }
+}

+ 134 - 0
Content.Pipeline/GraphicsImporters/Serialization/DynamicModelWriter.cs

@@ -0,0 +1,134 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content.Pipeline;
+using Microsoft.Xna.Framework.Content.Pipeline.Processors;
+using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
+using tainicom.Aether.Content.Pipeline.Graphics;
+
+namespace tainicom.Aether.Content.Pipeline.Serialization
+{
+    [ContentTypeWriter]
+    class DynamicModelWriter : ContentTypeWriter<DynamicModelContent>
+    {
+        /// <summary>
+        /// Write a Model xnb, compatible with the XNB Container Format.
+        /// </summary>
+        protected override void Write(ContentWriter output, DynamicModelContent model)
+        {   
+            WriteBones(output, model.Bones);
+            WriteMeshes(output, model, model.Meshes);
+            WriteBoneReference(output, model.Bones.Count, model.Source.Root);
+            output.WriteObject(model.Source.Tag);
+
+            return;
+        }
+
+
+        private void WriteBones(ContentWriter output, ModelBoneContentCollection bones)
+        {
+            var bonesCount = bones.Count;
+            output.Write((UInt32)bonesCount);
+
+            foreach (var bone in bones)
+            {
+                output.WriteObject(bone.Name);
+                output.Write(bone.Transform);
+            }
+
+            foreach (var bone in bones)
+            {
+                WriteBoneReference(output, bonesCount, bone.Parent);
+                
+                output.Write((uint)bone.Children.Count);
+                foreach (var child in bone.Children)
+                    WriteBoneReference(output, bonesCount, child);
+            }
+
+            return;
+        }
+
+        // The BoneReference type varies in size depending on the number of bones in the model. 
+        // If bone count is less than 255 this value is serialized as a Byte, otherwise it is UInt32. 
+        // If the reference value is zero the bone is null, otherwise (bone reference - 1) is an index into the model bone list.
+        private void WriteBoneReference(ContentWriter output, int bonesCount, ModelBoneContent bone)
+        {
+            if (bone == null)
+                output.Write((byte)0);
+            else if (bonesCount < 255)
+                output.Write((byte)(bone.Index + 1));
+            else
+                output.Write((UInt32)(bone.Index + 1));
+        }
+
+        private void WriteMeshes(ContentWriter output, DynamicModelContent model, List<DynamicModelMeshContent> meshes)
+        {
+            output.Write((UInt32)meshes.Count);
+
+            var bonesCount = model.Bones.Count;
+            foreach (var mesh in meshes)
+            {
+                output.WriteObject(mesh.Name); 
+                WriteBoneReference(output, bonesCount, mesh.ParentBone);
+                WriteBoundingSphere(output, mesh.BoundingSphere);
+                output.WriteObject(mesh.Tag);
+                
+                WriteParts(output, model, mesh.MeshParts);
+            }
+
+            return;
+        }
+
+        private void WriteBoundingSphere(ContentWriter output, BoundingSphere value)
+        {
+            output.Write(value.Center);
+            output.Write(value.Radius);
+        }
+
+        private void WriteParts(ContentWriter output, DynamicModelContent model, List<DynamicModelMeshPartContent> parts)
+        {
+            output.Write((UInt32)parts.Count);
+
+            foreach (var part in parts)
+            {
+                output.Write((UInt32)part.VertexOffset);
+                output.Write((UInt32)part.NumVertices);
+                output.Write((UInt32)part.StartIndex);
+                output.Write((UInt32)part.PrimitiveCount);
+                output.WriteObject(part.Tag);
+
+                output.WriteSharedResource(part.VertexBuffer);
+                output.WriteSharedResource(part.IndexBuffer);
+                output.WriteSharedResource(part.Material);
+            }
+
+            return;
+        }
+        
+        public override string GetRuntimeType(TargetPlatform targetPlatform)
+        {
+            return "Microsoft.Xna.Framework.Graphics.Model";
+        }
+
+        public override string GetRuntimeReader(TargetPlatform targetPlatform)
+        {
+            return "Microsoft.Xna.Framework.Content.ModelReader, Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553";
+        }
+    }
+}

+ 50 - 0
Content.Pipeline/GraphicsImporters/Serialization/DynamicVertexBufferWriter.cs

@@ -0,0 +1,50 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System;
+using Microsoft.Xna.Framework.Content.Pipeline;
+using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
+using tainicom.Aether.Content.Pipeline.Graphics;
+
+namespace tainicom.Aether.Content.Pipeline.Serialization
+{
+    [ContentTypeWriter]
+    public class DynamicVertexBufferWriter : ContentTypeWriter<DynamicVertexBufferContent>
+    {    
+        protected override void Write(ContentWriter output, DynamicVertexBufferContent buffer)
+        {            
+            WriteVertexBuffer(output, buffer);
+
+            output.Write(buffer.IsWriteOnly);
+
+            return;
+        }
+
+        private void WriteVertexBuffer(ContentWriter output, DynamicVertexBufferContent buffer)
+        {
+            var vertexCount = buffer.VertexData.Length / buffer.VertexDeclaration.VertexStride;
+            output.WriteRawObject(buffer.VertexDeclaration);
+            output.Write((UInt32)vertexCount);
+            output.Write(buffer.VertexData);
+        }
+                
+        public override string GetRuntimeReader(TargetPlatform targetPlatform)
+        {
+            return "tainicom.Aether.Graphics.Content.DynamicVertexBufferReader, Aether.Graphics";
+        }
+        
+    }
+}

+ 5 - 0
Content.Pipeline/GraphicsImporters/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MonoGame.Framework.Content.Pipeline.Portable" version="3.2.99.1-Beta" targetFramework="net45" />
+  <package id="MonoGame.Framework.Portable" version="3.2.99.1-Beta" targetFramework="net45" />
+</packages>

+ 54 - 0
Graphics/Aether.Graphics.PORTABLE.csproj

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <ProjectGuid>{3E3BB349-662A-4628-B033-154CB8CD2F2A}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>tainicom.Aether.Graphics</RootNamespace>
+    <AssemblyName>Aether.Graphics</AssemblyName>
+    <TargetFrameworkProfile>Profile328</TargetFrameworkProfile>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\bin\Debug\Portable\</OutputPath>
+    <DefineConstants>DEBUG;PORTABLE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\bin\Release\Portable\</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+    <DefineConstants>PORTABLE</DefineConstants>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="ContentReaders\DynamicIndexBufferReader.cs" />
+    <Compile Include="ContentReaders\DynamicVertexBufferReader.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <ItemGroup>
+    <Reference Include="MonoGame.Framework">
+      <HintPath>..\packages\MonoGame.Framework.Portable.3.2.99.1-Beta\lib\portable-net40+sl40+win+wp80\MonoGame.Framework.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Graphics\" />
+  </ItemGroup>
+</Project>

+ 58 - 0
Graphics/Aether.Graphics.WINDOWS.MG.csproj

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{0A4ED2DF-9CDD-4C98-83AA-1898A394AC27}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Graphics</RootNamespace>
+    <AssemblyName>Aether.Graphics</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\bin\Debug\Windows\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;WINDOWS MG</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\bin\Release\Windows\</OutputPath>
+    <DefineConstants>TRACE;WINDOWS MG</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MonoGame.Framework, Version=3.1.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\MonoGame.Framework.Portable.3.2.99.1-Beta\lib\portable-net40+sl40+win+wp80\MonoGame.Framework.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ContentReaders\DynamicIndexBufferReader.cs" />
+    <Compile Include="ContentReaders\DynamicVertexBufferReader.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 69 - 0
Graphics/Aether.Graphics.WINDOWS.XNA.csproj

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectGuid>{838D803F-F140-4763-A378-56DC27EDD5F3}</ProjectGuid>
+    <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Graphics</RootNamespace>
+    <AssemblyName>Aether.Graphics</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+    <XnaPlatform>Windows</XnaPlatform>
+    <XnaProfile>Reach</XnaProfile>
+    <XnaCrossPlatformGroupID>7b7d3ecb-9ffb-48a5-b97e-52538fb3d57d</XnaCrossPlatformGroupID>
+    <XnaOutputType>Library</XnaOutputType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\bin\Debug\Windows.XNA\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;WINDOWS XNA</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoStdLib>true</NoStdLib>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <PlatformTarget>x86</PlatformTarget>
+    <XnaCompressContent>false</XnaCompressContent>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\bin\Release\Windows.XNA\</OutputPath>
+    <DefineConstants>TRACE;WINDOWS XNA</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoStdLib>true</NoStdLib>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <PlatformTarget>x86</PlatformTarget>
+    <XnaCompressContent>true</XnaCompressContent>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ContentReaders\DynamicIndexBufferReader.cs" />
+    <Compile Include="ContentReaders\DynamicVertexBufferReader.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
+  <!--
+      To modify your build process, add your task inside one of the targets below and uncomment it. 
+      Other similar extension points exist, see Microsoft.Common.targets.
+      <Target Name="BeforeBuild">
+      </Target>
+      <Target Name="AfterBuild">
+      </Target>
+    -->
+</Project>

+ 53 - 0
Graphics/ContentReaders/DynamicIndexBufferReader.cs

@@ -0,0 +1,53 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace tainicom.Aether.Graphics.Content
+{
+    public class DynamicIndexBufferReader : ContentTypeReader<DynamicIndexBuffer>
+    {
+        protected override DynamicIndexBuffer Read(ContentReader input, DynamicIndexBuffer buffer)
+        {   
+            IGraphicsDeviceService graphicsDeviceService = (IGraphicsDeviceService)input.ContentManager.ServiceProvider.GetService(typeof(IGraphicsDeviceService));
+            var device = graphicsDeviceService.GraphicsDevice;
+
+            // read IndexBuffer
+            var is16Bit = input.ReadBoolean();
+            var dataSize = (int)input.ReadUInt32();
+            byte[] data = new byte[dataSize];
+            input.Read(data, 0, dataSize);
+
+            // read IsWriteOnly
+            bool IsWriteOnly = input.ReadBoolean();
+
+
+            if (buffer == null)
+            {
+                var elementSize = (is16Bit) ? IndexElementSize.SixteenBits : IndexElementSize.ThirtyTwoBits;
+                var stride = (is16Bit) ? 2 : 4;
+                var indexCount = dataSize / stride;
+                BufferUsage usage = (IsWriteOnly) ? BufferUsage.WriteOnly : BufferUsage.None;
+                buffer = new DynamicIndexBuffer(device, elementSize, indexCount, usage);
+            }
+
+            buffer.SetData(data, 0, dataSize);
+
+            return buffer;
+        }
+    }
+}

+ 49 - 0
Graphics/ContentReaders/DynamicVertexBufferReader.cs

@@ -0,0 +1,49 @@
+#region License
+//   Copyright 2016 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace tainicom.Aether.Graphics.Content
+{
+    public class DynamicVertexBufferReader : ContentTypeReader<DynamicVertexBuffer>
+    {
+        protected override DynamicVertexBuffer Read(ContentReader input, DynamicVertexBuffer buffer)
+        {   
+            IGraphicsDeviceService graphicsDeviceService = (IGraphicsDeviceService)input.ContentManager.ServiceProvider.GetService(typeof(IGraphicsDeviceService));
+            var device = graphicsDeviceService.GraphicsDevice;
+
+            // read standard VertexBuffer
+            var declaration = input.ReadRawObject<VertexDeclaration>();
+            var vertexCount = (int)input.ReadUInt32();
+            int dataSize = vertexCount * declaration.VertexStride;
+            byte[] data = new byte[dataSize];
+            input.Read(data, 0, dataSize);
+
+            // read extras
+            bool IsWriteOnly = input.ReadBoolean();
+            
+            if (buffer == null)
+            {
+                BufferUsage usage = (IsWriteOnly) ? BufferUsage.WriteOnly : BufferUsage.None;
+                buffer = new DynamicVertexBuffer(device, declaration, vertexCount, usage);
+            }
+            buffer.SetData(data, 0, dataSize);
+
+            return buffer;
+        }
+    }
+}

+ 30 - 0
Graphics/Properties/AssemblyInfo.cs

@@ -0,0 +1,30 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Aether.Graphics")]
+[assembly: AssemblyProduct("Aether.Graphics")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyCopyright("Copyright ©  Kastellanos Nikolaos 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+
+#if PHONE
+// Enable NEON/SIMD
+[assembly: CodeGeneration(CodeGenerationFlags.EnableFPIntrinsicsUsingSIMD)]
+#endif

+ 4 - 0
Graphics/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MonoGame.Framework.Portable" version="3.2.99.1-Beta" targetFramework="portable-net45+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10" />
+</packages>

+ 2 - 0
README.md

@@ -6,3 +6,5 @@ MonoGame Content Importers, Shaders, etc
 
 * 'DDS Importer' - Import of DDS files (images, Cubemaps). Supports conversion from DTX to Color (ex. import DTX cubemaps for Android that doesn't support DXT compressed cubemaps).
 * 'RawModelProcessor' - Import 3D Models with a raw copy of Vertex/Index data for platforms that don't support GetData().
+* 'DynamicModel' - Base Processor to customize the build in Model. It allows to modify
+VertexBuffer & IndexBuffers, make them Dynamic and WriteOnly.

BIN
bin/Release/Portable/Aether.Content.Pipeline.GraphicsImporters.dll


BIN
bin/Release/Portable/Aether.Graphics.dll


BIN
bin/Release/Windows.XNA/Aether.Content.Pipeline.GraphicsImporters.dll


BIN
bin/Release/Windows.XNA/Aether.Graphics.dll


BIN
bin/Release/Windows/Aether.Content.Pipeline.GraphicsImporters.dll


BIN
bin/Release/Windows/Aether.Graphics.dll


+ 2 - 0
packages/repositories.config

@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <repositories>
   <repository path="..\Content.Pipeline\DDSImporter\packages.config" />
+  <repository path="..\Content.Pipeline\GraphicsImporters\packages.config" />
   <repository path="..\Content.Pipeline\RawModelProcessor\packages.config" />
+  <repository path="..\Graphics\packages.config" />
 </repositories>