Пример #1
0
        //============================================================
        public void UnserializeWeight(IInput input)
        {
            // 读取顶点坐标
            int boneCount = input.ReadInt32();

            for (int n = 0; n < boneCount; n++)
            {
                FDrVertexWeight weight = new FDrVertexWeight();
                weight.Unserialize(input);
                _weights.Push(weight);
            }
            // 排序权重内容
            if (!_weights.IsEmpty)
            {
                _weights.Sort(FDrVertexWeight.Comparer);
                if (_weights.Count > _maxWeightCount)
                {
                    float total = 0;
                    for (int n = 0; n < _maxWeightCount; n++)
                    {
                        total += _weights[n].Weight;
                    }
                    for (int n = 0; n < _maxWeightCount; n++)
                    {
                        FDrVertexWeight weight = _weights[n];
                        weight.Weight = weight.Weight / total;
                    }
                }
            }
        }