public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) { if (!_initialized) { OnInitialize(holder); _initialized = true; } DrawInner(holder, camera, mode); }
public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) { if (_lights == null) { return; } foreach (var light in _lights) { light.Draw(holder, camera, mode); } }
public override void DrawInner(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) { _effect.FxDirectionalLightDirection.Set(Direction); _effect.FxLightColor.Set(Color); // using this instead of .Prepare() to keep DepthState — it might be special for filtering holder.QuadBuffers.PrepareInputAssembler(holder.DeviceContext, _effect.LayoutPT); (mode == SpecialLightMode.Default ? _effect.TechDirectionalLight : mode == SpecialLightMode.Shadows ? _effect.TechDirectionalLight_Shadows : mode == SpecialLightMode.ShadowsWithoutFilter ? _effect.TechDirectionalLight_Shadows_NoFilter : _effect.TechDirectionalLight_Split).DrawAllPasses(holder.DeviceContext, 6); }
public override void DrawInner(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) { //holder.DeviceContext.OutputMerger.DepthStencilState = null; _effect.FxPointLightRadius.Set(Radius * Radius); _effect.FxPointLightPosition.Set(Position); _effect.FxLightColor.Set(Color); _sphere.Draw(holder, camera, SpecialRenderMode.Shadow); holder.DeviceContext.Rasterizer.State = _rasterizer; //holder.DeviceContext.OutputMerger.DepthStencilState = _depth; var matrix = Matrix.Translation(Position); _effect.FxWorldViewProj.SetMatrix(matrix * camera.ViewProj); _effect.FxWorldInvTranspose.SetMatrix(Matrix.Invert(Matrix.Transpose(matrix))); _effect.FxWorld.SetMatrix(matrix); (Debug ? _effect.TechPointLight_Debug : Specular?_effect.TechPointLight : _effect.TechPointLight_NoSpec) .DrawAllPasses(holder.DeviceContext, _sphere.IndicesCount); holder.DeviceContext.Rasterizer.State = null; //holder.DeviceContext.OutputMerger.DepthStencilState = null; }
public abstract void DrawInner(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode);
public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) { if (!IsEnabled || _lights == null) return; foreach (var light in _lights) { light.Draw(holder, camera, mode); } }