@pinkaphant/kolmo 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -2
- package/bin/kolmo.mjs +112 -0
- package/dist/engine/index.d.ts +8 -0
- package/dist/engine/index.js +3 -0
- package/dist/engine/kolmoActor.d.ts +6 -0
- package/dist/engine/kolmoIsland.d.ts +17 -0
- package/dist/engine/kolmoLongDrive.d.ts +13 -0
- package/dist/engine/kolmoRigs.d.ts +13 -0
- package/dist/engine/kolmoStore.d.ts +68 -0
- package/dist/engine/kolmoSurface.d.ts +18 -0
- package/dist/engine/kolmoVehicle.d.ts +32 -0
- package/dist/engine/kolmoWorld.d.ts +51 -0
- package/dist/engine/longDriveKit.d.ts +19 -0
- package/dist/engine/mainlandMacroCell.d.ts +19 -0
- package/dist/engine-BiMeAPAi.js +1717 -0
- package/dist/importer/ChopShopPanel.d.ts +44 -0
- package/dist/importer/DomainWorkshopPanel.d.ts +17 -0
- package/dist/importer/GateHudBar.d.ts +29 -0
- package/dist/importer/GlbImportGate.d.ts +7 -0
- package/dist/importer/ImperativeVehicleRig.d.ts +9 -0
- package/dist/importer/Step1CalibrationPlinth.d.ts +38 -0
- package/dist/importer/Step2UniversalPad.d.ts +18 -0
- package/dist/importer/VfxEmitterPool.d.ts +8 -0
- package/dist/importer/chopShopActions.d.ts +44 -0
- package/dist/importer/gateStore.d.ts +73 -0
- package/dist/importer/glbNormalizer.d.ts +22 -0
- package/dist/importer/importerWebMcp.d.ts +37 -0
- package/dist/importer/index.d.ts +17 -0
- package/dist/importer/index.js +3 -0
- package/dist/importer/khrCompiler.d.ts +23 -0
- package/dist/importer/launcherBake.d.ts +15 -0
- package/dist/importer/meshIslands.d.ts +59 -0
- package/dist/importer/surfaceCutter.d.ts +27 -0
- package/dist/importer/surfaceTopology.d.ts +40 -0
- package/dist/importer/universalGateBake.d.ts +41 -0
- package/dist/importer/usdToGlb.d.ts +11 -0
- package/dist/importer/useChopShopController.d.ts +94 -0
- package/dist/importer/vehiclePanelAnim.d.ts +25 -0
- package/dist/importer/wheelAxlePairing.d.ts +19 -0
- package/dist/importer-Cz5w0mnC.js +5005 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +14 -0
- package/dist/junk/DestructibleTarget.d.ts +18 -0
- package/dist/junk/KolmoJunk.d.ts +14 -0
- package/dist/junk/ShardPieces.d.ts +10 -0
- package/dist/junk/TargetDecals.d.ts +18 -0
- package/dist/junk/bvhShatter.d.ts +7 -0
- package/dist/junk/bvhTriCollector.d.ts +20 -0
- package/dist/junk/index.d.ts +12 -0
- package/dist/junk/index.js +1 -0
- package/dist/junk/junkGeometry.d.ts +34 -0
- package/dist/junk/junkImportSanitize.d.ts +6 -0
- package/dist/junk/junkImporter.d.ts +25 -0
- package/dist/junk/junkLabelCanvas.d.ts +7 -0
- package/dist/junk/junkLabels.d.ts +31 -0
- package/dist/junk/junkTypes.d.ts +48 -0
- package/dist/junk/targetHelpers.d.ts +56 -0
- package/dist/junk/targetHitLogic.d.ts +30 -0
- package/dist/junk/useTargetAssets.d.ts +24 -0
- package/dist/junk-B4bC1zAl.js +1049 -0
- package/dist/kolmoSurface-DTnrFXH0.js +558 -0
- package/dist/schema/kolmoSchema.d.ts +69 -0
- package/dist/shaders/celestialBackdrop.d.ts +22 -0
- package/dist/shaders/index.d.ts +6 -0
- package/dist/shaders/index.js +1 -0
- package/dist/shaders/plumeAndSparkle.d.ts +14 -0
- package/dist/shaders/ps2GlslShared.d.ts +20 -0
- package/dist/shaders/ps2MaterialsTSL.d.ts +23 -0
- package/dist/shaders/ps2MaterialsWebGL.d.ts +15 -0
- package/dist/shaders/ps2RoadWebGL.d.ts +7 -0
- package/dist/shaders/ps2TerrainWebGL.d.ts +8 -0
- package/dist/shaders/ps2Textures.d.ts +22 -0
- package/dist/shaders/retroPalettes.d.ts +24 -0
- package/dist/shaders/retroShader.d.ts +69 -0
- package/dist/shaders-GS71Ek1A.js +1383 -0
- package/dist/world/frontage.d.ts +26 -0
- package/dist/world/index.d.ts +9 -0
- package/dist/world/index.js +3 -0
- package/dist/world/infiniteWorld2D.d.ts +24 -0
- package/dist/world/island.d.ts +29 -0
- package/dist/world/macroCellSchema.d.ts +72 -0
- package/dist/world/macroKnightAStar.d.ts +11 -0
- package/dist/world/random.d.ts +23 -0
- package/dist/world/road.d.ts +37 -0
- package/dist/world/roadRibbon.d.ts +44 -0
- package/dist/world/terrain.d.ts +62 -0
- package/dist/world/worldTypes.d.ts +39 -0
- package/dist/world-PRWPYrlx.js +947 -0
- package/dist/worldTypes-Z0KfdCd0.js +226 -0
- package/package.json +100 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./engine/index.js";
|
|
2
|
+
export { KolmoCanvas as Canvas, KolmoWorld as World, KolmoVehicle as Vehicle, KolmoActor as Actor, KolmoSurface as Surface, KolmoProp as Prop, KolmoIsland as Island, KolmoLongDrive as LongDrive, } from "./engine/index.js";
|
|
3
|
+
export * from "./shaders/index.js";
|
|
4
|
+
export { KolmoSkybox as Skybox, KolmoExoplanet as Exoplanet, KolmoEmitterRig as EmitterRig, } from "./shaders/index.js";
|
|
5
|
+
export * from "./schema/kolmoSchema.js";
|
|
6
|
+
export * from "./world/index.js";
|
|
7
|
+
export * from "./importer/index.js";
|
|
8
|
+
export * from "./junk/index.js";
|
|
9
|
+
export { KolmoJunk as Junk } from "./junk/index.js";
|
|
10
|
+
export type { KhrAssetBundle } from "@khr3/core";
|
|
11
|
+
export { DEFAULT_VAULT_URL, KOLMO_ASSETS_URL, VAULT_CARS, VAULT_CATALOG, VAULT_CITY, VAULT_WEAPONS, createAssetVault, inspectGlbBuffer, normalizeGlbBuffer, vaultAssetUrl, } from "@khr3/assets";
|
|
12
|
+
export { DOOR_HINGE_SPEC, Ex, ROOT3, buildFootprint, canPlace, instanceBatches, latticePose, planSettlement, poseEq, poseFromJSON, poseToFloat, poseToJSON, snapPose, socketFor, triangleCorners, vToFloat, worldSockets, } from "@khr3/c12";
|
|
13
|
+
export { COUPE_2DOOR, FLEET, SEDAN_4DOOR, VEHICLE_DOMAINS, VEHICLE_DOMAIN_SPECS, carUrl, findCar, fleetByDomain, planCar, } from "@khr3/vehicles";
|
|
14
|
+
export { CARBINE_556, LAUNCHER_RECIPES, PISTOL_9MM, SHOTGUN_12G, attachModule, createLauncherState, detachModule, findLauncherRecipe, planLauncher, stepLauncher, } from "@khr3/launchers";
|
|
15
|
+
export { BODY_MOVE_TUNE, BODY_SI, BODY_SOCKET_IDS, bodyEyeOffsetY, bodyRestCenterY, bodySpawnPosition, bodyStandingHeight, stepCameraSync, withExcludeCharacterRay, type BodySiConstants, type BodySocketId, } from "@khr3/body";
|
|
16
|
+
export { HeldItem, KhrBody, type HeldItemHandle, type HeldItemProps, type KhrBodyHandle, type KhrBodyProps, } from "@khr3/body/react";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { C as ee, S as te, T as e, _ as t, a as n, b as ne, c as r, d as i, f as a, g as o, h as re, i as ie, l as s, m as ae, n as oe, o as c, p as l, r as u, s as d, t as f, u as p, v as m, w as h, x as g, y as _ } from "./engine-BiMeAPAi.js";
|
|
2
|
+
import { a as v, c as y, d as b, f as x, i as S, l as C, n as w, o as T, r as E, s as D, t as O, u as k } from "./worldTypes-Z0KfdCd0.js";
|
|
3
|
+
import { a as A, c as j, d as M, i as N, l as P, n as F, o as I, r as L, s as R, t as z, u as B } from "./kolmoSurface-DTnrFXH0.js";
|
|
4
|
+
import { A as V, B as H, C as U, D as W, E as G, F as K, I as q, L as se, M as ce, N as le, O as ue, P as de, R as fe, S as pe, T as me, V as he, _ as ge, a as _e, b as ve, c as ye, d as be, f as J, g as Y, h as xe, i as Se, j as Ce, k as we, l as Te, m as Ee, n as De, o as Oe, p as X, r as ke, s as Ae, t as je, u as Me, v as Ne, w as Pe, x as Fe, y as Ie, z as Le } from "./shaders-GS71Ek1A.js";
|
|
5
|
+
import { $ as Re, A as ze, B as Be, C as Ve, D as He, E as Ue, F as We, G as Ge, H as Ke, I as qe, J as Je, K as Ye, L as Xe, M as Ze, N as Qe, O as $e, P as et, Q as tt, R as nt, S as rt, T as it, U as at, V as ot, W as st, X as ct, Y as lt, Z as ut, _ as dt, a as ft, b as pt, c as mt, d as ht, et as gt, f as _t, g as vt, h as yt, i as bt, j as xt, k as St, l as Ct, m as wt, n as Tt, nt as Et, o as Z, p as Dt, q as Ot, r as kt, s as At, t as Q, tt as jt, u as Mt, v as Nt, w as Pt, x as Ft, y as It, z as Lt } from "./importer-Cz5w0mnC.js";
|
|
6
|
+
import { _ as Rt, a as zt, b as Bt, c as Vt, d as Ht, f as Ut, g as Wt, h as Gt, i as Kt, l as qt, m as Jt, n as Yt, o as Xt, p as Zt, r as Qt, s as $t, t as en, u as tn, v as nn, y as rn } from "./world-PRWPYrlx.js";
|
|
7
|
+
import { C as an, S as on, _ as sn, a as cn, b as ln, c as un, d as dn, f as fn, g as pn, h as mn, i as hn, l as gn, m as _n, n as vn, o as yn, p as bn, r as xn, s as Sn, t as $, u as Cn, v as wn, w as Tn, x as En, y as Dn } from "./junk-B4bC1zAl.js";
|
|
8
|
+
import { DOOR_HINGE_SPEC as On, Ex as kn, ROOT3 as An, buildFootprint as jn, canPlace as Mn, instanceBatches as Nn, latticePose as Pn, planSettlement as Fn, poseEq as In, poseFromJSON as Ln, poseToFloat as Rn, poseToJSON as zn, snapPose as Bn, socketFor as Vn, triangleCorners as Hn, vToFloat as Un, worldSockets as Wn } from "@khr3/c12";
|
|
9
|
+
import { BODY_MOVE_TUNE as Gn, BODY_SI as Kn, BODY_SOCKET_IDS as qn, bodyEyeOffsetY as Jn, bodyRestCenterY as Yn, bodySpawnPosition as Xn, bodyStandingHeight as Zn, stepCameraSync as Qn, withExcludeCharacterRay as $n } from "@khr3/body";
|
|
10
|
+
import { DEFAULT_VAULT_URL as er, KOLMO_ASSETS_URL as tr, VAULT_CARS as nr, VAULT_CATALOG as rr, VAULT_CITY as ir, VAULT_WEAPONS as ar, createAssetVault as or, inspectGlbBuffer as sr, normalizeGlbBuffer as cr, vaultAssetUrl as lr } from "@khr3/assets";
|
|
11
|
+
import { CARBINE_556 as ur, LAUNCHER_RECIPES as dr, PISTOL_9MM as fr, SHOTGUN_12G as pr, attachModule as mr, createLauncherState as hr, detachModule as gr, findLauncherRecipe as _r, planLauncher as vr, stepLauncher as yr } from "@khr3/launchers";
|
|
12
|
+
import { COUPE_2DOOR as br, FLEET as xr, SEDAN_4DOOR as Sr, VEHICLE_DOMAINS as Cr, VEHICLE_DOMAIN_SPECS as wr, carUrl as Tr, findCar as Er, fleetByDomain as Dr, planCar as Or } from "@khr3/vehicles";
|
|
13
|
+
import { HeldItem as kr, KhrBody as Ar } from "@khr3/body/react";
|
|
14
|
+
export { Te as ATMO_FRAG, Me as ATMO_VERT, r as Actor, r as KolmoActor, ae as ActorTrait, Gn as BODY_MOVE_TUNE, Kn as BODY_SI, qn as BODY_SOCKET_IDS, mn as BOTTLE_HEIGHT, Xt as C12TileKind, mt as C12_TICK_M, $t as C12_TILE_M, pn as CAN_LOD_THRESHOLD_M, ur as CARBINE_556, st as CHOP_ROLES, br as COUPE_2DOOR, i as Canvas, i as KolmoCanvas, Qe as ChopShopPanel, Pt as DAMP_ZETA, er as DEFAULT_VAULT_URL, On as DOOR_HINGE_SPEC, vn as DestructibleTarget, St as DomainWorkshopPanel, Y as EmitterRig, Y as KolmoEmitterRig, kn as Ex, J as Exoplanet, J as KolmoExoplanet, xr as FLEET, Vt as FLOATING_ORIGIN_STEP_M, it as FREQ_HZ, re as FloatingBodyTrait, Fe as GLSL_BAYER_RGB555, pe as GLSL_RETRO_QUANTIZE, Ve as GateHudBar, Q as GlbImportGate, Q as ImporterWorkbench, kr as HeldItem, At as ImperativeVehicleRig, zt as InfiniteLongDrivePlanner, o as InteractableTrait, n as Island, n as KolmoIsland, $ as Junk, $ as KolmoJunk, be as KEY_SUN_DIRECTION, tr as KOLMO_ASSETS_URL, j as KOLMO_EXTENSION_NAME, p as KOLMO_KEY_MAP, Ar as KhrBody, a as KolmoGravityContext, f as KolmoLongDrive, f as LongDrive, z as KolmoProp, z as Prop, X as KolmoSkybox, X as Skybox, F as KolmoSurface, F as Surface, s as KolmoVehicle, s as Vehicle, l as KolmoWorld, l as World, dr as LAUNCHER_RECIPES, qt as MACRO_SIZE_M, le as PALETTE_CRUNCHY_16, de as PALETTE_CRUNCHY_64, ge as PARTICLE_FRAG, Ne as PARTICLE_VERT, fr as PISTOL_9MM, Ie as PLUME_FRAG, ve as PLUME_VERT, U as PS1_SNAP_RESOLUTION, t as PilotLink, K as RETRO_COLOR_MODES, Pe as RETRO_PRESETS, me as RETRO_UNIFORMS, Ee as RING_MOONLET_COUNT, An as ROOT3, ee as RetroViewportSync, h as RoomEnvRig, Sr as SEDAN_4DOOR, pr as SHOTGUN_12G, v as SHOULDER_K, Oe as SPLAT_LAYER, O as SeededSimplex2D, e as ShadowSnapRig, fn as ShardPieces, ie as ShiftedFixedBody, w as SplitMix32, Nt as Step1CalibrationPlinth, Z as Step2UniversalPad, tn as TILES_PER_MACRO, sn as TIN_CAN_HEIGHT, wn as TIN_CAN_RADIUS, Cn as TargetDecals, Ct as UNIFIED_ANCHOR_NAMES, nr as VAULT_CARS, rr as VAULT_CATALOG, ir as VAULT_CITY, ar as VAULT_WEAPONS, Cr as VEHICLE_DOMAINS, wr as VEHICLE_DOMAIN_SPECS, m as VehicleTrait, ft as VfxEmitterPool, _ as WorldSessionTrait, G as applyPs1Material, q as applyRetroFilteringToMaterial, W as applyRetroMaterial, se as applyRetroTextureFiltering, ue as applySceneRetroMaterials, cn as applySegmentsToImportedRoot, mr as attachModule, xt as bakeArticulatedLauncherGlb, Tt as bakeUniversalGateGlb, E as bakeWorldSplatMaps, Jn as bodyEyeOffsetY, Yn as bodyRestCenterY, Xn as bodySpawnPosition, Zn as bodyStandingHeight, en as buildCarvedTerrainGeometry, Ut as buildDodecagonalCivicHub, jn as buildFootprint, Dn as buildGlassBottleGeometry, Yt as buildHighwayAsphaltTexture, pt as buildImporterWebMcpTools, Ze as buildLauncherSceneFromPlan, fe as buildPaletteLutData, N as buildPatchPreviewEmitters, Qt as buildRoadRibbonGeometry, We as buildSelectionOverlayGeometry, Ge as buildSurfaceTopology, ln as buildTinCanGeometry, Mn as canPlace, Tr as carUrl, y as childSeed, Rt as closedRoadFromPoints, _n as collectValidTris, et as compileKhrAssetGlb, Mt as computeC12Metrics, A as computeChopPartHinge, c as computeIslandSpawnPose, oe as computeLongDriveBridgeheadSpawn, u as computeLongDriveMainlandSpawn, Le as computeRetroDpr, kt as convertUsdToGlb, En as countGeometryTriangles, or as createAssetVault, P as createDefaultSignals, qe as createFleet12GonWheelGroup, on as createGlassBottleMaterial, hr as createLauncherState, je as createPS2RoadMaterialTSL, _e as createPS2RoadMaterialWebGL, De as createPS2TerrainMaterialTSL, Se as createPS2TerrainMaterialWebGL, Ae as createPS2WorldTextures, an as createTinCanMaterials, I as createVehiclePanelAnimator, B as decodeKolmoRig, ht as defaultTargetMeters, gr as detachModule, _t as detectSceneAnchors, un as disposeImportedRoot, ze as enforceRetroPersonMaterials, gn as ensureMeshAttributes, lt as extractMeshIslands, C as fbm2, Er as findCar, _r as findLauncherRecipe, Xe as findMirrorIslandId, Dr as fleetByDomain, Ye as floodFillByCrease, Wt as frontage, Ue as gateTelemetry, ye as generatePS2DetailSlices, dn as getBulletHoleTexture, d as getCachedIslandPlan, H as getColorQuantVector, Ot as getIslandTopology, Ft as getNavigatorModelContext, he as getPaletteLutTexture, xn as getProceduralLabelTexture, we as getRetroPreset, V as getRetroShaderUniforms, nn as growRoad, S as hashSeed, sr as inspectGlbBuffer, Nn as instanceBatches, He as isGateStep1Unlocked, bt as isUsdFileName, Dt as khrBoxToRapierHalfExtents, ne as kolmoActions, g as kolmoTelemetry, te as kolmoWorld, Pn as latticePose, hn as loadCustomLabelTexture, yn as loadImportedGlbUrl, Jt as makeIslandHeightfn, It as makeStarterDomainScene, T as makeTerrain, rn as maxGrade, wt as measureAssemblyCalibration, yt as measureNormalizedSceneCalibration, Re as measureSelection, Je as mirrorTriangles, ke as mountPS2WorldMeshes, k as mulberry32, R as normalToMinusZQuaternion, cr as normalizeGlbBuffer, ct as normalizeSceneToSi, Sn as parseImportedGlbBuffer, nt as peelIslandSelection, Or as planCar, Kt as planDirtSpurs, Gt as planIslandWorld, vr as planLauncher, Fn as planSettlement, xe as populateMoonletMatrices, In as poseEq, Ln as poseFromJSON, Rn as poseToFloat, zn as poseToJSON, Lt as previewLoopPolyline, Ht as quantizeFloatingOrigin192, Be as refineMeshAlongLoop, ot as remapIslandIds, Bt as roadFromPoints, Zt as routeMacroKnightAStar, D as sampleHeightfield, b as seedFrom, Tn as selectCanLod, Ke as selectFacesByClick, at as selectFacesByLoop, ut as separateVehicleMeshes, tt as sliceMeshTriangles, vt as snapMetersToC12, Bn as snapPose, Vn as socketFor, bn as splitObjectIntoShards, M as stampKolmoNodesIntoGlb, Qn as stepCameraSync, yr as stepLauncher, gt as suggestCarAxles, jt as suggestMotorcycleWheels, Ce as syncRetroUniforms, ce as syncRetroViewport, Et as toggleIslandSelection, L as togglePropJoint, Hn as triangleCorners, $e as useGateStore, rt as useImporterWebMcp, Un as vToFloat, x as valueNoise2, lr as vaultAssetUrl, $n as withExcludeCharacterRay, Wn as worldSockets, dt as wrapSingleMeshWithPaperShellProxy };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DecalRecord, DestructibleTargetSpec, ShardSpec } from "./junkTypes.js";
|
|
2
|
+
import type { BallisticHitEvent } from "./junkTypes.js";
|
|
3
|
+
import type { ImportedGlbAsset } from "./junkImporter.js";
|
|
4
|
+
import type { DestructibleTargetSnapshot } from "./targetHelpers.js";
|
|
5
|
+
export interface DestructibleTargetHandle {
|
|
6
|
+
applyHit: (hit: BallisticHitEvent) => void;
|
|
7
|
+
getSnapshot: () => DestructibleTargetSnapshot;
|
|
8
|
+
}
|
|
9
|
+
export interface DestructibleTargetProps {
|
|
10
|
+
spec: DestructibleTargetSpec;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
importedAsset?: ImportedGlbAsset | null;
|
|
13
|
+
onHit?: (targetId: string, event: BallisticHitEvent, nextHp: number, decals: DecalRecord[]) => void;
|
|
14
|
+
onShatter?: (targetId: string, shards: ShardSpec[], event: BallisticHitEvent) => void;
|
|
15
|
+
onStateChange?: (snapshot: DestructibleTargetSnapshot) => void;
|
|
16
|
+
registerTarget?: (id: string, handle: DestructibleTargetHandle | null) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const DestructibleTarget: import("react").ForwardRefExoticComponent<DestructibleTargetProps & import("react").RefAttributes<DestructibleTargetHandle>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CanLodMode, JunkKind, ProceduralLabelId } from "./junkTypes.js";
|
|
3
|
+
export interface KolmoJunkProps {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly kind?: JunkKind;
|
|
6
|
+
readonly labelId?: ProceduralLabelId;
|
|
7
|
+
readonly position?: [number, number, number];
|
|
8
|
+
readonly hp?: number;
|
|
9
|
+
readonly fragile?: boolean;
|
|
10
|
+
readonly shatterPieceCount?: number;
|
|
11
|
+
readonly canLodMode?: CanLodMode;
|
|
12
|
+
readonly importedUrl?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function KolmoJunk({ id, kind, labelId, position, hp, fragile, shatterPieceCount, canLodMode, importedUrl, }: KolmoJunkProps): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { type SpawnedShardState } from "./targetHelpers.js";
|
|
3
|
+
export interface ShardPiecesProps {
|
|
4
|
+
shards: ReadonlyArray<SpawnedShardState>;
|
|
5
|
+
material: THREE.Material | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Renders independent dynamic Rapier RigidBodies for BVH shatter fragments.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ShardPieces({ shards, material }: ShardPiecesProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import type { DecalRecord } from "./junkTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Generates and caches a crisp procedural bullet-hole CanvasTexture (SRGBColorSpace).
|
|
6
|
+
* Returns null safely in non-DOM SSR environments.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getBulletHoleTexture(): THREE.CanvasTexture | null;
|
|
9
|
+
export declare function disposeBulletHoleTexture(): void;
|
|
10
|
+
export interface TargetDecalsProps {
|
|
11
|
+
decals: ReadonlyArray<DecalRecord>;
|
|
12
|
+
lodKey?: string;
|
|
13
|
+
meshRefMap?: ReadonlyMap<string, RefObject<THREE.Mesh>>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders local-space bullet-hole decals on a target mesh (or via explicit meshRefMap for multi-mesh GLBs).
|
|
17
|
+
*/
|
|
18
|
+
export declare function TargetDecals({ decals, lodKey, meshRefMap, }: TargetDecalsProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { ShardSpec } from "./junkTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Splits any single- or multi-mesh Object3D into independent centroid-centered
|
|
5
|
+
* BVH shard geometries ready for Rapier dynamic RigidBodies + CuboidColliders.
|
|
6
|
+
*/
|
|
7
|
+
export declare function splitObjectIntoShards(rootObj: THREE.Object3D, targetPieces: number): ShardSpec[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export interface ShardTri {
|
|
3
|
+
p: [number, number, number, number, number, number, number, number, number];
|
|
4
|
+
n: [number, number, number, number, number, number, number, number, number];
|
|
5
|
+
uv: [number, number, number, number, number, number];
|
|
6
|
+
cx: number;
|
|
7
|
+
cy: number;
|
|
8
|
+
cz: number;
|
|
9
|
+
minX: number;
|
|
10
|
+
minY: number;
|
|
11
|
+
minZ: number;
|
|
12
|
+
maxX: number;
|
|
13
|
+
maxY: number;
|
|
14
|
+
maxZ: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Collects valid root-space triangles from destructible meshes inside rootObj,
|
|
18
|
+
* skipping decals, gizmos, ShaderMaterials, and non-finite/degenerate triangles.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectValidTris(rootObj: THREE.Object3D): ShardTri[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { DestructibleTarget, type DestructibleTargetHandle, type DestructibleTargetProps, } from "./DestructibleTarget.js";
|
|
2
|
+
export { KolmoJunk, type KolmoJunkProps } from "./KolmoJunk.js";
|
|
3
|
+
export { ShardPieces } from "./ShardPieces.js";
|
|
4
|
+
export { TargetDecals, getBulletHoleTexture } from "./TargetDecals.js";
|
|
5
|
+
export { splitObjectIntoShards } from "./bvhShatter.js";
|
|
6
|
+
export { collectValidTris, type ShardTri } from "./bvhTriCollector.js";
|
|
7
|
+
export { BOTTLE_HEIGHT, CAN_LOD_THRESHOLD_M, TIN_CAN_HEIGHT, TIN_CAN_RADIUS, buildGlassBottleGeometry, buildTinCanGeometry, countGeometryTriangles, createGlassBottleMaterial, createTinCanMaterials, selectCanLod, type ResolvedCanLod, } from "./junkGeometry.js";
|
|
8
|
+
export { disposeImportedRoot, ensureMeshAttributes } from "./junkImportSanitize.js";
|
|
9
|
+
export { applySegmentsToImportedRoot, loadImportedGlbUrl, parseImportedGlbBuffer, type ImportedGlbAsset, } from "./junkImporter.js";
|
|
10
|
+
export { getProceduralLabelTexture, loadCustomLabelTexture } from "./junkLabels.js";
|
|
11
|
+
export type { DestructibleTargetSnapshot, SpawnedShardState } from "./targetHelpers.js";
|
|
12
|
+
export type { BallisticHitEvent, CanLodMode, DecalRecord, DestructibleTargetSpec, ImportedJunkSegment, JunkKind, ProceduralLabelId, ShardSpec, } from "./junkTypes.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { h as BOTTLE_HEIGHT, g as CAN_LOD_THRESHOLD_M, n as DestructibleTarget, t as KolmoJunk, f as ShardPieces, _ as TIN_CAN_HEIGHT, v as TIN_CAN_RADIUS, u as TargetDecals, a as applySegmentsToImportedRoot, y as buildGlassBottleGeometry, b as buildTinCanGeometry, m as collectValidTris, x as countGeometryTriangles, S as createGlassBottleMaterial, C as createTinCanMaterials, c as disposeImportedRoot, l as ensureMeshAttributes, d as getBulletHoleTexture, r as getProceduralLabelTexture, i as loadCustomLabelTexture, o as loadImportedGlbUrl, s as parseImportedGlbBuffer, w as selectCanLod, p as splitObjectIntoShards } from "../junk-B4bC1zAl.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { CanLodMode } from "./junkTypes.js";
|
|
3
|
+
export declare const TIN_CAN_RADIUS = 0.085;
|
|
4
|
+
export declare const TIN_CAN_HEIGHT = 0.25;
|
|
5
|
+
export declare const BOTTLE_HEIGHT = 0.32;
|
|
6
|
+
export declare const CAN_LOD_THRESHOLD_M = 14;
|
|
7
|
+
export type ResolvedCanLod = '3-gon' | '12-gon';
|
|
8
|
+
/**
|
|
9
|
+
* Selects concrete tin-can geometry LOD from camera distance and mode.
|
|
10
|
+
*/
|
|
11
|
+
export declare function selectCanLod(distanceM: number, mode: CanLodMode): ResolvedCanLod;
|
|
12
|
+
/**
|
|
13
|
+
* Counts triangles for indexed or non-indexed BufferGeometry.
|
|
14
|
+
*/
|
|
15
|
+
export declare function countGeometryTriangles(geometry: THREE.BufferGeometry): number;
|
|
16
|
+
/**
|
|
17
|
+
* Builds procedural Tin Can geometry for '3-gon' (12 tris) or '12-gon' (72 tris).
|
|
18
|
+
* Uses thetaStart = Math.PI so the UV seam is at -Z and u = 0.5 faces +Z.
|
|
19
|
+
* Preserves multi-material groups: 0 = label sleeve, 1 = top cap, 2 = bottom cap.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildTinCanGeometry(lod: ResolvedCanLod): THREE.BufferGeometry;
|
|
22
|
+
/**
|
|
23
|
+
* Builds procedural clearish glass bottle LatheGeometry ordered bottom-to-top
|
|
24
|
+
* with phiStart = Math.PI and height-normalized uv.y so labels wrap cleanly.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildGlassBottleGeometry(): THREE.BufferGeometry;
|
|
27
|
+
/**
|
|
28
|
+
* Creates Dreamcast-compatible clearish glass material.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createGlassBottleMaterial(): THREE.MeshStandardMaterial;
|
|
31
|
+
/**
|
|
32
|
+
* Creates tin can multi-material array [label sleeve, top lid, bottom lid].
|
|
33
|
+
*/
|
|
34
|
+
export declare function createTinCanMaterials(labelTexture: THREE.Texture | null): [THREE.MeshStandardMaterial, THREE.MeshStandardMaterial, THREE.MeshStandardMaterial];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare function ensureMeshAttributes(mesh: THREE.Mesh, fileName: string): void;
|
|
3
|
+
/**
|
|
4
|
+
* Disposes all geometries, materials, and textures owned by an imported Object3D.
|
|
5
|
+
*/
|
|
6
|
+
export declare function disposeImportedRoot(root: THREE.Object3D): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { ImportedJunkSegment } from "./junkTypes.js";
|
|
3
|
+
export { disposeImportedRoot } from "./junkImportSanitize.js";
|
|
4
|
+
export interface ImportedGlbAsset {
|
|
5
|
+
root: THREE.Group;
|
|
6
|
+
fileName: string;
|
|
7
|
+
segments: ImportedJunkSegment[];
|
|
8
|
+
bboxSizeM: [number, number, number];
|
|
9
|
+
normalizedExtent: number;
|
|
10
|
+
halfExtents: [number, number, number];
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Applies segment destructibility and customName metadata onto an imported root's meshes.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applySegmentsToImportedRoot(root: THREE.Object3D, segments: ImportedJunkSegment[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Parses an ArrayBuffer containing a .glb/.gltf asset, normalizes scale/origin,
|
|
19
|
+
* guarantees normals/UVs, and enumerates ImportedJunkSegment descriptors.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseImportedGlbBuffer(buffer: ArrayBuffer, fileName?: string): Promise<ImportedGlbAsset>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetches a .glb/.gltf URL (blob:, data:, or HTTP path) and parses it as an ImportedGlbAsset.
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadImportedGlbUrl(url: string, fileName?: string): Promise<ImportedGlbAsset>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProceduralLabelId } from "./junkTypes.js";
|
|
2
|
+
export declare const LABEL_CANVAS_WIDTH = 512;
|
|
3
|
+
export declare const LABEL_CANVAS_HEIGHT = 256;
|
|
4
|
+
/**
|
|
5
|
+
* Draws one of the 4 built-in procedural labels onto a 2D canvas context.
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderProceduralLabelCanvas(ctx: CanvasRenderingContext2D, labelId: Exclude<ProceduralLabelId, 'custom'>, width?: number, height?: number): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { ProceduralLabelId } from "./junkTypes.js";
|
|
3
|
+
export declare const BUILTIN_LABEL_IDS: ReadonlyArray<Exclude<ProceduralLabelId, 'custom'>>;
|
|
4
|
+
/**
|
|
5
|
+
* Generates or retrieves a cached deterministic CanvasTexture for built-in labels.
|
|
6
|
+
* Returns null safely in non-DOM SSR environments.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getProceduralLabelTexture(labelId: ProceduralLabelId, options?: {
|
|
9
|
+
cache?: boolean;
|
|
10
|
+
}): THREE.CanvasTexture | null;
|
|
11
|
+
/**
|
|
12
|
+
* Validates an uploaded image File before creating a custom label texture.
|
|
13
|
+
* Returns null if valid, or a descriptive error message if invalid.
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateLabelImageFile(file: File): string | null;
|
|
16
|
+
export interface LoadedCustomLabel {
|
|
17
|
+
texture: THREE.Texture;
|
|
18
|
+
dispose: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Loads a custom albedo texture from a URL or DataURL with SRGBColorSpace and cleanup handle.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadCustomLabelTexture(url: string): Promise<LoadedCustomLabel>;
|
|
24
|
+
/**
|
|
25
|
+
* Validates that an image URL decodes cleanly in the browser before applying it as a label.
|
|
26
|
+
*/
|
|
27
|
+
export declare function decodeLabelImageUrl(url: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Disposes all module-cached procedural label textures.
|
|
30
|
+
*/
|
|
31
|
+
export declare function disposeCachedLabelTextures(): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
export type JunkKind = "tin-can" | "glass-bottle" | "imported-glb";
|
|
3
|
+
export type CanLodMode = "auto" | "3-gon" | "12-gon";
|
|
4
|
+
export type ProceduralLabelId = "target" | "goofy-emoji" | "tris-soda" | "garys-beans" | "custom";
|
|
5
|
+
export interface DecalRecord {
|
|
6
|
+
id: string;
|
|
7
|
+
/** Position in target mesh local space. */
|
|
8
|
+
position: [number, number, number];
|
|
9
|
+
/** Euler XYZ rotation aligned to surface normal in target mesh local space. */
|
|
10
|
+
rotation: [number, number, number];
|
|
11
|
+
scale: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ShardSpec {
|
|
14
|
+
id: string;
|
|
15
|
+
geometry: THREE.BufferGeometry;
|
|
16
|
+
centroid: [number, number, number];
|
|
17
|
+
halfExtents: [number, number, number];
|
|
18
|
+
volumeFraction: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ImportedJunkSegment {
|
|
21
|
+
segmentId: string;
|
|
22
|
+
originalName: string;
|
|
23
|
+
customName: string;
|
|
24
|
+
destructible: boolean;
|
|
25
|
+
triCount: number;
|
|
26
|
+
bboxSizeM: [number, number, number];
|
|
27
|
+
}
|
|
28
|
+
export interface DestructibleTargetSpec {
|
|
29
|
+
id: string;
|
|
30
|
+
kind: JunkKind;
|
|
31
|
+
labelId: ProceduralLabelId;
|
|
32
|
+
customAlbedoUrl: string | null;
|
|
33
|
+
canLodMode: CanLodMode;
|
|
34
|
+
position: [number, number, number];
|
|
35
|
+
hp: number;
|
|
36
|
+
maxHp: number;
|
|
37
|
+
fragile: boolean;
|
|
38
|
+
shatterPieceCount: number;
|
|
39
|
+
importedUrl?: string | null;
|
|
40
|
+
segments?: ImportedJunkSegment[];
|
|
41
|
+
}
|
|
42
|
+
export interface BallisticHitEvent {
|
|
43
|
+
targetId: string;
|
|
44
|
+
point: [number, number, number];
|
|
45
|
+
normal: [number, number, number];
|
|
46
|
+
impulse: [number, number, number];
|
|
47
|
+
distance: number;
|
|
48
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { CanLodMode, JunkKind, ProceduralLabelId, ShardSpec } from "./junkTypes.js";
|
|
3
|
+
import type { BallisticHitEvent } from "./junkTypes.js";
|
|
4
|
+
import { type ResolvedCanLod } from "./junkGeometry.js";
|
|
5
|
+
export declare const SHARD_COLLIDER_INSET = 0.65;
|
|
6
|
+
export declare function getTargetDensity(kind: JunkKind): number;
|
|
7
|
+
export interface SpawnedShardState {
|
|
8
|
+
spec: ShardSpec;
|
|
9
|
+
worldPos: [number, number, number];
|
|
10
|
+
worldQuat: [number, number, number, number];
|
|
11
|
+
impulse: [number, number, number];
|
|
12
|
+
torque: [number, number, number];
|
|
13
|
+
linvel: [number, number, number];
|
|
14
|
+
angvel: [number, number, number];
|
|
15
|
+
density: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DestructibleTargetSnapshot {
|
|
18
|
+
id: string;
|
|
19
|
+
kind: JunkKind;
|
|
20
|
+
lodMode: CanLodMode;
|
|
21
|
+
activeLod: ResolvedCanLod;
|
|
22
|
+
triCount: number;
|
|
23
|
+
labelId: ProceduralLabelId;
|
|
24
|
+
customLabelLoaded: boolean;
|
|
25
|
+
materialTransparent: boolean;
|
|
26
|
+
opacity: number;
|
|
27
|
+
hp: number;
|
|
28
|
+
maxHp: number;
|
|
29
|
+
alive: boolean;
|
|
30
|
+
decalCount: number;
|
|
31
|
+
activeShardCount: number;
|
|
32
|
+
position: [number, number, number];
|
|
33
|
+
linearVelocity: [number, number, number];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Computes target-mesh local-space position & Euler XYZ rotation for a <Decal>.
|
|
37
|
+
*/
|
|
38
|
+
export declare function computeLocalDecalTransform(mesh: THREE.Mesh, worldPoint: [number, number, number], worldNormal: [number, number, number]): {
|
|
39
|
+
position: [number, number, number];
|
|
40
|
+
rotation: [number, number, number];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Finds the nearest non-decal Mesh inside an Object3D to a world-space hit point.
|
|
44
|
+
*/
|
|
45
|
+
export declare function findClosestMeshInGroup(root: THREE.Object3D, worldPoint: [number, number, number]): THREE.Mesh | null;
|
|
46
|
+
/**
|
|
47
|
+
* Splits a target Object3D into BVH shards and computes world poses + impulses.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildShardStates(rootObj: THREE.Object3D, targetPieces: number, worldPos: THREE.Vector3, worldQuat: THREE.Quaternion, hit: BallisticHitEvent, kind?: JunkKind): {
|
|
50
|
+
states: SpawnedShardState[];
|
|
51
|
+
specs: ShardSpec[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Creates a DoubleSide material for tumbling shatter shards matching target kind.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createShardMaterial(kind: JunkKind, labelTexture: THREE.Texture | null, importedRoot?: THREE.Object3D | null): THREE.Material;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RapierRigidBody } from '@react-three/rapier';
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import type { DecalRecord, DestructibleTargetSpec, ShardSpec } from "./junkTypes.js";
|
|
5
|
+
import type { BallisticHitEvent } from "./junkTypes.js";
|
|
6
|
+
import { type DestructibleTargetSnapshot, type SpawnedShardState } from "./targetHelpers.js";
|
|
7
|
+
import type { TargetAssetsState } from "./useTargetAssets.js";
|
|
8
|
+
export interface HitExecutionResult {
|
|
9
|
+
shattered: boolean;
|
|
10
|
+
nextHp: number;
|
|
11
|
+
shatterPos?: [number, number, number];
|
|
12
|
+
bodyPos?: [number, number, number];
|
|
13
|
+
shardStates?: SpawnedShardState[];
|
|
14
|
+
shardSpecs?: ShardSpec[];
|
|
15
|
+
shardMaterial?: THREE.Material;
|
|
16
|
+
newDecal?: DecalRecord;
|
|
17
|
+
newDecalMesh?: THREE.Mesh;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Applies physical knockback impulse and computes either a shatter state or a local decal.
|
|
21
|
+
*/
|
|
22
|
+
export declare function executeTargetHit(spec: DestructibleTargetSpec, assets: TargetAssetsState, rb: RapierRigidBody | null, group: THREE.Group | null, primaryMesh: THREE.Mesh | null, currentHp: number, nextDecalId: string, hit: BallisticHitEvent): HitExecutionResult;
|
|
23
|
+
/**
|
|
24
|
+
* Formats a runtime telemetry snapshot for a DestructibleTarget.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTargetSnapshot(spec: DestructibleTargetSpec, assets: TargetAssetsState, rb: RapierRigidBody | null, hp: number, alive: boolean, decalCount: number, shardCount: number, lastPosition?: [number, number, number]): DestructibleTargetSnapshot;
|
|
27
|
+
export declare function attachDecalMeshRef(map: Map<string, RefObject<THREE.Mesh>>, decalId: string, mesh?: THREE.Mesh): void;
|
|
28
|
+
export declare function appendDecalBounded(prev: ReadonlyArray<DecalRecord>, nextDecal: DecalRecord, meshRefs: Map<string, RefObject<THREE.Mesh>>, nextMesh?: THREE.Mesh, maxDecals?: number): DecalRecord[];
|
|
29
|
+
export declare function tagImportedMeshes(root: THREE.Object3D | null, targetId: string, applyHit: (hit: BallisticHitEvent) => void): void;
|
|
30
|
+
export declare function readTargetWorldPos(rb: RapierRigidBody | null, group: THREE.Group | null, out: THREE.Vector3): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { DestructibleTargetSpec } from "./junkTypes.js";
|
|
3
|
+
import { type ResolvedCanLod } from "./junkGeometry.js";
|
|
4
|
+
import { type ImportedGlbAsset } from "./junkImporter.js";
|
|
5
|
+
export interface TargetAssetsState {
|
|
6
|
+
effectiveLod: ResolvedCanLod;
|
|
7
|
+
setActiveLod: (lod: ResolvedCanLod) => void;
|
|
8
|
+
can3Geo: THREE.BufferGeometry | null;
|
|
9
|
+
can12Geo: THREE.BufferGeometry | null;
|
|
10
|
+
canMats: [THREE.MeshStandardMaterial, THREE.MeshStandardMaterial, THREE.MeshStandardMaterial] | null;
|
|
11
|
+
bottleGeo: THREE.BufferGeometry | null;
|
|
12
|
+
bottleMat: THREE.MeshStandardMaterial | null;
|
|
13
|
+
activeLabelTex: THREE.Texture | null;
|
|
14
|
+
customLabelLoaded: boolean;
|
|
15
|
+
importedRoot: THREE.Group | null;
|
|
16
|
+
importedHalfExtents: [number, number, number] | null;
|
|
17
|
+
importedKey: string;
|
|
18
|
+
triCount: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Manages procedural geometries, labels, custom textures, and imported GLB assets
|
|
22
|
+
* for a DestructibleTarget with deterministic GPU cleanup on unmount/change.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useTargetAssets(spec: DestructibleTargetSpec, importedAsset?: ImportedGlbAsset | null): TargetAssetsState;
|