protected override void AfterLoadContent(IContentManager manager, PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
        {
            base.AfterLoadContent(manager, ginfo, factory);
            this.ginfo = ginfo;

            pointLightEffect = factory.GetEffect("PrePass/plight");
            _clearGBuffer    = factory.GetEffect("PrePass/ClearGBuffer");
            _lighting        = factory.GetEffect("PrePass/LightingLpp");

            sphereModel = new SimpleModel(factory, "Model/Dsphere");
            ForwardPass = new ForwardPass(ForwardPassDescription.Default());
            _width      = ginfo.BackBufferWidth;
            _height     = ginfo.BackBufferHeight;

            _cwDepthState = new DepthStencilState();
            _cwDepthState.DepthBufferWriteEnable = false;
            _cwDepthState.DepthBufferFunction    = CompareFunction.LessEqual;

            _ccwDepthState = new DepthStencilState();
            _ccwDepthState.DepthBufferWriteEnable = false;
            _ccwDepthState.DepthBufferFunction    = CompareFunction.GreaterEqual;

            _directionalDepthState = new DepthStencilState();;
            _directionalDepthState.DepthBufferWriteEnable = false;
            _directionalDepthState.DepthBufferFunction    = CompareFunction.Greater;


            _depthStateDrawLights = new DepthStencilState();

            //we draw our volumes with front-face culling, so we have to use GreaterEqual here
            _depthStateDrawLights.DepthBufferFunction = CompareFunction.GreaterEqual;
            //with our z-buffer reconstructed we only need to read it
            _depthStateDrawLights.DepthBufferWriteEnable = false;

            _depthStateReconstructZ = new DepthStencilState
            {
                DepthBufferEnable      = true,
                DepthBufferWriteEnable = true,
                DepthBufferFunction    = CompareFunction.Always
            };

            _lightAddBlendState = new BlendState()
            {
                AlphaSourceBlend      = Blend.One,
                ColorSourceBlend      = Blend.One,
                AlphaDestinationBlend = Blend.One,
                ColorDestinationBlend = Blend.One,
            };

            CreateGBuffer(factory);
        }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     playerint = GameObject.Find("playerInputs").GetComponent <PlayerInputs>();
     fpass     = GameObject.Find("Backpro").GetComponent <ForwardPass>();
 }