Esempio n. 1
0
        public IEnumerator SetTheCorrectMaterialWhenLoadingMultipleTimes()
        {
            avatarModel = AvatarShapeTestHelpers.GetTestAvatarModel("test", "TestAvatar.json");
            avatarShape.avatarRenderer.ApplyModel(avatarModel, null, null);
            avatarShape.avatarRenderer.ApplyModel(avatarModel, null, null);
            avatarShape.avatarRenderer.ApplyModel(avatarModel, null, null);

            bool lastUpdateIsDone = false;

            avatarShape.avatarRenderer.ApplyModel(avatarModel, () => lastUpdateIsDone = true, null);

            yield return(new DCL.WaitUntil(() => lastUpdateIsDone));

            var             wearableControllers = AvatarRenderer_Mock.GetWearableMockControllers(avatarShape.avatarRenderer);
            List <Material> materials           = new List <Material>();

            foreach (var wearableControllerMock in wearableControllers.Values)
            {
                if (wearableControllerMock.category == WearableLiterals.Categories.EYES || wearableControllerMock.category == WearableLiterals.Categories.EYEBROWS || wearableControllerMock.category == WearableLiterals.Categories.MOUTH)
                {
                    continue;
                }

                materials.AddRange(wearableControllerMock.myAssetContainer.GetComponentsInChildren <Renderer>().SelectMany(x => x.materials).ToList());
            }

            Assert.IsTrue(materials.All(x => x.shader.name == "DCL/Toon Shader"));
        }
        public IEnumerator SetTheCorrectMaterial()
        {
            avatarModel = AvatarShapeTestHelpers.GetTestAvatarModel("test", "TestAvatar.json");
            yield return(avatarShape.ApplyChanges(JsonUtility.ToJson(avatarModel)));

            var             wearableControllers = AvatarRenderer_Mock.GetWearableMockControllers(avatarShape.avatarRenderer);
            List <Material> materials           = new List <Material>();

            foreach (var wearableControllerMock in wearableControllers.Values)
            {
                if (wearableControllerMock.category == WearableLiterals.Categories.EYES || wearableControllerMock.category == WearableLiterals.Categories.EYEBROWS || wearableControllerMock.category == WearableLiterals.Categories.MOUTH)
                {
                    continue;
                }

                materials.AddRange(wearableControllerMock.myAssetContainer.GetComponentsInChildren <Renderer>().SelectMany(x => x.materials).ToList());
            }

            Assert.IsTrue(materials.All(x => x.shader.name == "DCL/Toon Shader"));
        }