public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool cullPointLight, bool useFloatingBufferForLightning) { _lightAddBlendState = new BlendState() { AlphaSourceBlend = Blend.One, ColorSourceBlend = Blend.One, AlphaDestinationBlend = Blend.One, ColorDestinationBlend = Blend.One, }; this.ginfo = ginfo; this.cullPointLight = cullPointLight; if (useFloatingBufferForLightning) { lightRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); samplerState = SamplerState.PointClamp; } else { lightRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); samplerState = ginfo.SamplerState; } directionalLightEffect = manager.GetAsset <Effect>("DirectionalLight", true); pointLightEffect = manager.GetAsset <Effect>("PointLight", true); sphereModel = new SimpleModel(factory, "Dsphere", true); spotLightEffect = manager.GetAsset <Effect>("SpotLight", true); spotLightEffect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); pointLightEffect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); //DirectionalcolorMap = directionalLightEffect.Parameters["colorMap"]; //DirectionalnormalMap = directionalLightEffect.Parameters["normalMap"]; //DirectionaldepthMap = directionalLightEffect.Parameters["depthMap"]; DirectionalInvertViewProjection = directionalLightEffect.Parameters["InvertViewProjection"]; DirectionalhalfPixel = directionalLightEffect.Parameters["halfPixel"]; DirectionalcameraPosition = directionalLightEffect.Parameters["cameraPosition"]; DirectionallightDirection = directionalLightEffect.Parameters["lightDirection"]; DirectionalColor = directionalLightEffect.Parameters["Color"]; DirectionallightIntensity = directionalLightEffect.Parameters["lightIntensity"]; //PointcolorMap = pointLightEffect.Parameters["colorMap"]; //PointnormalMap = pointLightEffect.Parameters["normalMap"]; //PointdepthMap = pointLightEffect.Parameters["depthMap"]; PointProjection = pointLightEffect.Parameters["Projection"]; PointView = pointLightEffect.Parameters["View"]; PointInvertViewProjection = pointLightEffect.Parameters["InvertViewProjection"]; PointWorld = pointLightEffect.Parameters["World"]; PointlightPosition = pointLightEffect.Parameters["lightPosition"]; PointColor = pointLightEffect.Parameters["Color"]; PointlightRadius = pointLightEffect.Parameters["lightRadius"]; PointlightIntensity = pointLightEffect.Parameters["lightIntensity"]; Pointquadratic = pointLightEffect.Parameters["quadratic"]; PointcameraPosition = pointLightEffect.Parameters["cameraPosition"]; }
//EffectParameter PcolorMap; //EffectParameter PlightMap; #endregion #region IDeferredFinalCombination Members public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool useFloatBuffer, bool saveToTexture) { this.useFloatBuffer = useFloatBuffer; this.ginfo = ginfo; this.saveToTexture = saveToTexture; finalCombineEffect = manager.GetAsset <Effect>("CombineFinal", true); PhalfPixel = finalCombineEffect.Parameters["halfPixel"]; PambientColor = finalCombineEffect.Parameters["ambientColor"]; //PEXTRA1 = finalCombineEffect.Parameters["EXTRA1"]; //PcolorMap = finalCombineEffect.Parameters["colorMap"]; //PlightMap = finalCombineEffect.Parameters["lightMap"]; PhalfPixel.SetValue(ginfo.HalfPixel); if (saveToTexture) { if (useFloatBuffer) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } else { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } } }
/// <summary> /// Load graphics content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(Engine.GraphicInfo GraphicInfo, Engine.GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); videoPlayer = new VideoPlayer(); myVideoFile = contentManager.GetAsset <Video>(location); videoPlayer.IsLooped = false; }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, Color BackGroundColor, bool useFloatBuffer) { this.useFloatBuffer = useFloatBuffer; normalRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, false, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); depthRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, false, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); //lightOclusionRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); clearBufferEffect = manager.GetAsset <Effect>("PrePass2/ClearGBuffer"); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, Color BackGroundColor, bool useFloatBuffer) { this.backGroundColor = BackGroundColor; colorRT2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, 8, RenderTargetUsage.DiscardContents); colorRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents); normalRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); depthRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); lightOclusionRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); clearBufferEffect = manager.GetAsset <Effect>("ClearGBuffer", true); effect = factory.GetEffect("Effects//hibe"); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, Color BackGroundColor, bool useFloatBuffer) { this.useFloatBuffer = useFloatBuffer; this.backGroundColor = BackGroundColor; const int multisample = 0; colorRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, multisample, RenderTargetUsage.DiscardContents); normalRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); depthRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); lightOclusionRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); clearBufferEffect = manager.GetAsset <Effect>("ClearGBuffer", true); clearBufferEffect.Parameters["BackColor"].SetValue(backGroundColor.ToVector3()); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool useFloatBuffer, bool saveToTexture) { this.useFloatBuffer = useFloatBuffer; this.ginfo = ginfo; this.saveToTexture = saveToTexture; effect = factory.GetEffect("Effects//hibe"); finalCombineEffect = manager.GetAsset <Effect>("CombineFinal", true); if (saveToTexture) { //if (useFloatBuffer) // target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); //else target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } half = ginfo.HalfPixel; }
//EffectParameter Depth; //EffectParameter Color; /// <summary> /// Initializes a new instance of the <see cref="RestoreDepth"/> class. /// </summary> /// <param name="useFloatBuffer">if set to <c>true</c> [use float buffer].</param> /// <param name="manager">The manager.</param> /// <param name="factory">The factory.</param> /// <param name="ginfo">The ginfo.</param> public RestoreDepth(bool useFloatBuffer, IContentManager manager, GraphicFactory factory, GraphicInfo ginfo) { this.usefloatBuffer = useFloatBuffer; this.restore = manager.GetAsset <Effect>("RestoreDepth", true); this.restore.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); //Depth = restore.Parameters["DepthTexture"]; //Color = restore.Parameters["ColorTexture"]; if (useFloatBuffer) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } else { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } }