public VanillaEffect Init() { // vertex stuff VertexShader = _demo.ShaderManager["vanillaPlane.vs.cso"]; InputLayout = _disposer.Add(new VanillaInputLayout(VertexShader)); PrimitiveTopology = PrimitiveTopology.TriangleList; // pixel stuff // todo: perhaps add pixelshader PixelShader = null; // return this; }
public virtual Effect Init(EffectDescription description) { // vertex stuff VertexShader = _demo.ShaderManager[description.VertexShaderName ?? "vanillaPlane.vs.cso"]; InputLayout = _disposer.Add(new VanillaInputLayout(VertexShader)); PrimitiveTopology = PrimitiveTopology.TriangleList; // pixel stuff var addressMode = GetTextureAddressMode(); PixelShader = _demo.ShaderManager[description.PixelShaderName]; _textures = (description.TextureNames ?? new string[0]) .Select(textureName => string.IsNullOrEmpty(textureName) ? null : _demo.TextureManager[textureName]) .ToArray(); _resourceViews = _textures .Select(texture => (texture == null) ? null : _disposer.Add(new ShaderResourceView(_demo.Device, texture.Texture))) .ToArray(); _samplers = _textures .Select(texture => (texture == null) ? null : _disposer.Add(new SamplerState(_demo.Device, new SamplerStateDescription() { Filter = Filter.Anisotropic, AddressU = addressMode, AddressV = addressMode, AddressW = addressMode, BorderColor = Color.Black, ComparisonFunction = Comparison.Never, MaximumAnisotropy = 1, // 16 MipLodBias = 0, MinimumLod = 0, MaximumLod = 1, // 16 }))) .ToArray(); // return this; }