public void Draw(GameTime gameTime, Camera camera) { Matrix worldMatrix = Matrix.Identity; effect.Begin(); effect.Techniques[0].Passes[0].Begin(); world.SetValue(worldMatrix); view.SetValue(camera.View); projection.SetValue(camera.Projection); diffuseTexture.SetValue(skyBoxTexture); effect.CommitChanges(); GraphicsDevice.RenderState.CullMode = CullMode.None; GraphicsDevice.RenderState.DepthBufferWriteEnable = false; sphereMesh.Render(GraphicsDevice, camera); GraphicsDevice.RenderState.DepthBufferWriteEnable = true; GraphicsDevice.RenderState.CullMode = CullMode.CullCounterClockwiseFace; effect.Techniques[0].Passes[0].End(); effect.End(); }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="camera"></param> /// <param name="howBright">How bright for the skybox to be. Ranges 0.0f - 1.0f</param> public void Draw(GameTime gameTime, Camera camera, float howBright) { if (effect.IsDisposed) { return; } try { Matrix worldMatrix = Matrix.Identity; world.SetValue(worldMatrix); view.SetValue(camera.View); projection.SetValue(camera.Projection); diffuseTexture.SetValue(skyBoxTexture); brightness.SetValue(howBright); effect.Techniques[0].Passes[0].Apply(); GraphicsDevice.RasterizerState = RasterizerState.CullNone; if (GraphicsDevice.DepthStencilState.DepthBufferEnable) { GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; } else { GraphicsDevice.DepthStencilState = DepthStencilState.None; } sphereMesh.Render(GraphicsDevice, camera); GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; if (GraphicsDevice.DepthStencilState.DepthBufferEnable) { GraphicsDevice.DepthStencilState = DepthStencilState.Default; } else { GraphicsDevice.DepthStencilState = Helpers.DepthWrite; } } catch { } }