示例#1
0
        public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) {
            if (!_initialized) {
                OnInitialize(holder);
                _initialized = true;
            }

            DrawInner(holder, camera, mode);
        }
示例#2
0
        public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode)
        {
            if (!_initialized)
            {
                OnInitialize(holder);
                _initialized = true;
            }

            DrawInner(holder, camera, mode);
        }
示例#3
0
 public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode)
 {
     if (_lights == null)
     {
         return;
     }
     foreach (var light in _lights)
     {
         light.Draw(holder, camera, mode);
     }
 }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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;
        }
示例#7
0
 public abstract void DrawInner(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode);
示例#8
0
 public void Draw(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode) {
     if (!IsEnabled || _lights == null) return;
     foreach (var light in _lights) {
         light.Draw(holder, camera, mode);
     }
 }
示例#9
0
 public abstract void DrawInner(DeviceContextHolder holder, ICamera camera, SpecialLightMode mode);