示例#1
0
    public void OnEnable()
    {
        //Debug.LogWarning("SkyEditor refreshed " + DateTime.Now);
        //Debug.LogWarning("Version of the runtime: " + Application.unityVersion);

        marmosetLogo = Resources.Load("marmosetLogo") as Texture2D;
        skyshopLogo  = Resources.Load("skyshopLogo") as Texture2D;

        if (inSKY == null)
        {
            inSKY = mset.CubemapGUI.create(mset.CubemapGUI.Type.INPUT, false);
        }
        if (outSIM == null)
        {
            outSIM = mset.CubemapGUI.create(mset.CubemapGUI.Type.SIM, false);
        }
        if (outSKY == null)
        {
            outSKY = mset.CubemapGUI.create(mset.CubemapGUI.Type.SKY, false);
        }

        //link to input GUI (mostly for probe to send itself to input)
        outSKY.inputGUI = inSKY;
        outSIM.inputGUI = inSKY;

        ps.init();
    }
示例#2
0
        private static bool skyToGUI(ref Cubemap skyCube, ref bool skyHDR, mset.CubemapGUI cubeGUI, bool updatePreview)
        {
            bool dirty    = false;
            bool dirtyGUI = false;

            //sky -> cubeGUI
            dirtyGUI   |= cubeGUI.HDR != skyHDR;
            cubeGUI.HDR = skyHDR;

            if (cubeGUI.cube != skyCube)
            {
                if (skyCube)
                {
                    string path = AssetDatabase.GetAssetPath(skyCube);
                    cubeGUI.setReference(path, cubeGUI.mipmapped);
                }
                else
                {
                    cubeGUI.clear();
                }
                //dirty = true;
            }
            if (dirtyGUI && updatePreview)
            {
                cubeGUI.updatePreview();
            }
            return(dirty);
        }
示例#3
0
 private bool needsLinearSampling(mset.CubemapGUI cubegui)
 {
     if (cubegui.HDR)
     {
         return(!ps.gammaCompress);                          //non-gamma compression requires sRGB sampling bypassed
     }
     return(false);
 }
示例#4
0
 //returns whether or not an output cubemap should be generated/encoded with a gamma-curve
 private bool needsGamma(mset.CubemapGUI cubegui)
 {
     if (cubegui.HDR)
     {
         return(ps.gammaCompress);                           //toggle gamma curve by whether we want RGBM gamma compression on or off
     }
     return(true);                                           //LDR data should always be saved as sRGB
 }
示例#5
0
        private static bool GUIToSky(ref Cubemap skyCube, ref bool skyHDR, mset.CubemapGUI cubeGUI)
        {
            //cubeGUI -> sky
            bool    prevHDR  = cubeGUI.HDR;
            Cubemap prevCube = cubeGUI.cube;

            cubeGUI.drawGUI();

            skyCube = cubeGUI.cube;
            skyHDR  = cubeGUI.HDR;

            bool dirty = false;

            //return true if the cubeGUI gui changed any parameters
            dirty |= prevHDR != cubeGUI.HDR;
            dirty |= prevCube != cubeGUI.cube;
            return(dirty);
        }
示例#6
0
        private static bool GUIToSky(ref Texture skyCube, ref bool skyHDR, mset.SHEncoding skySH, mset.CubemapGUI cubeGUI)
        {
            //cubeGUI -> sky
            bool    prevHDR   = cubeGUI.HDR;
            Texture prevInput = cubeGUI.input;

            cubeGUI.drawGUI();

            skyCube = cubeGUI.input;
            skyHDR  = cubeGUI.HDR;

            bool dirty = false;

            //copy spherical harmonics if they've changed
            if (cubeGUI.computeSH)
            {
                if (skySH != null)
                {
                    if (cubeGUI.SH == null)
                    {
                        skySH.clearToBlack();
                        dirty = true;
                    }
                    else if (!skySH.equals(cubeGUI.SH))
                    {
                        skySH.copyFrom(cubeGUI.SH);
                        dirty = true;
                    }
                    skySH.copyToBuffer();
                }
            }

            //return true if the cubeGUI gui changed any parameters
            dirty |= prevHDR != cubeGUI.HDR;
            dirty |= prevInput != cubeGUI.input;
            return(dirty);
        }
示例#7
0
        private static bool skyToGUI(Texture skyCube, bool skyHDR, mset.SHEncoding skySH, mset.CubemapGUI cubeGUI, string skyName, bool updatePreview)
        {
            bool dirty    = false;
            bool dirtyGUI = false;

            //sky -> cubeGUI
            dirtyGUI       |= cubeGUI.HDR != skyHDR;
            cubeGUI.HDR     = skyHDR;
            cubeGUI.skyName = skyName;

            RenderTexture RT = skyCube as RenderTexture;

            if (cubeGUI.input != skyCube)
            {
                if (RT)
                {
                    cubeGUI.setReference(RT, RT.useMipMap);
                }
                else if (skyCube)
                {
                    string path = AssetDatabase.GetAssetPath(skyCube);
                    cubeGUI.setReference(path, cubeGUI.mipmapped);
                }
                else
                {
                    cubeGUI.clear();
                }
                //dirty = true;
            }

            if (RT && skySH != null)
            {
                if (cubeGUI.SH != null && !skySH.equals(cubeGUI.SH))
                {
                    cubeGUI.SH.copyFrom(skySH);
                    cubeGUI.SH.copyToBuffer();
                    //dirty = true;
                }
            }

            if (dirtyGUI && updatePreview)
            {
                cubeGUI.updatePreview();
            }
            return(dirty);
        }
示例#8
0
    public void OnEnable()
    {
        //Debug.LogWarning("SkyEditor refreshed " + DateTime.Now);
        //Debug.LogWarning("Version of the runtime: " + Application.unityVersion);

        marmosetLogo = Resources.Load("marmosetLogo") as Texture2D;
        skyshopLogo =  Resources.Load("skyshopLogo") as Texture2D;

        if (inSKY == null) inSKY = mset.CubemapGUI.create(mset.CubemapGUI.Type.INPUT, false);
        if (outSIM == null) outSIM = mset.CubemapGUI.create(mset.CubemapGUI.Type.SIM, false);
        if (outDIM == null) outDIM = mset.CubemapGUI.create(mset.CubemapGUI.Type.DIM, false);
        if (outSKY == null) outSKY = mset.CubemapGUI.create(mset.CubemapGUI.Type.SKY, false);

        //link to input GUI (mostly for probe to send itself to input)
        outSKY.inputGUI = inSKY;
        outDIM.inputGUI = inSKY;
        outSIM.inputGUI = inSKY;

        outSKY.reloadReference();
        outDIM.reloadReference();
        outSIM.reloadReference();

        inSKY.updateBuffers();
        inSKY.updatePreview();
        /*
        outSKY.updateBuffers();
        outDIM.updateBuffers();
        outSIM.updateBuffers();

        outSKY.updatePreview();
        outDIM.updatePreview();
        outSIM.updatePreview();
        */
        ps.init();
    }
示例#9
0
文件: Skyshop.cs 项目: damard/Unity
    public void OnEnable()
    {
        //Debug.LogWarning("SkyEditor refreshed " + DateTime.Now);
        //Debug.LogWarning("Version of the runtime: " + Application.unityVersion);

        marmosetLogo = Resources.Load("marmosetLogo") as Texture2D;
        skyshopLogo =  Resources.Load("skyshopLogo") as Texture2D;

        inSKY = new mset.CubemapGUI(mset.CubemapGUI.Type.INPUT,false);
        outSKY = new mset.CubemapGUI(mset.CubemapGUI.Type.SKY,false);
        outDIM = new mset.CubemapGUI(mset.CubemapGUI.Type.DIM,false);
        outSIM = new mset.CubemapGUI(mset.CubemapGUI.Type.SIM,false);

        //link to input GUI (mostly for probe to send itself to input)
        outSKY.inputGUI = inSKY;
        outDIM.inputGUI = inSKY;
        outSIM.inputGUI = inSKY;

        inSKY.allowTexture = true;

        ps.init();
    }
示例#10
0
        private bool updateCube(ref Cubemap skyCube, ref bool skyHDR, CubemapGUI cubeGUI)
        {
            bool dirty = false;
            bool dirtyGUI = false;

            //sky -> cubeGUI
            dirtyGUI |= cubeGUI.HDR != skyHDR;
            cubeGUI.HDR = skyHDR;

            if(cubeGUI.cube != skyCube) {
                if(skyCube) {
                    string path = AssetDatabase.GetAssetPath(skyCube);
                    cubeGUI.setReference(path, cubeGUI.mipmapped);
                } else {
                    cubeGUI.clear();
                }
                //dirty = true;
            }
            if( dirtyGUI ) {
                cubeGUI.updatePreview();
            }

            //cubeGUI -> sky
            bool prevHDR = cubeGUI.HDR;
            Cubemap prevCube = cubeGUI.cube;
            cubeGUI.drawGUI();

            skyCube = cubeGUI.cube;
            skyHDR = cubeGUI.HDR;

            //return true if the cubeGUI gui changed any parameters
            dirty |= prevHDR != cubeGUI.HDR;
            dirty |= prevCube != cubeGUI.cube;
            return dirty;
        }