3D 리플레이 무기 스킨: 뽑아 둔 스킨이면 3인칭 손의 총 · 1인칭 총을 그 모델로 (없거나 못 받으면 기본 총), 없는 스킨은 POST /site/maps3d/skins/want 로 요청 (기본 스킨 · 실패한 것 제외) · 서버 GET /site/maps3d/skins · want.json (형식 검사 · 중복 제거 · 다른 사이트 요청 막음 · 최대 2000) · 목 서버 · 테스트

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-20 22:28:13 +09:00
parent 0da993928e
commit 200dbceece
10 changed files with 294 additions and 18 deletions

View File

@@ -6,7 +6,8 @@ import { player } from '../store/player';
import { settings, useSettings } from '../store/settings';
import { useData } from '../store/app';
import { fmtClock } from '../lib/format';
import { equipAt, equipLabel, equipTracks, indexAt, isDead, roundAt, samplePath, samplePlayer, type ReplayFile, type ReplaySync } from '../lib/replay';
import { equipAt, equipLabel, equipTracks, indexAt, isDead, roundAt, samplePath, samplePlayer, skinTracks, type ReplayFile, type ReplaySync } from '../lib/replay';
import { loadSkins, lookOf, requestMissing } from '../lib/skins';
import { findMap3d, loadMap3d, mapMaterial, worldMatrix } from '../lib/map3d';
import { AgentRig, isGun, loadAgent, loadAnims, loadWeapon, weaponCat } from '../lib/agents3d';
import { Viewmodel, viewmodelIndex } from '../lib/viewmodel';
@@ -386,6 +387,19 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
});
let vmOn = false;
let scopedNow = false;
// 무기 스킨: 뽑아 둔 것만 그 스킨으로, 없는 것은 뽑아 달라고 요청한다 (다음에 열면 보인다)
const skinByPlayer = skinTracks(replay);
let skinIdx: Awaited<ReturnType<typeof loadSkins>> = null;
if (replay.skins?.length) {
void loadSkins().then((ix) => {
if (!disposed) skinIdx = ix;
});
void requestMissing(replay);
}
const skinLookAt = (p: number, t: number) => {
const s = equipAt(skinByPlayer[p], t);
return s >= 0 ? lookOf(skinIdx, replay.skins?.[s]) : null;
};
// 선택한 선수 이동 경로 (최근 6초)
const trailGeo = new THREE.BufferGeometry();
@@ -821,7 +835,7 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
const vy = q && !dead ? ((p.y - q.y) * 1000) / 150 : 0;
const a = (p.yaw * Math.PI) / 180;
const ek = replay.equipKinds?.[kind];
v.rig.setWeapon(isGun(ek) ? ek : null);
v.rig.setWeapon(isGun(ek) ? ek : null, isGun(ek) ? skinLookAt(v.idx, t) : null);
const inp = rigInput(replay, animIx, v.idx, t, { dt: dtR, fwd: vx * Math.cos(a) + vy * Math.sin(a), right: -vx * Math.sin(a) + vy * Math.cos(a), pitch: p.pitch });
v.rig.setShot(inp.shotMs);
v.rig.update(inp);
@@ -1022,7 +1036,7 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
const chr = replay.players[selIdx].character;
vmOn = !!fp && !sc && !!vm && vm.has(chr, fp.kind);
if (vmOn && vm && chr && fp) {
vm.set(chr, fp.kind!);
vm.set(chr, fp.kind!, skinLookAt(selIdx, t));
vm.pose(fp.input);
}
// 조준점: 선수 조준점(설정에 따라) 또는 내 조준점. 저격총 줌은 조준경 가운데 점, 정조준은 정조준 조준점