コード例 #1
0
        public IEnumerator ConvertAssetsWithExternalTextures()
        {
            ContentServerUtils.MappingPair[] input =
            {
                new ContentServerUtils.MappingPair {
                    file = "SimpleCubeWithSharedNormal.gltf", hash = "SimpleCubeWithSharedNormal.gltf"
                },
                new ContentServerUtils.MappingPair {
                    file = "SimpleCubeWithSharedNormal.bin", hash = "SimpleCubeWithSharedNormal.bin"
                },
                new ContentServerUtils.MappingPair {
                    file = "Textures/Test.png", hash = "Test.png"
                }
            };

            core.settings.baseUrl = Utils.GetTestsAssetsPath() + "/GLTF/SimpleCube/";

            env  = ABConverter.Environment.CreateWithDefaultImplementations();
            core = new ABConverter.Core(env, core.settings);

            core.Convert(input);

            yield return(new WaitUntil(() => core.state.step == ABConverter.Core.State.Step.FINISHED));

            Assert.IsTrue(core.state.lastErrorCode == ABConverter.Core.ErrorCodes.SUCCESS);

            AssetBundle abDependency = AssetBundle.LoadFromFile(ABConverter.Config.ASSET_BUNDLES_PATH_ROOT + "/Test.png");

            abDependency.LoadAllAssets();

            AssetBundle abMain = AssetBundle.LoadFromFile(ABConverter.Config.ASSET_BUNDLES_PATH_ROOT + "/SimpleCubeWithSharedNormal.gltf");

            Material[] mats = abMain.LoadAllAssets <Material>();

            bool hasMap = false;

            foreach (var mat in mats)
            {
                hasMap = mat.GetTexture("_BaseMap") != null;
            }

            abMain.Unload(true);
            abDependency.Unload(true);

            Assert.IsTrue(hasMap, "Dependency has NOT been generated correctly!");
        }
コード例 #2
0
        public void SetUp()
        {
            ResetCacheAndWorkingFolders();

            var settings = new ABConverter.Client.Settings(ContentServerUtils.ApiTLD.ZONE);

            settings.deleteDownloadPathAfterFinished = false;

            env  = ABConverter.Environment.CreateWithMockImplementations();
            core = new ABConverter.Core(env, settings);

            if (env.webRequest is Mocked.WebRequest mockedReq)
            {
                mockedReq.mockedContent.Add($"{baseUrl}{hash1}", contentData1);
                mockedReq.mockedContent.Add($"{baseUrl}{hash2}", contentData2);
                mockedReq.mockedContent.Add($"{baseUrl}{hash3}", contentData3);
            }
        }