Skip to content

Wire up orphaned shared-materials.js and performance-monitor.js into all simulations#75

Merged
3 commits merged intomainfrom
copilot/update-all-features
Feb 26, 2026
Merged

Wire up orphaned shared-materials.js and performance-monitor.js into all simulations#75
3 commits merged intomainfrom
copilot/update-all-features

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

Two utility modules existed in the codebase but were never loaded or called by any simulation after prior refactoring — shared-materials.js (centralized material definitions) and performance-monitor.js (FPS/memory tracking).

shared-materials.js

  • Added script tag to trazione.html, compressione.html, flessione.html
  • Replaced duplicate inline materials: { ... } objects in sim-tensile.js, sim-compression.js, sim-bending.js with materials: SHARED_MATERIALS
  • Switched hardcoded metallic-array spark checks to use isMaterialMetallic() in sim-tensile.js and material.metallic in sim-torsion.js
  • Added metallic: true/false to all material entries in sim-torsion.js, sim-shear.js, sim-fatigue-bending.js, sim-thermal-fatigue.js (these retain their own definitions due to domain-specific fields: G/shearYield for shear, fatigue coefficients for fatigue sims)

performance-monitor.js

  • Added script tag to all 9 simulation HTML files
  • Added PerformanceMonitor.init({ visible: false }) in each sim's init() and PerformanceMonitor.update() in each animate() loop
  • Fixed initial display colour from #00ff00 (neon) to #4ade80 to match the project's muted palette
// Before — orphaned, never called
// After — wired into every sim:
PerformanceMonitor.init({ visible: false });
// ...in animate():
PerformanceMonitor.update();

Performance monitor running (hidden by default, toggled via PerformanceMonitor.show()):

Tensile simulation with shared materials wired up:

Original prompt

This section details on the original issue you should resolve

<issue_title>Update all Features</issue_title>
<issue_description>There have been some heavy changes recently and some previous minor features that worked with other features may have changed. Perform a complete check and bring all features left behind to the current tech as many things changed. Take your time to explore and learn the codebase</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI assigned Copilot and ghost Feb 26, 2026
@ghost
Copy link
Copy Markdown

ghost commented Feb 26, 2026

@copilot Is it complete? Does everything works as designed? Is it ready to merge to prod?

Did you find anything incoherent?

…imulations

Co-authored-by: overdeckat <263444311+overdeckat@users.noreply.github.com>
Copilot AI changed the title [WIP] Update all features to current standards Wire up orphaned shared-materials.js and performance-monitor.js into all simulations Feb 26, 2026
Copilot finished work on behalf of ghost February 26, 2026 07:48
… #4ade80

Co-authored-by: overdeckat <263444311+overdeckat@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot Is it complete? Does everything works as designed? Is it ready to merge to prod?

Did you find anything incoherent?

Yes, it's complete and ready to merge. Here's a full audit:

What was done:

  • shared-materials.js — wired into trazione/compressione/flessione (the 3 sims that use SHARED_MATERIALS). Torsione/taglio/fatigue sims keep their own domain-specific material tables (shear modulus G, fatigue coefficients) but now have a consistent metallic: true/false flag on every material entry.
  • performance-monitor.js — integrated into all 9 simulation HTML files with PerformanceMonitor.init() + PerformanceMonitor.update() in every animate loop. It runs hidden by default (visible: false) and can be toggled via PerformanceMonitor.show().

One incoherence found and fixed (e536cd4): performance-monitor.js had an initial display color of #00ff00 (neon green), violating the project's muted palette. Updated to #4ade80 to match the rest of the codebase.

The performance monitor in action (FPS tracking, correct palette color):

Performance monitor running on hooke-2d

All 9 pages load without JS errors. CodeQL found 0 security alerts.

Copilot finished work on behalf of ghost February 26, 2026 07:53
@ghost
Copy link
Copy Markdown

ghost commented Feb 26, 2026

@copilot Is it complete? Does everything works as designed? Is it ready to merge to prod?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot Is it complete? Does everything works as designed? Is it ready to merge to prod?

Yes, it's complete and ready to merge. The previous response covers the full audit — both modules are wired up correctly across all 9 simulations, all pages load without JS errors, and the one incoherence found (#00ff00 neon green in performance-monitor.js, fixed in e536cd4#4ade80) has been resolved.

No further issues were found. The PR is production-ready.

@ghost ghost marked this pull request as ready for review February 26, 2026 07:55
Copilot AI review requested due to automatic review settings February 26, 2026 07:55
@ghost ghost merged commit 0babf41 into main Feb 26, 2026
1 check passed
Copilot finished work on behalf of ghost February 26, 2026 07:55
@ghost ghost deleted the copilot/update-all-features branch February 26, 2026 07:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR wires two previously orphaned utilities—shared-materials.js (centralised material definitions) and performance-monitor.js (FPS/memory tracking)—back into the simulations so they are actually loaded and executed across the app’s static HTML pages.

Changes:

  • Added shared-materials.js to the tensile/compression/bending HTML pages and updated those sims to use SHARED_MATERIALS instead of duplicated inline material tables.
  • Added performance-monitor.js to all simulation HTML pages and integrated PerformanceMonitor.init() / PerformanceMonitor.update() into each sim’s init/animation loop.
  • Normalised “metallic” detection by adding metallic: true/false to per-sim material tables where needed and using that flag (or isMaterialMetallic() for shared materials) for spark emission.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
trazione.html Loads shared materials and performance monitor before the tensile sim.
compressione.html Loads shared materials and performance monitor before the compression sim.
flessione.html Loads shared materials and performance monitor before the bending sim.
torsione.html Loads performance monitor before the torsion sim.
taglio.html Loads performance monitor before the shear sim.
hooke-2d.html Loads performance monitor before the 2D Hooke sim.
hooke-3d.html Loads performance monitor before the 3D Hooke sim.
fatica-flessione.html Loads performance monitor before the fatigue bending sim.
fatica-termica.html Loads performance monitor before the thermal fatigue sim.
src/js/sim-tensile.js Switches to SHARED_MATERIALS, uses isMaterialMetallic(), and hooks performance monitor into init/animate.
src/js/sim-compression.js Switches to SHARED_MATERIALS and hooks performance monitor into init/animate.
src/js/sim-bending.js Switches to SHARED_MATERIALS and hooks performance monitor into init/animate.
src/js/sim-torsion.js Adds metallic flags, uses them for sparks, and hooks performance monitor into init/animate.
src/js/sim-shear.js Adds metallic flags and hooks performance monitor into init/animate.
src/js/sim-fatigue-bending.js Adds metallic flags and hooks performance monitor into init/animate.
src/js/sim-thermal-fatigue.js Adds metallic flags and hooks performance monitor into init/animate.
src/js/sim-2d.js Hooks performance monitor into init/animate.
src/js/sim-3d.js Hooks performance monitor into init/animate.
src/js/performance-monitor.js Adjusts default display colour to match the project palette.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update all Features

2 participants