mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
Fixed SDF math; texture dimensions were accessed before they loaded in the REGL-based renderer
This commit is contained in:
@@ -190,8 +190,8 @@ export default ({ regl, config, lkg }) => {
|
||||
glintTexture: glintTexture.texture,
|
||||
|
||||
msdfPxRange: 4.0,
|
||||
glyphMSDFSize: [glyphMSDF.width(), glyphMSDF.height()],
|
||||
glintMSDFSize: [glintMSDF.width(), glintMSDF.height()],
|
||||
glyphMSDFSize: () => [glyphMSDF.width(), glyphMSDF.height()],
|
||||
glintMSDFSize: () => [glintMSDF.width(), glintMSDF.height()],
|
||||
|
||||
camera: regl.prop("camera"),
|
||||
transform: regl.prop("transform"),
|
||||
|
||||
@@ -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