lythreeframe 1.2.35 → 1.2.36

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.
@@ -3007,6 +3007,74 @@ class DirectionalLightActor extends Actor {
3007
3007
  }
3008
3008
  }
3009
3009
 
3010
+ class AmbientLightComponent extends LightComponent {
3011
+ get threeObject() {
3012
+ if (!this.obj) {
3013
+ throw Error("three object is invalid");
3014
+ }
3015
+ return this.obj;
3016
+ }
3017
+ set threeObject(newThreeObject) {
3018
+ this.obj = newThreeObject;
3019
+ if (this.obj) {
3020
+ this.obj.userData["LYObject"] = this;
3021
+ }
3022
+ }
3023
+ get castShadow() {
3024
+ return this.threeObject.castShadow;
3025
+ }
3026
+ set castShadow(value) {
3027
+ this.threeObject.castShadow = value;
3028
+ }
3029
+ constructor(app, color = 0xffffff, intensity = 10, uuid) {
3030
+ super(app, uuid);
3031
+ this.threeObject.color.set(color);
3032
+ this.threeObject.intensity = intensity;
3033
+ }
3034
+ createDefaultObject() {
3035
+ return new webgpu.AmbientLight(0xffffff, 10);
3036
+ }
3037
+ setPosition(...args) {
3038
+ if (args.length === 1) {
3039
+ super.setPosition(args[0]);
3040
+ }
3041
+ else {
3042
+ super.setPosition(args[0], args[1], args[2]);
3043
+ }
3044
+ this.update();
3045
+ }
3046
+ update() {
3047
+ if (this.world)
3048
+ this.world.viewport.markRenderStateDirty();
3049
+ }
3050
+ onAddedToWorld(world) {
3051
+ if (!this.threeObject) {
3052
+ throw Error("three object is invalid");
3053
+ }
3054
+ super.onAddedToWorld(world);
3055
+ }
3056
+ destroy() {
3057
+ super.destroy();
3058
+ }
3059
+ }
3060
+
3061
+ class AmbientLightActor extends Actor {
3062
+ constructor(app, color = 0xffffff, intensity = 1, uuid) {
3063
+ super(app, uuid);
3064
+ this.lightComponent = null;
3065
+ this.lightComponent = this.rootComponent;
3066
+ if (this.lightComponent) {
3067
+ this.lightComponent.color = color;
3068
+ this.lightComponent.intensity = intensity;
3069
+ this.lightComponent.castShadow = true;
3070
+ }
3071
+ this.lightComponent.castShadow = true;
3072
+ }
3073
+ constructRootComponent() {
3074
+ return new AmbientLightComponent(this.app);
3075
+ }
3076
+ }
3077
+
3010
3078
  class BoxComponent extends MeshComponent {
3011
3079
  constructor(app, width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1, material = new webgpu.MeshStandardMaterial(), uuid) {
3012
3080
  super(app, new webgpu.BoxGeometry(width, height, depth, widthSegments, heightSegments, depthSegments), material, uuid);
@@ -3430,6 +3498,8 @@ class TransformGizmo extends Pawn {
3430
3498
  }
3431
3499
 
3432
3500
  exports.Actor = Actor;
3501
+ exports.AmbientLightActor = AmbientLightActor;
3502
+ exports.AmbientLightComponent = AmbientLightComponent;
3433
3503
  exports.AssetManager = AssetManager;
3434
3504
  exports.BoxActor = BoxActor;
3435
3505
  exports.BoxComponent = BoxComponent;
@@ -1,4 +1,4 @@
1
- import { MathUtils, Object3D, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, LoadingManager, BufferGeometry, Texture, FileLoader, Material, NearestFilter, WebGPURenderer, PostProcessing, Color, Vector2, Raycaster, OrthographicCamera, PerspectiveCamera, Clock, DirectionalLight, MeshStandardMaterial, BoxGeometry, MeshBasicMaterial, PlaneGeometry, SphereGeometry } from 'three/webgpu';
1
+ import { MathUtils, Object3D, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, LoadingManager, BufferGeometry, Texture, FileLoader, Material, NearestFilter, WebGPURenderer, PostProcessing, Color, Vector2, Raycaster, OrthographicCamera, PerspectiveCamera, Clock, DirectionalLight, AmbientLight, MeshStandardMaterial, BoxGeometry, MeshBasicMaterial, PlaneGeometry, SphereGeometry } from 'three/webgpu';
2
2
  import { GLTFLoader, DRACOLoader, CSS2DRenderer, OrbitControls } from 'three/examples/jsm/Addons.js';
3
3
  import { pass, mrt, output, uniform, metalness, transformedNormalView, time, oscSine } from 'three/tsl';
4
4
  import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js';
@@ -3005,6 +3005,74 @@ class DirectionalLightActor extends Actor {
3005
3005
  }
3006
3006
  }
3007
3007
 
3008
+ class AmbientLightComponent extends LightComponent {
3009
+ get threeObject() {
3010
+ if (!this.obj) {
3011
+ throw Error("three object is invalid");
3012
+ }
3013
+ return this.obj;
3014
+ }
3015
+ set threeObject(newThreeObject) {
3016
+ this.obj = newThreeObject;
3017
+ if (this.obj) {
3018
+ this.obj.userData["LYObject"] = this;
3019
+ }
3020
+ }
3021
+ get castShadow() {
3022
+ return this.threeObject.castShadow;
3023
+ }
3024
+ set castShadow(value) {
3025
+ this.threeObject.castShadow = value;
3026
+ }
3027
+ constructor(app, color = 0xffffff, intensity = 10, uuid) {
3028
+ super(app, uuid);
3029
+ this.threeObject.color.set(color);
3030
+ this.threeObject.intensity = intensity;
3031
+ }
3032
+ createDefaultObject() {
3033
+ return new AmbientLight(0xffffff, 10);
3034
+ }
3035
+ setPosition(...args) {
3036
+ if (args.length === 1) {
3037
+ super.setPosition(args[0]);
3038
+ }
3039
+ else {
3040
+ super.setPosition(args[0], args[1], args[2]);
3041
+ }
3042
+ this.update();
3043
+ }
3044
+ update() {
3045
+ if (this.world)
3046
+ this.world.viewport.markRenderStateDirty();
3047
+ }
3048
+ onAddedToWorld(world) {
3049
+ if (!this.threeObject) {
3050
+ throw Error("three object is invalid");
3051
+ }
3052
+ super.onAddedToWorld(world);
3053
+ }
3054
+ destroy() {
3055
+ super.destroy();
3056
+ }
3057
+ }
3058
+
3059
+ class AmbientLightActor extends Actor {
3060
+ constructor(app, color = 0xffffff, intensity = 1, uuid) {
3061
+ super(app, uuid);
3062
+ this.lightComponent = null;
3063
+ this.lightComponent = this.rootComponent;
3064
+ if (this.lightComponent) {
3065
+ this.lightComponent.color = color;
3066
+ this.lightComponent.intensity = intensity;
3067
+ this.lightComponent.castShadow = true;
3068
+ }
3069
+ this.lightComponent.castShadow = true;
3070
+ }
3071
+ constructRootComponent() {
3072
+ return new AmbientLightComponent(this.app);
3073
+ }
3074
+ }
3075
+
3008
3076
  class BoxComponent extends MeshComponent {
3009
3077
  constructor(app, width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1, material = new MeshStandardMaterial(), uuid) {
3010
3078
  super(app, new BoxGeometry(width, height, depth, widthSegments, heightSegments, depthSegments), material, uuid);
@@ -3427,4 +3495,4 @@ class TransformGizmo extends Pawn {
3427
3495
  }
3428
3496
  }
3429
3497
 
3430
- export { Actor, AssetManager, AttachmentRules, BoxActor, BoxComponent, Controller, DefaultAAParams, DefaultAppParam, DefaultBloomParam, DefaultCameraParam, DefaultDOFParam, DefaultDenoiseParam, DefaultGTAOParam, DefaultOrthographicCameraParam, DefaultOutlineParams, DefaultPerspectiveCameraParam, DefaultPostProcessParam, DefaultRendererParameters, DefaultSSRParam, DefaultSkyParam, DefaultViewportParam, DefaultWorldParam, Delegate, DirectionalLightActor, DirectionalLightComponent, FirstPerson, GeometryAssetPointer, LabelComponent, LevelActor, LevelComponent, MaterialAssetPointer, MeshComponent, Orbital, PlaneActor, PlaneComponent, PostProcessStepType, SceneComponent, SkyActor, SkyComponent, SphereComponent, TAssetPointer, TSmartPointer, TextureAssetPointer, ThreeJsApp, ThreeObjectLibrary, TransformGizmo, Viewport, WebGPUPostProcessFactory, World };
3498
+ export { Actor, AmbientLightActor, AmbientLightComponent, AssetManager, AttachmentRules, BoxActor, BoxComponent, Controller, DefaultAAParams, DefaultAppParam, DefaultBloomParam, DefaultCameraParam, DefaultDOFParam, DefaultDenoiseParam, DefaultGTAOParam, DefaultOrthographicCameraParam, DefaultOutlineParams, DefaultPerspectiveCameraParam, DefaultPostProcessParam, DefaultRendererParameters, DefaultSSRParam, DefaultSkyParam, DefaultViewportParam, DefaultWorldParam, Delegate, DirectionalLightActor, DirectionalLightComponent, FirstPerson, GeometryAssetPointer, LabelComponent, LevelActor, LevelComponent, MaterialAssetPointer, MeshComponent, Orbital, PlaneActor, PlaneComponent, PostProcessStepType, SceneComponent, SkyActor, SkyComponent, SphereComponent, TAssetPointer, TSmartPointer, TextureAssetPointer, ThreeJsApp, ThreeObjectLibrary, TransformGizmo, Viewport, WebGPUPostProcessFactory, World };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export type { RendererParameters } from './lythreeframe/Frame/Parameters/Rendere
22
22
  export { DefaultRendererParameters } from './lythreeframe/Frame/Parameters/RendererParameters';
23
23
  export { Actor } from "./lythreeframe/Object/Actor";
24
24
  export { DirectionalLightActor } from "./lythreeframe/Object/Actors/Light/DirectionalLightActor";
25
+ export { AmbientLightActor } from './lythreeframe/Object/Actors/Light/AmbientLightActor';
25
26
  export { BoxActor } from "./lythreeframe/Object/Actors/Shape/BoxActor";
26
27
  export { SkyActor } from "./lythreeframe/Object/Actors/Sky/SkyActor";
27
28
  export { PlaneActor } from "./lythreeframe/Object/Actors/Shape/PlaneActor";
@@ -33,6 +34,7 @@ export { PlaneComponent } from "./lythreeframe/Object/Components/Mesh/Shape/Plan
33
34
  export { SphereComponent } from "./lythreeframe/Object/Components/Mesh/Shape/SphereComponent";
34
35
  export { LevelComponent } from "./lythreeframe/Object/Components/Level/LevelComponent";
35
36
  export { DirectionalLightComponent } from "./lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent";
37
+ export { AmbientLightComponent } from './lythreeframe/Object/Components/Light/AmbientLight/AmbientLightComponent';
36
38
  export { LabelComponent } from "./lythreeframe/Object/Components/2D/2DComponent";
37
39
  export { SkyComponent } from "./lythreeframe/Object/Components/Sky/SkyComponent";
38
40
  export type { SkyComponentParam } from "./lythreeframe/Object/Components/Sky/SkyComponent";
@@ -0,0 +1,9 @@
1
+ import { ColorRepresentation } from "three/webgpu";
2
+ import { Actor } from "../../Actor";
3
+ import { ThreeJsApp } from "../../../ThreeJsApp";
4
+ import { AmbientLightComponent } from "../../Components/Light/AmbientLight/AmbientLightComponent";
5
+ export declare class AmbientLightActor extends Actor {
6
+ protected lightComponent: AmbientLightComponent | null;
7
+ constructor(app: ThreeJsApp, color?: ColorRepresentation, intensity?: number, uuid?: string);
8
+ protected constructRootComponent(): AmbientLightComponent;
9
+ }
@@ -0,0 +1,16 @@
1
+ import { LightComponent } from "../LightComponent";
2
+ import { AmbientLight, ColorRepresentation, Vector3 } from "three/webgpu";
3
+ import { World } from "../../../../Frame/World";
4
+ import { ThreeJsApp } from "../../../../ThreeJsApp";
5
+ export declare class AmbientLightComponent extends LightComponent {
6
+ get threeObject(): AmbientLight;
7
+ set threeObject(newThreeObject: AmbientLight);
8
+ get castShadow(): boolean;
9
+ set castShadow(value: boolean);
10
+ constructor(app: ThreeJsApp, color?: ColorRepresentation, intensity?: number, uuid?: string);
11
+ protected createDefaultObject(): AmbientLight;
12
+ setPosition(...args: [Vector3] | [number, number, number]): void;
13
+ update(): void;
14
+ onAddedToWorld(world: World): void;
15
+ destroy(): void;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",