Пример #1
0
        public Skeleton CollectSkeleton()
        {
            //System.Diagnostics.Debugger.Launch();
            Skeleton skele = new Skeleton();

            List<Joint> joints = new List<Joint>();
            List<LimbNodeProperty<LimbNodeNodeAttributeType>> attrType = new List<LimbNodeProperty<LimbNodeNodeAttributeType>>();
            List<LimbNodeProperty<LimbNodeJointType>> jointTypes = new List<LimbNodeProperty<LimbNodeJointType>>();
            List<DeformerProperty<JointPropertyType>> deformTypes = new List<DeformerProperty<JointPropertyType>>();

            for (int i = 0; i < _properties.Count; i++)
            {
                IObjectProperty type = _properties[i];

                if (type.GetType() == typeof(LimbNodeProperty<LimbNodeJointType>))
                    jointTypes.Add((LimbNodeProperty<LimbNodeJointType>)type);
                else if (type.GetType() == typeof(LimbNodeProperty<LimbNodeNodeAttributeType>))
                    attrType.Add((LimbNodeProperty<LimbNodeNodeAttributeType>)type);
                else if (type.GetType() == typeof(DeformerProperty<JointPropertyType>))
                    deformTypes.Add((DeformerProperty<JointPropertyType>)type);
            }

            for (int i = 0; i < attrType.Count; i++)
            {
                for (int q = 0; q < jointTypes.Count; q++)
                {
                    ObjectConnection con = _connections.Find(obj => (attrType[i].ID == obj.Id1) && (jointTypes[q].ID == obj.Id2));

                    if (con != null)
                    {
                        if (!attrType[i].PropertyType.IsSkeletonType)
                            break;

                        for (int w = 0; w < deformTypes.Count; w++)
                        {
                            ObjectConnection con2 = _connections.Find(obj => (jointTypes[q].ID == obj.Id1) && (deformTypes[w].ID == obj.Id2));

                            if (con2 != null)
                            {
                                //System.Diagnostics.Debugger.Launch();
                                int parentId = FindParentOfJoint(jointTypes[q].ID, jointTypes);
                                skele.AddJoint(new Joint(jointTypes[q].Name, jointTypes[q].ID, parentId, jointTypes[q].PropertyType.Translation,
                                    jointTypes[q].PropertyType.Rotation, jointTypes[q].PropertyType.Scale, deformTypes[w].Indicies, deformTypes[w].PropertyType.Weights));
                                break;
                            }
                        }

                        break;
                    }
                }
            }

            skele.FinaliseJointTree();

            return skele;
        }
Пример #2
0
 public ANSKModelContent(List<Vector3> verts, List<int> vertInd, List<Vector2> uv, List<int> uvInd, List<int> edges, List<Vector3> normals, Skeleton joints, ANSKTagData tagData)
 {
     Verticies = verts;
     VertexIndicies = vertInd;
     Uvs = uv;
     UvIndicies = uvInd;
     Edges = edges;
     Normals = normals;
     Joints = joints;
     TagData = tagData;
 }
Пример #3
0
        //public ANSKTagData TagData { get { return _tagData; } }
        public ANSKModel(ANSKModelContent content)
        {
            _tagData = content.TagData;
            _verts = content.Verticies;
            RemakeIndices(content.VertexIndicies);
            _uvs = content.Uvs;
            _uvIndicies = content.UvIndicies;
            _edges = content.Edges;
            _normals = content.Normals;
            _skeleton = content.Joints;
            _joints = _skeleton.ToJointList();
            _skin = content.TagData.SkinData;

            _skeleton.Init();
            // Find a way to load in the effect;

            _verticies = new ANSKVertexDeclaration[_verts.Count];
            _poop = new VertexPositionColor[_verts.Count];
        }