Beispiel #1
0
    public void Destroy()
    {
        #if UNITY_EDITOR
            if (PatchMaterial != null)
            {
                Material.DestroyImmediate(PatchMaterial);
                PatchMaterial = null;
            }

            if (PackNoiseMaterial != null)
            {
                Material.DestroyImmediate(PackNoiseMaterial);
                PackNoiseMaterial = null;
            }

            if (SimpleTexMaterial != null)
            {
                Material.DestroyImmediate(SimpleTexMaterial);
                SimpleTexMaterial = null;
            }

            if (OuterAtmosphereMaterial != null)
            {
                Material.DestroyImmediate(OuterAtmosphereMaterial);
                OuterAtmosphereMaterial = null;
            }

            if (InnerAtmosphereMaterial != null)
            {
                Material.DestroyImmediate(InnerAtmosphereMaterial);
                InnerAtmosphereMaterial = null;
            }

            if (GenNoiseMaterial != null)
            {
                for (int i = 0; i < NoiseMaterialNames.Length; i++)
                {
                    if (GenNoiseMaterial[i] != null)
                    {
                        Material.DestroyImmediate(GenNoiseMaterial[i]);
                        GenNoiseMaterial[i] = null;
                    }
                }
                GenNoiseMaterial = null;
            }

            if (GenNormalMaterial != null)
            {
                Material.DestroyImmediate(GenNormalMaterial);
                GenNormalMaterial = null;
            }

            if (ShapeNoiseMaterial != null)
            {
                Material.DestroyImmediate(ShapeNoiseMaterial);
                ShapeNoiseMaterial = null;
            }

            if (PermTex != null)
            {
                Texture2D.DestroyImmediate(PermTex);
                PermTex = null;
            }

            if (SimplexTex != null)
            {
                Texture2D.DestroyImmediate(SimplexTex);
                SimplexTex = null;
            }

        #else

        if (PatchMaterial != null)
            {
                Material.Destroy(PatchMaterial);
                PatchMaterial = null;
            }

            if (PackNoiseMaterial != null)
            {
                Material.Destroy(PackNoiseMaterial);
                PackNoiseMaterial = null;
            }

            if (SimpleTexMaterial != null)
            {
                Material.Destroy(SimpleTexMaterial);
                SimpleTexMaterial = null;
            }

            if (OuterAtmosphereMaterial != null)
            {
                Material.Destroy(OuterAtmosphereMaterial);
                OuterAtmosphereMaterial = null;
            }

            if (InnerAtmosphereMaterial != null)
            {
                Material.Destroy(InnerAtmosphereMaterial);
                InnerAtmosphereMaterial = null;
            }

            if (GenNoiseMaterial != null)
            {
                for (int i = 0; i < NoiseMaterialNames.Length; i++)
                {
                    if (GenNoiseMaterial[i] != null)
                    {
                        Material.Destroy(GenNoiseMaterial[i]);
                        GenNoiseMaterial[i] = null;
                    }
                }
                GenNoiseMaterial = null;
            }

            if (GenNormalMaterial != null)
            {
                Material.Destroy(GenNormalMaterial);
                GenNormalMaterial = null;
            }

            if (ShapeNoiseMaterial != null)
            {
                Material.Destroy(ShapeNoiseMaterial);
                ShapeNoiseMaterial = null;
            }

            if (PermTex != null)
            {
                Texture2D.Destroy(PermTex);
                PermTex = null;
            }

            if (SimplexTex != null)
            {
                Texture2D.Destroy(SimplexTex);
                SimplexTex = null;
            }
        #endif

        SNoiseCPU = null;
    }
Beispiel #2
0
    public void Setup()
    {
        Destroy();

        // init the two textures needed by the GenNoise shader
        if (PermTex == null)
        {
            InitGenNoise();
        }

        // init GenNoise materials
        if (GenNoiseMaterial == null)
        {
            GenNoiseMaterial = new Material[NoiseMaterialNames.Length];
            for (int i = 0; i < NoiseMaterialNames.Length; i++)
            {
                if (GenNoiseMaterial[i] == null)
                {
                    GenNoiseMaterial[i] = new Material(Shader.Find(NoiseMaterialNames[i]));
                }
            }
        }

        // init GenNormal material
        if (GenNormalMaterial == null)
        {
            GenNormalMaterial = new Material(Shader.Find("GenNormal"));
        }

        // init ShapeNoise material
        if (ShapeNoiseMaterial == null)
        {
            ShapeNoiseMaterial = new Material(Shader.Find("ShapeNoise"));
        }

        // init patch material
        if (PatchMaterial == null)
        {
            PatchMaterial = new Material(Shader.Find("TexNormalSplat"));
        }

        // init packnoise material
        if (PackNoiseMaterial == null)
        {
            PackNoiseMaterial = new Material(Shader.Find("PackNoise"));
        }

        // init simple tex material
        if (SimpleTexMaterial == null)
        {
            SimpleTexMaterial = new Material(Shader.Find("SimpleTex"));
        }

        // init outer atmosphere tex material
        if (OuterAtmosphereMaterial == null)
        {
            OuterAtmosphereMaterial = new Material(Shader.Find("Surf_AtmosOut"));
        }

        // init inner atmosphere tex material
        if (InnerAtmosphereMaterial == null)
        {
            InnerAtmosphereMaterial = new Material(Shader.Find("Surf_AtmosIn"));
        }

        // init CPU simplex noise
        if (SNoiseCPU == null)
        {
            SNoiseCPU = new SimplexNoiseCPU();
        }
    }
Beispiel #3
0
    public void Setup()
    {
        Destroy();

        // init the two textures needed by the GenNoise shader
        if (PermTex == null)
        {
            InitGenNoise();
        }

        // init GenNoise materials
        if (GenNoiseMaterial == null)
        {
            GenNoiseMaterial = new Material[NoiseMaterialNames.Length];
            for (int i = 0; i < NoiseMaterialNames.Length; i++)
            {
                if (GenNoiseMaterial[i] == null)
                {
                    GenNoiseMaterial[i] = new Material(Shader.Find(NoiseMaterialNames[i]));
                }
            }
        }

        // init GenNormal material
        if (GenNormalMaterial == null)
        {
            GenNormalMaterial = new Material(Shader.Find("GenNormal"));
        }

        // init ShapeNoise material
        if (ShapeNoiseMaterial == null)
        {
            ShapeNoiseMaterial = new Material(Shader.Find("ShapeNoise"));
        }

        // init patch material
        if (PatchMaterial == null)
        {
            PatchMaterial = new Material(Shader.Find("TexNormalSplat"));
        }

        // init packnoise material
        if (PackNoiseMaterial == null)
        {
            PackNoiseMaterial = new Material(Shader.Find("PackNoise"));
        }

        // init simple tex material
        if (SimpleTexMaterial == null)
        {
            SimpleTexMaterial = new Material(Shader.Find("SimpleTex"));
        }

        // init outer atmosphere tex material
        if (OuterAtmosphereMaterial == null)
        {
            OuterAtmosphereMaterial = new Material(Shader.Find("Surf_AtmosOut"));
        }

        // init inner atmosphere tex material
        if (InnerAtmosphereMaterial == null)
        {
            InnerAtmosphereMaterial = new Material(Shader.Find("Surf_AtmosIn"));
        }

        // init CPU simplex noise
        if (SNoiseCPU == null)
        {
            SNoiseCPU = new SimplexNoiseCPU();
        }
    }
Beispiel #4
0
    public void Destroy()
    {
                #if UNITY_EDITOR
        if (PatchMaterial != null)
        {
            Material.DestroyImmediate(PatchMaterial);
            PatchMaterial = null;
        }

        if (PackNoiseMaterial != null)
        {
            Material.DestroyImmediate(PackNoiseMaterial);
            PackNoiseMaterial = null;
        }

        if (SimpleTexMaterial != null)
        {
            Material.DestroyImmediate(SimpleTexMaterial);
            SimpleTexMaterial = null;
        }

        if (OuterAtmosphereMaterial != null)
        {
            Material.DestroyImmediate(OuterAtmosphereMaterial);
            OuterAtmosphereMaterial = null;
        }

        if (InnerAtmosphereMaterial != null)
        {
            Material.DestroyImmediate(InnerAtmosphereMaterial);
            InnerAtmosphereMaterial = null;
        }

        if (GenNoiseMaterial != null)
        {
            for (int i = 0; i < NoiseMaterialNames.Length; i++)
            {
                if (GenNoiseMaterial[i] != null)
                {
                    Material.DestroyImmediate(GenNoiseMaterial[i]);
                    GenNoiseMaterial[i] = null;
                }
            }
            GenNoiseMaterial = null;
        }

        if (GenNormalMaterial != null)
        {
            Material.DestroyImmediate(GenNormalMaterial);
            GenNormalMaterial = null;
        }

        if (ShapeNoiseMaterial != null)
        {
            Material.DestroyImmediate(ShapeNoiseMaterial);
            ShapeNoiseMaterial = null;
        }

        if (PermTex != null)
        {
            Texture2D.DestroyImmediate(PermTex);
            PermTex = null;
        }

        if (SimplexTex != null)
        {
            Texture2D.DestroyImmediate(SimplexTex);
            SimplexTex = null;
        }
#else
        if (PatchMaterial != null)
        {
            Material.Destroy(PatchMaterial);
            PatchMaterial = null;
        }

        if (PackNoiseMaterial != null)
        {
            Material.Destroy(PackNoiseMaterial);
            PackNoiseMaterial = null;
        }

        if (SimpleTexMaterial != null)
        {
            Material.Destroy(SimpleTexMaterial);
            SimpleTexMaterial = null;
        }

        if (OuterAtmosphereMaterial != null)
        {
            Material.Destroy(OuterAtmosphereMaterial);
            OuterAtmosphereMaterial = null;
        }

        if (InnerAtmosphereMaterial != null)
        {
            Material.Destroy(InnerAtmosphereMaterial);
            InnerAtmosphereMaterial = null;
        }

        if (GenNoiseMaterial != null)
        {
            for (int i = 0; i < NoiseMaterialNames.Length; i++)
            {
                if (GenNoiseMaterial[i] != null)
                {
                    Material.Destroy(GenNoiseMaterial[i]);
                    GenNoiseMaterial[i] = null;
                }
            }
            GenNoiseMaterial = null;
        }

        if (GenNormalMaterial != null)
        {
            Material.Destroy(GenNormalMaterial);
            GenNormalMaterial = null;
        }

        if (ShapeNoiseMaterial != null)
        {
            Material.Destroy(ShapeNoiseMaterial);
            ShapeNoiseMaterial = null;
        }

        if (PermTex != null)
        {
            Texture2D.Destroy(PermTex);
            PermTex = null;
        }

        if (SimplexTex != null)
        {
            Texture2D.Destroy(SimplexTex);
            SimplexTex = null;
        }
                #endif

        SNoiseCPU = null;
    }