updated
This commit is contained in:
40
src/text.tsx
40
src/text.tsx
@@ -46,39 +46,6 @@ function runThree({ canvas, text, zoom = 1, scale = 1, width, height }: runThree
|
|||||||
|
|
||||||
//create mesh from text
|
//create mesh from text
|
||||||
const material = new THREE.MeshNormalMaterial();
|
const material = new THREE.MeshNormalMaterial();
|
||||||
// const material = new THREE.ShaderMaterial({
|
|
||||||
// uniforms: {
|
|
||||||
// 'tDiffuse': {
|
|
||||||
// value: null
|
|
||||||
// },
|
|
||||||
// 'resolution': {
|
|
||||||
// value: null
|
|
||||||
// },
|
|
||||||
// 'pixelSize': {
|
|
||||||
// value: 100
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// vertexShader:
|
|
||||||
// /* glsl */
|
|
||||||
// `
|
|
||||||
// varying highp vec2 vUv;
|
|
||||||
// void main() {
|
|
||||||
// vUv = uv;
|
|
||||||
// gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
// }`,
|
|
||||||
// fragmentShader:
|
|
||||||
// /* glsl */
|
|
||||||
// `
|
|
||||||
// uniform sampler2D tDiffuse;
|
|
||||||
// uniform float pixelSize;
|
|
||||||
// uniform vec2 resolution;
|
|
||||||
// varying highp vec2 vUv;
|
|
||||||
// void main(){
|
|
||||||
// vec2 dxy = pixelSize / resolution;
|
|
||||||
// vec2 coord = dxy * floor( vUv / dxy );
|
|
||||||
// gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
||||||
// }`
|
|
||||||
// });
|
|
||||||
const mesh = new THREE.Mesh(geometry, material);
|
const mesh = new THREE.Mesh(geometry, material);
|
||||||
scene.add(mesh);
|
scene.add(mesh);
|
||||||
|
|
||||||
@@ -97,7 +64,12 @@ function runThree({ canvas, text, zoom = 1, scale = 1, width, height }: runThree
|
|||||||
width = height * aspect;
|
width = height * aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(width! * scale, height! * scale)
|
if (!width || !height) {
|
||||||
|
//should never run
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(width * scale, height * scale)
|
||||||
|
|
||||||
canvas.width = width! * scale;
|
canvas.width = width! * scale;
|
||||||
canvas.height = height! * scale;
|
canvas.height = height! * scale;
|
||||||
|
|||||||
Reference in New Issue
Block a user