//추가 : ModMeshSet으로 RigWeightTable을 만드는 기능도 추가 public VertRigWeightTable(int vertIndex, apOptModifiedMeshSet modMeshSet, apOptModifiedMesh_VertexRig modMeshSet_Rigging) { apOptModifiedMesh_VertexRig.VertexRig.WeightPair[] weightPairs = modMeshSet_Rigging._vertRigs[vertIndex]._weightPairs; _rigTable = new RigBoneWeightPair[weightPairs.Length]; //float totalWeight = 0.0f; _totalRiggingWeight = 0.0f; for (int i = 0; i < weightPairs.Length; i++) { _rigTable[i] = new RigBoneWeightPair(modMeshSet._targetTransform, weightPairs[i]._bone, weightPairs[i]._weight); _totalRiggingWeight += weightPairs[i]._weight; } //Debug.Log("VertRigWeightTable : " + totalWeight); //RiggingMatrix를 위해서는 무조건 Normalize를 해야한다. //주의 : _totalRiggingWeight이 값은 1이 아닌 원래의 Weight 합을 유지해야한다. 보간시 필요 if (_totalRiggingWeight > 0.0f) { for (int i = 0; i < _rigTable.Length; i++) { _rigTable[i]._weight /= _totalRiggingWeight; } } _nRigTable = _rigTable.Length; }
public VertRigWeightTable(int vertIndex, apOptModifiedMesh modMesh) { apOptModifiedVertexRig.OptWeightPair[] weightPairs = modMesh._vertRigs[vertIndex]._weightPairs; _rigTable = new RigBoneWeightPair[weightPairs.Length]; float totalWeight = 0.0f; for (int i = 0; i < weightPairs.Length; i++) { _rigTable[i] = new RigBoneWeightPair(modMesh._targetTransform, weightPairs[i]._bone, weightPairs[i]._weight); totalWeight += weightPairs[i]._weight; } if (totalWeight < 1.0f && totalWeight > 0.0f) { for (int i = 0; i < _rigTable.Length; i++) { _rigTable[i]._weight /= totalWeight; } } _nRigTable = _rigTable.Length; }