soonspacejs 3.0.0-alpha.1 → 3.0.0-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soonspacejs",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "homepage": "https://www.xwbuilders.com/soonspacejs/",
5
5
  "description": "SoonSpace.js 3.0 alpha",
6
6
  "module": "./dist/index.esm.js",
@@ -19,6 +19,7 @@ export declare class EntityCollection {
19
19
  private pendingModels;
20
20
  private selected;
21
21
  private selectionDirty;
22
+ private selectionHighlight;
22
23
  constructor(scene: Scene, requestRender: () => void, models: ModelResources, sideVariants?: Pick<TransparentSideVariants, 'register' | 'unregister'>);
23
24
  get roots(): readonly Entity[];
24
25
  getById(id: string): Entity | undefined;
@@ -49,12 +50,18 @@ export declare class EntityCollection {
49
50
  getStats(): {
50
51
  updatedEntities: number;
51
52
  entities: number;
53
+ sourceParts: number;
54
+ renderObjects: number;
55
+ rebuilds: number;
52
56
  instancedBatches: number;
53
57
  batchedBatches: number;
54
58
  independentObjects: number;
55
- rebuilds: number;
59
+ lineBatches: number;
56
60
  };
57
- setSelection(entities: readonly Entity[]): void;
61
+ /** Selection identity is retained even when the optional visual overlay is disabled. */
62
+ setSelection(entities: readonly Entity[], options?: {
63
+ highlight?: boolean;
64
+ }): void;
58
65
  getSelection(): readonly Entity[];
59
66
  setInstancingEnabled(enabled: boolean): void;
60
67
  setBatchedEnabled(enabled: boolean): void;
@@ -28,10 +28,13 @@ export declare class EntityRenderer {
28
28
  private enabled;
29
29
  private batchedEnabled;
30
30
  private rebuilds;
31
+ private sourceParts;
32
+ private batchCounts;
31
33
  private selection;
32
34
  private selectionDirty;
33
35
  private highlights;
34
36
  private highlightMaterial;
37
+ private highlightLineMaterial;
35
38
  constructor(sideVariants?: Pick<TransparentSideVariants, "register" | "unregister"> | undefined);
36
39
  add(input: EntityRenderInput): void;
37
40
  remove(entity: Entity): void;
@@ -44,15 +47,22 @@ export declare class EntityRenderer {
44
47
  private assignGroup;
45
48
  private rebuildGroup;
46
49
  private createBatch;
50
+ private createLineBatch;
51
+ private updateLineBatch;
52
+ private sortLineBatch;
47
53
  private updateBatch;
48
54
  pick(raycaster: Raycaster): EntityHit[];
49
55
  getBounds(entity: Entity): Box3;
50
56
  getStats(): {
57
+ sourceParts: number;
58
+ renderObjects: number;
59
+ rebuilds: number;
51
60
  instancedBatches: number;
52
61
  batchedBatches: number;
53
62
  independentObjects: number;
54
- rebuilds: number;
63
+ lineBatches: number;
55
64
  };
65
+ private countBatch;
56
66
  private clearBatches;
57
67
  dispose(): void;
58
68
  }
@@ -1,6 +1,9 @@
1
1
  import { BufferGeometry, Material, Matrix4, Texture } from 'three';
2
2
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
3
3
  export interface ModelPart {
4
+ /** Omitted for triangle meshes. Basic line segments share the Entity lifecycle. */
5
+ kind?: 'mesh' | 'line-segments';
6
+ pickable?: boolean;
4
7
  geometry: BufferGeometry;
5
8
  material: Material | MaterialLease;
6
9
  matrix: Matrix4;
@@ -0,0 +1,28 @@
1
+ import { Object3D } from 'three';
2
+ import { ModelLease, ModelResources } from './ModelResources';
3
+ export interface StaticModelSnapshot {
4
+ object: Object3D;
5
+ model?: ModelLease;
6
+ empty?: boolean;
7
+ release: () => void;
8
+ }
9
+ export interface StaticModelExtraction extends StaticModelSnapshot {
10
+ restore: () => void;
11
+ }
12
+ /** Load-session cache. It owns snapshots, never resources borrowed from procedural factories. */
13
+ export declare class StaticModelPool {
14
+ private resources;
15
+ private options;
16
+ private materials;
17
+ private models;
18
+ private disposed;
19
+ constructor(resources: ModelResources, options?: {
20
+ pickableLines?: boolean;
21
+ ignoreRootVisibility?: boolean;
22
+ });
23
+ extract(root: Object3D): StaticModelExtraction;
24
+ /** Copy an immutable render snapshot without retaining/moving the source tree.
25
+ * The returned native remainder is owned by the snapshot, never the factory. */
26
+ snapshot(root: Object3D): StaticModelSnapshot;
27
+ dispose(): void;
28
+ }
@@ -1,4 +1,6 @@
1
1
  export { Entity, } from './Entity';
2
+ export { StaticModelPool, } from './StaticModelPool';
3
+ export type { StaticModelSnapshot, StaticModelExtraction, } from './StaticModelPool';
2
4
  export type { EntityOptions, EntityChange, } from './Entity';
3
5
  export { EntityCollection, } from './EntityCollection';
4
6
  export { ModelResources, ResourceLease, ModelResourceUnsupportedError, } from './ModelResources';
package/types/index.d.ts CHANGED
@@ -2164,6 +2164,7 @@ export declare class EntityCollection {
2164
2164
  private pendingModels;
2165
2165
  private selected;
2166
2166
  private selectionDirty;
2167
+ private selectionHighlight;
2167
2168
  constructor(scene: Scene, requestRender: () => void, models: ModelResources, sideVariants?: Pick<TransparentSideVariants, 'register' | 'unregister'>);
2168
2169
  get roots(): readonly Entity[];
2169
2170
  getById(id: string): Entity | undefined;
@@ -2194,12 +2195,18 @@ export declare class EntityCollection {
2194
2195
  getStats(): {
2195
2196
  updatedEntities: number;
2196
2197
  entities: number;
2198
+ sourceParts: number;
2199
+ renderObjects: number;
2200
+ rebuilds: number;
2197
2201
  instancedBatches: number;
2198
2202
  batchedBatches: number;
2199
2203
  independentObjects: number;
2200
- rebuilds: number;
2204
+ lineBatches: number;
2201
2205
  };
2202
- setSelection(entities: readonly Entity[]): void;
2206
+ /** Selection identity is retained even when the optional visual overlay is disabled. */
2207
+ setSelection(entities: readonly Entity[], options?: {
2208
+ highlight?: boolean;
2209
+ }): void;
2203
2210
  getSelection(): readonly Entity[];
2204
2211
  setInstancingEnabled(enabled: boolean): void;
2205
2212
  setBatchedEnabled(enabled: boolean): void;
@@ -3617,6 +3624,9 @@ declare class ModelManage extends DefaultManage {
3617
3624
  }
3618
3625
 
3619
3626
  export declare interface ModelPart {
3627
+ /** Omitted for triangle meshes. Basic line segments share the Entity lifecycle. */
3628
+ kind?: 'mesh' | 'line-segments';
3629
+ pickable?: boolean;
3620
3630
  geometry: BufferGeometry;
3621
3631
  material: Material | MaterialLease;
3622
3632
  matrix: Matrix4;
@@ -6108,6 +6118,35 @@ export declare interface State {
6108
6118
  };
6109
6119
  }
6110
6120
 
6121
+ export declare interface StaticModelExtraction extends StaticModelSnapshot {
6122
+ restore: () => void;
6123
+ }
6124
+
6125
+ /** Load-session cache. It owns snapshots, never resources borrowed from procedural factories. */
6126
+ export declare class StaticModelPool {
6127
+ private resources;
6128
+ private options;
6129
+ private materials;
6130
+ private models;
6131
+ private disposed;
6132
+ constructor(resources: ModelResources, options?: {
6133
+ pickableLines?: boolean;
6134
+ ignoreRootVisibility?: boolean;
6135
+ });
6136
+ extract(root: Object3D): StaticModelExtraction;
6137
+ /** Copy an immutable render snapshot without retaining/moving the source tree.
6138
+ * The returned native remainder is owned by the snapshot, never the factory. */
6139
+ snapshot(root: Object3D): StaticModelSnapshot;
6140
+ dispose(): void;
6141
+ }
6142
+
6143
+ export declare interface StaticModelSnapshot {
6144
+ object: Object3D;
6145
+ model?: ModelLease;
6146
+ empty?: boolean;
6147
+ release: () => void;
6148
+ }
6149
+
6111
6150
  export declare interface StrokeSelectOptions extends BaseSelectOptions {
6112
6151
  isOpacityShow?: boolean;
6113
6152
  edgeColor?: IColor;