From 5092d43e8e1532f22eb5465154d444ca424e5af7 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Wed, 12 Aug 2026 13:41:59 -0500 Subject: [PATCH] fix has pbr --- packages/website/src/components/GuessRenderer.tsx | 6 +++++- .../website/src/components/MixerScene/index.tsx | 2 +- .../TankSandbox/components/Lighting.tsx | 15 ++++++++------- .../HeroSection/components/TankSandbox/index.tsx | 6 +++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/website/src/components/GuessRenderer.tsx b/packages/website/src/components/GuessRenderer.tsx index cc349d731..8bb46acad 100644 --- a/packages/website/src/components/GuessRenderer.tsx +++ b/packages/website/src/components/GuessRenderer.tsx @@ -1,3 +1,4 @@ +import { useModel } from "../hooks/useModel"; import { Guess, GuessState } from "../stores/guess"; import { SmartCanvas } from "./SmartCanvas"; import { Controls } from "./Tankopedia/HeroSection/components/TankSandbox/components/Control"; @@ -12,6 +13,9 @@ export function GuessRenderer() { const helpingReveal = Guess.use((state) => state.helpingReveal); const isRevealed = helpingReveal || guessState !== GuessState.NotGuessed; + const id = Guess.use((state) => state.tank.id); + const { hasPbr } = useModel(id); + return ( - + ); diff --git a/packages/website/src/components/MixerScene/index.tsx b/packages/website/src/components/MixerScene/index.tsx index c1b9291f5..3259d73fb 100644 --- a/packages/website/src/components/MixerScene/index.tsx +++ b/packages/website/src/components/MixerScene/index.tsx @@ -43,7 +43,7 @@ export const MixerScene = forwardRef((_, ref) => { target={[0, 0.5, 0]} /> - + }> diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/Lighting.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/Lighting.tsx index af8d0d161..cba10908e 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/Lighting.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/Lighting.tsx @@ -12,8 +12,6 @@ import { } from "react"; import { HemisphereLight, SpotLight, type Group } from "three"; import { degToRad, lerp } from "three/src/math/MathUtils.js"; -import { useModel } from "../../../../../../hooks/useModel"; -import { Duel } from "../../../../../../stores/duel"; import { Tankopedia } from "../../../../../../stores/tankopedia"; import { TankopediaPersistent } from "../../../../../../stores/tankopediaPersistent"; import { TankopediaDisplay } from "../../../../../../stores/tankopediaPersistent/constants"; @@ -39,7 +37,11 @@ const SHADOW_FOCUS = 2 ** 0; export const transitionEvent = new Quicklime(0); -export function Lighting() { +interface Props { + hasPbr: boolean; +} + +export function Lighting({ hasPbr }: Props) { const wrapper = useRef(null); const highGraphics = TankopediaPersistent.use((state) => state.highGraphics); @@ -84,6 +86,7 @@ export function Lighting() { {animate && ( ; animationTime: RefObject; wrapper: RefObject; + hasPbr: boolean; } -function Animator({ stop, t0, animationTime, wrapper }: AnimatorProps) { +function Animator({ stop, t0, animationTime, wrapper, hasPbr }: AnimatorProps) { const requestedDisplay = Tankopedia.use((state) => state.requestedDisplay); - - const id = Duel.use((state) => state.protagonist.tank.id); const display = Tankopedia.use((state) => state.display); - const { hasPbr } = useModel(id); const factor = !hasPbr && display !== TankopediaDisplay.StaticArmor ? NON_PBR_FACTOR : 1; diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx index 732bf7927..d9640dc9e 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx @@ -9,6 +9,7 @@ import { applyPitchYawLimits } from "../../../../../core/blitz/applyPitchYawLimi import { modelTransformEvent } from "../../../../../core/blitzkit/modelTransform"; import { Pose, poseEvent } from "../../../../../core/blitzkit/pose"; import { useEquipment } from "../../../../../hooks/useEquipment"; +import { useModel } from "../../../../../hooks/useModel"; import { useTankModelDefinition } from "../../../../../hooks/useTankModelDefinition"; import { Duel } from "../../../../../stores/duel"; import { Tankopedia } from "../../../../../stores/tankopedia"; @@ -49,6 +50,9 @@ export const TankSandbox = forwardRef( (state) => state.hideTankModelUnderArmor, ); + const id = Duel.use((state) => state.protagonist.tank.id); + const { hasPbr } = useModel(id); + useImperativeHandle(ref, () => canvas.current!, []); function handlePointerDown() { @@ -169,7 +173,7 @@ export const TankSandbox = forwardRef( outline: undefined, }} > - + {(display === TankopediaDisplay.Model ||