gl_shader_gen: Implement fragment lighting fresnel effect.

This commit is contained in:
bunnei 2015-11-23 20:26:09 -05:00
parent 0e67c21c9e
commit c37de30cfc
3 changed files with 38 additions and 9 deletions

View file

@ -713,12 +713,15 @@ struct Regs {
}
};
/// Returns true if the specified lighting sampler is supported by the current Pica lighting configuration
static bool IsLightingSamplerSupported(LightingConfig config, LightingSampler sampler) {
switch (sampler) {
case LightingSampler::Distribution0:
return (config != LightingConfig::Config1);
case LightingSampler::Distribution1:
return (config != LightingConfig::Config0) && (config != LightingConfig::Config1) && (config != LightingConfig::Config5);
case LightingSampler::Fresnel:
return (config != LightingConfig::Config0) && (config != LightingConfig::Config2) && (config != LightingConfig::Config4);
}
return false;
}
@ -761,6 +764,7 @@ struct Regs {
BitField<0, 3, u32> src_num; // number of enabled lights - 1
union {
BitField< 2, 2, LightingFresnelSelector> fresnel_selector;
BitField< 4, 4, LightingConfig> config;
BitField<27, 1, u32> clamp_highlights; // 1: GL_TRUE, 0: GL_FALSE
};
@ -768,6 +772,7 @@ struct Regs {
union {
BitField<16, 1, u32> lut_enable_d0; // 0: GL_TRUE, 1: GL_FALSE
BitField<17, 1, u32> lut_enable_d1; // 0: GL_TRUE, 1: GL_FALSE
BitField<19, 1, u32> lut_enable_fr; // 0: GL_TRUE, 1: GL_FALSE
// Each bit specifies whether distance attenuation should be applied for the
// corresponding light