medieval-kit/vite.config.ts
CRT b3b4188216 Initial commit: @medieval-kit registry and viewer
A lowpoly medieval procedural model library for Vibe3D, plus the model
inspector used to build it.

Registry (@medieval-kit, published as @medieval-kit/registry):
- core: deterministic mulberry32 RNG, slot-based vertex-coloured materials,
  a geometry vocabulary (box, prism, stave, band, head, flip), and the
  stable-anchor part slots the Vibe3D protocol requires
- wooden-barrel: 806 tris, 13 separate staves, iron hoops, recessed heads
- wooden-crate: 360 tris, plank rows on corner posts, forged straps
- iron-brazier: 423 tris, typed actions, per-frame flame flicker, own light

The kit declares no renderer capabilities, so it runs on WebGLRenderer as
well as WebGPURenderer. Colour variation lives in vertex attributes rather
than in materials, so each model keeps one draw call per material.

Verification (bun run verify) covers 64 checks without a browser: geometry
validity, winding by two measures (radial alignment for bodies of
revolution, signed volume for closed solids), coplanar-face detection for
z-fighting, stable root and anchor identity across configure(),
deterministic seeding, material ownership, and idempotent disposal.
2026-08-20 23:15:58 +00:00

23 lines
1.1 KiB
TypeScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
export default defineConfig({
resolve: {
alias: [
// vibe3d, kurulan kaynağı "@/lib/vibe3d/..." ve "@/models/..." takma
// adlarıyla yazar. Bu adlar models.json içindeki `aliases` alanından gelir,
// o yüzden bundler tarafında da aynı şekilde tanımlanmaları gerekir.
{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
// `three` ve `three/webgpu` AYRI bundle'lar; ikisi de çekirdek sınıfların
// kendi kopyasını içerir. scifi-kit modeli three/webgpu'dan, taşınabilir
// medieval modeli düz three'den import ettiği için tarayıcı "Multiple
// instances of Three.js" uyarısı veriyor ve instanceof kontrolleri iki
// kopya arasında bozuluyor. WebGPU ile çalışan uygulamada standart çözüm:
// `three`yi tek kopyaya, three/webgpu'ya yönlendirmek.
// Regex şart — düz string önek eşleşmesi yapar ve "three/addons/..." yolunu
// da bozardı.
{ find: /^three$/, replacement: 'three/webgpu' },
],
},
})