From 5be5be2c84f9697368eaa230105f952710c723ad Mon Sep 17 00:00:00 2001 From: "SND\\GinieDp_cp" Date: Sat, 12 Nov 2011 00:17:25 +0000 Subject: [PATCH] - implemented ModelBone properties - implemented ModelMesh properties - implemented ModelMeshPart properties - implemented Model properties - implemented ModelReader --- ANX.Framework/ANX.Framework.csproj | 1 + ANX.Framework/Graphics/Model.cs | 68 ++++++++------- ANX.Framework/Graphics/ModelBone.cs | 47 +++++------ ANX.Framework/Graphics/ModelMesh.cs | 108 ++++++++++++------------ ANX.Framework/Graphics/ModelMeshPart.cs | 81 +++++++++--------- 5 files changed, 152 insertions(+), 153 deletions(-) diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj index b11c4077..936cb834 100644 --- a/ANX.Framework/ANX.Framework.csproj +++ b/ANX.Framework/ANX.Framework.csproj @@ -64,6 +64,7 @@ + diff --git a/ANX.Framework/Graphics/Model.cs b/ANX.Framework/Graphics/Model.cs index 0a49b1c1..0e4d3030 100644 --- a/ANX.Framework/Graphics/Model.cs +++ b/ANX.Framework/Graphics/Model.cs @@ -54,6 +54,43 @@ namespace ANX.Framework.Graphics { public sealed class Model { + private ModelBoneCollection bones; + + public ModelBoneCollection Bones + { + get { return bones; } + } + + private ModelMeshCollection meshes; + + public ModelMeshCollection Meshes + { + get { return meshes; } + } + + private ModelBone root; + + public ModelBone Root + { + get { return root; } + } + + private Object tag; + + public Object Tag + { + get { return tag; } + set { tag = value; } + } + + public Model(ModelBoneCollection bones, ModelMeshCollection meshes, ModelBone rootBone, Object tag) + { + this.bones = bones; + this.meshes = meshes; + this.root = rootBone; + this.tag = tag; + } + public void CopyAbsoluteBoneTransformsTo(Matrix[] destinationBoneTransforms) { throw new NotImplementedException(); @@ -73,36 +110,5 @@ namespace ANX.Framework.Graphics { throw new NotImplementedException(); } - - public ModelBoneCollection Bones - { - get - { - throw new NotImplementedException(); - } - } - - public ModelMeshCollection Meshes - { - get - { - throw new NotImplementedException(); - } - } - - public ModelBone Root - { - get - { - throw new NotImplementedException(); - } - } - - public Object Tag - { - get; - set; - } - } } diff --git a/ANX.Framework/Graphics/ModelBone.cs b/ANX.Framework/Graphics/ModelBone.cs index 4b9d2b2f..ff365787 100644 --- a/ANX.Framework/Graphics/ModelBone.cs +++ b/ANX.Framework/Graphics/ModelBone.cs @@ -54,49 +54,44 @@ namespace ANX.Framework.Graphics { public sealed class ModelBone { + private ModelBoneCollection children; public ModelBoneCollection Children { - get - { - throw new NotImplementedException(); - } + get { return children; } + internal set { children = value; } } + private int index; public int Index - { - get - { - throw new NotImplementedException(); - } + { + get { return index; } } + private string name; public string Name - { - get - { - throw new NotImplementedException(); - } + { + get { return name; } } + private ModelBone parent; public ModelBone Parent { - get - { - throw new NotImplementedException(); - } + get { return parent; } + internal set { parent = value; } } + private Matrix transform; public Matrix Transform { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } + get { return transform; } + set { transform = value; } } + public ModelBone(string name, Matrix transform, int index) + { + this.name = name; + this.transform = transform; + this.index = index; + } } } diff --git a/ANX.Framework/Graphics/ModelMesh.cs b/ANX.Framework/Graphics/ModelMesh.cs index 4854fff9..8eba6a39 100644 --- a/ANX.Framework/Graphics/ModelMesh.cs +++ b/ANX.Framework/Graphics/ModelMesh.cs @@ -1,6 +1,7 @@ #region Using Statements using System; - +using System.Collections; +using System.Collections.Generic; #endregion // Using Statements #region License @@ -54,62 +55,61 @@ namespace ANX.Framework.Graphics { public sealed class ModelMesh { + private BoundingSphere boundingSphere; + + public BoundingSphere BoundingSphere + { + get { return boundingSphere; } + } + + private ModelEffectCollection effects; + + public ModelEffectCollection Effects + { + get { return effects; } + } + + private ModelMeshPartCollection meshParts; + + public ModelMeshPartCollection MeshParts + { + get { return meshParts; } + } + + private string name; + + public string Name + { + get { return name; } + } + + private ModelBone parentBone; + + public ModelBone ParentBone + { + get { return parentBone; } + } + + private Object tag; + + public Object Tag + { + get { return tag; } + set { this.tag = value; } + } + + public ModelMesh(string name, ModelBone bone, BoundingSphere sphere, ModelMeshPart[] meshParts, Object tag) + { + this.name = name; + this.parentBone = bone; + this.boundingSphere = sphere; + this.tag = tag; + this.meshParts = new ModelMeshPartCollection(meshParts); + } + public void Draw() { throw new NotImplementedException(); } - - public BoundingSphere BoundingSphere - { - get - { - throw new NotImplementedException(); - } - } - - public ModelEffectCollection Effects - { - get - { - throw new NotImplementedException(); - } - } - - public ModelMeshPartCollection MeshParts - { - get - { - throw new NotImplementedException(); - } - } - - public string Name - { - get - { - throw new NotImplementedException(); - } - } - - public ModelBone ParentBone - { - get - { - throw new NotImplementedException(); - } - } - - public Object Tag - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - } } diff --git a/ANX.Framework/Graphics/ModelMeshPart.cs b/ANX.Framework/Graphics/ModelMeshPart.cs index 9ecfb4c4..101798eb 100644 --- a/ANX.Framework/Graphics/ModelMeshPart.cs +++ b/ANX.Framework/Graphics/ModelMeshPart.cs @@ -54,76 +54,73 @@ namespace ANX.Framework.Graphics { public sealed class ModelMeshPart { + private Effect effect; + public Effect Effect { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } + get { return effect; } + set { this.effect = value; } } - public IndexBuffer IndexBuffer + private IndexBuffer indexBufer; + + public IndexBuffer IndexBufer { - get - { - throw new NotImplementedException(); - } + get { return indexBufer; } + internal set { this.indexBufer = value; } } + private int numVertices; + public int NumVertices { - get - { - throw new NotImplementedException(); - } + get { return numVertices; } } + private int primitiveCount; + public int PrimitiveCount { - get - { - throw new NotImplementedException(); - } + get { return primitiveCount; } } + private int startIndex; + public int StartIndex { - get - { - throw new NotImplementedException(); - } + get { return startIndex; } } - public Object Tag + private Object tag; + + public Object Tag { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } + get { return tag; } + set { tag = value; } } + private VertexBuffer vertexBuffer; + public VertexBuffer VertexBuffer { - get - { - throw new NotImplementedException(); - } + get { return vertexBuffer; } + internal set { this.vertexBuffer = value; } } + private int vertexOffset; + public int VertexOffset { - get - { - throw new NotImplementedException(); - } + get { return vertexOffset; } + } + + internal ModelMeshPart(int vertexOffset, int numVertices, int startIndex, int primitiveCount, object tag) + { + this.vertexOffset = vertexOffset; + this.numVertices = numVertices; + this.startIndex = startIndex; + this.primitiveCount = primitiveCount; + this.tag = tag; } } }