mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 06:09:30 -07:00
Fixing several embarrassing bugs.
WebGPU and REGL projects now flipY again, and they properly flip the symbolY glyph coordinate in the rain pass's fragment shader. Switching on some older code that was disabled for FF Nightly support— it makes more sense to wait for that support as implementations finalize. Added mipmap to images loaded into REGL project.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
const makePassTexture = (regl, halfFloat, mipmap) =>
|
||||
const makePassTexture = (regl, halfFloat) =>
|
||||
regl.texture({
|
||||
width: 1,
|
||||
height: 1,
|
||||
type: halfFloat ? "half float" : "uint8",
|
||||
wrap: "clamp",
|
||||
minFilter: "mipmap",
|
||||
min: mipmap ? "mipmap" : "linear",
|
||||
min: "linear",
|
||||
mag: "linear",
|
||||
});
|
||||
|
||||
@@ -26,7 +25,9 @@ const makeDoubleBuffer = (regl, props) => {
|
||||
};
|
||||
};
|
||||
|
||||
const loadImage = (regl, url) => {
|
||||
const isPowerOfTwo = (x) => Math.log2(x) % 1 == 0;
|
||||
|
||||
const loadImage = (regl, url, mipmap) => {
|
||||
let texture = regl.texture([[0]]);
|
||||
let loaded = false;
|
||||
return {
|
||||
@@ -55,10 +56,17 @@ const loadImage = (regl, url) => {
|
||||
data.src = url;
|
||||
await data.decode();
|
||||
loaded = true;
|
||||
if (mipmap) {
|
||||
if (!isPowerOfTwo(data.width) || !isPowerOfTwo(data.height)) {
|
||||
console.warn(`Can't mipmap a non-power-of-two image: ${url}`);
|
||||
}
|
||||
mipmap = false;
|
||||
}
|
||||
texture = regl.texture({
|
||||
data,
|
||||
mag: "linear",
|
||||
min: "linear",
|
||||
min: mipmap ? "mipmap" : "linear",
|
||||
flipY: true,
|
||||
});
|
||||
}
|
||||
})(),
|
||||
|
||||
Reference in New Issue
Block a user