コード例 #1
0
        private IEnumerator InitializeRoutine(SKEffectCamera other, Material material, MeshRenderer sourceRenderer,
                                              MeshRenderer targetRenderer, Mesh mesh, Transform originTransform, Transform destinationTransform)
        {
            while (RenderDataTemplate == null)
            {
                yield return(WaitCache.Frame);
            }
            OtherCamera        = other;
            PrimaryCam         = GetComponent <Camera>();
            PrimaryCam.enabled = false;
            CameraLib.Initialize(originTransform, destinationTransform);
            OriginTransform                   = originTransform;
            DestinationTransform              = destinationTransform;
            RenderDataTemplate.Material       = material;
            RenderDataTemplate.SourceRenderer = sourceRenderer;
            RenderDataTemplate.TargetRenderer = targetRenderer;
            RenderDataTemplate.SourceCollider = sourceRenderer.GetComponent <Collider>();
            RenderDataTemplate.TargetCollider = targetRenderer.GetComponent <Collider>();
            RenderDataTemplate.Mesh           = mesh;

            //Init cache
            for (var i = 0; i < (int)TextureTargetEye.Count; i++)
            {
                RenderDataTemplate.RenderDataCache[i] = RenderDataTemplate.Clone();
            }

            RenderDataTemplate.InitCache();
            UpdateMaterial(material);

            InstantiateRecursion(SKSGlobalRenderSettings.RecursionNumber);
            Initialized = true;
        }
コード例 #2
0
        /// <summary>
        /// Initialize this SKEffectCamera
        /// </summary>
        /// <param name="other">The Sister SKSEffectCamera</param>
        /// <param name="material">The Material to be rendered to</param>
        /// <param name="sourceRenderer">Source renderer</param>
        /// <param name="targetRenderer">Target Renderer</param>
        /// <param name="mesh">Mesh to be rendered to</param>
        public void Initialize(SKEffectCamera other, Material material, MeshRenderer sourceRenderer, MeshRenderer targetRenderer, Mesh mesh, Transform originTransform, Transform destinationTransform)
        {
            //OnDisable();

            OtherCamera        = other;
            PrimaryCam         = GetComponent <Camera>();
            PrimaryCam.enabled = false;
            CameraLib.Initialize(originTransform, destinationTransform);
            OriginTransform           = originTransform;
            DestinationTransform      = destinationTransform;
            RenderData.Material       = material;
            RenderData.SourceRenderer = sourceRenderer;
            RenderData.TargetRenderer = targetRenderer;
            RenderData.Mesh           = mesh;


            InstantiateRecursion(SKSGlobalRenderSettings.RecursionNumber);
            Initialized = true;
        }
コード例 #3
0
 /// <summary>
 ///     Initialize this SKEffectCamera
 /// </summary>
 /// <param name="other">The Sister SKSEffectCamera</param>
 /// <param name="material">The Material to be rendered to</param>
 /// <param name="sourceRenderer">Source renderer</param>
 /// <param name="targetRenderer">Target Renderer</param>
 /// <param name="mesh">Mesh to be rendered to</param>
 public void Initialize(SKEffectCamera other, Material material, MeshRenderer sourceRenderer,
                        MeshRenderer targetRenderer, Mesh mesh, Transform originTransform, Transform destinationTransform)
 {
     StartCoroutine(InitializeRoutine(other, material, sourceRenderer, targetRenderer, mesh, originTransform,
                                      destinationTransform));
 }