|
|
|
@ -518,6 +518,58 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
|
|
|
|
|
SyncLightPosition(7);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Fragment lighting distance attenuation bias
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].dist_atten_bias, 0x014A + 0 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(0);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].dist_atten_bias, 0x014A + 1 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(1);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].dist_atten_bias, 0x014A + 2 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(2);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].dist_atten_bias, 0x014A + 3 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(3);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].dist_atten_bias, 0x014A + 4 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(4);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].dist_atten_bias, 0x014A + 5 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(5);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].dist_atten_bias, 0x014A + 6 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(6);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].dist_atten_bias, 0x014A + 7 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationBias(7);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Fragment lighting distance attenuation scale
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].dist_atten_scale, 0x014B + 0 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(0);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].dist_atten_scale, 0x014B + 1 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(1);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].dist_atten_scale, 0x014B + 2 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(2);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].dist_atten_scale, 0x014B + 3 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(3);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].dist_atten_scale, 0x014B + 4 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(4);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].dist_atten_scale, 0x014B + 5 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(5);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].dist_atten_scale, 0x014B + 6 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(6);
|
|
|
|
|
break;
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].dist_atten_scale, 0x014B + 7 * 0x10):
|
|
|
|
|
SyncLightDistanceAttenuationScale(7);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Fragment lighting global ambient color (emission + ambient * ambient)
|
|
|
|
|
case PICA_REG_INDEX_WORKAROUND(lighting.global_ambient, 0x1c0):
|
|
|
|
|
SyncGlobalAmbient();
|
|
|
|
@ -896,6 +948,8 @@ void RasterizerOpenGL::SetShader() {
|
|
|
|
|
SyncLightDiffuse(light_index);
|
|
|
|
|
SyncLightAmbient(light_index);
|
|
|
|
|
SyncLightPosition(light_index);
|
|
|
|
|
SyncLightDistanceAttenuationBias(light_index);
|
|
|
|
|
SyncLightDistanceAttenuationScale(light_index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1105,3 +1159,21 @@ void RasterizerOpenGL::SyncLightPosition(int light_index) {
|
|
|
|
|
uniform_block_data.dirty = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RasterizerOpenGL::SyncLightDistanceAttenuationBias(int light_index) {
|
|
|
|
|
GLfloat dist_atten_bias = Pica::float20::FromRaw(Pica::g_state.regs.lighting.light[light_index].dist_atten_bias).ToFloat32();
|
|
|
|
|
|
|
|
|
|
if (dist_atten_bias != uniform_block_data.data.light_src[light_index].dist_atten_bias) {
|
|
|
|
|
uniform_block_data.data.light_src[light_index].dist_atten_bias = dist_atten_bias;
|
|
|
|
|
uniform_block_data.dirty = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RasterizerOpenGL::SyncLightDistanceAttenuationScale(int light_index) {
|
|
|
|
|
GLfloat dist_atten_scale = Pica::float20::FromRaw(Pica::g_state.regs.lighting.light[light_index].dist_atten_scale).ToFloat32();
|
|
|
|
|
|
|
|
|
|
if (dist_atten_scale != uniform_block_data.data.light_src[light_index].dist_atten_scale) {
|
|
|
|
|
uniform_block_data.data.light_src[light_index].dist_atten_scale = dist_atten_scale;
|
|
|
|
|
uniform_block_data.dirty = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|