fix:新增功能并优化
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user