public AreaLight(GraphicsDevice graphicsDevice, ShadowMapSize size) { int baseSize = 2 << (int)size; LightAreaSize = new Vector2(baseSize); RenderTarget = new RenderTarget2D(graphicsDevice, baseSize, baseSize); this.graphicsDevice = graphicsDevice; }
/// <summary> /// Creates a new shadowmap resolver /// </summary> /// <param name="graphicsDevice">The Graphics Device used by the XNA game</param> /// <param name="quadRender"></param> /// <param name="baseSize">The size of the light regions </param> public ShadowMapResolver(GraphicsDevice graphicsDevice, QuadRenderComponent quadRender, ShadowMapSize maxShadowmapSize, ShadowMapSize maxDepthBufferSize) { this.graphicsDevice = graphicsDevice; this.quadRender = quadRender; reductionChainCount = (int)maxShadowmapSize; baseSize = 2 << reductionChainCount; depthBufferSize = 2 << (int)maxDepthBufferSize; }
public LightSpot(GraphicsDevice graphdev, ShadowMapSize size) { int baseSize = 2 << (int)size; this.LAreaSize = new Vector2(baseSize); this.RenderTarget = new RenderTarget2D(graphdev, baseSize, baseSize); this.LColor = Color.White; this.GraphDev = graphdev; }
/// <summary> /// Creates a new shadowmap resolver /// </summary> /// <param name="quadRender"></param> /// <param name="baseSize"> /// The size of the light regions /// </param> public ShadowResolver(GraphicsDevice graphdev, QuadRenderComponent quadRender, ShadowMapSize maxShadowmapSize, ShadowMapSize maxDepthBufferSize, Color color) { this.GraphDev = graphdev; this.QuadRender = quadRender; this.SColor = color; Batcher = new SpriteBatch(GraphDev); ReductionChainCount = (int)maxShadowmapSize; BaseSize = 2 << ReductionChainCount; DepthBufferSize = 2 << (int)maxDepthBufferSize; SScreen = new RenderTarget2D(graphdev, graphdev.Viewport.Width, graphdev.Viewport.Height); }
/// <summary> /// Handles input, and moves the point lights around /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { float dt = (float)gameTime.ElapsedGameTime.TotalSeconds; const float LightRotSpeed = 0.3f; Matrix rotMatrix = Matrix.CreateRotationY(LightRotSpeed * 2 * MathHelper.Pi * dt); foreach (Light light in lights) { if (light is PointLight) { PointLight pointLight = (PointLight)light; pointLight.Position = Vector3.Transform(pointLight.Position, rotMatrix); } } const float CamMoveSpeed = 1000.0f; const float CamRotSpeed = 0.3f; float slowdown = 1.0f; KeyboardState kbState = Keyboard.GetState(); if (kbState.IsKeyDown(Keys.LeftShift)) { slowdown = 0.1f; } if (kbState.IsKeyDown(Keys.W)) { camera.Position += camera.WorldMatrix.Forward * CamMoveSpeed * slowdown * dt; } else if (kbState.IsKeyDown(Keys.S)) { camera.Position += camera.WorldMatrix.Backward * CamMoveSpeed * slowdown * dt; } if (kbState.IsKeyDown(Keys.A)) { camera.Position += camera.WorldMatrix.Left * CamMoveSpeed * slowdown * dt; } else if (kbState.IsKeyDown(Keys.D)) { camera.Position += camera.WorldMatrix.Right * CamMoveSpeed * slowdown * dt; } if (kbState.IsKeyDown(Keys.Q)) { camera.Position += camera.WorldMatrix.Up * CamMoveSpeed * slowdown * dt; } else if (kbState.IsKeyDown(Keys.E)) { camera.Position += camera.WorldMatrix.Down * CamMoveSpeed * slowdown * dt; } if (kbState.IsKeyDown(Keys.Escape)) { Exit(); } if (kbState.IsKeyDown(Keys.M) && !lastKBState.IsKeyDown(Keys.M)) { enableMSAA = !enableMSAA; CreateRenderTargets(); } if (kbState.IsKeyDown(Keys.V) && !lastKBState.IsKeyDown(Keys.V)) { graphics.SynchronizeWithVerticalRetrace = !graphics.SynchronizeWithVerticalRetrace; graphics.ApplyChanges(); } if (kbState.IsKeyDown(Keys.G) && !lastKBState.IsKeyDown(Keys.G)) { int size = (int)gBufferSize; size++; size = size % Enum.GetValues(typeof(GBufferSize)).Length; gBufferSize = (GBufferSize)size; CreateRenderTargets(); } if (kbState.IsKeyDown(Keys.N) && !lastKBState.IsKeyDown(Keys.N)) { enableNormalMaps = !enableNormalMaps; } if (kbState.IsKeyDown(Keys.P) && !lastKBState.IsKeyDown(Keys.P)) { enablePointLights = !enablePointLights; } if (kbState.IsKeyDown(Keys.T) && !lastKBState.IsKeyDown(Keys.T)) { int mode = (int)transparencyMode; mode++; mode = mode % Enum.GetValues(typeof(TransparencyMode)).Length; transparencyMode = (TransparencyMode)mode; } if (kbState.IsKeyDown(Keys.L) && !lastKBState.IsKeyDown(Keys.L)) { if (shadowMapSize == ShadowMapSize.Size1024) { shadowMapSize = ShadowMapSize.Size2048; } else { shadowMapSize = ShadowMapSize.Size1024; } CreateRenderTargets(); } MouseState mouseState = Mouse.GetState(); int moveX = mouseState.X - lastMouseState.X; int moveY = mouseState.Y - lastMouseState.Y; if (mouseState.RightButton == ButtonState.Pressed) { camera.XRotation -= moveY * CamRotSpeed * dt; camera.YRotation -= moveX * CamRotSpeed * dt; } lastKBState = kbState; lastMouseState = mouseState; base.Update(gameTime); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (TextureQuality != 0) { hash ^= TextureQuality.GetHashCode(); } if (ShaderLod != 0) { hash ^= ShaderLod.GetHashCode(); } if (DefaultTargetFps != 0) { hash ^= DefaultTargetFps.GetHashCode(); } if (Antialiasing != 0) { hash ^= Antialiasing.GetHashCode(); } if (AnisotropicFiltering != 0) { hash ^= AnisotropicFiltering.GetHashCode(); } if (BillboardsFaceCameraPosition != false) { hash ^= BillboardsFaceCameraPosition.GetHashCode(); } if (RealtimeShadows != 0) { hash ^= RealtimeShadows.GetHashCode(); } if (ArAzimuthBlurring != false) { hash ^= ArAzimuthBlurring.GetHashCode(); } hash ^= GamemodeOverrides.GetHashCode(); if (ArEncounterParticleCap != 0) { hash ^= ArEncounterParticleCap.GetHashCode(); } if (LockedEncounterParticleCap != 0) { hash ^= LockedEncounterParticleCap.GetHashCode(); } if (MenuParticleCap != 0) { hash ^= MenuParticleCap.GetHashCode(); } if (ArAzimuthColorGrading != false) { hash ^= ArAzimuthColorGrading.GetHashCode(); } if (ShadowMapSize != 0) { hash ^= ShadowMapSize.GetHashCode(); } if (EncounterCameraTargetScaling != 0) { hash ^= EncounterCameraTargetScaling.GetHashCode(); } if (AdvancedArCameraResolution != 0) { hash ^= AdvancedArCameraResolution.GetHashCode(); } if (VfxLod != 0) { hash ^= VfxLod.GetHashCode(); } if (ForceSimpleAr != false) { hash ^= ForceSimpleAr.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public LightSpot(GraphicsDevice graphdev, ShadowMapSize size, Vector2 pos, Color color) : this(graphdev, size, pos) { this.LColor = color; }
public LightSpot(GraphicsDevice graphdev, ShadowMapSize size, Vector2 pos) : this(graphdev, size) { this.WPosition = pos; }