Exemple #1
0
        private static IMeshConverter CreateMeshConverter()
        {
            IMeshConverter meshConverter = AvatarSdkMgr.IoCContainer.Create <IMeshConverter>();

            if (meshConverter == null)
            {
                Debug.LogError("Unable to create mesh converter");
            }
            return(meshConverter);
        }
        private IEnumerator InitializeScene()
        {
            if (initParams != null)
            {
                avatarProvider    = initParams.avatarProvider;
                sceneToReturn     = initParams.sceneToReturn;
                currentAvatarCode = initParams.avatarCode;
                useAnimations     = initParams.useAnimations;

#if !UNITY_WEBGL
                IMeshConverter meshConverter = AvatarSdkMgr.IoCContainer.Create <IMeshConverter>();
                if (meshConverter.IsObjConvertEnabled)
                {
                    convertToObjButton.gameObject.SetActive(true);
                }

                if (meshConverter.IsFBXExportEnabled)
                {
                    fbxExportButton.gameObject.SetActive(true);
                }
#endif

#if UNITY_EDITOR
                prefabButton.gameObject.SetActive(true);
#endif
                settingsPanel.SetActive(initParams.showSettings);
                animationsPanel.SetActive(initParams.useAnimations);
                blendshapesPanel.SetActive(!initParams.useAnimations);
                if (initParams.faceAvatarRequest != null)
                {
                    isWebGLDemo    = true;
                    headAvatarCode = currentAvatarCode;
                    StartCoroutine(WaitFaceAvatarCalculations(initParams.faceAvatarRequest));
                }
                initParams = null;

                yield return(ShowAvatar(currentAvatarCode));
            }
            else
            {
                Debug.LogError("Scene parameters were no set!");
            }
        }
        void IStreamConverter.Convert(
            Stream sourceStream,
            FileFormat sourceFileFormat,
            Stream destStream,
            FileFormat destFileFormat,
            IEnumerable <IMeshOperation> meshOperations)
        {
            IMeshConverter sourceMeshConverter = meshConverterFactory.CreateMeshConverter(sourceFileFormat);
            IMeshConverter destMeshConverter   = meshConverterFactory.CreateMeshConverter(destFileFormat);

            IMesh mesh = sourceMeshConverter.FromStream(sourceStream);

            foreach (IMeshOperation meshOperation in meshOperations)
            {
                meshOperation.Execute(mesh);
            }

            using (Stream stream = destMeshConverter.ToStream(mesh))
            {
                stream.CopyTo(destStream);
            }
        }