Beispiel #1
0
        /// <summary>
        /// Function called when the volume is being disabled
        /// </summary>
        private void AuraVolume_OnUninitialize(AuraVolume auraVolume)
        {
            if (RegisteredVolumesList.Contains(auraVolume))
            {
                if (RegisteredLightProbesProxyVolumesList.Contains(auraVolume))
                {
                    RegisteredLightProbesProxyVolumesList.Remove(auraVolume);
                }

                if (OnUnregisterVolume != null)
                {
                    OnUnregisterVolume(auraVolume);
                }

                if (Texture2DMasksAtlasComposer.RemoveTexture(auraVolume.texture2DMask.texture))
                {
                    SetTexture2DMasksId();
                    Texture2DMasksAtlasComposer.Generate();
                }

                if (Texture3DMasksAtlasComposer.RemoveTexture(auraVolume.texture3DMask.texture))
                {
                    SetTexture3DMasksId();
                    Texture3DMasksAtlasComposer.Generate();
                }

                RegisteredVolumesList.Remove(auraVolume);
            }

            auraVolume.OnUninitialize -= AuraVolume_OnUninitialize;
        }
Beispiel #2
0
 /// <summary>
 /// Sets the id of the AuraVolumes's Texture3D mask in the atlas
 /// </summary>
 private void SetTexture3DMaskId(AuraVolume auraVolume)
 {
     if (auraVolume.UsesTexture3DMasking)
     {
         auraVolume.texture3DMask.textureIndex = Texture3DMasksAtlasComposer.GetTextureIndex(auraVolume.texture3DMask.texture);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Registers the Aura Volume to the global manager
        /// </summary>
        /// <param name="auravolume">The Aura Volume to register</param>
        public void RegisterVolume(AuraVolume auraVolume)
        {
            if (!RegisteredVolumesList.Contains(auraVolume))
            {
                RegisteredVolumesList.Add(auraVolume);

                if (auraVolume.useAsLightProbesProxyVolume)
                {
                    RegisteredLightProbesProxyVolumesList.Add(auraVolume);
                }

                if (auraVolume.UsesTexture2DMasking)
                {
                    Texture2DMasksAtlasComposer.AddTexture(auraVolume.texture2DMask.texture);
                    Texture2DMasksAtlasComposer.Generate();
                    SetTexture2DMasksId();
                }

                if (auraVolume.UsesTexture3DMasking)
                {
                    Texture3DMasksAtlasComposer.AddTexture(auraVolume.texture3DMask.texture);
                    Texture3DMasksAtlasComposer.Generate();
                    SetTexture3DMasksId();
                }

                if (OnRegisterVolume != null)
                {
                    OnRegisterVolume(auraVolume);
                }
            }

            auraVolume.OnUninitialize += AuraVolume_OnUninitialize;
        }