Fixed palette lookup

This commit is contained in:
jglrxavpok 2020-08-11 23:49:21 +02:00
parent c0a704dc56
commit 7070f46a39
2 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,8 @@ public class PaletteGenerator {
Map<Integer, Integer> colors = new HashMap<>();
int highestIndex = 0;
for(MapColors c : MapColors.values()) {
if (c == MapColors.NONE)
continue;
for(MapColors.Multiplier m : MapColors.Multiplier.values()) {
int index = ((int)m.apply(c)) & 0xFF;
if(index > highestIndex) {

View File

@ -15,8 +15,8 @@ void main() {
// render in map colors
int closest = 0;
uint closestDistance = uint(2147483647);
for(int i = 1; i < paletteSize; i++) {
vec3 mapColor = texture(palette, vec2(i/paletteSize, 0.0)).rgb;
for(int i = 4; i < paletteSize; i++) {
vec3 mapColor = texture(palette, vec2((i+0.5f)/paletteSize, 0.0)).rgb;
int dr = int((mapColor.r - vertexColor.r)*255);
int dg = int((mapColor.g - vertexColor.g)*255);
int db = int((mapColor.b - vertexColor.b)*255);