3D 리플레이 1인칭 시야: 세로 70° 고정 대신 게임처럼 가로 103° (16:9 게임 화면을 창에 꽉 차게 잘라 보여 줌 — 가로로 긴 창에서 약 120° 까지 넓어지던 것) · 줌은 tan 배율
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ import CrosshairPanel from './CrosshairPanel';
|
||||
import { buildAnimIndex, rigInput } from '../lib/replayAnim';
|
||||
import { abilityLook, type AbilityLook } from '../lib/abilities';
|
||||
import { loadVfxDb, vfxCoverage, VfxObject, type Place, type VfxDb } from '../lib/vfx';
|
||||
import { buildDirector, fitDistance, shotIndexAt, SHOT_LABEL } from '../lib/director';
|
||||
import { buildDirector, fitDistance, gameFov, shotIndexAt, SHOT_LABEL } from '../lib/director';
|
||||
import { boardIndex } from '../lib/scoreboard';
|
||||
import ReplayScoreboard from './ReplayScoreboard';
|
||||
|
||||
@@ -1028,7 +1028,7 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
|
||||
}
|
||||
// 1인칭 팔 · 총: 들고 있는 무기 · 꺼낸 때 · 사격 · 재장전 · 줌 · 걷기
|
||||
const fp = p && !isDead(replay, selIdx, t) ? fpState(selIdx, t) : null;
|
||||
const zoomFov = fp ? 70 / (fp.zoom === 0 ? 1 : fp.sniper ? (fp.zoom >= 2 ? 5 : 2.5) : 1.25) : 70;
|
||||
const zoomFov = gameFov(camera.aspect, fp ? (fp.zoom === 0 ? 1 : fp.sniper ? (fp.zoom >= 2 ? 5 : 2.5) : 1.25) : 1);
|
||||
if (camera.fov !== zoomFov) {
|
||||
camera.fov = zoomFov;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
@@ -299,3 +299,17 @@ export function fitDistance(points: V3[], target: V3, dir: V3, fovDeg: number, a
|
||||
}
|
||||
return need;
|
||||
}
|
||||
|
||||
/** 발로란트 시야: 16:9 화면에서 가로 103° (바꿀 수 없음) */
|
||||
export const GAME_HFOV = 103;
|
||||
const GAME_TAN_H = Math.tan(((GAME_HFOV / 2) * Math.PI) / 180);
|
||||
|
||||
/**
|
||||
* 1인칭 세로 시야각(three.js fov). 게임 화면(16:9 · 가로 103°)을 이 창 비율에 꽉 차게 잘라 보여 준다:
|
||||
* 16:9 보다 넓은 창은 가로 103° 를 지키고(위아래가 잘림), 좁은 창은 게임 세로 시야(약 70.5°)를 지킨다(양옆이 잘림).
|
||||
* 그래서 어느 창에서도 게임보다 넓게 보이지 않는다. zoom 은 배율 (정조준 1.25 · 저격 2.5 · 5)
|
||||
*/
|
||||
export function gameFov(aspect: number, zoom = 1): number {
|
||||
const tv = GAME_TAN_H / Math.max(aspect, 16 / 9) / zoom;
|
||||
return (2 * Math.atan(tv) * 180) / Math.PI;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user