コード例 #1
0
        public void FilterChannels_DisablesChannelsWithWeightBelowTolerance()
        {
            var e = new EditableBoneWeight();

            e.AddChannel(0, 0.2f, true);
            e.AddChannel(1, 0.2f, true);
            e.AddChannel(2, 0.3f, true);
            e.AddChannel(3, 0.3f, true);

            e.FilterChannels(0.25f);

            Assert.False(e[0].enabled, "Channel should be disabled");
            Assert.False(e[1].enabled, "Channel should be disabled");
            Assert.True(e[2].enabled, "Channel should be enabled");
            Assert.True(e[3].enabled, "Channel should be enabled");
            Assert.AreEqual(0f, e[0].weight, "Incorrect boneWeight");
            Assert.AreEqual(0f, e[1].weight, "Incorrect boneWeight");
            Assert.AreEqual(0.3f, e[2].weight, "Incorrect boneWeight");
            Assert.AreEqual(0.3f, e[3].weight, "Incorrect boneWeight");
        }
コード例 #2
0
        public void FilterChannels_DisablesChannelsWithWeightBelowTolerance()
        {
            EditableBoneWeight editableBoneWeight = new EditableBoneWeight();

            editableBoneWeight.AddChannel(new BoneWeightData(0, 0.2f), true);
            editableBoneWeight.AddChannel(new BoneWeightData(1, 0.2f), true);
            editableBoneWeight.AddChannel(new BoneWeightData(2, 0.3f), true);
            editableBoneWeight.AddChannel(new BoneWeightData(3, 0.3f), true);

            editableBoneWeight.FilterChannels(0.25f);

            Assert.False(editableBoneWeight.IsChannelEnabled(0), "Channel should be disabled");
            Assert.False(editableBoneWeight.IsChannelEnabled(1), "Channel should be disabled");
            Assert.True(editableBoneWeight.IsChannelEnabled(2), "Channel should be enabled");
            Assert.True(editableBoneWeight.IsChannelEnabled(3), "Channel should be enabled");
            Assert.AreEqual(0f, editableBoneWeight.GetBoneWeightData(0).weight, "Incorrect boneWeight");
            Assert.AreEqual(0f, editableBoneWeight.GetBoneWeightData(1).weight, "Incorrect boneWeight");
            Assert.AreEqual(0.3f, editableBoneWeight.GetBoneWeightData(2).weight, "Incorrect boneWeight");
            Assert.AreEqual(0.3f, editableBoneWeight.GetBoneWeightData(3).weight, "Incorrect boneWeight");
        }