protected void UpdateShaders(GraphicsDevice graphics, D3DRenderComponent render, D3DShaderTechniquePass pass, VertexLayoutConstructor layconst) { var device = graphics.D3DDevice; var vertexShaderByteCode = pass.VertexShader.ReadCompiledBytes(); var inputSignature = ShaderSignature.GetInputSignature(vertexShaderByteCode); render.Layout.Set(new InputLayout(device, inputSignature, layconst.ConstuctElements())); render.VertexShader.Set(new VertexShader(device, vertexShaderByteCode)); if (pass.GeometryShader != null) { render.GeometryShader.Set(new GeometryShader(device, pass.GeometryShader.ReadCompiledBytes())); } if (pass.PixelShader != null) { render.PixelShader.Set(new PixelShader(device, pass.PixelShader.ReadCompiledBytes())); } render.RasterizerState = new D3DRasterizerState(rasterizerStateDescription); render.SetStates( new BlendState(graphics.D3DDevice, blendStateDescription), new DepthStencilState(graphics.D3DDevice, depthStencilStateDescription)); }
//readonly ShaderDebugMode debug1; public BackgroundRenderTechnique() { var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(BackgroundRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "BG_")); vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); depthStencilState = new DisposableSetter <DepthStencilState>(disposer); rasterizerStateDescription = new RasterizerStateDescription2() { CullMode = CullMode.None, FillMode = FillMode.Solid, IsMultisampleEnabled = false, IsFrontCounterClockwise = false, IsScissorEnabled = false, IsAntialiasedLineEnabled = false, DepthBias = 0, DepthBiasClamp = .0f, SlopeScaledDepthBias = .0f }; //debug1 = new ShaderDebugMode(new System.IO.DirectoryInfo(@"D:\Storage_D\trash\archive\shaders\"), pass); //debug1.Activate(); }
public OneFrameFlatWhiteRenderTechnique() { var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(OneFrameFlatWhiteRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "BW_")); layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector3(); vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); rasterizerStateDescription = new RasterizerStateDescription2() { CullMode = CullMode.Front, FillMode = FillMode.Solid, IsMultisampleEnabled = false, IsFrontCounterClockwise = false, IsScissorEnabled = false, IsAntialiasedLineEnabled = false, DepthBias = 0, DepthBiasClamp = .0f, SlopeScaledDepthBias = .0f }; }
public SpherePointRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector4() .AddColorElementAsVector4(); var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(SpherePointRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "SpP_")); vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); geometryShader = new DisposableSetter <GeometryShader>(disposer); depthStencilState = new DisposableSetter <DepthStencilState>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); rasterizerStateDescription = new RasterizerStateDescription2() { CullMode = CullMode.None, FillMode = FillMode.Solid, IsMultisampleEnabled = false, IsFrontCounterClockwise = false, IsScissorEnabled = false, IsAntialiasedLineEnabled = false, DepthBias = 0, DepthBiasClamp = .0f, SlopeScaledDepthBias = .0f }; }
public StensilTest_TriangleColoredVertexRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector3() .AddNormalElementAsVector3(); var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(TriangleColoredVertexRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "CV_")); flatShadingPass = new D3DShaderTechniquePass(d.Load(gs_flat_shading, "FCV_")); wireframePass = new D3DShaderTechniquePass(d.Load(wireframe, "WCV_")); //debug1 = new ShaderDebugMode(new DirectoryInfo(@"D:\Storage_D\trash\archive\shaders\"), pass); //debug1.Activate(); //debug2 = new ShaderDebugMode(new DirectoryInfo(@"D:\Storage_D\trash\archive\shaders\"), flatShadingPass); //debug2.Activate(); depthStencilStateDesc = D3DDepthStencilDefinition.DepthEnabled; blendStateDesc = D3DBlendStateDescriptions.BlendStateEnabled; // blendStateDesc.AlphaToCoverageEnable = true; vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); flatShadingGS = new DisposableSetter <GeometryShader>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); wireframePS = new DisposableSetter <PixelShader>(disposer); wireframeGS = new DisposableSetter <GeometryShader>(disposer); }
static TerrainClipmapsRenderTechnique() { layconst = new VertexLayoutConstructor() .AddTexCoorElementAsVector2(); var d = new CombinedShadersLoader(typeof(TerrainClipmapsRenderTechnique)); pass = new D3DShaderTechniquePass(d.Load(path, "TRR_")); }
static SkyGradientColoringRenderTechnique() { layconst = new VertexLayoutConstructor() .AddPositionElementAsVector3(); var d = new CombinedShadersLoader(typeof(SkyGradientColoringRenderTechnique)); pass = new D3DShaderTechniquePass(d.Load(path, "SKY_")); }
static SpherePointRenderStrategy() { layconst = new VertexLayoutConstructor() .AddPositionElementAsVector3() .AddColorElementAsVector4(); var d = new CombinedShadersLoader(typeof(SpherePointRenderStrategy)); pass = new D3DShaderTechniquePass(d.Load(path, "SPH_")); }
static LineVertexRenderTechnique() { layconst = new VertexLayoutConstructor() .AddPositionElementAsVector3() .AddColorElementAsVector4(); var d = new CombinedShadersLoader(typeof(LineVertexRenderTechnique)); pass = new D3DShaderTechniquePass(d.Load(path, "LV_")); }
public ShaderDebugMode(DirectoryInfo dir, D3DShaderTechniquePass pass) { this.dir = dir; this.pass = pass; if (!dir.Exists) { dir.Create(); } watcher = new FileSystemWatcher(dir.FullName, "*.hlsl"); }
static SkyPlaneWithParallaxRenderTechnique() { layconst = new VertexLayoutConstructor() .AddPositionElementAsVector3() .AddTexCoorElementAsVector2(); var d = new CombinedShadersLoader(typeof(SkyPlaneWithParallaxRenderTechnique)); pass = new D3DShaderTechniquePass(d.Load(path, "SKYPL_")); }
static SphereByPoint() { layconst = new VertexLayoutConstructor() .AddPositionElementAsVector3() .AddColorElementAsVector4(); pass = new D3DShaderTechniquePass(new IShaderInfo[] { new ShaderInMemoryInfo("SPH_VertexShader", vertexShaderText, null, ShaderStages.Vertex.ToString(), "main"), new ShaderInMemoryInfo("SPH_GeometryShader", geometryShaderText, null, ShaderStages.Geometry.ToString(), "main"), new ShaderInMemoryInfo("SPH_FragmentShader", pixelShaderNoLogicText, null, ShaderStages.Fragment.ToString(), "main"), }); }
static CameraViewsRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector3() .AddNormalElementAsVector3() .AddColorElementAsVector4(); var d = new CombinedShadersLoader(new ECS.Common.ManifestResourceLoader(typeof(CameraViewsRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "CameraViews_")); }
static AminRenderTechniqueSystem() { layconst = new VertexLayoutConstructor() .AddSVPositionElementAsVector4() .AddNormalElementAsVector3() .AddColorElementAsVector4() .AddTexCoorElementAsVector2() .AddBlendIndicesElementAsUInt4() .AddBlendWeightElementAsVector4(); var d = new CombinedShadersLoader(typeof(AminRenderTechniqueSystem)); pass = new D3DShaderTechniquePass(d.Load(path, "ANIM_")); }
public LineVertexRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector4() .AddColorElementAsVector4(); var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(LineVertexRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "L_")); vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); }
static TerrainRenderTechnique() { layconst = new VertexLayoutConstructor() .AddPositionElementAsVector3() .AddNormalElementAsVector3() .AddTexCoorElementAsVector2() .AddTexCoorElementAsVector2() .AddTangentElementAsVector3() .AddBinormalElementAsVector3() .AddColorElementAsVector4() .AddTexCoorElementAsVector4(); var d = new CombinedShadersLoader(typeof(TerrainRenderTechnique)); pass = new D3DShaderTechniquePass(d.Load(path, "TRR_")); }
public BillboardRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector4() .AddColorElementAsVector3() ; var d = new CombinedShadersLoader(new ManifestResourceLoader(this.GetType())); VS_FS = new D3DShaderTechniquePass(d.Load(path_VS_FS, "BILL_")); GS_ScreenFixed = new D3DShaderTechniquePass(d.Load(path_GS_ScreenFixed, "BILL_")); GS_SizeFixed = new D3DShaderTechniquePass(d.Load(path_GS_SizeFixed, "BILL_")); vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); gsScreenFixed = new DisposableSetter <GeometryShader>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); gsSizeFixed = new DisposableSetter <GeometryShader>(disposer); }
// ShaderDebugMode debug; public TriangleTexturedVertexRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector3() .AddNormalElementAsVector3() .AddTexCoorElementAsVector2(); var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(TriangleTexturedVertexRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(path, "TV_")); flatShadingPass = new D3DShaderTechniquePass(d.Load(gs_flat_shading, "TV_")); //debug = new ShaderDebugMode(new DirectoryInfo(@"D:\"), pass); //debug.Activate(); depthStencilStateDesc = D3DDepthStencilDefinition.DepthEnabled; blendStateDesc = D3DBlendStateDescriptions.BlendStateEnabled; vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); flatShadingGS = new DisposableSetter <GeometryShader>(disposer); }
public OITTriangleColoredVertexRenderTechnique() { layconst = new VertexLayoutConstructor(Vertex.Size) .AddPositionElementAsVector3() .AddNormalElementAsVector3() .AddColorElementAsVector4(); var d = new CombinedShadersLoader(new ManifestResourceLoader(typeof(OITTriangleColoredVertexRenderTechnique <>))); pass = new D3DShaderTechniquePass(d.Load(oit, "OIT_")); quardPass = new D3DShaderTechniquePass(d.Load(quard, "QOIT_")); depthStencilStateDesc = D3DDepthStencilDefinition.DepthEnabled.Description; blendStateDesc = D3DBlendStateDescriptions.BlendStateEnabled; vertexShader = new DisposableSetter <VertexShader>(disposer); pixelShader = new DisposableSetter <PixelShader>(disposer); inputLayout = new DisposableSetter <InputLayout>(disposer); vertexShaderQuard = new DisposableSetter <VertexShader>(disposer); pixelShaderQuard = new DisposableSetter <PixelShader>(disposer); colorTargetTex2D = new DisposableSetter <Texture2D>(disposer); alphaTargetTex2D = new DisposableSetter <Texture2D>(disposer); colorTargetNoMSAATexture2D = new DisposableSetter <Texture2D>(disposer); alphaTargetNoMSAATexture2D = new DisposableSetter <Texture2D>(disposer); colorTargetNoMSAA = new DisposableSetter <ShaderResourceView>(disposer); alphaTargetNoMSAA = new DisposableSetter <ShaderResourceView>(disposer); colorTargetView = new DisposableSetter <RenderTargetView>(disposer); alphaTargetView = new DisposableSetter <RenderTargetView>(disposer); quardTargetView = new DisposableSetter <RenderTargetView>(disposer); targetSampler = new DisposableSetter <SamplerState>(disposer); }