コード例 #1
0
        public void Clear()
        {
            if (Renderers != null)
            {
                Renderers.Clear();
                Renderers = null;
            }

            if (Materials != null)
            {
                for (int i = 0; i < Materials.Count; i++)
                {
                    Object.Destroy(Materials[i]);
                }
                Materials.Clear();
                Materials = null;
            }

            if (renderTextureCreated)
            {
                CommandBuffer.ReleaseTemporaryRT(tmpRenderTextureID);
                renderTextureCreated = false;
            }
            else
            {
                if (CommandBuffer != null)
                {
                    attachedCamera.RemoveCommandBuffer(CameraEvent.BeforeImageEffects, CommandBuffer);
                    CommandBuffer.Dispose();
                    CommandBuffer = null;
                }
            }

            //TODO: resettare anche la RenderTexture?
        }
コード例 #2
0
        public void Adds_to_an_empty_chain()
        {
            Renderers.Clear();
            Config.Append <NewRenderer>();

            Renderers.Single().ShouldBeType <NewRenderer>();
        }
        private void RenderTemplates_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var template = RenderTemplates.SelectedValue as string;

            Renderers.Clear();
            Renderers.AddRange(TemplateHelper.GetRenderers(template));
            SelectedRenderer = GetSelectedRenderer(template);
        }
コード例 #4
0
        // --------------------------------------------------------------------

        public void UpdateRenderers(Entity e)
        {
            Renderers.Clear();
            if (e != null)
            {
                e.Root.GetComponentsInChildren <MeshRenderer>(Renderers);
            }

            UpdateBounds();
        }
コード例 #5
0
 /// <summary>
 /// Clear this instance.
 /// </summary>
 public void clear()
 {
     lock (this.Mutex)
     {
         foreach (CadKit.Scene.Visitors.Renderer r in _renderers)
         {
             CadKit.Referenced.Base.dereference(r);
         }
         _renderers.Clear();
     }
 }
コード例 #6
0
        public void BeginUpdate()
        {
            if (!ClearOnUpdate)
            {
                return;
            }

            ClearOnUpdate = false;

            if (CommandBuffer == null)
            {
                CommandBuffer      = new CommandBuffer();
                CommandBuffer.name = "Draw Silhouettes " + mode.ToString();
                attachedCamera.AddCommandBuffer(CameraEvent.BeforeImageEffects, CommandBuffer);
            }
            else
            {
                CommandBuffer.Clear();
            }

            CommandBuffer.GetTemporaryRT(tmpRenderTextureID, -1, -1, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default, 1, false);
            renderTextureCreated = true;
            CommandBuffer.SetRenderTarget(tmpRenderTextureID);

            //commandBuffer.ClearRenderTarget( true, true, Color.green );
            CommandBuffer.ClearRenderTarget(true, true, Color.clear);

            if (Renderers == null)
            {
                Renderers = new List <Renderer>();
            }
            Renderers.Clear();

            if (Materials == null)
            {
                Materials = new List <Material>();
            }


            //             for ( int i = 0; i < Materials.Count; i++ )
            //                 Object.Destroy( Materials[i] );
            //
            //
            //             Materials.Clear();

            materialCounter = 0;
        }
コード例 #7
0
        /// <summary>
        /// Stops the packet reader, frame decoder, and block renderers
        /// </summary>
        internal void StopWorkers()
        {
            // Pause the clock so no further updates are propagated
            Clock.Pause();

            // Let the threads know a cancellation is pending.
            Commands.IsStopWorkersPending = true;

            // Cause an immediate Packet read abort
            Container?.SignalAbortReads(false);

            // Stop the rendering worker before anything else
            StopBlockRenderingWorker();

            // Call close on all renderers
            foreach (var renderer in Renderers.Values)
            {
                renderer.Close();
            }

            // Stop the rest of the workers
            // i.e. wait for worker threads to finish
            var wrokers = new[] { PacketReadingTask, FrameDecodingTask };

            foreach (var w in wrokers)
            {
                // Abort causes memory leaks bacause packets and frames might not
                // get disposed by the corresponding workers. We use Join instead.
                // w.Abort();
                w?.Join();
            }

            // Set the threads to null
            FrameDecodingTask = null;
            PacketReadingTask = null;

            // Remove the renderers disposing of them
            Renderers.Clear();

            // Reset the clock
            Clock.Reset();
        }
コード例 #8
0
ファイル: CharacterBody.cs プロジェクト: yazici/FRONTIERS
        public override void Initialize(IItemOfInterest worlditem)
        {
            base.Initialize(worlditem);

            NObject = gameObject.GetComponent <TNObject> ();

            Renderers.Clear();
            Renderers.AddRange(gameObject.GetComponentsInChildren <Renderer> (true));

            for (int i = 0; i < Renderers.Count; i++)
            {
                Renderers [i].gameObject.layer = Globals.LayerNumWorldItemActive;
            }

            SetHairLength(HairLength);

            /*if (HairLength == CharacterHairLength.Long) {
             *                                      if (ShortHairRenderer != null) {
             *                                                      ShortHairRenderer.enabled = false;
             *                                      }
             *                                      if (LongHairRenderer != null) {
             *                                                      LongHairRenderer.enabled = true;
             *                                      }
             *
             *                      } else if (HairLength == CharacterHairLength.Short) {
             *                                      if (ShortHairRenderer != null) {
             *                                                      ShortHairRenderer.enabled = true;
             *                                      }
             *                                      if (LongHairRenderer != null) {
             *                                                      LongHairRenderer.enabled = false;
             *                                      }
             *
             *                      } else {
             *                                      if (ShortHairRenderer != null) {
             *                                                      ShortHairRenderer.enabled = false;
             *                                      }
             *                                      if (LongHairRenderer != null) {
             *                                                      LongHairRenderer.enabled = false;
             *                                      }
             *                      }*/
        }
コード例 #9
0
ファイル: Game.cs プロジェクト: lucas-miranda/Raccoon
 public void ClearRenderers()
 {
     Renderers.Clear();
 }
コード例 #10
0
        public async Task CloseAsync()
        {
            Container?.Log(MediaLogMessageType.Debug, $"{nameof(CloseAsync)}: Entered");
            Clock.Pause();

            IsTaskCancellationPending = true;

            // Wait for cycles to complete.
            await Task.Run(() =>
            {
                while (!BlockRenderingCycle.Wait(1))
                {
                }
                while (!FrameDecodingCycle.Wait(1))
                {
                }
                while (!PacketReadingCycle.Wait(1))
                {
                }
            });

            BlockRenderingTask?.Join();
            FrameDecodingTask?.Join();
            PacketReadingTask?.Join();

            BlockRenderingTask = null;
            FrameDecodingTask  = null;
            PacketReadingTask  = null;

            foreach (var renderer in Renderers.Values)
            {
                renderer.Close();
            }

            Renderers.Clear();

            // Reset the clock
            Clock.Reset();

            Container?.Log(MediaLogMessageType.Debug, $"{nameof(CloseAsync)}: Completed");

            // Dispose the container
            if (Container != null)
            {
                Container.Dispose();
                Container = null;
            }

            // Dispose the Blocks for all components
            foreach (var kvp in Blocks)
            {
                kvp.Value.Dispose();
            }
            Blocks.Clear();

            // Dispose the Frames for all components
            foreach (var kvp in Frames)
            {
                kvp.Value.Dispose();
            }
            Frames.Clear();

            // Clear the render times
            LastRenderTime.Clear();

            // Update notification properties
            UpdateMediaProperties();
            MediaState = MediaState.Close;
        }
コード例 #11
0
ファイル: CutsceneBody.cs プロジェクト: yazici/FRONTIERS
        public void Start()
        {
            if (CharacterName == "[Player]")
            {
                if (Flags.Gender != (int)Profile.Get.CurrentGame.Character.Gender)
                {
                    gameObject.SetActive(false);
                    return;
                }
                else
                {
                    FaceTextureName = Profile.Get.CurrentGame.Character.FaceTextureName;
                    BodyTextureName = Profile.Get.CurrentGame.Character.BodyTextureName;
                    HairTextureName = Profile.Get.CurrentGame.Character.HairTextureName;
                    HairLength      = Profile.Get.CurrentGame.Character.HairLength;
                    HairColor       = Profile.Get.CurrentGame.Character.HairColor;
                }
            }
            else
            {
                CharacterTemplate template = null;
                if (Characters.GetTemplate(false, CharacterName, out template))
                {
                    if (string.IsNullOrEmpty(FaceTextureName))
                    {
                        FaceTextureName = template.StateTemplate.FaceTextureName;
                    }
                    if (string.IsNullOrEmpty(BodyTextureName))
                    {
                        BodyTextureName = template.StateTemplate.BodyTextureName;
                    }

                    if (template.StateTemplate.RelatedToPlayer)
                    {
                        FaceTextureName = Characters.MatchFaceTextureEthnicity(FaceTextureName, Profile.Get.CurrentGame.Character.Ethnicity);
                    }

                    HairTextureName = BodyTextureName;
                    HairLength      = template.StateTemplate.HairLength;
                    HairColor       = template.StateTemplate.HairColor;
                    Debug.Log("Template: " + CharacterName + ", Face name: " + FaceTextureName + ", Body Name: " + BodyTextureName);
                }
                else
                {
                    Debug.Log("COULDN'T GET TEMPLATE IN CUTSCENE BODY");
                }
            }


            Renderers.Clear();
            Renderers.AddRange(transform.GetComponentsInChildren <Renderer> ());

            gameObject.SetLayerRecursively(Globals.LayerNumScenery);

            Texture2D     bodyTexture  = null;
            Texture2D     faceTexture  = null;
            Texture2D     hairTexture  = null;
            Material      bodyMaterial = null;
            Material      faceMaterial = null;
            Material      hairMaterial = null;
            CharacterBody body         = this;

            //update textures
            bodyMaterial = body.MainMaterial;
            if (bodyMaterial == null)
            {
                bodyMaterial      = new Material(Characters.Get.CharacterBodyMaterial);
                bodyMaterial.name = "NewBodyMaterial";
                body.MainMaterial = bodyMaterial;
            }
            faceMaterial = body.FaceMaterial;
            if (faceMaterial == null)
            {
                faceMaterial      = new Material(Characters.Get.CharacterFaceMaterial);
                faceMaterial.name = "NewFaceMaterial";
                body.FaceMaterial = faceMaterial;
            }
            hairMaterial = body.HairMaterial;
            if (hairMaterial == null)
            {
                hairMaterial      = new Material(Characters.Get.CharacterHairMaterial);
                hairMaterial.name = "NewHairMaterial";
                body.HairMaterial = hairMaterial;
            }

            if (Mods.Get.Runtime.BodyTexture(ref bodyTexture, BodyTextureName))
            {
                bodyMaterial.SetTexture("_MainTex", bodyTexture);
            }
            else
            {
                Debug.Log("Couldn't get body texture " + BodyTextureName);
            }
            if (Mods.Get.Runtime.FaceTexture(ref faceTexture, FaceTextureName))
            {
                faceMaterial.SetTexture("_MainTex", faceTexture);
            }
            else
            {
                Debug.Log("Couldn't get body texture " + FaceTextureName);
            }
            if (Mods.Get.Runtime.BodyTexture(ref hairTexture, HairTextureName))
            {
                hairMaterial.SetTexture("_MainTex", hairTexture);
                //now apply the hair color - we use a full red texture to color the whole texture
                hairMaterial.SetColor("_EyeColor", Colors.Get.HairColor(HairColor));
            }

            body.SetHairLength(HairLength);
        }