@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 +8 -23
- package/dist/engine/actor.d.ts +1 -1
- package/dist/engine/gltfLoader.d.ts +6 -7
- package/dist/engine/index.js +181 -784
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/input.d.ts +2 -1
- package/dist/engine/surface.d.ts +1 -3
- package/dist/engine/traits.d.ts +7 -2
- package/dist/engine/world.d.ts +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -5
- package/dist/physics/index.d.ts +3 -3
- package/dist/physics/index.js +1 -1
- package/dist/physics/nBodyGravity.d.ts +14 -7
- package/dist/{physics-FhWvTBfH.js → physics-ZDFXaCli.js} +122 -71
- package/dist/physics-ZDFXaCli.js.map +1 -0
- package/dist/surface-DUol_5ml.js +610 -0
- package/dist/surface-DUol_5ml.js.map +1 -0
- package/dist/toolgun/Toolgun.d.ts +33 -0
- package/dist/toolgun/index.d.ts +2 -0
- package/dist/toolgun/index.js +1 -0
- package/dist/toolgun/store.d.ts +198 -0
- package/dist/toolgun-BfcCIAQx.js +1582 -0
- package/dist/toolgun-BfcCIAQx.js.map +1 -0
- package/dist/vite/index.d.ts +0 -4
- package/dist/vite/index.js +1 -9
- package/dist/vite/index.js.map +1 -1
- package/package.json +12 -15
- package/dist/physics-FhWvTBfH.js.map +0 -1
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
|
|
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 {
|
|
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
|
|
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
|
|
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
|
}
|
package/dist/engine/actor.d.ts
CHANGED
|
@@ -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
|
|
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)
|
|
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<
|
|
19
|
-
export declare function loadKolmoGlbUrl(url: string, options?: KolmoGltfLoaderOptions): Promise<
|
|
17
|
+
export declare function parseKolmoGlbBuffer(buffer: ArrayBuffer | Uint8Array, options?: KolmoGltfLoaderOptions): Promise<KhrAssetBundle>;
|
|
18
|
+
export declare function loadKolmoGlbUrl(url: string, options?: KolmoGltfLoaderOptions): Promise<KhrAssetBundle>;
|