fix:新增功能并优化

This commit is contained in:
Daniel
2026-04-02 11:15:21 +08:00
parent 0304805ce1
commit 8d69c0979c
13 changed files with 1283 additions and 214 deletions

View File

@@ -1,12 +1,7 @@
/**
* One-off WebGL capture: try multiple iTime values, pick a non-degenerate frame (avoid flat black/white),
* export PNG, then loseContext.
*/
(function () {
const THUMB_W = 512;
const THUMB_H = 320;
/** 首帧常为过黑/过白/无对比时,在这些时刻采样并打分选帧 */
const THUMB_TIME_CANDIDATES = [
0, 0.1, 0.22, 0.45, 0.78, 1.15, 1.7, 2.25, 2.85, 3.45, 4.2, 5.1, 6.28, 7.5, 9, 11, 13,
];
@@ -276,11 +271,6 @@ void main() { mainImage(outColor, gl_FragCoord.xy); }`;
return varL * 85 + (1 - Math.abs(mean - 0.4) * 1.05);
}
/**
* @param {string} code — normalized GLSL (same as server returns)
* @param {string} name — shader title for fallback hash
* @returns {Promise<string>} data:image/png;base64,...
*/
window.captureShaderThumbnail = function captureShaderThumbnail(code, name) {
const canvas = document.createElement("canvas");
canvas.width = THUMB_W;