diff options
| author | 2017-06-09 15:24:28 -0500 | |
|---|---|---|
| committer | 2017-07-11 19:39:15 +0300 | |
| commit | 80b6fc592e3a2f5821975e84b5df35f5dc4ae51a (patch) | |
| tree | cad65ac28cacd3fea21fac1c73439933d0ff179a /src/video_core/swrasterizer | |
| parent | SwRasterizer: Calculate fresnel for fragment lighting. (diff) | |
| download | yuzu-80b6fc592e3a2f5821975e84b5df35f5dc4ae51a.tar.gz yuzu-80b6fc592e3a2f5821975e84b5df35f5dc4ae51a.tar.xz yuzu-80b6fc592e3a2f5821975e84b5df35f5dc4ae51a.zip | |
SwRasterizer: Fixed the lighting lut lookup function.
Diffstat (limited to 'src/video_core/swrasterizer')
| -rw-r--r-- | src/video_core/swrasterizer/rasterizer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index 2d1daa24a..2b85ac86c 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp | |||
| @@ -117,7 +117,9 @@ static std::tuple<float24, float24, PAddr> ConvertCubeCoord(float24 u, float24 v | |||
| 117 | 117 | ||
| 118 | 118 | ||
| 119 | float LookupLightingLut(size_t lut_index, float index) { | 119 | float LookupLightingLut(size_t lut_index, float index) { |
| 120 | unsigned index_i = static_cast<unsigned>(MathUtil::Clamp(floor(index * 256), 0.0f, 1.0f)); | 120 | index *= 256; |
| 121 | |||
| 122 | unsigned index_i = static_cast<unsigned>(MathUtil::Clamp(floor(index), 0.0f, 255.0f)); | ||
| 121 | 123 | ||
| 122 | float index_f = index - index_i; | 124 | float index_f = index - index_i; |
| 123 | 125 | ||
| @@ -126,7 +128,7 @@ float LookupLightingLut(size_t lut_index, float index) { | |||
| 126 | float lut_value = g_state.lighting.luts[lut_index][index_i].ToFloat(); | 128 | float lut_value = g_state.lighting.luts[lut_index][index_i].ToFloat(); |
| 127 | float lut_diff = g_state.lighting.luts[lut_index][index_i].DiffToFloat(); | 129 | float lut_diff = g_state.lighting.luts[lut_index][index_i].DiffToFloat(); |
| 128 | 130 | ||
| 129 | return lut_value + lut_diff * index_f; | 131 | return lut_value + lut_diff * index_f / 256.f; |
| 130 | } | 132 | } |
| 131 | 133 | ||
| 132 | std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(const Math::Quaternion<float>& normquat, const Math::Vec3<float>& view) { | 134 | std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(const Math::Quaternion<float>& normquat, const Math::Vec3<float>& view) { |