Exemple #1
0
        private void Start()
        {
            FARLogger.Level = LogLevel.Trace;

            if (pixelCountShader != null)
            {
                pixelCountMain = new Kernel(pixelCountShader, pixelCountMain.name);
            }

            exposedMaterial = new Material(exposedSurfaceShader);
            debugMaterial   = new Material(debugShader);

            exposureRenderer = new Renderer <GameObject>()
            {
                Bounds           = bounds,
                Device           = device,
                Material         = exposedMaterial,
                PixelCountKernel = pixelCountMain,
                PixelCountShader = pixelCountShader,
                RenderSize       = new int2(renderSize.x, renderSize.y),
            };

            debugger = new Debugger()
            {
                enabled  = true,
                Material = debugMaterial,
            };

            debugColorList.Capacity = objects.Count;
            foreach (ObjectColor obj in objects)
            {
                exposureRenderer.SetupRenderers(obj.go, obj.go.GetComponentsInChildren <Renderer>(false));
                debugColorList.Add(obj.color);
            }

            debugColors = new Texture2D(debugColorList.Count, 1)
            {
                filterMode = FilterMode.Point,
                wrapMode   = TextureWrapMode.Repeat
            };
            debugColors.SetPixels(debugColorList.ToArray());
            debugColors.Apply();

            requests.Add(new RenderRequest()
            {
                debugger = debugger,
                result   = new RenderResult <GameObject>()
                {
                    renderer = exposureRenderer
                },
                callback = OnRequestComplete,
                userData = this
            });

            OnValidate();
        }