public Renderer(GraphicSettings graphicSettings, ServerSettings serverSettings) { var resolution = GetResolution(graphicSettings); var rendererName = serverSettings.Dedicated ? "Null" : graphicSettings.Renderer; var rendererPath = Platform.ResolvePath(".", "OpenRA.Platforms." + rendererName + ".dll"); Device = CreateDevice(Assembly.LoadFile(rendererPath), resolution.Width, resolution.Height, graphicSettings.Mode); if (!serverSettings.Dedicated) { TempBufferSize = graphicSettings.BatchSize; SheetSize = graphicSettings.SheetSize; } WorldSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp")); WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba")); WorldLineRenderer = new LineRenderer(this, Device.CreateShader("line")); WorldVoxelRenderer = new VoxelRenderer(this, Device.CreateShader("vxl")); LineRenderer = new LineRenderer(this, Device.CreateShader("line")); WorldQuadRenderer = new QuadRenderer(this, Device.CreateShader("line")); RgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba")); SpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp")); tempBuffer = Device.CreateVertexBuffer(TempBufferSize); }
protected override void LoadContent() { base.LoadContent(); Managers.TextureManager = new TextureManager(Content, GraphicsDevice); Managers.FontManager = new FontManager(Content); Managers.SoundManager = new SoundManager(Content); _spriteBatch = new SpriteBatch(GraphicsDevice); _lineBatch = new LineBatch(GraphicsDevice); _quadRenderer = new QuadRenderer(GraphicsDevice); _input.LoadContent(GraphicsDevice.Viewport); _screenManager = new ScreenManager(this, _lineBatch, _quadRenderer, _spriteBatch, _input); #if WINDOWS _counter.LoadContent(); #endif _screenManager.LoadContent(); //TODO: Can't call this in MonoGame at the moment //ResetElapsedTime(); }
public void Render(Matrix pTransforme, float pScale) { mTimer = (float)(KryptonEngine.EngineSettings.Time.TotalGameTime.TotalMilliseconds / 10000); mGrapicsDevice.SetRenderTarget(mFogTarget); mGrapicsDevice.Clear(Color.Transparent); mFogShader.Parameters["View"].SetValue(pTransforme.Translation); mFogShader.Parameters["Scale"].SetValue(pScale); mFogShader.Parameters["Timer"].SetValue(mTimer); mFogShader.Parameters["Speed"].SetValue(mSpeed); mFogShader.Parameters["FogFactorMin"].SetValue(mFogFactorMin); mFogShader.Parameters["FogFactorMax"].SetValue(mFogFactorMax); mFogShader.Parameters["FogStrength"].SetValue(0.3f); mGrapicsDevice.Textures[1] = mSceneDepthMap; mGrapicsDevice.Textures[2] = mFogTexture; mGrapicsDevice.Textures[3] = mSceneDiffuseMap; mFogShader.CurrentTechnique.Passes[0].Apply(); QuadRenderer.Render(mGrapicsDevice); mGrapicsDevice.SetRenderTarget(null); mGrapicsDevice.Clear(Color.Black); mGrapicsDevice.Textures[1] = mFogTarget; mSimpleDrawShader.CurrentTechnique.Passes[0].Apply(); QuadRenderer.Render(mGrapicsDevice); }
/// <summary> /// Initializes a new instance of the <see cref="LightManager"/> class. /// </summary> /// <param name="game">The game.</param> public LightManager(Game game) { // Load Effects, Models and Quad Renderer directionalLightEffect = game.Content.Load <Effect>("Shaders/Lights/DirectionalLight"); pointLightEffect = game.Content.Load <Effect>("Shaders/Lights/PointLight"); hemisphericLightEffect = game.Content.Load <Effect>("Shaders/Lights/HemisphericLight"); sphereModel = game.Content.Load <Model>("Models/Sphere"); fullscreenQuad = new QuadRenderer(game); game.Components.Add(fullscreenQuad); halfPixel = new Vector2() { X = 0.5f / (float)game.GraphicsDevice.PresentationParameters.BackBufferWidth, Y = 0.5f / (float)game.GraphicsDevice.PresentationParameters.BackBufferHeight }; // Load the Color Map for the Hemispheric Light hemisphericColorMap = game.Content.Load <Texture2D>("Textures/ColorMap"); // Make our directional light source light = new Lights.DirectionalLight(); light.Direction = new Vector3(-1, -1, -1); light.Color = new Vector3(0.7f, 0.7f, 0.7f); // Instantiate the PointLights List pointLights = new List <Lights.PointLight>(); }
protected override void InitializeService() { // Listen to changes in light count sceneManager.LightCountSet += new SceneManager.LightCountSetDelegate(SetLightCount); ShadowBlendState = BlendState.Default; ShadowFaceCullState = FaceCullState.Default; ShadowDepthState = DepthState.Default; quadRenderer = new QuadRenderer(renderer); visualizeShadowMap = renderer.Programs["VisualizeShadowMap"]; if (example.Renderer.Configuration.hardwareShadowPCF) { materialManager.MakeMaterial("Shadow", "ShadowCaster2"); } else { materialManager.MakeMaterial("Shadow", "ShadowCaster"); } { var m = materialManager.MakeMaterial("VisualizeShadowMap"); m.DepthState = DepthState.Disabled; m.FaceCullState = FaceCullState.Disabled; } renderer.Resize += new EventHandler <EventArgs>(renderer_Resize); }
public void SetUp() { var fakeVertex = new FakeVertex(); _quad = new Quad <FakeVertex>(fakeVertex, fakeVertex, fakeVertex, fakeVertex); _expectedVertices = new[] { _quad.FirstVertex, _quad.SecondVertex, _quad.ThirdVertex, _quad.FourthVertex, _quad.FirstVertex, _quad.SecondVertex, _quad.ThirdVertex, _quad.FourthVertex }; _expectedIndices = new uint[] { 0, 2, 3, 0, 1, 2, 4, 6, 7, 4, 5, 6 }; _fakeVao = new Vao <FakeVertex>(); _fakeVbo = new Vbo <FakeVertex>(3); _fakeEbo = new Ebo(); _vaoFactoryMock = new Mock <Factory <Vao <FakeVertex>, VaoArgs <FakeVertex> > >(); _vaoFactoryMock.Setup(m => m.Create(It.IsAny <VaoArgs <FakeVertex> >())).Returns(_fakeVao); _vboFactoryMock = new Mock <Factory <Vbo <FakeVertex>, VboArgs <FakeVertex> > >(); _vboFactoryMock.Setup(m => m.Create(It.IsAny <VboArgs <FakeVertex> >())).Returns(_fakeVbo); _eboFactoryMock = new Mock <Factory <Ebo, EboArgs> >(); _eboFactoryMock.Setup(m => m.Create(It.IsAny <EboArgs>())).Returns(_fakeEbo); _vboRendererMock = new Mock <VboRenderer <FakeVertex> >(); _quadRenderer = new QuadRenderer <FakeVertex>(new[] { _quad, _quad }, _vaoFactoryMock.Object, _vboFactoryMock.Object, _eboFactoryMock.Object, _vboRendererMock.Object); }
protected override void InitializeService() { // \todo fix quadRenderer = new QuadRenderer(renderer); GL.ClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL.Clear(ClearBufferMask.ColorBufferBit); window.SwapBuffers(); windowViewport = new Viewport(window.Width, window.Height); renderer.Requested.Viewport = windowViewport; camera2D = new Camera(); camera2D.Name = "camera2D"; Update2DCamera(); if (Configuration.voxelTest) { map.UpdateChunksAround(0, 0); map.UpdateRender(); } timers = new Timers(); InitializeCommonMaterials(); }
public void Load(ContentManager content) { _shader = content.Load <Effect>("Shaders/Transition/TransitionShader"); _passShear = _shader.Techniques["Shear"].Passes[0]; _passSpiral = _shader.Techniques["Spiral"].Passes[0]; _passCircle = _shader.Techniques["Circle"].Passes[0]; _quadRenderer = new QuadRenderer(); }
public ScreenManager(Game1 game, LineBatch lineBatch, QuadRenderer quadRenderer, SpriteBatch spriteBatch, InputHelper input) { _graphics = game.GraphicsDevice; _game = game; _lineBatch = lineBatch; _quadRenderer = quadRenderer; _spriteBatch = spriteBatch; _input = input; }
Vector2 noisePow = Vector2.Zero; // artistic param? 0.017f, 0.031f public OceanWater(ContentManager content, GraphicsDevice graphics) { _content = content; _graphics = graphics; _quadRenderer = new QuadRenderer(graphics); oceanEffectRT = new RenderTarget2D(_graphics, GameOptions.PrefferedBackBufferWidth, GameOptions.PrefferedBackBufferHeight); oceanRippleEffect = _content.Load <Effect>("oceanRippleEffect"); noiseMap = _content.Load <Texture2D>("cellnoise"); // bing noise good for wakes? }
public void Dispose() { #if DRAW_SAMPLE_CONTENT if (quadRenderer != null) { quadRenderer.Dispose(); quadRenderer = null; } #endif }
public void SetHolographicSpace(HolographicSpace holographicSpace) { this.holographicSpace = holographicSpace; // // TODO: Add code here to initialize your content. // #if DRAW_SAMPLE_CONTENT // Initialize the sample hologram. quadRenderer = new QuadRenderer(deviceResources); spatialInputHandler = new SpatialInputHandler(); #endif // Use the default SpatialLocator to track the motion of the device. locator = SpatialLocator.GetDefault(); // Be able to respond to changes in the positional tracking state. locator.LocatabilityChanged += this.OnLocatabilityChanged; // Respond to camera added events by creating any resources that are specific // to that camera, such as the back buffer render target view. // When we add an event handler for CameraAdded, the API layer will avoid putting // the new camera in new HolographicFrames until we complete the deferral we created // for that handler, or return from the handler without creating a deferral. This // allows the app to take more than one frame to finish creating resources and // loading assets for the new holographic camera. // This function should be registered before the app creates any HolographicFrames. holographicSpace.CameraAdded += this.OnCameraAdded; // Respond to camera removed events by releasing resources that were created for that // camera. // When the app receives a CameraRemoved event, it releases all references to the back // buffer right away. This includes render target views, Direct2D target bitmaps, and so on. // The app must also ensure that the back buffer is not attached as a render target, as // shown in DeviceResources.ReleaseResourcesForBackBuffer. holographicSpace.CameraRemoved += this.OnCameraRemoved; // The simplest way to render world-locked holograms is to create a stationary reference frame // when the app is launched. This is roughly analogous to creating a "world" coordinate system // with the origin placed at the device's position as the app is launched. referenceFrame = locator.CreateStationaryFrameOfReferenceAtCurrentLocation(); // Notes on spatial tracking APIs: // * Stationary reference frames are designed to provide a best-fit position relative to the // overall space. Individual positions within that reference frame are allowed to drift slightly // as the device learns more about the environment. // * When precise placement of individual holograms is required, a SpatialAnchor should be used to // anchor the individual hologram to a position in the real world - for example, a point the user // indicates to be of special interest. Anchor positions do not drift, but can be corrected; the // anchor will use the corrected position starting in the next frame after the correction has // occurred. }
public void Render() { KryptonEngine.EngineSettings.Graphics.GraphicsDevice.SetRenderTarget(mHatchingTarget); KryptonEngine.EngineSettings.Graphics.GraphicsDevice.Clear(Color.Transparent); HatchingShader.Parameters["repeat"].SetValue(mResolution); KryptonEngine.EngineSettings.Graphics.GraphicsDevice.Textures[1] = mLightMap; HatchingShader.CurrentTechnique.Passes[0].Apply(); QuadRenderer.Render(KryptonEngine.EngineSettings.Graphics.GraphicsDevice); }
protected override void InitializeService() { renderer.Resize += new EventHandler <EventArgs>(renderer_Resize); quadRenderer = new QuadRenderer(renderer); blit = renderer.Programs["VisualizeOpenRL"]; texture = new TextureGL(128, 128, PixelFormat.Rgba, PixelInternalFormat.Rg32f); material = materialManager.MakeMaterial("VisualizeOpenRL"); material.DepthState = DepthState.Disabled; material.FaceCullState = FaceCullState.Disabled; UpdateQuad(); InitializeOpenRL(); }
public override void Render() { QuadRenderer.Begin(); float alpha = (10 - timer) / 10; QuadRenderer.DrawFullScreenGradient(new Color4(38f / 255, 38f / 255, 39f / 255, alpha), new Color4(70f / 255, 69f / 255, 70f / 255, alpha)); Color4 color = new Color4(1, 1, 1, alpha); QuadRenderer.Draw(StartupLayer.logo, new Vector2(Display.Width / 2 - StartupLayer.logo.Width / 2, Display.Height / 2 - StartupLayer.logo.Height / 2 - 20 * alpha), color); QuadRenderer.End(); }
public void Dispose() { if(textRenderer != null) { textRenderer.Dispose(); textRenderer = null; } if(quadRenderer != null) { quadRenderer.Dispose(); quadRenderer = null; } }
/// <summary> /// Initialize all our rendermodules and helpers. Done after the Load() function /// </summary> /// <param name="graphicsDevice"></param> /// <param name="assets"></param> public void Initialize(GraphicsDevice graphicsDevice, Assets assets) { _graphicsDevice = graphicsDevice; _quadRenderer = new QuadRenderer(); _spriteBatch = new SpriteBatch(graphicsDevice); _assets = assets; //Apply some base settings to overwrite shader defaults with game settings defaults GameSettings.ApplySettings(); Shaders.GBufferEffectParameter_Material_EnvironmentMap.SetValue(_assets.EnvironmentMap); SetUpRenderTargets(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight, false); }
public void Initialize(GraphicsDevice graphicsDevice) { _graphicsDevice = graphicsDevice; _gaussEffect = Shaders.GaussianBlurEffect; _quadRenderer = new QuadRenderer(); _horizontalPass = _gaussEffect.Techniques["GaussianBlur"].Passes["Horizontal"]; _verticalPass = _gaussEffect.Techniques["GaussianBlur"].Passes["Vertical"]; _rt2562 = new RenderTarget2D(graphicsDevice, 256, 256, false, SurfaceFormat.Vector2, DepthFormat.None); _rt5122 = new RenderTarget2D(graphicsDevice, 512, 512, false, SurfaceFormat.Vector2, DepthFormat.None); _rt10242 = new RenderTarget2D(graphicsDevice, 1024, 1024, false, SurfaceFormat.Vector2, DepthFormat.None); _rt20482 = new RenderTarget2D(graphicsDevice, 2048, 2048, false, SurfaceFormat.Vector2, DepthFormat.None); }
public override void Render(QuadRenderer renderer) { if (_stringBuilder.Length == 0) { return; } var originPos = Position + Origin; Vector2 originBuffer; var posBuffer = Position; var destBuffer = new Box2(); var lineStart = posBuffer.X; //pos = origin pos //origin = desired pos - pos for (int i = 0; i < _stringBuilder.Length; i++) { var character = _stringBuilder[i]; if (character == '\n') { posBuffer.X = lineStart; posBuffer.Y -= _font.Spacing.Y; continue; } if (character == ' ') { posBuffer.X += _font.SpaceWidth; continue; } var glyph = _font.GetGlyph(character); originBuffer = originPos - posBuffer; destBuffer.Min = Position; destBuffer.Max = destBuffer.Min + glyph.Size; renderer.SubmitQuad(destBuffer, glyph.Source, Color, originBuffer, Scale, Rotation, _font.Texture); posBuffer.X += glyph.Size.X + _font.Spacing.X; } }
public void Dispose() { #if DRAW_SAMPLE_CONTENT if (quadRendererR != null) { quadRendererR.Dispose(); quadRendererR = null; } if (quadRendererL != null) { quadRendererL.Dispose(); quadRendererL = null; } #endif }
protected override void InitializeService() { blend = renderer.Programs["Blend"]; renderer.Resize += new EventHandler <EventArgs>(renderer_Resize); stereoMerge = materialManager.MakeMaterial("Stereo", null); stereoMerge.FaceCullState = FaceCullState.Disabled; stereoMerge.DepthState = DepthState.Disabled; stereoMerge.MeshMode = MeshMode.PolygonFill; stereoMerge.Floats("t").Set(0.5f); stereoMerge.Sync(); quadRenderer = new QuadRenderer(renderer); UpdateQuad(); CreateViews(); }
public void ProcessLight(List <Light> pLightList, Matrix pTranslation) { EngineSettings.Graphics.GraphicsDevice.SetRenderTarget(mLightTarget); EngineSettings.Graphics.GraphicsDevice.Clear(Color.Transparent); EngineSettings.Graphics.GraphicsDevice.BlendState = mLightMapBlendState; KryptonEngine.EngineSettings.Graphics.GraphicsDevice.Textures[0] = mGBuffer.RenderTargets[1]; KryptonEngine.EngineSettings.Graphics.GraphicsDevice.Textures[1] = mGBuffer.RenderTargets[3]; this.mTranslatetViewMatrix = Matrix.Multiply(mView, pTranslation); //this.mLightShader.Parameters["World"].SetValue(this.mWorld); this.mLightShader.Parameters["View"].SetValue(pTranslation); //this.mLightShader.Parameters["Projection"].SetValue(this.mProjection); foreach (Light l in pLightList) { if (!l.IsVisible) { continue; } Vector4 lightPos = new Vector4(l.Position, l.Depth * 720, 1f); this.mLightShader.Parameters["View"].SetValue(pTranslation); this.mLightShader.Parameters["LightIntensity"].SetValue(l.Intensity); this.mLightShader.Parameters["LightColor"].SetValue(l.LightColor); this.mLightShader.Parameters["LightPosition"].SetValue(lightPos); this.mLightShader.Parameters["screen"].SetValue(new Vector2(EngineSettings.VirtualResWidth, EngineSettings.VirtualResHeight)); if (l.GetType() == typeof(PointLight)) { PointLight tempPl = (PointLight)l; mLightShader.Parameters["LightRadius"].SetValue(tempPl.Radius); mLightShader.CurrentTechnique.Passes[0].Apply(); } //directional Light! QuadRenderer.Render(this.mGraphicsDevice); } EngineSettings.Graphics.GraphicsDevice.SetRenderTarget(null); }
/// <summary> /// Instantiates the renderer. /// </summary> private AbstractRenderer InstantiateRenderer() { Trace.WriteLine("Instantiating particle renderer...", "CORE"); AbstractRenderer renderer = new QuadRenderer { GraphicsDeviceService = GraphicsDeviceService.Instance, }; //AbstractRenderer renderer = new SpriteBatchRenderer //{ // GraphicsDeviceService = GraphicsDeviceService.Instance //}; renderer.LoadContent(null); return(renderer); }
/// <summary> /// Creates a new lighting pre pass technique. /// </summary> public LPP() { pointLightEffect = Common.ContentManager.Load <Effect>("Eon/Shaders/Lighting/2DPointLight"); dominateLightEffect = Common.ContentManager.Load <Effect>("Eon/Shaders/Lighting/DominateLight"); combinedEffect = Common.ContentManager.Load <Effect>("Eon/Shaders/Lighting/Compose"); quadRenderer = new QuadRenderer(); blendBlack = new BlendState() { ColorBlendFunction = BlendFunction.Add, ColorSourceBlend = Blend.One, ColorDestinationBlend = Blend.One, AlphaBlendFunction = BlendFunction.Add, AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.One }; }
protected override void OnLoad() { base.OnLoad(); var shaderDir = "resources/shader/"; spriteShader = new QuadShader(shaderDir + "sprite.vert", shaderDir + "sprite.geo", shaderDir + "sprite.frag"); quadRenderer = new QuadRenderer(4, spriteShader); //texture = new Texture(@"C:\Users\bobub\Downloads\garo.jpg"); texture = new Texture("resources/image/vex.png"); vex = new Sprite(texture: texture); //vex.Color = Color4.White; vex.Pos = new Vector2(0f, 0f); //vex.Size = new Vector2(2f, 2f); //vex.Origin = new Vector2(-1, 1f); vex.CenterOrigin(); //vex.Origin = new Vector2(1f, -1f); vex.QuickScale(.5f); //vex.Rotation = 45; nilep = new MonoFont("resources/font/nilep.png", "resources/font/nilep.json"); helloText = new Text(nilep); helloText.Color = Color4.MediumPurple; helloText.String = "HEQ"; helloText.Position = new Vector2(.5f); //helloText.QuickScale(1.5f); helloText.CenterOrigin(); //helloText.Origin.Y = 0; //helloText.Origin = new Vector2(.6f, 0.1125f); //helloText.Rotation = -90; colorAnimator = new LinearColorAnimator(new TextColorSetter(helloText), true, Color4.White, new Color4(.5f, .5f, .5f, .5f), Color4.Black); posAnimator = new LinearVector2Animator(new TextPositionSetter(helloText), true, new Vector2(-1, -1), new Vector2(1f, 1), new Vector2(.2f)); colorAnimator.Active = false; //posAnimator.Active = false; }
public void ProcessFinalScene() { EngineSettings.Graphics.GraphicsDevice.SetRenderTarget(mFinalTarget); EngineSettings.Graphics.GraphicsDevice.Clear(Color.Transparent); EngineSettings.Graphics.GraphicsDevice.Textures[0] = this.mGBuffer.RenderTargets[0]; EngineSettings.Graphics.GraphicsDevice.Textures[1] = mLightTarget; EngineSettings.Graphics.GraphicsDevice.Textures[2] = this.mGBuffer.RenderTargets[2]; this.mCombineShader.Parameters["ambientColor"].SetValue(AmbientLight.LightColor); this.mCombineShader.Parameters["ambientIntensity"].SetValue(AmbientLight.Intensity); mCombineShader.CurrentTechnique.Passes[0].Apply(); QuadRenderer.Render(this.mGraphicsDevice); EngineSettings.Graphics.GraphicsDevice.SetRenderTarget(null); }
public void SetHolographicSpace(HolographicSpace holographicSpace) { this.holographicSpace = holographicSpace; #if DRAW_SAMPLE_CONTENT // Initialize the sample hologram. var gap = 0.016f; var size = .15f; quadRendererR = new QuadRenderer(deviceResources, size, new Vector3(gap, -size / 4, -.2f), "Guitar_R_001.jpg"); quadRendererL = new QuadRenderer(deviceResources, size, new Vector3(-(size + gap), -size / 4, -.2f), "Guitar_L_001.jpg"); spatialInputHandler = new SpatialInputHandler(); #endif // Respond to camera added events by creating any resources that are specific // to that camera, such as the back buffer render target view. // When we add an event handler for CameraAdded, the API layer will avoid putting // the new camera in new HolographicFrames until we complete the deferral we created // for that handler, or return from the handler without creating a deferral. This // allows the app to take more than one frame to finish creating resources and // loading assets for the new holographic camera. // This function should be registered before the app creates any HolographicFrames. holographicSpace.CameraAdded += this.OnCameraAdded; // Respond to camera removed events by releasing resources that were created for that // camera. // When the app receives a CameraRemoved event, it releases all references to the back // buffer right away. This includes render target views, Direct2D target bitmaps, and so on. // The app must also ensure that the back buffer is not attached as a render target, as // shown in DeviceResources.ReleaseResourcesForBackBuffer. holographicSpace.CameraRemoved += this.OnCameraRemoved; // Notes on spatial tracking APIs: // * Stationary reference frames are designed to provide a best-fit position relative to the // overall space. Individual positions within that reference frame are allowed to drift slightly // as the device learns more about the environment. // * When precise placement of individual holograms is required, a SpatialAnchor should be used to // anchor the individual hologram to a position in the real world - for example, a point the user // indicates to be of special interest. Anchor positions do not drift, but can be corrected; the // anchor will use the corrected position starting in the next frame after the correction has // occurred. }
public void Draw() { if (!initialized) { return; } #if DEBUG //bool wasDirty = surface.IsDirty; #endif if (surface.IsDirty) { DataRectangle rect = mappableSurface.Map(SharpDX.DXGI.MapFlags.Write); surface.CopyTo(rect.DataPointer, rect.Pitch, 4, false, false); mappableSurface.Unmap(); Display.context.CopyResource(mappableTexture, webTex.Tex); } QuadRenderer.Draw(webTex, position, new Color4(1, 1, 1, 1)); #if DEBUG //FontRenderer.Draw(FontManager.Get("default"), "Dirty:"+wasDirty, new Vector2(position.X, position.Y), Color.White); #endif }
protected override void Initialize() { ShaderManager.Add("VS_2D", Resources.GetShader("VS", "VS", "UI2D.fx")).SetInputLayout(Vertex2D.Elements); ShaderManager.Add("PS_2D", Resources.GetShader("PS", "PS", "UI2D.fx")); FontManager.Add("small", Resources.GetFont("Fonts/small")); FontManager.Add("default", Resources.GetFont("Fonts/default")); ScreenshotManager.Initialize(); QuadRenderer.Initialize(); InputManager.Initialize(); WebWindow.Initialize(); DebugPerfMonitor.Initialize(); ScreenManager.AddScreen(new StartupScreen()); ScreenManager.GotoScreen("Startup"); Form.KeyDown += Form_KeyDown; }
public void Initialize() { _quadRenderer = new QuadRenderer(); this.Childs[0] = new QuadNode(null, NodeChild.NorthEast); this.Childs[0].Location = this.Location; this.Childs[0].ParentTree = this; this.Childs[0].Initialize(); }
public DeferredRenderer(GraphicsDevice graphics) : base(graphics) { m_QuadRenderer = new QuadRenderer(graphics); }
/// <summary> /// Construct a new copy of our renderer /// </summary> /// <param name="graphicsDevice"></param> /// <param name="contentManager"></param> /// <param name="width"></param> /// <param name="height"></param> public Renderer(Game game, GraphicsDevice graphicsDevice, ContentManager contentManager, int width, int height) { _width = width; _height = height; _graphicsDevice = graphicsDevice; _contentManager = contentManager; _quadRenderer = new QuadRenderer(); _sphereRenderer = new MeshRenderer(contentManager.Load<Model>("models/sphere")); _spotRenderer = new MeshRenderer(contentManager.Load<Model>("models/cone")); _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; _shadowRenderer = new ShadowRenderer(this); CreateGBuffer(); LoadShaders(); _downsampleDepth = new DownsampleDepthEffect(); _downsampleDepth.Init(contentManager, this); }
/// <summary> /// Initialize the effect. Loads the shader file, extract the parameters, apply /// the default values /// </summary> /// <param name="contentManager"></param> /// <param name="renderer"></param> public void Init(ContentManager contentManager, Renderer renderer) { _quadRenderer = new QuadRenderer(); try { _effect = contentManager.Load<Effect>("Shaders/LightShaft"); ExtractParameters(); } catch (Exception ex) { Console.WriteLine("Error loading bloom depth effect: " + ex.ToString()); } }
/// <summary> /// Called when graphics resources need to be loaded. /// </summary> protected override void LoadContent() { this.spriteBatch = new SpriteBatch(this.GraphicsDevice); this.spriteFont = this.Game.Content.Load<SpriteFont>("System/Fonts/SegoeUI"); this.clearBufferEffect = this.Game.Content.Load<Effect>("System/Effects/ClearGBuffer"); this.clearBufferEffect.CurrentTechnique = this.clearBufferEffect.Techniques [0]; this.gBufferEffect = this.Game.Content.Load<Effect>("System/Effects/GBuffer"); this.gBufferEffect.CurrentTechnique = this.gBufferEffect.Techniques [0]; this.depthWriterEffect = this.Game.Content.Load<Effect>("System/Effects/DepthWriter"); this.depthWriterEffect.CurrentTechnique = this.depthWriterEffect.Techniques [0]; this.directionalLightRenderer = new DirectionalLightRenderingComponent(this); this.directionalLightRenderer.LoadContent(); this.pointLightRenderer = new PointLightRenderingComponent(this); this.pointLightRenderer.LoadContent(); this.spotLightRenderer = new SpotLightRenderingComponent(this); this.spotLightRenderer.LoadContent(); this.finalCombineEffect = this.Game.Content.Load<Effect>("System/Effects/FinalCombine"); this.finalCombineEffect.CurrentTechnique = this.finalCombineEffect.Techniques [0]; this.lightMapBlendState = new BlendState(); this.lightMapBlendState.ColorSourceBlend = Blend.One; this.lightMapBlendState.ColorDestinationBlend = Blend.One; this.lightMapBlendState.ColorBlendFunction = BlendFunction.Add; this.lightMapBlendState.AlphaSourceBlend = Blend.One; this.lightMapBlendState.AlphaDestinationBlend = Blend.One; this.lightMapBlendState.AlphaBlendFunction = BlendFunction.Add; this.gBufferTextureSize = new Vector2(this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height); this.gBufferTargets = new RenderTargetBinding[3]; this.gBufferTargets [0] = new RenderTargetBinding(new RenderTarget2D( this.GraphicsDevice, this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8) ); this.gBufferTargets [1] = new RenderTargetBinding(new RenderTarget2D( this.GraphicsDevice, this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8) ); this.gBufferTargets [2] = new RenderTargetBinding(new RenderTarget2D( this.GraphicsDevice, this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8) ); this.lightMapRenderTarget = new RenderTarget2D( this.GraphicsDevice, this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); this.quadRenderer = new QuadRenderer(this.GraphicsDevice); this.sceneTarget = new RenderTarget2D( GraphicsDevice, this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); /* this.ssaoTarget = new RenderTarget2D( GraphicsDevice, this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); this.ssao = new SSAO(this); this.ssao.LoadContent(this.Game.Content); */ this.dof = new DOF(this); this.dof.LoadContent(this.Game.Content); }
public DownsampleDepthEffect() { _quadRenderer = new QuadRenderer(); }
/// <summary> /// Instantiates the renderer. /// </summary> private AbstractRenderer InstantiateRenderer() { Trace.WriteLine("Instantiating particle renderer...", "CORE"); AbstractRenderer renderer = new QuadRenderer { GraphicsDeviceService = GraphicsDeviceService.Instance, }; //AbstractRenderer renderer = new SpriteBatchRenderer //{ // GraphicsDeviceService = GraphicsDeviceService.Instance //}; renderer.LoadContent(null); return renderer; }