Пример #1
0
        private void stbtnView_Click(object sender, EventArgs e)
        {
            if (attributeListView.SelectedItems.Count <= 0)
            {
                return;
            }

            var attribute = attributeListView.SelectedItems[0];

            uint VertexID = 0;

            VertexAttributeDataList list = new VertexAttributeDataList();

            foreach (Vertex vtx in activeShape.vertices)
            {
                switch (attribute.Text)
                {
                case "_p0":
                    list.AddVector3(vtx.pos, VertexID);
                    break;

                case "_n0":
                    list.AddVector3(vtx.nrm, VertexID);
                    break;

                case "_u0":
                    list.AddVector2(vtx.uv0, VertexID);
                    break;

                case "_u1":
                    list.AddVector2(vtx.uv1, VertexID);
                    break;

                case "_u2":
                    list.AddVector2(vtx.uv2, VertexID);
                    break;

                case "_c0":
                    list.AddColor(vtx.col, VertexID);
                    break;

                case "_t0":
                    list.AddVector4(vtx.tan, VertexID);
                    break;

                case "_b0":
                    list.AddVector4(vtx.bitan, VertexID);
                    break;

                case "_w0":
                    list.AddWeights(vtx.boneWeights, VertexID);
                    break;

                case "_i0":
                    List <string> boneNames = new List <string>();
                    foreach (int id in vtx.boneIds)
                    {
                        boneNames.Add(activeShape.GetBoneNameFromIndex(activeShape.GetParentModel(), id));
                    }
                    list.AddBoneName(boneNames, vtx.boneIds, VertexID);
                    boneNames = null;
                    break;

                case "_w1":
                    list.AddWeights(vtx.boneWeights, VertexID);
                    break;

                case "_i1":
                    List <string> boneNames2 = new List <string>();
                    foreach (int id in vtx.boneIds)
                    {
                        boneNames2.Add(activeShape.GetBoneNameFromIndex(activeShape.GetParentModel(), id));
                    }
                    list.AddBoneName(boneNames2, vtx.boneIds, VertexID);
                    boneNames2 = null;
                    break;
                }
                VertexID++;
            }

            list.Show();
        }
Пример #2
0
        private void LoadAttribute(string attribute)
        {
            VertexAttributeDataList list = new VertexAttributeDataList();

            foreach (Vertex vtx in activeShape.vertices)
            {
                switch (attribute)
                {
                case "_p0":
                    list.AddVector3(vtx.pos);
                    break;

                case "_n0":
                    list.AddVector3(vtx.nrm);
                    break;

                case "_u0":
                    list.AddVector2(vtx.uv0);
                    break;

                case "_u1":
                    list.AddVector2(vtx.uv1);
                    break;

                case "_u2":
                    list.AddVector2(vtx.uv2);
                    break;

                case "_c0":
                    list.AddColor(vtx.col);
                    break;

                case "_t0":
                    list.AddVector4(vtx.tan);
                    break;

                case "_b0":
                    list.AddVector4(vtx.bitan);
                    break;

                case "_w0":
                    list.AddWeights(vtx.weights);
                    break;

                case "_i0":
                    List <string> boneNames = new List <string>();
                    foreach (int id in vtx.boneIds)
                    {
                        boneNames.Add(activeShape.GetBoneNameFromIndex(activeModel, id));
                    }
                    list.AddBoneName(boneNames);
                    boneNames = null;
                    break;

                case "_w1":
                    list.AddWeights(vtx.weights);
                    break;

                case "_i1":
                    List <string> boneNames2 = new List <string>();
                    foreach (int id in vtx.boneIds)
                    {
                        boneNames2.Add(activeShape.GetBoneNameFromIndex(activeModel, id));
                    }
                    list.AddBoneName(boneNames2);
                    boneNames2 = null;
                    break;
                }
            }
            list.Show();
        }