@zephyr3d/scene 0.1.0 → 0.1.1

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.
Files changed (60) hide show
  1. package/README.md +46 -0
  2. package/dist/animation/animation.js +28 -28
  3. package/dist/animation/skeleton.js +14 -14
  4. package/dist/animation/usertrack.js +9 -9
  5. package/dist/app.js +31 -31
  6. package/dist/asset/assetmanager.js +50 -50
  7. package/dist/asset/builtin.js +157 -157
  8. package/dist/asset/loaders/dds/dds_loader.js +11 -11
  9. package/dist/asset/loaders/gltf/gltf_loader.js +10 -10
  10. package/dist/asset/loaders/hdr/hdr.js +5 -5
  11. package/dist/asset/loaders/image/tga_Loader.js +3 -3
  12. package/dist/asset/loaders/image/webimage_loader.js +3 -3
  13. package/dist/asset/loaders/loader.js +19 -19
  14. package/dist/asset/model.js +57 -57
  15. package/dist/blitter/blitter.js +35 -35
  16. package/dist/blitter/box.js +24 -24
  17. package/dist/blitter/depthlimitedgaussion.js +3 -3
  18. package/dist/blitter/gaussianblur.js +21 -21
  19. package/dist/camera/camera.js +68 -68
  20. package/dist/index.d.ts +2 -0
  21. package/dist/material/grassmaterial.js +17 -17
  22. package/dist/material/lambert.js +3 -3
  23. package/dist/material/lightmodel.js +362 -362
  24. package/dist/material/material.js +50 -50
  25. package/dist/material/meshmaterial.js +48 -48
  26. package/dist/material/unlit.js +3 -3
  27. package/dist/posteffect/bloom.js +5 -5
  28. package/dist/posteffect/compositor.js +16 -16
  29. package/dist/posteffect/fxaa.js +5 -5
  30. package/dist/posteffect/grayscale.js +5 -5
  31. package/dist/posteffect/posteffect.js +42 -42
  32. package/dist/posteffect/sao.js +5 -5
  33. package/dist/posteffect/tonemap.js +5 -5
  34. package/dist/posteffect/water.js +6 -6
  35. package/dist/render/cull_visitor.js +12 -12
  36. package/dist/render/depth_pass.js +8 -8
  37. package/dist/render/envlight.js +104 -104
  38. package/dist/render/render_queue.js +33 -33
  39. package/dist/render/renderpass.js +18 -18
  40. package/dist/render/renderscheme.js +14 -14
  41. package/dist/render/scatteringlut.js +3 -3
  42. package/dist/render/sky.js +38 -38
  43. package/dist/render/temporalcache.js +4 -4
  44. package/dist/render/watermesh.js +5 -5
  45. package/dist/scene/graph_node.js +25 -25
  46. package/dist/scene/octree.js +191 -191
  47. package/dist/scene/scene.js +37 -37
  48. package/dist/scene/terrain/grass.js +27 -27
  49. package/dist/scene/terrain/quadtree.js +45 -45
  50. package/dist/shaders/framework.js +161 -161
  51. package/dist/shaders/lighting.js +7 -7
  52. package/dist/shaders/noise.js +43 -43
  53. package/dist/shadow/shadowmapper.js +76 -76
  54. package/dist/shadow/ssm.js +34 -34
  55. package/dist/utility/bounding_volume.js +30 -27
  56. package/dist/utility/bounding_volume.js.map +1 -1
  57. package/dist/utility/shprojection.js +14 -14
  58. package/package.json +70 -70
  59. package/dist/material/mixins/texture.js +0 -110
  60. package/dist/material/mixins/texture.js.map +0 -1
@@ -353,9 +353,9 @@ class ScatteringLut {
353
353
  this.$l.sliceU = pb.clamp(pb.div(pb.sub(this.$inputs.uv.x, pb.mul(this.slice, 1 / ScatteringLut._aerialPerspectiveSliceZ)), 1 / ScatteringLut._aerialPerspectiveSliceZ), 0, 1);
354
354
  this.$l.horizonAngle = pb.sub(pb.mul(this.sliceU, Math.PI * 2), Math.PI);
355
355
  this.$l.zenithAngle = pb.mul(this.$inputs.uv.y, Math.PI / 2);
356
- /*
357
- this.$l.rayDir = pb.vec3(pb.mul(this.cosAltitude, pb.sin(this.azimuthAngle)), pb.sin(this.altitudeAngle), pb.mul(pb.neg(this.cosAltitude), pb.cos(this.azimuthAngle)));
358
- this.$l.sunDir = pb.vec3(0, pb.sin(this.sunAltitude), pb.neg(pb.cos(this.sunAltitude)));
356
+ /*
357
+ this.$l.rayDir = pb.vec3(pb.mul(this.cosAltitude, pb.sin(this.azimuthAngle)), pb.sin(this.altitudeAngle), pb.mul(pb.neg(this.cosAltitude), pb.cos(this.azimuthAngle)));
358
+ this.$l.sunDir = pb.vec3(0, pb.sin(this.sunAltitude), pb.neg(pb.cos(this.sunAltitude)));
359
359
  */ this.$l.rayDir = pb.vec3(pb.mul(pb.cos(this.zenithAngle), pb.sin(this.horizonAngle)), pb.sin(this.zenithAngle), pb.mul(pb.neg(pb.cos(this.zenithAngle)), pb.cos(this.horizonAngle)));
360
360
  this.$l.atmoDist = this.rayIntersectSphere(this.viewPos, this.rayDir, ScatteringLut._atmosphereRadiusMM);
361
361
  this.$l.groundDist = this.rayIntersectSphere(this.viewPos, this.rayDir, ScatteringLut._groundRadiusMM);
@@ -18,9 +18,9 @@ const fogTypeMap = {
18
18
  none: ShaderFramework.FOG_TYPE_NONE
19
19
  };
20
20
  const defaultSkyWorldMatrix = Matrix4x4.identity();
21
- /**
22
- * The sky renderer
23
- * @public
21
+ /**
22
+ * The sky renderer
23
+ * @public
24
24
  */ class SkyRenderer {
25
25
  static _defaultSunDir = Vector3.one().inplaceNormalize();
26
26
  _skyType;
@@ -55,8 +55,8 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
55
55
  _renderStatesFog;
56
56
  _renderStatesFogScatter;
57
57
  _lastSunDir;
58
- /**
59
- * Creates an instance of SkyRenderer
58
+ /**
59
+ * Creates an instance of SkyRenderer
60
60
  */ constructor(){
61
61
  this._skyType = 'scatter';
62
62
  this._updateRadianceMaps = true;
@@ -103,12 +103,12 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
103
103
  this.invalidateIBLMaps();
104
104
  }
105
105
  }
106
- /**
107
- * Wether the IBL maps should be updated automatically.
108
- *
109
- * @remarks
110
- * If use use the sky for image-based lighting, the value shoud be set to true. default is false
111
- *
106
+ /**
107
+ * Wether the IBL maps should be updated automatically.
108
+ *
109
+ * @remarks
110
+ * If use use the sky for image-based lighting, the value shoud be set to true. default is false
111
+ *
112
112
  */ get autoUpdateIBLMaps() {
113
113
  return this._updateRadianceMaps;
114
114
  }
@@ -120,8 +120,8 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
120
120
  }
121
121
  }
122
122
  }
123
- /**
124
- * The solid sky color
123
+ /**
124
+ * The solid sky color
125
125
  */ get skyColor() {
126
126
  return this._skyColor;
127
127
  }
@@ -131,12 +131,12 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
131
131
  this.invalidateIBLMaps();
132
132
  }
133
133
  }
134
- /**
135
- * Light density of the sky.
136
- *
137
- * @remarks
138
- * This value controls how much cloud should be rendered when the sky type is scatter.
139
- * Typically, the value should be in the range of 0 to 1.
134
+ /**
135
+ * Light density of the sky.
136
+ *
137
+ * @remarks
138
+ * This value controls how much cloud should be rendered when the sky type is scatter.
139
+ * Typically, the value should be in the range of 0 to 1.
140
140
  */ get cloudy() {
141
141
  return this._cloudy;
142
142
  }
@@ -146,8 +146,8 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
146
146
  this.invalidateIBLMaps();
147
147
  }
148
148
  }
149
- /**
150
- * Intensity of the sky color
149
+ /**
150
+ * Intensity of the sky color
151
151
  */ get cloudIntensity() {
152
152
  return this._cloudIntensity;
153
153
  }
@@ -157,19 +157,19 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
157
157
  this.invalidateIBLMaps();
158
158
  }
159
159
  }
160
- /**
161
- * Wind velocity
162
- *
163
- * @remarks
164
- * This value affects the movement of the cloud
160
+ /**
161
+ * Wind velocity
162
+ *
163
+ * @remarks
164
+ * This value affects the movement of the cloud
165
165
  */ get wind() {
166
166
  return this._wind;
167
167
  }
168
168
  set wind(val) {
169
169
  this._wind.set(val);
170
170
  }
171
- /**
172
- * Radiance map of the sky.
171
+ /**
172
+ * Radiance map of the sky.
173
173
  */ get radianceMap() {
174
174
  if (!this._radianceMap) {
175
175
  this._radianceMap = Application.instance.device.createCubeTexture('rgba16f', this._radianceMapWidth);
@@ -177,8 +177,8 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
177
177
  }
178
178
  return this._radianceMap;
179
179
  }
180
- /**
181
- * Irradiance map of the sky.
180
+ /**
181
+ * Irradiance map of the sky.
182
182
  */ get irradianceMap() {
183
183
  if (!this._irradianceMap) {
184
184
  this._irradianceMap = Application.instance.device.createCubeTexture('rgba16f', this._irradianceMapWidth, {
@@ -190,8 +190,8 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
190
190
  }
191
191
  return this._irradianceMap;
192
192
  }
193
- /**
194
- * Cube texture for skybox.
193
+ /**
194
+ * Cube texture for skybox.
195
195
  */ get skyboxTexture() {
196
196
  return this._skyboxTexture;
197
197
  }
@@ -258,8 +258,8 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
258
258
  set fogParams(val) {
259
259
  this._fogParams.set(val);
260
260
  }
261
- /**
262
- * Force the radiance map and irradiance map to be regenerated.
261
+ /**
262
+ * Force the radiance map and irradiance map to be regenerated.
263
263
  */ invalidateIBLMaps() {
264
264
  this._radianceMapDirty = true;
265
265
  }
@@ -276,10 +276,10 @@ const defaultSkyWorldMatrix = Matrix4x4.identity();
276
276
  return null;
277
277
  }
278
278
  }
279
- /**
280
- * Regenerate the radiance map and irradiance map
281
- *
282
- * @param sunLight - The sun light
279
+ /**
280
+ * Regenerate the radiance map and irradiance map
281
+ *
282
+ * @param sunLight - The sun light
283
283
  */ updateIBLMaps(sunDir) {
284
284
  const device = Application.instance.device;
285
285
  let bakedSkyboxTexture = null;
@@ -1,9 +1,9 @@
1
1
  import { Application } from '../app.js';
2
2
 
3
- /**
4
- * Temporal framebuffer cache
5
- *
6
- * @internal
3
+ /**
4
+ * Temporal framebuffer cache
5
+ *
6
+ * @internal
7
7
  */ class TemporalCache {
8
8
  static _ownDepthTextures = new Set();
9
9
  static _variantWidth = 0;
@@ -199,11 +199,11 @@ const RENDER_TWO_PASS = 2;
199
199
  paramsChanged() {
200
200
  this._paramsChanged = true;
201
201
  }
202
- /*
203
- private resolutionChanged() {
204
- this._resolutionChanged = true;
205
- this._paramsChanged = true;
206
- }
202
+ /*
203
+ private resolutionChanged() {
204
+ this._resolutionChanged = true;
205
+ this._paramsChanged = true;
206
+ }
207
207
  */ get alignment() {
208
208
  return this._params.alignment;
209
209
  }
@@ -1,23 +1,23 @@
1
1
  import { SceneNode } from './scene_node.js';
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- /**
5
- * Graph scene node
6
- *
7
- * @remarks
8
- * Graph node is the base class of any kind of scene node that will be placed into the octree
9
- *
10
- * @public
4
+ /**
5
+ * Graph scene node
6
+ *
7
+ * @remarks
8
+ * Graph node is the base class of any kind of scene node that will be placed into the octree
9
+ *
10
+ * @public
11
11
  */ class GraphNode extends SceneNode {
12
- /**
13
- * Creates a graph node
14
- * @param scene - The scene to which the node belongs
12
+ /**
13
+ * Creates a graph node
14
+ * @param scene - The scene to which the node belongs
15
15
  */ constructor(scene){
16
16
  super(scene);
17
17
  this._renderOrder = 0;
18
18
  }
19
- /**
20
- * Render order of the node
19
+ /**
20
+ * Render order of the node
21
21
  */ get renderOrder() {
22
22
  return this._renderOrder;
23
23
  }
@@ -27,29 +27,29 @@ import { SceneNode } from './scene_node.js';
27
27
  /** Gets the name */ getName() {
28
28
  return this._name;
29
29
  }
30
- /**
31
- * {@inheritDoc SceneNode.isGraphNode}
32
- * @override
30
+ /**
31
+ * {@inheritDoc SceneNode.isGraphNode}
32
+ * @override
33
33
  */ isGraphNode() {
34
34
  return true;
35
35
  }
36
- /**
37
- * {@inheritDoc Drawable.getXForm}
36
+ /**
37
+ * {@inheritDoc Drawable.getXForm}
38
38
  */ getXForm() {
39
39
  return this;
40
40
  }
41
- /**
42
- * {@inheritDoc Drawable.getBoneMatrices}
41
+ /**
42
+ * {@inheritDoc Drawable.getBoneMatrices}
43
43
  */ getBoneMatrices() {
44
44
  return null;
45
45
  }
46
- /**
47
- * {@inheritDoc Drawable.getInvBindMatrix}
46
+ /**
47
+ * {@inheritDoc Drawable.getInvBindMatrix}
48
48
  */ getInvBindMatrix() {
49
49
  return null;
50
50
  }
51
- /**
52
- * {@inheritDoc Drawable.getSortDistance}
51
+ /**
52
+ * {@inheritDoc Drawable.getSortDistance}
53
53
  */ getSortDistance(camera) {
54
54
  const cameraWorldMatrix = camera.worldMatrix;
55
55
  const objectWorldMatrix = this.worldMatrix;
@@ -58,8 +58,8 @@ import { SceneNode } from './scene_node.js';
58
58
  const dz = cameraWorldMatrix.m23 - objectWorldMatrix.m23;
59
59
  return dx * dx + dy * dy * dz * dz;
60
60
  }
61
- /**
62
- * {@inheritDoc Drawable.isBatchable}
61
+ /**
62
+ * {@inheritDoc Drawable.isBatchable}
63
63
  */ isBatchable() {
64
64
  return false;
65
65
  }