lythreeframe 1.3.3 → 1.3.4
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/dist/bundle.cjs.js +58 -54
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +59 -56
- package/dist/bundle.esm.js.map +1 -1
- package/dist/index.d.ts +72 -70
- package/dist/src/AssetManagement/AssetDefines.d.ts +65 -0
- package/dist/src/AssetManagement/AssetManager.d.ts +35 -0
- package/dist/src/AssetManagement/AssetPointer/AssetPointer.d.ts +20 -0
- package/dist/src/AssetManagement/AssetPointer/Assets/GeometryAssetPointer.d.ts +5 -0
- package/dist/src/AssetManagement/AssetPointer/Assets/MaterialAssetPointer.d.ts +24 -0
- package/dist/src/AssetManagement/AssetPointer/Assets/TextureAssetPointer.d.ts +5 -0
- package/dist/src/Container/SmartPointer.d.ts +15 -0
- package/dist/src/Defines.d.ts +4 -0
- package/dist/src/Delegate.d.ts +8 -0
- package/dist/src/Factory/CameraFactory.d.ts +6 -0
- package/dist/src/Factory/RendererFactory.d.ts +2 -0
- package/dist/src/Frame/Controller.d.ts +130 -0
- package/dist/src/Frame/Parameters/AppParameter.d.ts +25 -0
- package/dist/src/Frame/Parameters/CameraParameter.d.ts +22 -0
- package/dist/src/Frame/Parameters/RendererParameters.d.ts +17 -0
- package/dist/src/Frame/Parameters/ViewportParameters.d.ts +6 -0
- package/dist/src/Frame/Parameters/WorldParameter.d.ts +5 -0
- package/dist/src/Frame/Rendering/PostProcess.d.ts +45 -0
- package/dist/src/Frame/Viewport.d.ts +52 -0
- package/dist/src/Frame/World.d.ts +29 -0
- package/dist/src/Geometry/PlaneGeometry.d.ts +3 -0
- package/dist/src/Geometry/TriangleGeometry.d.ts +3 -0
- package/dist/src/Library/ContainerLibrary.d.ts +3 -0
- package/dist/src/Library/Debounce.d.ts +1 -0
- package/dist/src/Library/Math.d.ts +27 -0
- package/dist/src/Library/ResourceLibrary.d.ts +7 -0
- package/dist/src/Object/Actor.d.ts +86 -0
- package/dist/src/Object/Actors/Level/LevelActor.d.ts +13 -0
- package/dist/src/Object/Actors/Light/AmbientLightActor.d.ts +9 -0
- package/dist/src/Object/Actors/Light/DirectionalLightActor.d.ts +9 -0
- package/dist/src/Object/Actors/Shape/BoxActor.d.ts +7 -0
- package/dist/src/Object/Actors/Shape/PlaneActor.d.ts +8 -0
- package/dist/src/Object/Actors/Sky/SkyActor.d.ts +9 -0
- package/dist/src/Object/BaseObject.d.ts +14 -0
- package/dist/src/Object/Components/2D/2DComponent.d.ts +14 -0
- package/dist/src/Object/Components/Component.d.ts +18 -0
- package/dist/src/Object/Components/Level/LevelComponent.d.ts +9 -0
- package/dist/src/Object/Components/Light/AmbientLight/AmbientLightComponent.d.ts +16 -0
- package/dist/src/Object/Components/Light/DirectionalLight/DirectionalLightComponent.d.ts +16 -0
- package/dist/src/Object/Components/Light/LightComponent.d.ts +12 -0
- package/dist/src/Object/Components/Mesh/CustomMeshComponent.d.ts +63 -0
- package/dist/src/Object/Components/Mesh/MeshComponent.d.ts +28 -0
- package/dist/src/Object/Components/Mesh/Shape/BoxComponent.d.ts +6 -0
- package/dist/src/Object/Components/Mesh/Shape/PlaneComponent.d.ts +6 -0
- package/dist/src/Object/Components/Mesh/Shape/SphereComponent.d.ts +6 -0
- package/dist/src/Object/Components/Mesh/Sprite/SpriteComponent.d.ts +9 -0
- package/dist/src/Object/Components/SceneComponent.d.ts +79 -0
- package/dist/src/Object/Components/Sky/SkyComponent.d.ts +22 -0
- package/dist/src/Object/PawnV2/FirstPerson.d.ts +11 -0
- package/dist/src/Object/PawnV2/Oribital.d.ts +22 -0
- package/dist/src/Object/PawnV2/Pawn.d.ts +22 -0
- package/dist/src/Object/PawnV2/TransformControl.d.ts +62 -0
- package/dist/src/PostProcess/Param/AAParam.d.ts +6 -0
- package/dist/src/PostProcess/Param/Bloom.d.ts +8 -0
- package/dist/src/PostProcess/Param/DOF.d.ts +8 -0
- package/dist/src/PostProcess/Param/GTAO.d.ts +12 -0
- package/dist/src/PostProcess/Param/LensFlare.d.ts +11 -0
- package/dist/src/PostProcess/Param/MotionBlur.d.ts +4 -0
- package/dist/src/PostProcess/Param/Outline.d.ts +12 -0
- package/dist/src/PostProcess/Param/SSR.d.ts +8 -0
- package/dist/src/PostProcess/PostProcessParam.d.ts +16 -0
- package/dist/src/Shader/Postprocess/ColorShader.d.ts +29 -0
- package/dist/src/ThreeJsApp.d.ts +37 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Pawn } from "./Pawn";
|
|
2
|
+
import { Controller } from "../../Frame/Controller";
|
|
3
|
+
import { OrbitControls } from "three/examples/jsm/Addons.js";
|
|
4
|
+
import { Euler, Quaternion, Vector3 } from "three/webgpu";
|
|
5
|
+
export declare class Orbital extends Pawn {
|
|
6
|
+
private anim;
|
|
7
|
+
get control(): OrbitControls;
|
|
8
|
+
protected _control: OrbitControls;
|
|
9
|
+
protected changeEvent: () => void;
|
|
10
|
+
get camera(): import("three").PerspectiveCamera | import("three").OrthographicCamera;
|
|
11
|
+
constructor(controller: Controller);
|
|
12
|
+
possess(): void;
|
|
13
|
+
unpossess(): void;
|
|
14
|
+
onChange(): void;
|
|
15
|
+
focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
|
|
16
|
+
getFocuingData(): {
|
|
17
|
+
position: Vector3;
|
|
18
|
+
quaternion: Quaternion;
|
|
19
|
+
distance: number;
|
|
20
|
+
} | null;
|
|
21
|
+
stopFocusing(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Euler, Quaternion, Vector3 } from "three/webgpu";
|
|
2
|
+
import { Controller } from "../../Frame/Controller";
|
|
3
|
+
export declare abstract class Pawn {
|
|
4
|
+
get camera(): import("three").PerspectiveCamera | import("three").OrthographicCamera;
|
|
5
|
+
set enabled(value: boolean);
|
|
6
|
+
get control(): any;
|
|
7
|
+
protected _control: any | null;
|
|
8
|
+
protected controller: Controller;
|
|
9
|
+
protected isTickEnabled: boolean;
|
|
10
|
+
protected constructor(controller: Controller);
|
|
11
|
+
tick(_deltaTime: number): void;
|
|
12
|
+
possess(): void;
|
|
13
|
+
unpossess(): void;
|
|
14
|
+
focusTo(_targetPos: Vector3, _targetQuat: Quaternion | Euler, _distance: number, _time: number, _onGoing?: (() => void) | null, _onFinished?: (() => void) | null): void;
|
|
15
|
+
stopFocusing(): void;
|
|
16
|
+
getFocuingData(): {
|
|
17
|
+
position: Vector3;
|
|
18
|
+
quaternion: Quaternion;
|
|
19
|
+
distance: number;
|
|
20
|
+
} | null;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Pawn } from "./Pawn";
|
|
2
|
+
import { Matrix4, Scene } from "three/webgpu";
|
|
3
|
+
import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
|
|
4
|
+
import { Controller } from "../../Frame/Controller";
|
|
5
|
+
export interface TransformType {
|
|
6
|
+
rotate: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
7
|
+
scale: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
8
|
+
translate: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
9
|
+
}
|
|
10
|
+
export interface ITransforming {
|
|
11
|
+
isTransformAllowed(): boolean;
|
|
12
|
+
onTransforming(worldMatrix: Matrix4): void;
|
|
13
|
+
getMatrixInWorld(): Matrix4;
|
|
14
|
+
getAllowedTransformType(): TransformType;
|
|
15
|
+
}
|
|
16
|
+
/** Options for TransformGizmo */
|
|
17
|
+
export interface TransformGizmoOptions {
|
|
18
|
+
/** Optional separate scene for rendering gizmo (not affected by post-processing) */
|
|
19
|
+
helperScene?: Scene;
|
|
20
|
+
}
|
|
21
|
+
export declare class TransformGizmo extends Pawn {
|
|
22
|
+
get control(): TransformControls;
|
|
23
|
+
protected _control: TransformControls | null;
|
|
24
|
+
private helperObject;
|
|
25
|
+
private targets;
|
|
26
|
+
private primaryTarget;
|
|
27
|
+
private targetMatrixMap;
|
|
28
|
+
/** Scene where gizmo is rendered (can be separate from main scene to avoid post-processing) */
|
|
29
|
+
private gizmoScene;
|
|
30
|
+
protected onDraggingChangedEvent: (param: {
|
|
31
|
+
value: unknown;
|
|
32
|
+
}) => void;
|
|
33
|
+
protected onObjectChangeEvent: () => void;
|
|
34
|
+
protected onChangeEvent: () => void;
|
|
35
|
+
protected onUpdateFunction: (() => void) | null;
|
|
36
|
+
protected onDraggingFunction: ((event: boolean) => void) | null;
|
|
37
|
+
constructor(controller: Controller, options?: TransformGizmoOptions);
|
|
38
|
+
/** Get the scene where gizmo should be added */
|
|
39
|
+
private getTargetScene;
|
|
40
|
+
possess(): void;
|
|
41
|
+
unpossess(): void;
|
|
42
|
+
refresh(): void;
|
|
43
|
+
protected onChange(): void;
|
|
44
|
+
protected onDraggingChanged(event: {
|
|
45
|
+
value: any;
|
|
46
|
+
}): void;
|
|
47
|
+
protected onObjectChanged(): void;
|
|
48
|
+
set enable(newEnable: boolean);
|
|
49
|
+
setTarget(primaryTarget: ITransforming, multiTargets: ITransforming[], onUpdate?: (() => void) | null, onDragging?: ((bDragging: boolean) => void) | null): void;
|
|
50
|
+
getMode(): "translate" | "rotate" | "scale";
|
|
51
|
+
setMode(mode: "translate" | "rotate" | "scale"): void;
|
|
52
|
+
setSpace(space: "world" | "local"): void;
|
|
53
|
+
setAxis(axis: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null): void;
|
|
54
|
+
setSize(size: number): void;
|
|
55
|
+
getTranslationSnap(): number | null;
|
|
56
|
+
setTranslationSnap(translationSnap: number | null): void;
|
|
57
|
+
getRotationnSnap(): number | null;
|
|
58
|
+
setRotationSnap(translationSnap: number | null): void;
|
|
59
|
+
getScaleSnap(): number | null;
|
|
60
|
+
setScaleSnap(translationSnap: number | null): void;
|
|
61
|
+
destroy(): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
2
|
+
export interface AAParams extends PostProcessStepParam {
|
|
3
|
+
type: PostProcessStepType.Antialiasing;
|
|
4
|
+
method: "fxaa" | "smaa" | "traa";
|
|
5
|
+
}
|
|
6
|
+
export declare const DefaultAAParams: AAParams;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
2
|
+
export interface BloomParam extends PostProcessStepParam {
|
|
3
|
+
type: PostProcessStepType.Bloom;
|
|
4
|
+
threshold: number;
|
|
5
|
+
strength: number;
|
|
6
|
+
radius: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DefaultBloomParam: BloomParam;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
2
|
+
export interface DOFParam extends PostProcessStepParam {
|
|
3
|
+
type: PostProcessStepType.DepthOfField;
|
|
4
|
+
focus: number;
|
|
5
|
+
aperture: number;
|
|
6
|
+
maxblur: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DefaultDOFParam: DOFParam;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
2
|
+
export interface GTAOParam extends PostProcessStepParam {
|
|
3
|
+
type: PostProcessStepType.GroundTruthAmbientOcclusion;
|
|
4
|
+
distanceExponent: number;
|
|
5
|
+
distanceFallOff: number;
|
|
6
|
+
radius: number;
|
|
7
|
+
scale: number;
|
|
8
|
+
thickness: number;
|
|
9
|
+
samples: 16;
|
|
10
|
+
useTemporalFiltering: false;
|
|
11
|
+
}
|
|
12
|
+
export declare const DefaultGTAOParam: GTAOParam;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
2
|
+
export interface LensFlareParam extends PostProcessStepParam {
|
|
3
|
+
type: PostProcessStepType.LensFlare;
|
|
4
|
+
threshold: number;
|
|
5
|
+
ghostSamples: number;
|
|
6
|
+
ghostSpacing: number;
|
|
7
|
+
ghostAttenuationFactor: number;
|
|
8
|
+
ghostTint: [number, number, number];
|
|
9
|
+
downSampleRatio: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const DefaultLensFlareParam: LensFlareParam;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColorRepresentation } from "three/webgpu";
|
|
2
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
3
|
+
export interface OutlineParams extends PostProcessStepParam {
|
|
4
|
+
type: PostProcessStepType.Outline;
|
|
5
|
+
edgeStrength: number;
|
|
6
|
+
edgeGlow: number;
|
|
7
|
+
edgeThickness: number;
|
|
8
|
+
pulsePeriod: number;
|
|
9
|
+
visibleEdgeColor: ColorRepresentation;
|
|
10
|
+
hiddenEdgeColor: ColorRepresentation;
|
|
11
|
+
}
|
|
12
|
+
export declare const DefaultOutlineParams: OutlineParams;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostProcessStepParam, PostProcessStepType } from "../PostProcessParam";
|
|
2
|
+
export interface SSRParam extends PostProcessStepParam {
|
|
3
|
+
type: PostProcessStepType.ScreenSpaceReflection;
|
|
4
|
+
maxDistance: number;
|
|
5
|
+
opacity: number;
|
|
6
|
+
thickness: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DefaultSSRParam: SSRParam;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PostProcessParam {
|
|
2
|
+
steps: PostProcessStepParam[];
|
|
3
|
+
}
|
|
4
|
+
export declare const DefaultPostProcessParam: PostProcessParam;
|
|
5
|
+
export declare enum PostProcessStepType {
|
|
6
|
+
Bloom = 0,
|
|
7
|
+
DepthOfField = 1,
|
|
8
|
+
ScreenSpaceReflection = 2,
|
|
9
|
+
GroundTruthAmbientOcclusion = 3,
|
|
10
|
+
Outline = 4,
|
|
11
|
+
Antialiasing = 5,
|
|
12
|
+
LensFlare = 6
|
|
13
|
+
}
|
|
14
|
+
export interface PostProcessStepParam {
|
|
15
|
+
type: PostProcessStepType;
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brightness and contrast adjustment
|
|
3
|
+
* https://github.com/evanw/glfx.js
|
|
4
|
+
* brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
|
|
5
|
+
* contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
|
|
6
|
+
*/
|
|
7
|
+
declare const ColorShader: {
|
|
8
|
+
name: string;
|
|
9
|
+
uniforms: {
|
|
10
|
+
tDiffuse: {
|
|
11
|
+
value: null;
|
|
12
|
+
};
|
|
13
|
+
brightness: {
|
|
14
|
+
value: number;
|
|
15
|
+
};
|
|
16
|
+
contrast: {
|
|
17
|
+
value: number;
|
|
18
|
+
};
|
|
19
|
+
saturation: {
|
|
20
|
+
value: number;
|
|
21
|
+
};
|
|
22
|
+
exposure: {
|
|
23
|
+
value: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
vertexShader: string;
|
|
27
|
+
fragmentShader: string;
|
|
28
|
+
};
|
|
29
|
+
export { ColorShader };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { World } from "./Frame/World";
|
|
2
|
+
import { Viewport } from "./Frame/Viewport";
|
|
3
|
+
import { Controller } from "./Frame/Controller";
|
|
4
|
+
import { Clock, OrthographicCamera, PerspectiveCamera } from "three/webgpu";
|
|
5
|
+
import { Delegate } from './Delegate';
|
|
6
|
+
import { CameraParam } from './Frame/Parameters/CameraParameter';
|
|
7
|
+
import { AppParam } from './Frame/Parameters/AppParameter';
|
|
8
|
+
import { AssetManager } from './AssetManagement/AssetManager';
|
|
9
|
+
export declare class ThreeJsApp {
|
|
10
|
+
get camera(): PerspectiveCamera | OrthographicCamera;
|
|
11
|
+
get clock(): Clock;
|
|
12
|
+
get world(): World;
|
|
13
|
+
get viewport(): Viewport;
|
|
14
|
+
get controller(): Controller;
|
|
15
|
+
get assetManager(): AssetManager;
|
|
16
|
+
protected _clock: Clock;
|
|
17
|
+
protected _camera: PerspectiveCamera | OrthographicCamera;
|
|
18
|
+
protected _world: World;
|
|
19
|
+
protected _viewport: Viewport;
|
|
20
|
+
protected _controller: Controller;
|
|
21
|
+
protected _assetManager: AssetManager;
|
|
22
|
+
protected _tickingFunctions: Array<(delta: number) => void>;
|
|
23
|
+
get appParam(): AppParam;
|
|
24
|
+
protected _appParam: AppParam;
|
|
25
|
+
get onCameraChangedDelegate(): Delegate<[void]>;
|
|
26
|
+
protected _onCameraChangedDelegate: Delegate<[void]>;
|
|
27
|
+
constructor(appParam?: AppParam);
|
|
28
|
+
protected postConstruct(): void;
|
|
29
|
+
init(): void;
|
|
30
|
+
protected tick(deltaTime: number): void;
|
|
31
|
+
addTickingFunction(func: (deltaTime: number) => void): void;
|
|
32
|
+
removeTickingFunction(func: (deltaTime: number) => void): void;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
updateCamera(param: CameraParam): void;
|
|
35
|
+
onWindowResize(width: number, height: number): void;
|
|
36
|
+
renderAsImage(width?: number, height?: number): Promise<string>;
|
|
37
|
+
}
|