public LightSpaceTransformer(List <Mesh> scene, FragPosSampler posSampler, Vector3 lightDir)
        {
            GL.BindImageTexture(0, posSampler.SampleImage.TextureId, 0, false, 0, TextureAccess.ReadWrite, posSampler.SampleImage.InternalFormat());

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, posSampler.SampleDepthStencilBuffer.TextureId);
            GL.TextureParameter(posSampler.SampleDepthStencilBuffer.TextureId, TextureParameterName.DepthStencilTextureMode, (int)All.StencilIndex);

            ComputeLightTransform(scene, lightDir);
            TransformShader.SetMatrix4("lightTransform", _lightTransform);
        }
Esempio n. 2
0
        public IZBRenderer(List <Mesh> scene, Camera defaultCam)
        {
            Scene      = scene;
            DefaultCam = defaultCam;
            LightDir   = new Vector3(-1, -1, -1).Normalized();

            PosSampler    = new FragPosSampler(scene, defaultCam);
            LSTransformer = new LightSpaceTransformer(scene, PosSampler, LightDir);
            Binner        = new LightSpaceBinner(defaultCam.Width, defaultCam.Height);
            ConTester     = new ConservativeTester(LSTransformer, defaultCam.Width, defaultCam.Height);
        }