Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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();
    }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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;
        }