mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-16 21:39:29 -07:00
Corrected the MSDF logic in the GLSL and WGSL shaders, which fixed the rendering in Chrome's software renderer.
This commit is contained in:
@@ -189,6 +189,10 @@ export default ({ regl, config, lkg }) => {
|
||||
baseTexture: baseTexture.texture,
|
||||
glintTexture: glintTexture.texture,
|
||||
|
||||
msdfPxRange: 4.0,
|
||||
glyphMSDFSize: [glyphMSDF.width(), glyphMSDF.height()],
|
||||
glintMSDFSize: [glintMSDF.width(), glintMSDF.height()],
|
||||
|
||||
camera: regl.prop("camera"),
|
||||
transform: regl.prop("transform"),
|
||||
screenSize: regl.prop("screenSize"),
|
||||
|
||||
@@ -36,6 +36,8 @@ const loadImage = (regl, url) => {
|
||||
}
|
||||
return texture;
|
||||
},
|
||||
width: () => (loaded ? texture.width : 1),
|
||||
height: () => (loaded ? texture.height : 1),
|
||||
loaded: (async () => {
|
||||
if (url != null) {
|
||||
const data = new Image();
|
||||
|
||||
@@ -17,6 +17,7 @@ const makeConfigBuffer = (device, configUniforms, config, density, gridSize) =>
|
||||
rippleType: config.rippleTypeName in rippleTypes ? rippleTypes[config.rippleTypeName] : -1,
|
||||
slantScale: 1 / (Math.abs(Math.sin(2 * config.slant)) * (Math.sqrt(2) - 1) + 1),
|
||||
slantVec: [Math.cos(config.slant), Math.sin(config.slant)],
|
||||
msdfPxRange: 4,
|
||||
};
|
||||
// console.table(configData);
|
||||
|
||||
@@ -93,7 +94,7 @@ export default ({ config, device, timeBuffer }) => {
|
||||
let highPassOutput;
|
||||
|
||||
const loaded = (async () => {
|
||||
const [msdfTexture, glintMSDFTexture, baseTexture, glintTexture, rainShader] = await Promise.all(assets);
|
||||
const [glyphMSDFTexture, glintMSDFTexture, baseTexture, glintTexture, rainShader] = await Promise.all(assets);
|
||||
|
||||
const rainShaderUniforms = structs.from(rainShader.code);
|
||||
configBuffer = makeConfigBuffer(device, rainShaderUniforms.Config, config, density, gridSize);
|
||||
@@ -170,7 +171,7 @@ export default ({ config, device, timeBuffer }) => {
|
||||
timeBuffer,
|
||||
sceneBuffer,
|
||||
linearSampler,
|
||||
msdfTexture.createView(),
|
||||
glyphMSDFTexture.createView(),
|
||||
glintMSDFTexture.createView(),
|
||||
baseTexture.createView(),
|
||||
glintTexture.createView(),
|
||||
|
||||
Reference in New Issue
Block a user