world.ts 0.2.6 → 0.2.8

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.
@@ -3,7 +3,7 @@ import type { Viewport } from "../viewport";
3
3
  export * from "./billboard";
4
4
  export * from "./container";
5
5
  export * from "./line";
6
- export * from "./mesh";
6
+ export * from "./object";
7
7
  export * from "./polygon";
8
8
  export * from "./terrain";
9
9
  import type { Pick } from "../model";
@@ -45,9 +45,14 @@ export type Polygon = {
45
45
  export type Mesh = {
46
46
  vertices: vec3[];
47
47
  indices: vec3[];
48
+ normals: vec3[];
49
+ };
50
+ export type Object = {
51
+ mesh: Mesh;
48
52
  position: vec3;
49
53
  orientation: quat;
50
54
  color: vec4;
55
+ diffuse: vec4;
51
56
  size: number;
52
57
  minSizePixels?: number;
53
58
  maxSizePixels?: number;
@@ -72,7 +77,8 @@ export type Layer = {
72
77
  export type Properties<T> = {
73
78
  [K in keyof T]: T[K] extends Function | undefined ? T[K] : () => T[K];
74
79
  };
75
- export declare const cache: <T, R>(_value: () => T, f: (_: T) => R) => () => R;
80
+ export declare const cacheAll: <T extends readonly any[], R>(_value: { [K in keyof T]: () => T[K]; }, f: (_: T) => R) => () => R;
81
+ export declare const cache: <T, R>(value: () => T, f: (_: T) => R) => () => R;
76
82
  export declare const createMouseEvents: (properties: Properties<Partial<LayerOptions>>) => {
77
83
  onClick: ((_: Pick) => void) | undefined;
78
84
  onRightClick: ((_: Pick) => void) | undefined;
@@ -0,0 +1,19 @@
1
+ import type { Context } from "../../context";
2
+ import type { Properties } from "..";
3
+ import { type Object } from "..";
4
+ import type { Viewport } from "../../viewport";
5
+ export declare const createObjectLayer: (context: Context, properties?: Properties<Partial<Object>>) => {
6
+ onClick: ((_: import("../..").Pick) => void) | undefined;
7
+ onRightClick: ((_: import("../..").Pick) => void) | undefined;
8
+ onDoubleClick: ((_: import("../..").Pick) => void) | undefined;
9
+ onDrag: ((_: import("../..").Pick) => void) | undefined;
10
+ onDragFlat: ((_: import("../..").Pick) => void) | undefined;
11
+ onDragStart: ((_: import("../..").Pick) => void) | undefined;
12
+ onDragEnd: ((_: import("../..").Pick) => void) | undefined;
13
+ render: ({ viewport: { projection, modelView, camera, screen }, depth, index, }: {
14
+ viewport: Viewport;
15
+ depth?: boolean | undefined;
16
+ index?: number | undefined;
17
+ }) => void;
18
+ dispose: () => void;
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "world.ts",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",