Ejemplo n.º 1
0
        } // Load8

        private void LoadMeshType6(BinaryReader br)
        {
            UInt16 vidx;

            VertexCount = br.ReadUInt16();


            if (HasPosition())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    vidx = br.ReadUInt16();
                    Vertex.Add(bh.ReadVector3f());
                }
            }

            if (HasNormal())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    vidx = br.ReadUInt16();
                    Normal.Add(bh.ReadVector3f());
                }
            }

            if (HasColor())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    Color.Add(bh.ReadVector4f());
                }
            }

            if (HasSkin())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    vidx = br.ReadUInt16();
                    Vector4  weights = bh.ReadVector4f();
                    Vector4w ids     = bh.ReadVector4w();

                    for (int wi = 0; wi < 4; wi++)
                    {
                        if (weights[wi] != 0.0f)
                        {
                            BoneWeights.Add(new BoneWeight(i, BoneIndices[ids[wi]], weights[wi]));
                        }
                    }
                }
            }

            if (HasTangents())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    vidx = br.ReadUInt16();
                    Tangent.Add(bh.ReadVector3f());
                }
            }

            for (int c = 0; c < 4; c++)
            {
                if (HasUVChannel(c))
                {
                    for (int i = 0; i < VertexCount; i++)
                    {
                        vidx = br.ReadUInt16();
                        // (x, 1.0f - y)
                        UV[c].Add(bh.ReadUVVector2f());
                    }
                }
            }

            FaceCount = br.ReadUInt16();

            for (int findex = 0; findex < FaceCount; findex++)
            {
                vidx = br.ReadUInt16();
                Face.Add(bh.ReadVector3w());
            }
        } // Load6
Ejemplo n.º 2
0
 public ZMSSkin(Vector4 Weights, Vector4w Indices)
 {
     BoneWeights = Weights;
     BoneIndices = Indices;
 }
Ejemplo n.º 3
0
        private void LoadMeshType8(BinaryReader br)
        {
            VertexCount = br.ReadUInt16();

            if (HasPosition())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    Vertex.Add(bh.ReadVector3f());
                }
            }

            if (HasNormal())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    Normal.Add(bh.ReadVector3f());
                }
            }

            if (HasColor())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    Color.Add(bh.ReadVector4f());
                }
            }

            if (HasSkin() && HasPosition())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    Vector4  weights = bh.ReadVector4f();
                    Vector4w ids     = bh.ReadVector4w();

                    for (int wi = 0; wi < 4; wi++)
                    {
                        // do not optimize - add all 4 bone weights per vertex
                        //if (weights[wi] != 0.0f)
                        //{
                        BoneWeights.Add(new BoneWeight(i, BoneIndices[ids[wi]], weights[wi]));
                        //}
                    }
                }
            }

            if (HasTangents())
            {
                for (int i = 0; i < VertexCount; i++)
                {
                    Tangent.Add(bh.ReadVector3f());
                }
            }

            for (int c = 0; c < 4; c++)
            {
                if (HasUVChannel(c))
                {
                    for (int i = 0; i < VertexCount; i++)
                    {
                        UV[c].Add(bh.ReadVector2f());
                    }
                }
            }

            FaceCount = br.ReadUInt16();

            for (int findex = 0; findex < FaceCount; findex++)
            {
                Face.Add(bh.ReadVector3w());
            }
        } // Load8