fix: reintroduce some frame invalidations

This commit is contained in:
tresabhi committed 2024-11-10 22:19:05 -06:00
1 parent b893409a0a
commit e68b4bea5d
8 files changed
+5 -27

No files matched your search

@@ -85,8 +85,6 @@ export function PrimaryArmorSceneComponent({
true,
);
// console.log('handleShellChange');
invalidate();
}
function handleGreenPenetrationChange(greenPenetration: boolean) {
@@ -94,8 +92,6 @@ export function PrimaryArmorSceneComponent({
}
function handleOpaqueChange(opaque: boolean) {
material.uniforms.opaque.value = opaque;
// invalidate();
}
function handleWireframeChange(wireframe: boolean) {
material.wireframe = wireframe;
@@ -185,8 +181,6 @@ export function PrimaryArmorSceneComponent({
spacedArmorRenderTarget.depthTexture;
material.uniforms.inverseProjectionMatrix.value =
camera.projectionMatrixInverse;
// invalidate();
});
return (
@@ -1,7 +1,7 @@
import { J_HAT, K_HAT } from '@blitzkit/core';
import { Box, Flex, Text } from '@radix-ui/themes';
import { Html } from '@react-three/drei';
import { useFrame } from '@react-three/fiber';
import { invalidate, useFrame } from '@react-three/fiber';
import { clamp } from 'lodash-es';
import { useEffect, useRef, type ComponentProps } from 'react';
import {
@@ -105,7 +105,7 @@ export function ShotDisplay() {
outTracer.current.position.set(0, tracerT2 * outLength, 0);
}
// invalidate();
invalidate();
}
if (
@@ -122,7 +122,7 @@ export function ShotDisplay() {
splashRadiusWrapper.current.scale.set(scale, scale, scale);
splashRadiusMaterial.current.opacity = opacity;
// invalidate();
invalidate();
}
});
@@ -53,7 +53,6 @@ export function SpacedArmorSubExternal({
const tankopediaEphemeral = tankopediaEphemeralStore.getState();
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
material.uniforms.penetration.value = shell.penetration.near;
// invalidate();
}
async function handleProtagonistEquipmentChange(
equipment: EquipmentMatrix,
@@ -67,8 +66,6 @@ export function SpacedArmorSubExternal({
material.uniforms.thickness.value = hasEnhancedArmor
? thickness * 1.03
: thickness;
// invalidate();
}
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
const duel = duelStore.getState();
@@ -84,8 +81,6 @@ export function SpacedArmorSubExternal({
material.uniforms.penetration.value =
penetration *
resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
// invalidate();
}
handleShellChange();
@@ -63,8 +63,6 @@ export function SpacedArmorSubSpaced({
material.uniforms.normalization.value = degToRad(
shell.normalization ?? 0,
);
// invalidate();
}
async function handleProtagonistEquipmentChange(
equipment: EquipmentMatrix,
@@ -78,8 +76,6 @@ export function SpacedArmorSubSpaced({
material.uniforms.thickness.value = hasEnhancedArmor
? thickness * 1.03
: thickness;
// invalidate();
}
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
const duel = duelStore.getState();
@@ -21,7 +21,6 @@ export function DynamicArmorSwitcher() {
variant="soft"
size={{ initial: '2', sm: '3' }}
onClick={() => {
// invalidate();
mutateDuel((draft) => {
if (draft.protagonist.consumables.includes(73)) {
draft.protagonist.consumables =
@@ -201,7 +201,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
size={{ initial: '2', sm: '3' }}
radius="none"
onClick={() => {
// invalidate();
mutateDuel((draft) => {
draft.antagonist.shell = thisShell;
});
@@ -239,7 +238,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
size={{ initial: '2', sm: '3' }}
radius="none"
onClick={() => {
// invalidate();
mutateDuel((draft) => {
draft.antagonist.equipmentMatrix[0][0] = hasCalibratedShells
? 0
@@ -265,7 +263,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
size={{ initial: '2', sm: '3' }}
radius="none"
onClick={() => {
// invalidate();
mutateDuel((draft) => {
draft.protagonist.equipmentMatrix[1][1] = hasEnhancedArmor
? 0
@@ -1,5 +1,5 @@
import { normalizeAngleRad } from '@blitzkit/core';
import { useThree, type ThreeEvent } from '@react-three/fiber';
import { invalidate, useThree, type ThreeEvent } from '@react-three/fiber';
import { memo, useRef } from 'react';
import { Group, Mesh, MeshStandardMaterial, Vector2 } from 'three';
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
@@ -55,7 +55,7 @@ export const TankModel = memo(() => {
if (!material) return;
// invalidate();
invalidate();
if (material.map) material.map.offset.y += offset;
if (material.aoMap) material.aoMap.offset.y += offset;
@@ -6,6 +6,3 @@ export interface ModelTransformEventData {
}
export const modelTransformEvent = new EventManager<ModelTransformEventData>();
modelTransformEvent.on(() => {
// invalidate();
});