public override void SetShaderParameters(Device device, DeviceContext deviceContext, MaterialParameters matParams) { base.SetShaderParameters(device, deviceContext, matParams); Shader_50760736Params parameters = new Shader_50760736Params(); var material = matParams.MaterialData; if (material.Parameters.ContainsKey("C005")) { ShaderParameter param = material.Parameters["C005"]; parameters.C005_EmissiveFacadeColorAndIntensity = new Vector4(param.Paramaters[0], param.Paramaters[1], param.Paramaters[2], param.Paramaters[3]); } else { parameters.C005_EmissiveFacadeColorAndIntensity = new Vector4(0f); } if (material == null) { ShaderResourceView texture = RenderStorageSingleton.Instance.TextureCache[0]; deviceContext.PixelShader.SetShaderResource(0, texture); ShaderParams = parameters; } else { ShaderParameterSampler sampler; ShaderResourceView[] textures = new ShaderResourceView[2]; if (material.Samplers.TryGetValue("S000", out sampler)) { textures[0] = RenderStorageSingleton.Instance.TextureCache[sampler.TextureHash]; } else { textures[0] = RenderStorageSingleton.Instance.TextureCache[0]; } if (material.Samplers.TryGetValue("S011", out sampler)) { textures[1] = RenderStorageSingleton.Instance.TextureCache[sampler.TextureHash]; } else { textures[1] = RenderStorageSingleton.Instance.TextureCache[0]; } deviceContext.PixelShader.SetShaderResources(0, textures.Length, textures); } ShaderParams = parameters; }
public override void SetShaderParameters(Device device, DeviceContext deviceContext, MaterialParameters matParams) { base.SetShaderParameters(device, deviceContext, matParams); Shader_50760736Params parameters = new Shader_50760736Params(); var material = matParams.MaterialData; var param = material.GetParameterByKey("C005"); if (param != null) { parameters.C005_EmissiveFacadeColorAndIntensity = new Vector4(param.Paramaters[0], param.Paramaters[1], param.Paramaters[2], param.Paramaters[3]); } if (material == null) { ShaderResourceView texture = RenderStorageSingleton.Instance.TextureCache[0]; deviceContext.PixelShader.SetShaderResource(0, texture); ShaderParams = parameters; } else { ShaderResourceView[] textures = new ShaderResourceView[2]; HashName TextureFile = material.GetTextureByID("S000"); if (TextureFile != null) { textures[0] = RenderStorageSingleton.Instance.TextureCache[TextureFile.Hash]; } else { textures[0] = RenderStorageSingleton.Instance.TextureCache[0]; } TextureFile = material.GetTextureByID("S011"); if (TextureFile != null) { textures[1] = RenderStorageSingleton.Instance.TextureCache[TextureFile.Hash]; } else { textures[1] = RenderStorageSingleton.Instance.TextureCache[0]; } deviceContext.PixelShader.SetShaderResources(0, textures.Length, textures); } ShaderParams = parameters; }