mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-20 23:09:30 -07:00
Removing the camera, actually.
This commit is contained in:
@@ -142,16 +142,16 @@ const glyphVariable = gpuCompute.addVariable(
|
|||||||
numColumns: {type: "f", value: numColumns},
|
numColumns: {type: "f", value: numColumns},
|
||||||
sharpness: { type: "f", value: sharpness },
|
sharpness: { type: "f", value: sharpness },
|
||||||
numGlyphColumns: {type: "f", value: numGlyphColumns},
|
numGlyphColumns: {type: "f", value: numGlyphColumns},
|
||||||
|
resolution: {type: "v2", value: new THREE.Vector2() },
|
||||||
},
|
},
|
||||||
vertexShader: `
|
vertexShader: `
|
||||||
attribute vec2 uv;
|
attribute vec2 uv;
|
||||||
attribute vec3 position;
|
attribute vec3 position;
|
||||||
uniform mat4 projectionMatrix;
|
uniform vec2 resolution;
|
||||||
uniform mat4 modelViewMatrix;
|
|
||||||
varying vec2 vUV;
|
varying vec2 vUV;
|
||||||
void main() {
|
void main() {
|
||||||
vUV = uv;
|
vUV = uv;
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
gl_Position = vec4( resolution * position.xy, 0.0, 1.0 );
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
fragmentShader: `
|
fragmentShader: `
|
||||||
@@ -209,11 +209,14 @@ const glyphVariable = gpuCompute.addVariable(
|
|||||||
if (isBigEnough <= BIG_ENOUGH && alpha < 0.5) { discard; return; }
|
if (isBigEnough <= BIG_ENOUGH && alpha < 0.5) { discard; return; }
|
||||||
if (alpha < 0.5 * MODIFIED_ALPHATEST) { discard; return; }
|
if (alpha < 0.5 * MODIFIED_ALPHATEST) { discard; return; }
|
||||||
|
|
||||||
gl_FragColor = vec4(vec3(brightness * alpha), 1);
|
gl_FragColor = vec4(vec3(brightness * alpha), 1.0);
|
||||||
|
|
||||||
|
// gl_FragColor = vec4(glyph.r, glyph.b, glyph.a, 1.0);
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
mesh.frustumCulled = false;
|
||||||
|
|
||||||
if (isPolar) {
|
if (isPolar) {
|
||||||
mesh.material.defines.isPolar = 1.0;
|
mesh.material.defines.isPolar = 1.0;
|
||||||
@@ -223,8 +226,6 @@ const glyphVariable = gpuCompute.addVariable(
|
|||||||
mesh.material.defines.isSlanted = 1.0;
|
mesh.material.defines.isSlanted = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mesh.material = new THREE.MeshBasicMaterial({map: glyphRTT});
|
|
||||||
|
|
||||||
scene.add( mesh );
|
scene.add( mesh );
|
||||||
|
|
||||||
let start = NaN;
|
let start = NaN;
|
||||||
@@ -250,25 +251,16 @@ const glyphVariable = gpuCompute.addVariable(
|
|||||||
glyphVariable.material.uniforms.now.value = now;
|
glyphVariable.material.uniforms.now.value = now;
|
||||||
glyphVariable.material.uniforms.delta.value = delta;
|
glyphVariable.material.uniforms.delta.value = delta;
|
||||||
|
|
||||||
gpuCompute.compute(); // Do the gpu computation
|
gpuCompute.compute();
|
||||||
renderer.render( scene, camera );
|
renderer.render( scene, camera );
|
||||||
};
|
};
|
||||||
|
|
||||||
matrixRenderer.resize = (width, height) => {
|
matrixRenderer.resize = (width, height) => {
|
||||||
const ratio = height / width;
|
if (width > height) {
|
||||||
const frac = 0.5;
|
mesh.material.uniforms.resolution.value.set(2, 2 * width / height);
|
||||||
if (ratio < 1) {
|
|
||||||
camera.left = -frac;
|
|
||||||
camera.right = frac;
|
|
||||||
camera.bottom = (camera.left - camera.right) * ratio + frac;
|
|
||||||
camera.top = frac;
|
|
||||||
} else {
|
} else {
|
||||||
camera.bottom = -frac;
|
mesh.material.uniforms.resolution.value.set(2 * height / width, 2);
|
||||||
camera.top = frac;
|
|
||||||
camera.left = camera.bottom / ratio;
|
|
||||||
camera.right = camera.top / ratio;
|
|
||||||
}
|
}
|
||||||
camera.updateProjectionMatrix();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return matrixRenderer;
|
return matrixRenderer;
|
||||||
|
|||||||
Reference in New Issue
Block a user