Exemple #1
0
    void OnEnable()
    {
        _bc = new BufferCreator(GetComponent <Camera>());

        foreach (var config in configs)
        {
            var rt = GpuUtils.GetScreenRenderTexture(24, false, config.format);
            _bc.Add(config.shader, config.name, config.tag, rt);
        }
    }
    public RenderSystemTest()
    {
        cam = new GameObject().AddComponent <Camera>();
        cam.CopyFrom(Controller.currentCamera);
        cam.enabled = false;

        var computeShader = GameObject.Instantiate <ComputeShader>(Finder.Find <ComputeShader>("RenderTest"));

        computeSystem = new ComputeSystem(computeShader);

        mrtCam = new MRTCamera <DefferredBufferID>(cam);
        // mrtCam = new MRTCamera(cam, new DefferredBufferID());
        mrtCam.GatherBuffers();

        render = GpuUtils.GetScreenRenderTexture(0, true);

        deferredBuffers.Add(DefferredBufferID.Normals, new ComputeBuffer(Screen.width * Screen.height, sizeof(float) * 4));
        deferredBuffers.Add(DefferredBufferID.Position, new ComputeBuffer(Screen.width * Screen.height, sizeof(float) * 4));
        deferredBuffers.Add(DefferredBufferID.RenderIDs, new ComputeBuffer(Screen.width * Screen.height, sizeof(float) * 4));         //int

        Set();
    }
 public void Add(Shader shader, string name, string tag) => Add(shader, name, tag, GpuUtils.GetScreenRenderTexture(32));