Fix scrubbing stalls, camera clipping and plate z-fighting
- The studio rebuilds with one shared material set, and paint only marks a material for recompiling when its finish changes, so scrubbing a field no longer compiles shaders every frame. - The camera cannot zoom into the car, and the near/far range is tightened so millimetre-apart details stop fighting for depth. - Licence plates sit 5 mm proud of their surround. - Development tools: page errors and a scrub benchmark report to the dev server's terminal; pointer capture tolerates synthetic events.
This commit is contained in:
parent
02e8854cc4
commit
8ad95fb30a
10 changed files with 125 additions and 12 deletions
|
|
@ -1,10 +1,13 @@
|
|||
/** Turning the spec into a vehicle on screen: coalesced rebuilds, coarse builds while a field is scrubbed, the rig pose. */
|
||||
import { generateVehicle, type Vehicle } from '../generator/index.ts'
|
||||
import { createMaterials, generateVehicle, type Vehicle, type VehicleMaterials } from '../generator/index.ts'
|
||||
import { effectiveSpec, stage, state } from './context.ts'
|
||||
import { renderInspector } from './inspector.ts'
|
||||
import { renderStatus } from './status.ts'
|
||||
|
||||
export let vehicle: Vehicle | null = null
|
||||
// One material set for every rebuild: new materials would mean new shaders to
|
||||
// compile, and while a field is scrubbed that happens every frame.
|
||||
let materials: VehicleMaterials | null = null
|
||||
export let rebuildQueued = false
|
||||
export let refit = false
|
||||
export let scrubbing = false
|
||||
|
|
@ -31,7 +34,9 @@ export function rebuild(frame = false): void {
|
|||
const t0 = performance.now()
|
||||
// While a field is scrubbed, build only the coarse level so dragging stays
|
||||
// smooth; the full build follows on release.
|
||||
const next = scrubbing ? generateVehicle(effectiveSpec(), { lods: [2], interior: false }) : generateVehicle(effectiveSpec())
|
||||
const spec = effectiveSpec()
|
||||
materials ??= createMaterials(spec.paint)
|
||||
const next = scrubbing ? generateVehicle(spec, { lods: [2], interior: false, materials }) : generateVehicle(spec, { materials })
|
||||
lastBuildMs = performance.now() - t0
|
||||
stage.setVehicle(next, refit || !vehicle)
|
||||
if (resumeView) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue