Exemplo n.º 1
0
 public void QueueCubemap(Cubemap cube, bool HDR, Vector3 pos, Quaternion rot)
 {
     if (cube != null)
     {
         ProbeTarget target = new ProbeTarget();
         target.cube     = cube;
         target.position = pos;
         target.rotation = rot;
         target.HDR      = HDR;
         probeQueue.Enqueue(target);
         progressTotal++;
     }
 }
Exemplo n.º 2
0
        private void StartStage(Stage nextStage)
        {
            if (this.probeQueue == null)
            {
                //designates an empty sky queue, we are done
                nextStage = Stage.DONE;
            }

            if (nextStage == Stage.NEXTSKY)
            {
                RenderSettings.skybox = this.sceneSkybox;
                //look for the next valid sky in the queue
                ProbeTarget pt = probeQueue.Dequeue();
                if (pt != null)
                {
                    progress++;
                    if (ProgressCallback != null && progressTotal > 0)
                    {
                        ProgressCallback((float)progress / (float)progressTotal);
                    }
                    targetCube = pt.cube;
                    captureHDR = pt.HDR && (RT != null);
                    lookPos    = pt.position;
                    lookRot    = pt.rotation;
                }
                else
                {
                    //last sky in the queue is null, we are done
                    nextStage = Stage.DONE;
                }
            }

            if (nextStage == Stage.CAPTURE)
            {
                //throw away the first frame, the camera needs to stabilize first
                drawShot = -1;
                RenderSettings.skybox = this.sceneSkybox;
                this.targetMip        = 0;
                this.captureSize      = targetCube.width;
                this.mipCount         = mset.QPow.Log2i(this.captureSize) - 1;
                GetComponent <Camera>().cullingMask = defaultCullMask;
            }

            if (nextStage == Stage.CONVOLVE)
            {
                Shader.SetGlobalVector("_UniformOcclusion", Vector4.one);
                drawShot       = 0;
                this.targetMip = 1;
                if (this.targetMip < this.mipCount)
                {
                    //render nothing but the background
                    GetComponent <Camera>().cullingMask = 0;
                    UnityEngine.RenderSettings.skybox   = convolveSkybox;

                    Matrix4x4 matrix = Matrix4x4.identity;
                    //matrix.SetTRS(position, rotation, Vector3.one);
                    convolveSkybox.SetMatrix("_SkyMatrix", matrix);
                    convolveSkybox.SetTexture("_CubeHDR", targetCube);

                    //toggleKeywordPair("MARMO_LINEAR", "MARMO_GAMMA", this.linear);
                    toggleKeywordPair("MARMO_RGBM_INPUT_ON", "MARMO_RGBM_INPUT_OFF", captureHDR && this.RT != null);
                    toggleKeywordPair("MARMO_RGBM_OUTPUT_ON", "MARMO_RGBM_OUTPUT_OFF", captureHDR && this.RT != null);

                    mset.SkyProbe.bindRandomValueTable(convolveSkybox, "_PhongRands", targetCube.width);
                }
            }

            if (nextStage == Stage.DONE)
            {
                RenderSettings.skybox = this.sceneSkybox;
                ClearQueue();
                FreeFaceTexture();

                foreach (Camera cam in disabledCameras)
                {
                    cam.enabled = true;
                }
                disabledCameras.Clear();

                if (DoneCallback != null)
                {
                    DoneCallback();
                    DoneCallback = null;
                }
            }
            stage = nextStage;
        }
Exemplo n.º 3
0
 public void QueueCubemap(Cubemap cube, bool HDR, Vector3 pos, Quaternion rot)
 {
     if( cube != null ) {
         ProbeTarget target = new ProbeTarget();
         target.cube = cube;
         target.position = pos;
         target.rotation = rot;
         target.HDR = HDR;
         probeQueue.Enqueue(target);
         progressTotal++;
     }
 }
Exemplo n.º 4
0
 internal ProbeRegister()
 {
     register = ProbeTarget.Damage;
     name     = "PROBE";
     code     = (Int16)Bytecodes.REG_PROBE;
 }
Exemplo n.º 5
0
 internal ProbeRegister()
 {
     register = ProbeTarget.Damage;
     name = "PROBE";
     code = (Int16)Bytecodes.REG_PROBE;
 }