private void addTransformWithoutWeightCheck( Node bone, int weight, int firstVertex, int numVertices) { this.requireIsLegacy(); SkinnedMesh.requireValidVertexRange(firstVertex, numVertices, (int)ushort.MaxValue); this.addBone(bone); this.addWeight(bone, weight, firstVertex, numVertices); }
protected void addWeight(Node bone, int weight, int firstVertex, int numVertices) { SkinnedMesh.requireBoneNotNull(bone); this.requireVertexBufferNotNull(); int vertexCount = this.getVertexBuffer().getVertexCount(); SkinnedMesh.requireValidVertexRange(firstVertex, numVertices, vertexCount); if (this.m_weightsByBone == null) { this.m_weightsByBone = new Dictionary <Node, int[]>(); } int[] numArray1 = this.m_weightsByBone.ContainsKey(bone) ? this.m_weightsByBone[bone] : new int[vertexCount]; if (this.m_summedWeights.Length == 0) { this.m_summedWeights = new int[vertexCount]; } int[] numArray2 = numArray1; int num1 = firstVertex + numVertices; for (int index = firstVertex; index < num1; ++index) { int num2 = numArray2[index]; this.m_summedWeights[index] -= Math.Abs(num2); int num3 = num2 + weight; this.m_summedWeights[index] += Math.Abs(num3); numArray2[index] = num3; } if (this.m_weightsByBone.ContainsKey(bone)) { this.m_weightsByBone[bone] = numArray1; } else { this.m_weightsByBone.Add(bone, numArray1); } }