Merge branch 'main' into feat/elevator-system
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// GPU work-time measurement, gated by `?perf` in the URL.
|
||||
//
|
||||
// We can't use WebGPU timestamp queries here because the editor renders via
|
||||
// a custom `RenderPipeline.render()` path that bypasses three.js's built-in
|
||||
// timestamp infrastructure. Instead we use `device.queue.onSubmittedWorkDone()`,
|
||||
// which resolves when the GPU finishes all submitted work — measuring the
|
||||
// CPU→GPU-done delta gives a clean approximation of per-frame GPU duration
|
||||
// regardless of which render path produced it.
|
||||
|
||||
export const PERF_OVERLAY_ENABLED =
|
||||
typeof window !== 'undefined' && new URLSearchParams(window.location.search).has('perf')
|
||||
|
||||
const MAX_SAMPLES = 256
|
||||
const samples: number[] = []
|
||||
|
||||
export function pushGpuSample(ms: number): void {
|
||||
samples.push(ms)
|
||||
if (samples.length > MAX_SAMPLES) samples.shift()
|
||||
}
|
||||
|
||||
export function drainGpuSamples(): number[] {
|
||||
if (samples.length === 0) return []
|
||||
const out = samples.slice()
|
||||
samples.length = 0
|
||||
return out
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import {
|
||||
getMaterialPresetByRef,
|
||||
resolveMaterial,
|
||||
type MaterialMapProperties,
|
||||
type MaterialPresetPayload,
|
||||
type MaterialProperties,
|
||||
type MaterialSchema,
|
||||
resolveMaterial,
|
||||
} from '@pascal-app/core'
|
||||
import * as THREE from 'three'
|
||||
import { MeshStandardNodeMaterial } from 'three/webgpu'
|
||||
import { MeshLambertNodeMaterial, MeshStandardNodeMaterial } from 'three/webgpu'
|
||||
|
||||
export const baseMaterial = new MeshStandardNodeMaterial({
|
||||
color: '#f2f0ed',
|
||||
@@ -15,10 +15,8 @@ export const baseMaterial = new MeshStandardNodeMaterial({
|
||||
metalness: 0.0,
|
||||
})
|
||||
|
||||
export const glassMaterial = new MeshStandardNodeMaterial({
|
||||
export const glassMaterial = new MeshLambertNodeMaterial({
|
||||
color: '#e0f2fe',
|
||||
roughness: 0.05,
|
||||
metalness: 0.0,
|
||||
transparent: true,
|
||||
opacity: 0.35,
|
||||
side: THREE.DoubleSide,
|
||||
|
||||
Reference in New Issue
Block a user