diff --git a/font.wgsl b/font.wgsl index fe7c603..932d9ef 100644 --- a/font.wgsl +++ b/font.wgsl @@ -232,5 +232,7 @@ fn fragmentMain(input: VertexOutput) -> FragmentOutput output.color = supersampleColor(input.texture, s, p); } + output.color = vec4f(output.color.xyz / output.color.w, output.color.w); + return output; } diff --git a/fontSliders.js b/fontSliders.js index 02626b5..23403e2 100644 --- a/fontSliders.js +++ b/fontSliders.js @@ -38,13 +38,13 @@ function makeSliders() //colorOffset: new Slider("color offset", 0.0, 3.1415), }; + const defaults = {"undefined":"0","subpixel offset":"62","text":"supersampling","bone length":"32","outline scale":"208","ramp min":"0","dist. threshold":"513","velocity acc.":"385","gamma":"494","aliasing enable":"1","outline threshold":"335","outline color":"#000000","threshold offset":"265","outline. threshold":"512","outline offset":"0","inside color":"#ffffff","color mix":"0","scale":"89","supersample count":"1","distance threshold":"494","supersamples":"0","distance offset":"513","translate y":"381","ramp max":"1024","multisampleCount":"1","supersample offset":"248","subpixel enable":"1","translate x":"581","color offset":"118","velocity damp.":"796","distance scale":"49","threshold scale":"739","bone count":"40","color scale":"148","subpixel strength":"348"}; /* - const defaults = {"color scale":"148","bone length":"32","outline scale":"37","dist. threshold":"562","velocity acc.":"385","translate x":"464","outline threshold":"433","translate y":"495","bone count":"40","outline offset":"482","scale":"229","outline. threshold":"512","color offset":"118","distance offset":"676","threshold offset":"265","velocity damp.":"796","distance scale":"404","threshold scale":"739","color mix":"0"}; for (let slider of Object.values(sliders)) { if (slider.label in defaults) { slider.input.value = defaults[slider.label]; } - } + } */ return sliders; diff --git a/index.html b/index.html index b2212b7..6b2fe8a 100644 --- a/index.html +++ b/index.html @@ -106,7 +106,7 @@ - + diff --git a/index.js b/index.js index 6c9dcfd..53ed6cd 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ const eyeValueZ = document.getElementById("eye-value-z"); const yawValue = document.getElementById("yaw"); const pitchValue = document.getElementById("pitch"); -var downloadFramebufferPending = false; +var downloadRenderBufferPending = false; var tempBuffer = undefined; function recreateDepth(canvasTexture, sampleCount) @@ -210,15 +210,15 @@ function handleKeyup(e) function handleDownloadButton(e) { - downloadFramebufferPending = true; + downloadRenderBufferPending = true; console.log("download framebuffer"); } window.addEventListener('keydown', handleKeydown, false); window.addEventListener('keyup', handleKeyup, false); -const downloadFramebufferButton = document.getElementById("download-framebuffer"); -downloadFramebufferButton.addEventListener("click", handleDownloadButton, false); +const downloadRenderBufferButton = document.getElementById("download-render-buffer"); +downloadRenderBufferButton.addEventListener("click", handleDownloadButton, false); function updateView() { @@ -345,9 +345,9 @@ function render2() updateView(); //const clearValue = ; - const clearValue = (downloadFramebufferPending) ? { r: 0.0, g: 0.0, b: 0.0, a: 0.0 } : { r: 0.2, g: 0.2, b: 0.4, a: 1.0 }; + const clearValue = (downloadRenderBufferPending) ? { r: 0.0, g: 0.0, b: 0.0, a: 0.0 } : { r: 0.2, g: 0.2, b: 0.4, a: 1.0 }; - const viewTexture = (downloadFramebufferPending) ? copyTexture : canvasTexture; + const viewTexture = (downloadRenderBufferPending) ? copyTexture : canvasTexture; const attachment0 = (sampleCount == 1) ? { view: viewTexture.createView(), @@ -384,7 +384,7 @@ function render2() renderPass.end(); - if (downloadFramebufferPending) { + if (downloadRenderBufferPending) { encoder.copyTextureToBuffer({ texture: copyTexture, }, { @@ -402,7 +402,7 @@ function render2() frameNumber = (frameNumber + 1) % 2; - if (downloadFramebufferPending) { + if (downloadRenderBufferPending) { tempBuffer.mapAsync(GPUMapMode.READ).then(() => { const mappedRange = tempBuffer.getMappedRange(); // arraybuffer const blob = tgaBlob(copyTexture, mappedRange); @@ -414,7 +414,7 @@ function render2() tempBuffer.unmap(); requestAnimationFrame(render2); }); - downloadFramebufferPending = false; + downloadRenderBufferPending = false; } else { requestAnimationFrame(render2); } diff --git a/select.js b/select.js index ac57969..b4dbe44 100644 --- a/select.js +++ b/select.js @@ -8,34 +8,34 @@ class Select { const labelE = document.createElement("label"); labelE.innerHTML = label; - const selectE = document.createElement("select"); - selectE.className = "span-2"; + const inputE = document.createElement("select"); + inputE.className = "span-2"; for (let i = 0; i < options.length; i++) { const option = options[i]; const optionE = document.createElement("option"); optionE.setAttribute("value", i); optionE.innerHTML = option; - selectE.appendChild(optionE); + inputE.appendChild(optionE); } const rowE = document.createElement("row"); const sepE = document.createElement("row-separator"); rowE.appendChild(labelE); - rowE.appendChild(selectE); + rowE.appendChild(inputE); parent.appendChild(rowE); parent.appendChild(sepE); - this.select = selectE; + this.input = inputE; this.options = options; this.lastValue = undefined; const storageValue = localStorage.getItem(this.label); if (storageValue !== null) { - this.select.value = storageValue; + this.input.value = storageValue; } this.update(); @@ -43,7 +43,7 @@ class Select { update() { - const rawValue = parseInt(this.select.value); + const rawValue = parseInt(this.input.value); if (rawValue !== this.lastValue) { this.lastValue = rawValue; localStorage.setItem(this.label, rawValue);