Ejemplo n.º 1
0
        protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
        {
            Instance = this;

            _oceanMaskShader   = Shader.Find(SHADER_OCEAN_MASK);
            _oceanMaskMaterial = CoreUtils.CreateEngineMaterial(_oceanMaskShader);

            _colorBuffer = RTHandles.Alloc
                           (
                scaleFactor: Vector2.one,
                slices: TextureXR.slices,
                dimension: TextureXR.dimension,
                colorFormat: GraphicsFormat.R16_SFloat,
                useDynamicScale: true,
                name: "Crest Ocean Mask"
                           );

            _depthBuffer = RTHandles.Alloc
                           (
                scaleFactor: Vector2.one,
                slices: TextureXR.slices,
                dimension: TextureXR.dimension,
                depthBufferBits: DepthBits.Depth24,
                colorFormat: GraphicsFormat.R8_UNorm, // This appears to be used for depth.
                enableRandomWrite: false,
                useDynamicScale: true,
                name: "Crest Ocean Mask Depth"
                           );
        }
Ejemplo n.º 2
0
        protected override void Cleanup()
        {
            CoreUtils.Destroy(_oceanMaskMaterial);
            _colorBuffer.Release();
            _depthBuffer.Release();

            Instance = null;
        }