mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 06:09:30 -07:00
Fixed SDF math; texture dimensions were accessed before they loaded in the REGL-based renderer
This commit is contained in:
@@ -36,8 +36,18 @@ const loadImage = (regl, url) => {
|
||||
}
|
||||
return texture;
|
||||
},
|
||||
width: () => (loaded ? texture.width : 1),
|
||||
height: () => (loaded ? texture.height : 1),
|
||||
width: () => {
|
||||
if (!loaded && url != null) {
|
||||
console.warn(`texture still loading: ${url}`);
|
||||
}
|
||||
return loaded ? texture.width : 1;
|
||||
},
|
||||
height: () => {
|
||||
if (!loaded && url != null) {
|
||||
console.warn(`texture still loading: ${url}`);
|
||||
}
|
||||
return loaded ? texture.height : 1;
|
||||
},
|
||||
loaded: (async () => {
|
||||
if (url != null) {
|
||||
const data = new Image();
|
||||
|
||||
Reference in New Issue
Block a user