visual-song 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -195,12 +195,14 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
195
195
|
]);
|
|
196
196
|
}
|
|
197
197
|
const glm_color = playerRef.current.getBackgroundColor();
|
|
198
|
-
|
|
198
|
+
const result = new Float32Array([
|
|
199
199
|
glm_color.x,
|
|
200
200
|
glm_color.y,
|
|
201
201
|
glm_color.z,
|
|
202
202
|
glm_color.w
|
|
203
203
|
]);
|
|
204
|
+
glm_color.delete();
|
|
205
|
+
return result;
|
|
204
206
|
},
|
|
205
207
|
setBackgroundColor (color) {
|
|
206
208
|
if (!playerRef.current || !isInitialized.current) return;
|
|
@@ -210,6 +212,7 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
210
212
|
glm_color.z = color[2];
|
|
211
213
|
glm_color.w = color[3];
|
|
212
214
|
playerRef.current.setBackgroundColor(glm_color);
|
|
215
|
+
glm_color.delete();
|
|
213
216
|
},
|
|
214
217
|
setVertexShader (shader) {
|
|
215
218
|
if (!playerRef.current || !isInitialized.current) return false;
|
|
@@ -241,7 +244,12 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
241
244
|
setVertexShaderTransition (shader, mode, time, vertexCount, backgroundColor, easingType) {
|
|
242
245
|
if (!playerRef.current || !isInitialized.current || !module.current) return false;
|
|
243
246
|
const easing = module.current.EasingType[EasingType[easingType]];
|
|
244
|
-
|
|
247
|
+
const bgColor = new module.current.vec4(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]);
|
|
248
|
+
try {
|
|
249
|
+
return playerRef.current.setVertexShaderTransition(shader, mode, time, vertexCount, bgColor, easing);
|
|
250
|
+
} finally{
|
|
251
|
+
bgColor.delete();
|
|
252
|
+
}
|
|
245
253
|
},
|
|
246
254
|
exportRender (currentTime) {
|
|
247
255
|
if (!playerRef.current || !isInitialized.current) return;
|
|
@@ -348,6 +356,7 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
348
356
|
glm_color.z = color[2];
|
|
349
357
|
glm_color.w = color[3];
|
|
350
358
|
playerRef.current.setBackgroundColor(glm_color);
|
|
359
|
+
glm_color.delete();
|
|
351
360
|
}
|
|
352
361
|
}
|
|
353
362
|
async function _init() {
|
|
@@ -386,12 +395,13 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
386
395
|
initializedCallback();
|
|
387
396
|
}
|
|
388
397
|
}
|
|
389
|
-
function _resizeRenderer(width, height) {
|
|
398
|
+
function _resizeRenderer(width, height, pointSizeScale) {
|
|
390
399
|
if (!module.current) {
|
|
391
400
|
return;
|
|
392
401
|
}
|
|
393
402
|
if (playerRef.current) {
|
|
394
403
|
playerRef.current.resize(width, height);
|
|
404
|
+
playerRef.current.setPointSizeScale(pointSizeScale);
|
|
395
405
|
}
|
|
396
406
|
canvasRef.current.width = width;
|
|
397
407
|
canvasRef.current.height = height;
|
|
@@ -417,11 +427,15 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
417
427
|
canvas.style.setProperty("height", "100%");
|
|
418
428
|
canvas.style.setProperty("width", `${Math.floor(canvas.offsetHeight * engineAspectRatio)}px`);
|
|
419
429
|
}
|
|
420
|
-
|
|
430
|
+
// 내보내기 결과가 기기마다 달라지지 않도록 gl_PointSize는 렌더 타깃 픽셀 그대로 쓴다.
|
|
431
|
+
_resizeRenderer(resolutionRef.current.width, resolutionRef.current.height, 1);
|
|
421
432
|
} else {
|
|
422
433
|
canvas.style.setProperty("width", "100%");
|
|
423
434
|
canvas.style.setProperty("height", "100%");
|
|
424
|
-
|
|
435
|
+
// 캔버스는 DPR배 해상도로 그리지만 gl_PointSize 에 DPR 을 곱하지 않는다. 셰이더 프롬프트가
|
|
436
|
+
// 점 크기를 resolution.y(디바이스 px)에 비례하게 쓰라고 하므로, 여기서 DPR 을 또 곱하면
|
|
437
|
+
// 레티나에서 2배, DPR 3 폰에서 3배로 커진다(2026-10 POINTS 보드 50개 렌더 비교로 확인).
|
|
438
|
+
_resizeRenderer(window.devicePixelRatio * wrapperWidth, window.devicePixelRatio * wrapperHeight, 1);
|
|
425
439
|
}
|
|
426
440
|
}
|
|
427
441
|
function destroy() {
|
|
@@ -64,6 +64,7 @@ export interface VSPlayer extends ClassHandle {
|
|
|
64
64
|
getPrimitiveMode(): number;
|
|
65
65
|
setPrimitiveMode(_0: number): void;
|
|
66
66
|
exportRender(_0: number): void;
|
|
67
|
+
setPointSizeScale(_0: number): void;
|
|
67
68
|
setVertexShader(_0: EmbindString): boolean;
|
|
68
69
|
setVertexShaderTransition(_0: EmbindString, _1: number, _2: number, _3: number, _4: vec4, _5: EasingType): boolean;
|
|
69
70
|
getLastCompileError(): string;
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-song",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "visual-song core library",
|
|
5
5
|
"author": "kunyoungparkk (rjsdud3263@gmail.com)",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
|
|
8
7
|
"type": "module",
|
|
9
8
|
"files": [
|
|
10
9
|
"dist/index.js",
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
"react": "^19.0.0",
|
|
34
33
|
"react-dom": "^19.0.0"
|
|
35
34
|
},
|
|
36
|
-
"scripts":{
|
|
35
|
+
"scripts": {
|
|
37
36
|
"build": "rollup -c",
|
|
38
37
|
"pack": "npm pack"
|
|
39
38
|
}
|