mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: reintroduce some frame invalidations
This commit is contained in:
1 parent
b893409a0a
commit
e68b4bea5d
8 files changed
+5
-27
No files matched your search
@@ -85,8 +85,6 @@ export function PrimaryArmorSceneComponent({
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// console.log('handleShellChange');
|
|
||||||
|
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
function handleGreenPenetrationChange(greenPenetration: boolean) {
|
function handleGreenPenetrationChange(greenPenetration: boolean) {
|
||||||
@@ -94,8 +92,6 @@ export function PrimaryArmorSceneComponent({
|
|||||||
}
|
}
|
||||||
function handleOpaqueChange(opaque: boolean) {
|
function handleOpaqueChange(opaque: boolean) {
|
||||||
material.uniforms.opaque.value = opaque;
|
material.uniforms.opaque.value = opaque;
|
||||||
|
|
||||||
// invalidate();
|
|
||||||
}
|
}
|
||||||
function handleWireframeChange(wireframe: boolean) {
|
function handleWireframeChange(wireframe: boolean) {
|
||||||
material.wireframe = wireframe;
|
material.wireframe = wireframe;
|
||||||
@@ -185,8 +181,6 @@ export function PrimaryArmorSceneComponent({
|
|||||||
spacedArmorRenderTarget.depthTexture;
|
spacedArmorRenderTarget.depthTexture;
|
||||||
material.uniforms.inverseProjectionMatrix.value =
|
material.uniforms.inverseProjectionMatrix.value =
|
||||||
camera.projectionMatrixInverse;
|
camera.projectionMatrixInverse;
|
||||||
|
|
||||||
// invalidate();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { J_HAT, K_HAT } from '@blitzkit/core';
|
import { J_HAT, K_HAT } from '@blitzkit/core';
|
||||||
import { Box, Flex, Text } from '@radix-ui/themes';
|
import { Box, Flex, Text } from '@radix-ui/themes';
|
||||||
import { Html } from '@react-three/drei';
|
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 { clamp } from 'lodash-es';
|
||||||
import { useEffect, useRef, type ComponentProps } from 'react';
|
import { useEffect, useRef, type ComponentProps } from 'react';
|
||||||
import {
|
import {
|
||||||
@@ -105,7 +105,7 @@ export function ShotDisplay() {
|
|||||||
outTracer.current.position.set(0, tracerT2 * outLength, 0);
|
outTracer.current.position.set(0, tracerT2 * outLength, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -122,7 +122,7 @@ export function ShotDisplay() {
|
|||||||
splashRadiusWrapper.current.scale.set(scale, scale, scale);
|
splashRadiusWrapper.current.scale.set(scale, scale, scale);
|
||||||
splashRadiusMaterial.current.opacity = opacity;
|
splashRadiusMaterial.current.opacity = opacity;
|
||||||
|
|
||||||
// invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
-5
@@ -53,7 +53,6 @@ export function SpacedArmorSubExternal({
|
|||||||
const tankopediaEphemeral = tankopediaEphemeralStore.getState();
|
const tankopediaEphemeral = tankopediaEphemeralStore.getState();
|
||||||
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
|
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
|
||||||
material.uniforms.penetration.value = shell.penetration.near;
|
material.uniforms.penetration.value = shell.penetration.near;
|
||||||
// invalidate();
|
|
||||||
}
|
}
|
||||||
async function handleProtagonistEquipmentChange(
|
async function handleProtagonistEquipmentChange(
|
||||||
equipment: EquipmentMatrix,
|
equipment: EquipmentMatrix,
|
||||||
@@ -67,8 +66,6 @@ export function SpacedArmorSubExternal({
|
|||||||
material.uniforms.thickness.value = hasEnhancedArmor
|
material.uniforms.thickness.value = hasEnhancedArmor
|
||||||
? thickness * 1.03
|
? thickness * 1.03
|
||||||
: thickness;
|
: thickness;
|
||||||
|
|
||||||
// invalidate();
|
|
||||||
}
|
}
|
||||||
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
|
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
|
||||||
const duel = duelStore.getState();
|
const duel = duelStore.getState();
|
||||||
@@ -84,8 +81,6 @@ export function SpacedArmorSubExternal({
|
|||||||
material.uniforms.penetration.value =
|
material.uniforms.penetration.value =
|
||||||
penetration *
|
penetration *
|
||||||
resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
|
resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
|
||||||
|
|
||||||
// invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleShellChange();
|
handleShellChange();
|
||||||
|
|||||||
-4
@@ -63,8 +63,6 @@ export function SpacedArmorSubSpaced({
|
|||||||
material.uniforms.normalization.value = degToRad(
|
material.uniforms.normalization.value = degToRad(
|
||||||
shell.normalization ?? 0,
|
shell.normalization ?? 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
// invalidate();
|
|
||||||
}
|
}
|
||||||
async function handleProtagonistEquipmentChange(
|
async function handleProtagonistEquipmentChange(
|
||||||
equipment: EquipmentMatrix,
|
equipment: EquipmentMatrix,
|
||||||
@@ -78,8 +76,6 @@ export function SpacedArmorSubSpaced({
|
|||||||
material.uniforms.thickness.value = hasEnhancedArmor
|
material.uniforms.thickness.value = hasEnhancedArmor
|
||||||
? thickness * 1.03
|
? thickness * 1.03
|
||||||
: thickness;
|
: thickness;
|
||||||
|
|
||||||
// invalidate();
|
|
||||||
}
|
}
|
||||||
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
|
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
|
||||||
const duel = duelStore.getState();
|
const duel = duelStore.getState();
|
||||||
|
|||||||
-1
@@ -21,7 +21,6 @@ export function DynamicArmorSwitcher() {
|
|||||||
variant="soft"
|
variant="soft"
|
||||||
size={{ initial: '2', sm: '3' }}
|
size={{ initial: '2', sm: '3' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// invalidate();
|
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
if (draft.protagonist.consumables.includes(73)) {
|
if (draft.protagonist.consumables.includes(73)) {
|
||||||
draft.protagonist.consumables =
|
draft.protagonist.consumables =
|
||||||
|
|||||||
@@ -201,7 +201,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
|||||||
size={{ initial: '2', sm: '3' }}
|
size={{ initial: '2', sm: '3' }}
|
||||||
radius="none"
|
radius="none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// invalidate();
|
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.antagonist.shell = thisShell;
|
draft.antagonist.shell = thisShell;
|
||||||
});
|
});
|
||||||
@@ -239,7 +238,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
|||||||
size={{ initial: '2', sm: '3' }}
|
size={{ initial: '2', sm: '3' }}
|
||||||
radius="none"
|
radius="none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// invalidate();
|
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.antagonist.equipmentMatrix[0][0] = hasCalibratedShells
|
draft.antagonist.equipmentMatrix[0][0] = hasCalibratedShells
|
||||||
? 0
|
? 0
|
||||||
@@ -265,7 +263,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
|||||||
size={{ initial: '2', sm: '3' }}
|
size={{ initial: '2', sm: '3' }}
|
||||||
radius="none"
|
radius="none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// invalidate();
|
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.protagonist.equipmentMatrix[1][1] = hasEnhancedArmor
|
draft.protagonist.equipmentMatrix[1][1] = hasEnhancedArmor
|
||||||
? 0
|
? 0
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { normalizeAngleRad } from '@blitzkit/core';
|
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 { memo, useRef } from 'react';
|
||||||
import { Group, Mesh, MeshStandardMaterial, Vector2 } from 'three';
|
import { Group, Mesh, MeshStandardMaterial, Vector2 } from 'three';
|
||||||
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
@@ -55,7 +55,7 @@ export const TankModel = memo(() => {
|
|||||||
|
|
||||||
if (!material) return;
|
if (!material) return;
|
||||||
|
|
||||||
// invalidate();
|
invalidate();
|
||||||
|
|
||||||
if (material.map) material.map.offset.y += offset;
|
if (material.map) material.map.offset.y += offset;
|
||||||
if (material.aoMap) material.aoMap.offset.y += offset;
|
if (material.aoMap) material.aoMap.offset.y += offset;
|
||||||
|
|||||||
@@ -6,6 +6,3 @@ export interface ModelTransformEventData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const modelTransformEvent = new EventManager<ModelTransformEventData>();
|
export const modelTransformEvent = new EventManager<ModelTransformEventData>();
|
||||||
modelTransformEvent.on(() => {
|
|
||||||
// invalidate();
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user