Wire up orphaned shared-materials.js and performance-monitor.js into all simulations#75
Wire up orphaned shared-materials.js and performance-monitor.js into all simulations#753 commits merged intomainfrom
Conversation
|
@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>
… #4ade80 Co-authored-by: overdeckat <263444311+overdeckat@users.noreply.github.com>
Yes, it's complete and ready to merge. Here's a full audit: What was done:
One incoherence found and fixed (e536cd4): The performance monitor in action (FPS tracking, correct palette color): All 9 pages load without JS errors. CodeQL found 0 security alerts. |
|
@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 ( No further issues were found. The PR is production-ready. |
There was a problem hiding this comment.
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.jsto the tensile/compression/bending HTML pages and updated those sims to useSHARED_MATERIALSinstead of duplicated inline material tables. - Added
performance-monitor.jsto all simulation HTML pages and integratedPerformanceMonitor.init()/PerformanceMonitor.update()into each sim’s init/animation loop. - Normalised “metallic” detection by adding
metallic: true/falseto per-sim material tables where needed and using that flag (orisMaterialMetallic()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.

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) andperformance-monitor.js(FPS/memory tracking).shared-materials.js
trazione.html,compressione.html,flessione.htmlmaterials: { ... }objects insim-tensile.js,sim-compression.js,sim-bending.jswithmaterials: SHARED_MATERIALSisMaterialMetallic()insim-tensile.jsandmaterial.metallicinsim-torsion.jsmetallic: true/falseto all material entries insim-torsion.js,sim-shear.js,sim-fatigue-bending.js,sim-thermal-fatigue.js(these retain their own definitions due to domain-specific fields:G/shearYieldfor shear, fatigue coefficients for fatigue sims)performance-monitor.js
PerformanceMonitor.init({ visible: false })in each sim'sinit()andPerformanceMonitor.update()in eachanimate()loop#00ff00(neon) to#4ade80to match the project's muted palettePerformance monitor running (hidden by default, toggled via
PerformanceMonitor.show()):Tensile simulation with shared materials wired up:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.