fix scaling issue

This commit is contained in:
dank074 2021-09-01 13:21:12 -05:00
parent 8d14854b4e
commit 3821633dd3

View File

@ -25,13 +25,13 @@ void main(void) {
{
if(channel == 0)
{
adjusted = texture2D(lut, vec2(currentColor.r, 0.5));
adjusted = texture2D(lut, vec2((currentColor.r * 255.0 + 0.5) / 256.0, 0.5));
} else if(channel == 1) {
adjusted = texture2D(lut, vec2(currentColor.g, 0.5));
adjusted = texture2D(lut, vec2((currentColor.g * 255.0 + 0.5) / 256.0, 0.5));
} else if(channel == 2) {
adjusted = texture2D(lut, vec2(currentColor.b, 0.5));
adjusted = texture2D(lut, vec2((currentColor.b * 255.0 + 0.5) / 256.0, 0.5));
} else if(channel == 3) {
adjusted = texture2D(lut, vec2(currentColor.a, 0.5));
adjusted = texture2D(lut, vec2((currentColor.a * 255.0 + 0.5) / 256.0, 0.5));
}
}
@ -70,7 +70,7 @@ export class PaletteMapFilter extends NitroFilter
break;
}
this._lut = NitroBasetexture.fromBuffer(Uint8Array.from(lut), lut.length / 4, 1);
this._lut = NitroBasetexture.fromBuffer(Uint8Array.from(lut), lut.length / 4, 1, { mipmap: 0, scaleMode: 0 });
this.uniforms.lut = this._lut;
this.uniforms.channel = this._channel;