|
14 | 14 | type SocketApiError, |
15 | 15 | SocketApiErrorType, |
16 | 16 | } from '@shared/types/api'; |
17 | | - import { DEFAULT_PLAYER_VOLUME, OcclusionQuality } from '@shared/types/store/settings'; |
| 17 | + import { DEFAULT_PLAYER_VOLUME } from '@shared/types/store/settings'; |
18 | 18 | import { |
19 | 19 | currentTime, |
20 | 20 | nextServerRestart, |
|
45 | 45 | import SteamLoginButton from './components/SteamLoginButton.svelte'; |
46 | 46 | import { cn } from './lib/tailwind'; |
47 | 47 | import { transformVector } from './lib/vector'; |
48 | | - import { flipDoor, getMap, getMapDoors, getReverbZones, initializeMap } from './render/maps'; |
| 48 | + import { getReverbZones, initializeMap } from './render/maps'; |
49 | 49 | import { renderFrame } from './render/renderFrame'; |
50 | 50 | import { type AudioConnectionStuff, CsTeam, type PlayerPositionApiData } from './type'; |
51 | 51 | import { decodePlayerData, decodeServerConfig } from './utils/decode'; |
|
65 | 65 | } |
66 | 66 | $: useTurnConfig = $settings.natFixEnabled; |
67 | 67 | $: microphoneMuted = $settings.micMuted; |
68 | | - $: occlusionQuality = $settings.occlusionQuality; |
69 | 68 | $: noiseSuppression = $settings.noiseSuppression; |
70 | 69 | $: playerVolumes = $settings.playerVolumes; |
71 | 70 | $: if (playerVolumes) { |
|
294 | 293 |
|
295 | 294 | $socket?.on('current-map', async (mapName) => { |
296 | 295 | console.log(`$socket.on('current-map'): ${mapName}`); |
297 | | - if ($settings.occlusionAutoQuality) { |
298 | | - window.api.setSettingsValue('occlusionQuality', OcclusionQuality.VERYLOW); |
299 | | - } |
300 | 296 | await initializeMap($scene, mapName); |
301 | 297 | }); |
302 | 298 |
|
|
329 | 325 | } |
330 | 326 | }); |
331 | 327 |
|
332 | | - $socket?.on('door-rotation', (data) => { |
333 | | - // console.log(`$socket.on('door-rotation'): ${JSON.stringify(data)}`); |
334 | | - const origin = new THREE.Vector3(data.absorigin.x, data.absorigin.y, data.absorigin.z); |
335 | | - flipDoor(origin, data.rotation); |
336 | | - }); |
337 | | -
|
338 | | - // $socket?.on('player-positions', (players: PlayerPositionApiData[]) => { |
339 | 328 | $socket?.on('player-positions', (data) => { |
340 | 329 | if (!$connectedToRoom) { |
341 | 330 | return; |
|
404 | 393 | continue; |
405 | 394 | } |
406 | 395 |
|
| 396 | + positionalSound.SetServerOcclusion(player.occlusion ?? 0); |
| 397 | +
|
407 | 398 | positionalSound.playerIsAlive = |
408 | 399 | player.isAlive && |
409 | 400 | (player.team === CsTeam.CounterTerrorist || player.team === CsTeam.Terrorist) |
|
454 | 445 | } |
455 | 446 | } |
456 | 447 |
|
457 | | - renderFrame($threejs, $scene, $clientCamera, $settingsOpen, updateSoundFilters); |
| 448 | + renderFrame($threejs, $scene, $clientCamera, updateSoundFilters); |
458 | 449 | }); |
459 | 450 | } |
460 | 451 |
|
|
726 | 717 | }; |
727 | 718 | document.querySelector('#threejs')!.innerHTML = ''; |
728 | 719 | initializeRenderer(); |
729 | | - if ($settings.occlusionAutoQuality) { |
730 | | - window.api.setSettingsValue('occlusionQuality', OcclusionQuality.VERYLOW); |
731 | | - } |
732 | 720 | await initializeMap($scene, response.mapName ?? 'de_dust2'); |
733 | 721 | if (response.serverConfig) { |
734 | 722 | serverConfigStore.set({ |
|
770 | 758 | }; |
771 | 759 |
|
772 | 760 | const updateSoundFilters = (): void => { |
773 | | - const map = getMap(); |
774 | | - if (map) { |
775 | | - for (const soundData of $remotePlayers.values()) { |
776 | | - soundData?.updateFilters( |
777 | | - [map, ...getMapDoors()], |
778 | | - occlusionQuality, |
779 | | - $serverConfigStore, |
780 | | - getReverbZones(), |
781 | | - ); |
782 | | - } |
| 761 | + for (const soundData of $remotePlayers.values()) { |
| 762 | + soundData?.updateFilters($serverConfigStore, getReverbZones()); |
783 | 763 | } |
784 | 764 | }; |
785 | 765 |
|
|
812 | 792 | return; |
813 | 793 | } |
814 | 794 | $threejs.autoClear = true; |
| 795 | + $threejs.setClearColor(0x101820, 1); |
| 796 | +
|
| 797 | + if (!$scene.getObjectByName('debug-ambient-light')) { |
| 798 | + const ambientLight = new THREE.AmbientLight(0xffffff, 1.25); |
| 799 | + ambientLight.name = 'debug-ambient-light'; |
| 800 | + $scene.add(ambientLight); |
| 801 | + } |
| 802 | +
|
| 803 | + if (!$scene.getObjectByName('debug-directional-light')) { |
| 804 | + const directionalLight = new THREE.DirectionalLight(0xffffff, 0.75); |
| 805 | + directionalLight.name = 'debug-directional-light'; |
| 806 | + directionalLight.position.set(2000, 2500, 2000); |
| 807 | + $scene.add(directionalLight); |
| 808 | + } |
815 | 809 |
|
816 | 810 | const threeJsDom = document.querySelector('#threejs'); |
817 | 811 | if (!threeJsDom) { |
|
1012 | 1006 |
|
1013 | 1007 | {#if clientSteamId && socketUrl} |
1014 | 1008 | <div class="m-2 overflow-hidden relative"> |
1015 | | - {#if $roomCode} |
1016 | | - <div class="absolute left-0 top-0 bg-black text-white text-xs p-1 z-5"> |
1017 | | - <span>Occlusion Detail:</span> |
1018 | | - {OcclusionQuality[occlusionQuality]} |
1019 | | - </div> |
1020 | | - {/if} |
1021 | 1009 | {#if microphoneMuted} |
1022 | 1010 | <div |
1023 | 1011 | class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-red-500 text-white text-xs p-1 z-5" |
|
0 commit comments