Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

low #2536

Merged
merged 1 commit into from
Dec 16, 2024
Merged

low #2536

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions client/src/three/components/ArmyModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ export class ArmyModel {
updateAnimations(deltaTime: number) {
const time = performance.now() * 0.001;

if (GRAPHICS_SETTING === GraphicsSettings.LOW) {
return;
}
// if (GRAPHICS_SETTING === GraphicsSettings.LOW) {
// return;
// }
Comment on lines +162 to +164
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider keeping the early return for LOW graphics setting. While the current approach works, the early return avoids unnecessary iteration over models and is more performant.

Suggested change
// if (GRAPHICS_SETTING === GraphicsSettings.LOW) {
// return;
// }
if (GRAPHICS_SETTING === GraphicsSettings.LOW) {
return;
}


this.models.forEach((modelData) => {
let needsMatrixUpdate = false;
Expand All @@ -188,7 +188,10 @@ export class ArmyModel {

for (let i = 0; i < modelData.mesh.count; i++) {
const animationState = this.animationStates[i];
if (GRAPHICS_SETTING === GraphicsSettings.MID && animationState === ANIMATION_STATE_IDLE) {
if (
(GRAPHICS_SETTING === GraphicsSettings.MID && animationState === ANIMATION_STATE_IDLE) ||
GRAPHICS_SETTING === GraphicsSettings.LOW
) {
Comment on lines +191 to +194
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this complex condition into a descriptive function like shouldSkipAnimation(graphicsSetting, animationState) to improve readability and maintainability.

Suggested change
if (
(GRAPHICS_SETTING === GraphicsSettings.MID && animationState === ANIMATION_STATE_IDLE) ||
GRAPHICS_SETTING === GraphicsSettings.LOW
) {
if (this.shouldSkipAnimation(GRAPHICS_SETTING, animationState)) {

continue;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/three/components/InstancedModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class InstancedModel {
tmp.userData.isInstanceModel = true;

if (!enableRaycast) {
tmp.raycast = () => { };
tmp.raycast = () => {};
}

this.mixer = new AnimationMixer(gltf.scene);
Expand Down
Loading