@awayjs/scene 0.13.313 → 0.13.315

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.
@@ -205,17 +205,14 @@ import { SkyboxElements, _Stage_SkyboxElements } from '../elements/SkyboxElement
205
205
  * using material methods to define their appearance.
206
206
  */
207
207
  export class _Render_SkyboxMaterial extends _Render_MaterialPassBase {
208
- public _skybox: Skybox;
209
208
  public _texture: _Shader_TextureBase;
210
209
 
211
210
  public init(skybox: Skybox, renderElements: _Render_ElementsBase): void {
212
211
  super.init(skybox, renderElements);
213
212
 
214
- this._skybox = skybox;
215
-
216
213
  this._shader = new ShaderBase(renderElements, this, this, this._stage);
217
214
 
218
- this._texture = this._skybox.texture.getAbstraction<_Shader_TextureBase>(this._shader);
215
+ this._texture = this._shader.abstractions.getAbstraction<_Shader_TextureBase>((<Skybox> this.material).texture);
219
216
 
220
217
  this._pAddPass(this);
221
218
  }
@@ -225,8 +222,6 @@ export class _Render_SkyboxMaterial extends _Render_MaterialPassBase {
225
222
 
226
223
  this._texture.onClear();
227
224
  this._texture = null;
228
-
229
- this._skybox = null;
230
225
  }
231
226
 
232
227
  /**
@@ -235,10 +230,12 @@ export class _Render_SkyboxMaterial extends _Render_MaterialPassBase {
235
230
  public _pUpdateRender(): void {
236
231
  super._pUpdateRender();
237
232
 
238
- this.requiresBlending = ((<IMaterial> this._asset).blendMode != BlendMode.NORMAL);
233
+ const material: IMaterial = this.material;
234
+
235
+ this.requiresBlending = (material.blendMode != BlendMode.NORMAL);
239
236
 
240
- this.shader.setBlendMode(((<IMaterial> this._asset).blendMode == BlendMode.NORMAL && this.requiresBlending) ?
241
- BlendMode.LAYER : (<IMaterial> this._asset).blendMode);
237
+ this.shader.setBlendMode((material.blendMode == BlendMode.NORMAL && this.requiresBlending) ?
238
+ BlendMode.LAYER : material.blendMode);
242
239
  }
243
240
 
244
241
  public _includeDependencies(shader: ShaderBase): void {
@@ -303,16 +300,17 @@ export class _Render_Skybox extends _Render_RenderableBase {
303
300
  -1,-1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1));
304
301
  }
305
302
 
306
- return elements.getAbstraction<_Stage_SkyboxElements>(this._stage);
303
+ return this._stage.abstractions.getAbstraction<_Stage_SkyboxElements>(elements);
307
304
  }
308
305
 
309
306
  protected _getRenderMaterial(): _Render_SkyboxMaterial {
310
- return this._asset.getAbstraction<_Render_SkyboxMaterial>(
311
- this.entity.renderer.getRenderElements(this.stageElements.elements));
307
+ return this.entity.renderer
308
+ .getRenderElements(this.stageElements.elements).abstractions
309
+ .getAbstraction<_Render_SkyboxMaterial>(this.renderable);
312
310
  }
313
311
 
314
312
  protected _getStyle(): Style {
315
- return (<Skybox> this._asset).style;
313
+ return this.renderable.style;
316
314
  }
317
315
  }
318
316
 
@@ -126,14 +126,14 @@ export class _Stage_SkyboxElements extends _Stage_TriangleElements {
126
126
 
127
127
  shader.viewMatrix.copyFrom(this._skyboxProjection, true);
128
128
 
129
- const context: IContextGL = this._stage.context;
129
+ const context: IContextGL = (<Stage> this._pool).context;
130
130
  context.setProgramConstantsFromArray(ContextGLProgramType.VERTEX, shader.vertexConstantData);
131
131
  context.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT, shader.fragmentConstantData);
132
132
 
133
133
  if (this._indices)
134
134
  this.getIndexBufferGL().draw(ContextGLDrawMode.TRIANGLES, 0, this.numIndices);
135
135
  else
136
- this._stage.context.drawVertices(ContextGLDrawMode.TRIANGLES, offset, count || this.numVertices);
136
+ (<Stage> this._pool).context.drawVertices(ContextGLDrawMode.TRIANGLES, offset, count || this.numVertices);
137
137
  }
138
138
  }
139
139
 
@@ -258,7 +258,6 @@ export class SceneImage2D extends BitmapImage2D {
258
258
  public dispose(): void {
259
259
  this._clearFromDispose = true;
260
260
 
261
- this.dropAllReferences();
262
261
  this.unmarkToUnload();
263
262
  this.unuseWeakRef();
264
263
 
@@ -285,8 +284,8 @@ export class SceneImage2D extends BitmapImage2D {
285
284
  super.unload();
286
285
  }
287
286
 
288
- protected deepClone(from: BitmapImage2D) {
289
- this.copyPixels(from, this._rect, new Point(0,0));
287
+ public copyTo(target: SceneImage2D): void {
288
+ target.copyPixels(this, target.rect, new Point(0,0));
290
289
  }
291
290
 
292
291
  /**
@@ -333,7 +332,6 @@ export class SceneImage2D extends BitmapImage2D {
333
332
  alphaBitmapData?: BitmapImage2D, alphaPoint?: Point, mergeAlpha?: boolean): void {
334
333
 
335
334
  this._lastUsedFill = null;
336
- this.dropAllReferences();
337
335
  this.unmarkToUnload();
338
336
 
339
337
  // need drop alpha from source when target is not has alpha
@@ -431,7 +429,6 @@ export class SceneImage2D extends BitmapImage2D {
431
429
  ): void {
432
430
 
433
431
  this._lastUsedFill = null;
434
- this.dropAllReferences();
435
432
  this.unmarkToUnload();
436
433
 
437
434
  if (this._initalFillColor !== null)
@@ -446,8 +443,6 @@ export class SceneImage2D extends BitmapImage2D {
446
443
  return false;
447
444
  }
448
445
 
449
- this.dropAllReferences(false);
450
-
451
446
  const result = this._stage.filterManager.applyFilter (
452
447
  source,
453
448
  this,
@@ -460,7 +455,6 @@ export class SceneImage2D extends BitmapImage2D {
460
455
  }
461
456
 
462
457
  public colorTransform(rect: Rectangle, colorTransform: ColorTransform): void {
463
- this.dropAllReferences();
464
458
  this.unmarkToUnload();
465
459
 
466
460
  this._lastUsedFill = null;
@@ -622,7 +616,6 @@ export class SceneImage2D extends BitmapImage2D {
622
616
  {
623
617
  /* eslint-enable */
624
618
 
625
- this.dropAllReferences();
626
619
  this.unmarkToUnload();
627
620
 
628
621
  if (source instanceof DisplayObject) {
@@ -845,14 +838,7 @@ export class SceneImage2D extends BitmapImage2D {
845
838
  renderer.view.width = this.width;
846
839
  renderer.view.height = this.height;
847
840
 
848
- let sourceNode: ContainerNode = rootNode.getChildAt(0);
849
-
850
- if (sourceNode?.container != source) {
851
- if (sourceNode)
852
- rootNode.removeChildAt(0);
853
- sourceNode = rootNode.addChildAt(source, 0);
854
- }
855
-
841
+ const sourceNode: ContainerNode = rootNode.addChildAt(source, 0);
856
842
  const transformDisabled = sourceNode.transformDisabled;
857
843
 
858
844
  sourceNode.transformDisabled = true;
@@ -876,6 +862,8 @@ export class SceneImage2D extends BitmapImage2D {
876
862
  renderer.antiAlias = 0;
877
863
  renderer.disableClear = true;
878
864
 
865
+ rootNode.removeChildAt(0);
866
+
879
867
  sourceNode.transformDisabled = transformDisabled;
880
868
 
881
869
  if (useTemp) {
@@ -906,7 +894,8 @@ export class SceneImage2D extends BitmapImage2D {
906
894
  false
907
895
  );
908
896
 
909
- image.deepClone(this);
897
+ this.copyTo(image);
898
+
910
899
  return image;
911
900
  }
912
901
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awayjs/scene",
3
- "version": "0.13.313",
3
+ "version": "0.13.315",
4
4
  "description": "AwayJS scene classes",
5
5
  "main": "bundle/awayjs-scene.umd.js",
6
6
  "module": "dist/index.js",