run-scene-v2 0.1.136 → 0.1.140

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": "run-scene-v2",
3
- "version": "0.1.136",
3
+ "version": "0.1.140",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "dependencies": {
package/types/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { TransformControls } from "run-scene-core/examples/jsm/controls/TransformControls";
2
2
  import RunScene, { Utils, ModelEx, MaterialEx, TextureEx, Bus } from "./src/RunScene";
3
3
  import Three from "./src/Libs/Three";
4
+ export { textureAdapt } from "./src/Texture/utils/TextureAdapt";
4
5
  declare const _default: {
5
6
  RunScene: typeof RunScene;
6
7
  Utils: typeof Utils;
@@ -33,7 +33,7 @@ export default class Assets {
33
33
  scene: import("run-scene-core").Scene;
34
34
  camera: import("run-scene-core").PerspectiveCamera;
35
35
  renderer: import("run-scene-core").WebGLRenderer;
36
- controls: import("run-scene-core/examples/jsm/controls/OrbitControls").OrbitControls;
36
+ controls: import("../Controls/ConstrainedOrbitControls").ConstrainedOrbitControls;
37
37
  engineDom: HTMLElement;
38
38
  render2: CSS3DRenderer;
39
39
  render3: CSS3DRenderer;
@@ -275,7 +275,7 @@ export default class OptionCb extends BaseEx {
275
275
  }, any>;
276
276
  onSetInfo: BindEvent<{
277
277
  model: any;
278
- type: "material" | "lock" | "visible" | "v3" | "receiveShadow" | "castShadow";
278
+ type: "material" | "visible" | "lock" | "v3" | "receiveShadow" | "castShadow";
279
279
  data: any;
280
280
  }, void>;
281
281
  };
@@ -520,6 +520,11 @@ export default class OptionCb extends BaseEx {
520
520
  map: MapEx<string, E.Texture>;
521
521
  opts: ExporterGltfType["opts"];
522
522
  }, Promise<any>>;
523
+ bindBlob: BindEvent<void, Promise<{
524
+ data: Blob;
525
+ uniqueName: string;
526
+ config: Record<string, any>;
527
+ }[]>>;
523
528
  };
524
529
  model: {
525
530
  parse: BindEvent<{
@@ -575,6 +580,11 @@ export default class OptionCb extends BaseEx {
575
580
  [key: string]: ArrayBuffer;
576
581
  };
577
582
  }, void>;
583
+ onLoadedBindBlob: BindEvent<{
584
+ config: Record<string, any>;
585
+ uniqueName: string;
586
+ ab: ArrayBuffer;
587
+ }, void>;
578
588
  };
579
589
  };
580
590
  custom: {
@@ -652,7 +662,7 @@ export default class OptionCb extends BaseEx {
652
662
  animaUpdateCbs: (() => void)[];
653
663
  completedCbs: (() => void)[];
654
664
  };
655
- ignoreModules?: ("texture" | "scene" | "material" | "light" | "model" | "sky" | "time-line")[];
665
+ ignoreModules?: ("texture" | "scene" | "material" | "model" | "light" | "sky" | "time-line")[];
656
666
  }, void>;
657
667
  resetItem: BindEvent<{
658
668
  type: string;
@@ -773,6 +783,20 @@ export default class OptionCb extends BaseEx {
773
783
  };
774
784
  }, void>;
775
785
  };
786
+ background: {
787
+ layerSet: BindEvent<{
788
+ layerId: number;
789
+ layer: any;
790
+ }, void>;
791
+ layerRemove: BindEvent<{
792
+ layerId: number;
793
+ }, void>;
794
+ layerUpdate: BindEvent<{
795
+ layerId: number;
796
+ property: string;
797
+ value: any;
798
+ }, void>;
799
+ };
776
800
  };
777
801
  msg: {
778
802
  add: BindEvent<{
@@ -0,0 +1,47 @@
1
+ import MapEx from "../Ex/MapEx";
2
+ import RunScene from "../RunScene";
3
+ import { E } from "../Types/Engine";
4
+ export interface BackgroundLayer {
5
+ id: number;
6
+ source: Blob | null;
7
+ texture: E.Texture | null;
8
+ type: "image" | "video";
9
+ opacity: number;
10
+ visible: boolean;
11
+ zIndex: number;
12
+ dom: HTMLElement | null;
13
+ url?: string;
14
+ }
15
+ export interface LayerOptions {
16
+ opacity?: number;
17
+ visible?: boolean;
18
+ zIndex?: number;
19
+ }
20
+ export default class CameraBackground {
21
+ runScene: RunScene;
22
+ layers: MapEx<number, BackgroundLayer>;
23
+ container: HTMLElement | null;
24
+ catchMap: Array<any>;
25
+ constructor(runScene: RunScene);
26
+ init(): void;
27
+ private initBindArraybuffer;
28
+ private initContainer;
29
+ setLayer(layerId: number, source: Blob | null, options?: LayerOptions): Promise<BackgroundLayer>;
30
+ private createLayer;
31
+ private createLayerDom;
32
+ private detectSourceType;
33
+ private setImageLayer;
34
+ private setVideoLayer;
35
+ removeLayer(layerId: number): void;
36
+ clearAll(): void;
37
+ getLayer(layerId: number): BackgroundLayer | null;
38
+ setOpacity(layerId: number, opacity: number): void;
39
+ setVisible(layerId: number, visible: boolean): void;
40
+ setZIndex(layerId: number, zIndex: number): void;
41
+ swapLayers(layerId1: number, layerId2: number): void;
42
+ setSize(width: number, height: number): void;
43
+ private disposeLayer;
44
+ dispose(): void;
45
+ toJSON(): object;
46
+ fromJSON(data: any): void;
47
+ }
@@ -1,5 +1,6 @@
1
1
  import { OrthographicCamera, PerspectiveCamera } from "run-scene-core";
2
2
  import CameraConfig from "./Camera/Config";
3
+ import CameraBackground from "./Camera/Background";
3
4
  import MapEx from "./Ex/MapEx";
4
5
  import RunScene from "./RunScene";
5
6
  import { E } from "./Types/Engine";
@@ -23,6 +24,7 @@ export default class EngineCamera {
23
24
  oCam: OrthographicCamera;
24
25
  pCam: any;
25
26
  config: CameraConfig;
27
+ backgroundEx: CameraBackground;
26
28
  constructor(runScene: RunScene);
27
29
  onInited: () => void;
28
30
  clean: () => void;
@@ -127,6 +129,7 @@ export default class EngineCamera {
127
129
  far: number;
128
130
  fov: number;
129
131
  }>;
132
+ background: object;
130
133
  };
131
134
  getDistanceSelectModel(model?: E.Model): number;
132
135
  }
@@ -27,7 +27,7 @@ export default class Code {
27
27
  scene: Three.Scene;
28
28
  camera: Three.PerspectiveCamera;
29
29
  renderer: Three.WebGLRenderer;
30
- controls: import("run-scene-core/examples/jsm/controls/OrbitControls").OrbitControls;
30
+ controls: import("./Controls/ConstrainedOrbitControls").ConstrainedOrbitControls;
31
31
  engineDom: HTMLElement;
32
32
  render2: import("run-scene-core/examples/jsm/renderers/CSS3DRenderer").CSS3DRenderer;
33
33
  render3: import("run-scene-core/examples/jsm/renderers/CSS3DRenderer").CSS3DRenderer;
@@ -1,4 +1,4 @@
1
- export declare const defModelNames: readonly ["Group", "Box", "Plane", "Sphere", "Sprite", "VerticesRain", "Water", "3DDom", "3DSprite", "2DDom", "GroundProjected", "Lod", "RandomTree", "FluffyGrass", "Atmosphere", "Text"];
1
+ export declare const defModelNames: readonly ["Group", "Box", "Plane", "Sphere", "Sprite", "VerticesRain", "Water", "3DDom", "3DSprite", "2DDom", "GroundProjected", "Lod", "RandomTree", "FluffyGrass", "Atmosphere", "WindField", "Text"];
2
2
  export declare const commonModelNames: readonly ["Group", "Box", "Plane", "Sprite", "VerticesRain", "Water", "GroundProjected", "3DDom", "3DSprite", "2DDom"];
3
3
  export declare const constModelNameForDom: readonly ["3DDom", "3DSprite", "2DDom"];
4
4
  export declare const exModelNames: readonly ["test", "Text"];
@@ -1,7 +1,8 @@
1
- export declare const version = "0.1.136";
1
+ export declare const version = "0.1.140";
2
2
  export declare const versionStr: string;
3
3
  import "./constStr";
4
4
  import "./constAssets";
5
5
  export declare const defExt = ".lt";
6
+ export declare const defCompressExt = ".ltc";
6
7
  export declare const defFileName = "linktwins.lt";
7
8
  export declare const sliceBufferStr = "_||_";
@@ -75,6 +75,9 @@ export declare type ExportJSONEx = {
75
75
  };
76
76
  msg?: string;
77
77
  isDecodeCompress?: boolean;
78
+ exporterOptions?: {
79
+ notPp?: boolean;
80
+ };
78
81
  };
79
82
  export declare type ExportJSONExNotOption = {
80
83
  [P in keyof ExportJSONEx]-?: ExportJSONEx[P];
@@ -112,7 +115,7 @@ export default class ExporterGltf extends BaseEx {
112
115
  scene(down?: boolean, type?: "scene" | "main-scene" | "sub-scene", opts?: ExporterGltfType["opts"]): Promise<ArrayBuffer>;
113
116
  originModel(model?: E.Model): Promise<void>;
114
117
  addDecoderToAb(ab: ArrayBuffer, downLoad?: boolean): Promise<Blob>;
115
- addInfoToAb(outMap: Obj, moduleMap?: Obj): Blob;
118
+ addInfoToAb(outMap: Obj, moduleMap?: Obj): Promise<Blob>;
116
119
  addNormalToAb(ab: ArrayBuffer, opts?: {
117
120
  toArrayBuffer?: boolean;
118
121
  }): Promise<any>;
@@ -8,6 +8,7 @@ export declare type filExParse = {
8
8
  type: "model" | "scene" | "material" | "timeLine" | "texture" | "timeLineData" | "graph" | "camera" | "texture-other";
9
9
  result: any;
10
10
  file?: File;
11
+ json?: any;
11
12
  };
12
13
  export default class FileEx {
13
14
  runScene: RunScene;
@@ -341,6 +341,7 @@ export default abstract class GraphBase extends LGraphNode {
341
341
  drawMessage(ctx: CanvasRenderingContext2D): void;
342
342
  drawRoundRect(ctx: CanvasRenderingContext2D, r: number, x: number, y: number, w: number, h: number): void;
343
343
  hasSubNode(type: "input" | "out", name: string): boolean;
344
+ getIns(): Graph;
344
345
  log(any: string, parms?: GraphBaseType["triggerParms"]): void;
345
346
  findOutNodeByName(name: string): GraphBase[];
346
347
  onLoadProperties(map: Obj): void;
@@ -0,0 +1,9 @@
1
+ import GraphBase, { GraphBaseType } from "../../GraphBase";
2
+ export default class TextureVideoState extends GraphBase {
3
+ title: string;
4
+ static title: string;
5
+ constructor();
6
+ actions: string[];
7
+ onPlay(_runName: string, parms: GraphBaseType["triggerParms"]): void;
8
+ onStop(): void;
9
+ }
@@ -16,3 +16,9 @@ export declare const getMaterialMapNameByModel: (model: E.unknowModel, each?: (c
16
16
  material: E.Material;
17
17
  model: E.unknowModel;
18
18
  }>;
19
+ export declare const utilsMaterial: {
20
+ useByListBackUndos: (_material: E.Material, _list: {
21
+ name: string;
22
+ url: string;
23
+ }[]) => void;
24
+ };
@@ -9,6 +9,7 @@ import WaterModel from "./WaterModel";
9
9
  import { RandomTree } from "./RandomTree";
10
10
  import { FluffyGrass } from "./FluffyGrass";
11
11
  import Atmosphere from "./Atmosphere";
12
+ import WindField from "./WindField";
12
13
  export declare type ModelExDefType = {
13
14
  tools: {
14
15
  type: string;
@@ -28,6 +29,7 @@ export default class ModelExDef {
28
29
  lod: Lod;
29
30
  fluffyGrass: FluffyGrass;
30
31
  atmosphere: Atmosphere;
32
+ windField: WindField;
31
33
  models: string[];
32
34
  constructor(runScene: RunScene);
33
35
  createSavedModel(type: DefModelTypes): any;
@@ -0,0 +1,57 @@
1
+ import RunScene from "../../RunScene";
2
+ import { ParamsConfigManager } from "../../Config/ParamsConfig";
3
+ import { E } from "../../Types/Engine";
4
+ import { HelperBeforeModel } from "./BeforeModel";
5
+ import { Obj } from "js-funcs";
6
+ import { TypeModelBase } from "./ModelBaseType";
7
+ export default class WindField implements HelperBeforeModel {
8
+ isHelperBeforeModel: boolean;
9
+ runScene: RunScene;
10
+ models: any[];
11
+ paramsConfig: ParamsConfigManager<unknown>;
12
+ static paramsConfig: ParamsConfigManager<unknown>;
13
+ static type: string;
14
+ type: string;
15
+ private windFields;
16
+ private windPlanes;
17
+ private lbmBuffers;
18
+ private lbmComputeMaterial;
19
+ private lbmRenderMaterial;
20
+ private computeGeometry;
21
+ private computeScene;
22
+ private computeCamera;
23
+ constructor(runScene: RunScene);
24
+ dispose(): void;
25
+ private initializeLBMCompute;
26
+ private createLBMComputeMaterial;
27
+ private createLBMRenderMaterial;
28
+ private updateModel;
29
+ private createLBMBuffers;
30
+ private initializeLBMTexture;
31
+ private performLBMStep;
32
+ private debugVelocityField;
33
+ private updateObstacles;
34
+ private updateObstacleData;
35
+ private isDescendant;
36
+ private getBounds;
37
+ create(map?: {
38
+ oldParams?: Obj;
39
+ }): any;
40
+ private createWindFieldModel;
41
+ private createLBMPlane;
42
+ private createWindPlane;
43
+ private initializeWindField;
44
+ private updateWindFieldConfig;
45
+ private updateWindPlaneVisualization;
46
+ private updateBoundsConfig;
47
+ private updateWindPlaneConfig;
48
+ to(model: E.unknowModel): void;
49
+ toNormal: (map: {
50
+ type: string;
51
+ model: E.unknowModel;
52
+ runScene: RunScene;
53
+ }) => {
54
+ model: any;
55
+ };
56
+ parse: (map: TypeModelBase["process"]) => any[];
57
+ }
@@ -124,6 +124,7 @@ export declare class OptionsEx {
124
124
  compressTexture: boolean;
125
125
  notMaterial: boolean;
126
126
  outTime: number;
127
+ notPp: boolean;
127
128
  };
128
129
  stats: Stats | undefined;
129
130
  runScene: RunScene;
@@ -7,7 +7,7 @@ import { SnapshotType } from "./SnapshotType";
7
7
  export { ConstantSnapshot };
8
8
  export default class Snapshot {
9
9
  runScene: RunScene;
10
- sliceMap: MapEx<"texture" | "scene" | "material" | "light" | "model" | "sky" | "time-line", {
10
+ sliceMap: MapEx<"texture" | "scene" | "material" | "model" | "light" | "sky" | "time-line", {
11
11
  [is: string]: MapEx<string, {
12
12
  name: string;
13
13
  time: number;
@@ -76,7 +76,9 @@ export default class EngineTexture {
76
76
  clone(oldTexture: E.Texture): E.Texture;
77
77
  getDef(img?: ImageBitmap): Texture;
78
78
  private getSameAndAddtoAll;
79
- afterLoad(texture: E.Texture, blob?: Blob): Promise<Texture>;
79
+ afterLoad(texture: E.Texture, blob?: Blob, opts?: {
80
+ md5?: boolean;
81
+ }): Promise<Texture>;
80
82
  getSameTexture(md5: string, oldTexture: E.Texture): E.Texture | undefined;
81
83
  initTextureAndAddtoAll(texture: E.Texture): Promise<Texture>;
82
84
  addTextureToAll(texture: E.Texture): void;
@@ -87,6 +89,7 @@ export default class EngineTexture {
87
89
  coverByImage(texture: E.Texture, file: File | null | E.Texture, opts?: {
88
90
  addUndo?: boolean;
89
91
  }): Promise<UndoBase[]>;
92
+ setTextureEncodeing(texture: E.Texture, opts: string): void;
90
93
  remove(texture: E.Texture | E.Texture[]): Promise<void>;
91
94
  delete(texture: E.Texture): void;
92
95
  setAnima: (m: {
@@ -102,7 +105,9 @@ export default class EngineTexture {
102
105
  getSize(texture: E.Texture): number;
103
106
  setEncoding(encoding: "def" | "srgb"): void;
104
107
  getAllBase64ByType(_type: "id"): {};
105
- createByImg(img: ImageBitmap | ImageData, blob?: Blob): Promise<Texture>;
108
+ createByImg(img: ImageBitmap | ImageData, blob?: Blob, opts?: {
109
+ md5?: boolean;
110
+ }): Promise<Texture>;
106
111
  bindDataForTexture(t: E.Texture, newT: E.Texture): void;
107
112
  awaitOuterToImgBitMapMap: MapEx<string, boolean>;
108
113
  toStandard(texture: E.Texture): Promise<{
@@ -62,7 +62,9 @@ export declare const disposeTexture: (texture: E.Texture | null) => void;
62
62
  export declare const setTextureBlob: (texture: Texture, blob: Blob) => void;
63
63
  export declare const setTextureSize: (texture: Texture) => void;
64
64
  export declare const setTextureUrl: (texture: Texture, blob: Blob) => void;
65
- export declare const bindTextureBaseData: (texture: E.Texture, _runScene: RunScene, inputBlob?: Blob) => Promise<Texture>;
65
+ export declare const bindTextureBaseData: (texture: E.Texture, _runScene: RunScene, inputBlob?: Blob, opts?: {
66
+ md5?: boolean;
67
+ }) => Promise<Texture>;
66
68
  export declare const getBlobByTexture: (texture: E.Texture) => any;
67
69
  export declare const initTexture: (texture: E.Texture) => Texture;
68
70
  export declare const parseImageBitMapByBlob: (blob: ImageBitmapSource, map?: TextureExType["loadOptions"]) => Promise<ImageBitmap>;
@@ -0,0 +1,9 @@
1
+ import { Texture } from "run-scene-core";
2
+ export default class TextureAdapt {
3
+ processVideoTexture(blob: Blob): Promise<Texture>;
4
+ bindVideoTexture(texture: any): boolean;
5
+ isVideoTexture(texture: any): any;
6
+ bindVideoToObj(obj: any): boolean;
7
+ isVideoObj(obj: any): any;
8
+ }
9
+ export declare const textureAdapt: TextureAdapt;
@@ -1,7 +1,7 @@
1
1
  import { Obj } from "js-funcs";
2
2
  import { Euler, Object3D, Vector2, Vector3 } from "run-scene-core";
3
- import { OrbitControls } from "run-scene-core/examples/jsm/controls/OrbitControls";
4
3
  import * as THREE from "run-scene-core";
4
+ import { ConstrainedOrbitControls } from "../Controls/ConstrainedOrbitControls";
5
5
  export interface UserData {
6
6
  isTimeLineUsed: boolean | undefined;
7
7
  id: string;
@@ -28,7 +28,7 @@ export declare namespace E {
28
28
  type BaseMaterialTexture = "map" | "metalnessMap" | "roughnessMap" | "normalMap" | "aoMap" | "emissiveMap" | "alphaMap" | "lightMap" | "envMap" | "displacementMap";
29
29
  type Camera = THREE.PerspectiveCamera;
30
30
  type Scene = THREE.Scene;
31
- type Controls = OrbitControls;
31
+ type Controls = ConstrainedOrbitControls;
32
32
  type Texture = THREE.Texture;
33
33
  type Render = THREE.WebGLRenderer;
34
34
  }