@pinkaphant/kolmo 0.5.0 → 0.5.1

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 CHANGED
@@ -1,43 +1,28 @@
1
1
  # `@pinkaphant/kolmo`
2
2
 
3
- Thin React Three Fiber + Rapier WASM game layer over the pmndrs stack:
3
+ Thin React Three Fiber + Rapier WASM game layer over the pmndrs + KHR + C12 stack:
4
4
 
5
- - **`@pinkaphant/ecctrl`**: Direct `Ecctrl` (`Ref<EcctrlHandle>`) and `EcctrlVehicle` (`Ref<EcctrlVehicleHandle>`), `ShapeCastWheel`, `ThrustPropeller`, `Joystick`, `VirtualButton`, `EcctrlCameraControls`, `useCustomGravity`, and `zustand` stores — zero swallowed refs or wrapper walls.
5
+ - **`@pinkaphant/ecctrl`**: Direct `Ecctrl` (`Ref<EcctrlHandle>`) and `EcctrlVehicle` (`Ref<EcctrlVehicleHandle>`), `ShapeCastWheel`, `ThrustPropeller`, `Joystick`, `VirtualButton`, `EcctrlCameraControls`, `useCustomGravity`, and `zustand` stores.
6
6
  - **Koota ECA**: Zero-allocation SoA traits (`ActorTrait`, `VehicleTrait`, `TransformTrait`, `VelocityTrait`, `VehicleTelemetryTrait`) via `unpackEntity` + `getStore`, `PilotLink` exclusive relation, and `kolmoActions(world)`.
7
7
  - **`@khr3/core` & `@khr3/c12`**: `KHR_physics_rigid_bodies` + `KHR_implicit_shapes` + `OMI_vehicle_wheel` `.glb` assemblies/vehicles (`<Vehicle>`, `<Prop>`, `<Surface>`) and exact $\mathbb{Z}[1/2, \sqrt{3}]$ C12 lattice tools.
8
+ - **`<Toolgun />` (`@pinkaphant/kolmo/toolgun`)**: Handheld physics/building toolgun with real Rapier WASM raycasts (`castRayAndGetNormal`), two-shot Fixed Weld & Revolute Hinge `ImpulseJoint`s, direct `@khr3/core` `JointRuntime` rigging/breakaway, KHR `.glb` spawning, exact `@khr3/c12` 30° `yaw12` socket building, and diegetic `256×192` LCD screen.
8
9
 
9
10
  ## Usage
10
11
 
11
12
  ```tsx
12
13
  import { useRef } from "react";
13
- import { useFrame } from "@react-three/fiber";
14
- import { Game, Surface, Actor, Vehicle, Hud, type EcctrlHandle, type EcctrlVehicleHandle } from "@pinkaphant/kolmo";
14
+ import { Game, Surface, Actor, Vehicle, Toolgun, Hud, type EcctrlHandle } from "@pinkaphant/kolmo";
15
15
 
16
- function Scene() {
16
+ export function App() {
17
17
  const actorRef = useRef<EcctrlHandle>(null);
18
- const vehicleRef = useRef<EcctrlVehicleHandle>(null);
19
-
20
- useFrame(() => {
21
- // Direct imperative Ecctrl / EcctrlVehicle handle access in useFrame
22
- if (actorRef.current?.isOnGround) {
23
- // actorRef.current.currPos, currLinVel, moveSpeed, setMovement(...)
24
- }
25
- });
26
18
 
27
19
  return (
28
- <>
20
+ <Game skybox="day">
29
21
  <Surface size={200} />
30
22
  <Actor ref={actorRef} position={[0, 1.4, 0]} />
31
- <Vehicle ref={vehicleRef} src="/assets/coupe.glb" position={[4, 0.8, 4]} />
23
+ <Vehicle src="/assets/coupe.glb" position={[4, 0.8, 4]} />
24
+ <Toolgun />
32
25
  <Hud />
33
- </>
34
- );
35
- }
36
-
37
- export function App() {
38
- return (
39
- <Game skybox="day">
40
- <Scene />
41
26
  </Game>
42
27
  );
43
28
  }
@@ -1,7 +1,7 @@
1
1
  import React, { type ComponentProps } from "react";
2
2
  import { type EcctrlHandle, type EcctrlProps } from "@pinkaphant/ecctrl";
3
3
  import { EcctrlCameraControls, type EcctrlCameraControlsHandle } from "@pinkaphant/ecctrl/camera";
4
- import type { KhrAssetBundle } from "@khr3/core";
4
+ import { type KhrAssetBundle } from "@khr3/core";
5
5
  import { type KolmoInputGetter } from "./input.js";
6
6
  export interface KolmoActorProps extends Omit<EcctrlProps, "ref"> {
7
7
  readonly ref?: React.Ref<EcctrlHandle>;
@@ -1,6 +1,6 @@
1
- import * as THREE from "three";
1
+ import type * as THREE from "three";
2
2
  import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
3
- import { type KhrPluginOptions } from "@khr3/core";
3
+ import { type KhrAssetBundle, type KhrPluginOptions } from "@khr3/core";
4
4
  export interface KolmoGltfLoaderOptions {
5
5
  /** Optional WebGLRenderer so KTX2 (`KHR_texture_basisu`) detects hardware ASTC/BC7/ETC2 support. */
6
6
  readonly renderer?: THREE.WebGLRenderer | null;
@@ -10,10 +10,9 @@ export interface KolmoGltfLoaderOptions {
10
10
  readonly khrOptions?: KhrPluginOptions;
11
11
  }
12
12
  /**
13
- * Khronos-compliant `GLTFLoader` configured with `EXT_meshopt_compression` (`MeshoptDecoder`),
14
- * `KHR_texture_basisu` (`KTX2Loader` when a renderer is supplied), and `@khr3/core` physics plugin.
15
- * Never mounts legacy `DRACOLoader`.
13
+ * Khronos-compliant `GLTFLoader` configured with `EXT_meshopt_compression` (`MeshoptDecoder`)
14
+ * and `KHR_texture_basisu` (`KTX2Loader` when a renderer is supplied).
16
15
  */
17
16
  export declare function createKolmoGltfLoader(options?: KolmoGltfLoaderOptions): GLTFLoader;
18
- export declare function parseKolmoGlbBuffer(buffer: ArrayBuffer, options?: KolmoGltfLoaderOptions): Promise<THREE.Group>;
19
- export declare function loadKolmoGlbUrl(url: string, options?: KolmoGltfLoaderOptions): Promise<THREE.Group>;
17
+ export declare function parseKolmoGlbBuffer(buffer: ArrayBuffer | Uint8Array, options?: KolmoGltfLoaderOptions): Promise<KhrAssetBundle>;
18
+ export declare function loadKolmoGlbUrl(url: string, options?: KolmoGltfLoaderOptions): Promise<KhrAssetBundle>;