@awayjs/scene 0.13.308 → 0.13.310
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/bundle/awayjs-scene.umd.js +2 -2
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/display/Billboard.d.ts +5 -19
- package/dist/lib/display/Billboard.d.ts.map +1 -1
- package/dist/lib/display/Billboard.js +14 -32
- package/dist/lib/display/DisplayObject.d.ts +3 -1
- package/dist/lib/display/DisplayObject.d.ts.map +1 -1
- package/dist/lib/display/DisplayObject.js +12 -8
- package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
- package/dist/lib/display/DisplayObjectContainer.js +2 -4
- package/dist/lib/display/LineSegment.d.ts +2 -20
- package/dist/lib/display/LineSegment.d.ts.map +1 -1
- package/dist/lib/display/LineSegment.js +12 -41
- package/dist/lib/display/MorphSprite.js +1 -1
- package/dist/lib/display/Skybox.d.ts +1 -12
- package/dist/lib/display/Skybox.d.ts.map +1 -1
- package/dist/lib/display/Skybox.js +6 -28
- package/dist/lib/events/FocusEvent.d.ts +3 -3
- package/dist/lib/events/FocusEvent.d.ts.map +1 -1
- package/dist/lib/events/MouseEvent.js +1 -1
- package/dist/lib/events/PointerEvent.d.ts +3 -3
- package/dist/lib/events/PointerEvent.d.ts.map +1 -1
- package/dist/lib/events/TouchEvent.js +1 -1
- package/dist/lib/managers/MouseManager.js +2 -2
- package/index.ts +1 -1
- package/lib/display/Billboard.ts +17 -44
- package/lib/display/DisplayObject.ts +14 -9
- package/lib/display/DisplayObjectContainer.ts +2 -4
- package/lib/display/LineSegment.ts +12 -55
- package/lib/display/MorphSprite.ts +1 -1
- package/lib/display/Skybox.ts +6 -30
- package/lib/events/FocusEvent.ts +3 -3
- package/lib/events/MouseEvent.ts +1 -1
- package/lib/events/PointerEvent.ts +3 -3
- package/lib/events/TouchEvent.ts +1 -1
- package/lib/managers/MouseManager.ts +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusEvent.d.ts","sourceRoot":"","sources":["../../../lib/events/FocusEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"FocusEvent.d.ts","sourceRoot":"","sources":["../../../lib/events/FocusEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D;;GAEG;AACH,qBAAa,UAAW,SAAQ,SAAS;IAExC;;OAEG;IACH,OAAc,QAAQ,EAAE,MAAM,CAAe;IAC7C;;OAEG;IACH,OAAc,SAAS,EAAE,MAAM,CAAgB;IAE/C;;OAEG;IACI,IAAI,EAAE,IAAI,CAAC;IAElB;;OAEG;IACI,MAAM,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACI,cAAc,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACI,QAAQ,EAAE,SAAS,CAAC;IAEpB,cAAc,EAAE,KAAK,CAAC;IAE7B;;;OAGG;gBACS,IAAI,EAAE,MAAM;IAIxB;;OAEG;IACI,KAAK,IAAI,UAAU;IAcnB,cAAc,CAAC,UAAU,EAAE,KAAK;CAIvC"}
|
|
@@ -33,7 +33,7 @@ var MouseEvent = /** @class */ (function (_super) {
|
|
|
33
33
|
result.view = this.view;
|
|
34
34
|
result.containerNode = this.containerNode;
|
|
35
35
|
result.rootNode = this.rootNode;
|
|
36
|
-
result.
|
|
36
|
+
result.pickable = this.pickable;
|
|
37
37
|
result.material = this.material;
|
|
38
38
|
result.uv = this.uv;
|
|
39
39
|
result.position = this.position;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point, Vector3D, EventBase } from '@awayjs/core';
|
|
2
|
-
import { ContainerNode, INode,
|
|
2
|
+
import { ContainerNode, INode, View, IContainer, IPickable } from '@awayjs/view';
|
|
3
3
|
import { IMaterial } from '@awayjs/renderer';
|
|
4
4
|
/**
|
|
5
5
|
* A MouseEvent is dispatched when a mouse event occurs over a mouseEnabled object in View.
|
|
@@ -29,9 +29,9 @@ export declare class PointerEvent extends EventBase {
|
|
|
29
29
|
*/
|
|
30
30
|
rootNode: INode;
|
|
31
31
|
/**
|
|
32
|
-
* The
|
|
32
|
+
* The pickable owner inside which the event took place.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
pickable: IPickable;
|
|
35
35
|
/**
|
|
36
36
|
* The material of the 3d element inside which the event took place.
|
|
37
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointerEvent.d.ts","sourceRoot":"","sources":["../../../lib/events/PointerEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PointerEvent.d.ts","sourceRoot":"","sources":["../../../lib/events/PointerEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,SAAS;IAEnC,aAAa,EAAE,YAAY,CAAC;IAC5B,cAAc,EAAE,KAAK,CAAC;IAE7B;;OAEG;IACI,OAAO,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACI,OAAO,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACI,IAAI,EAAE,IAAI,CAAC;IAElB;;OAEG;IACI,aAAa,EAAE,aAAa,CAAC;IAEpC;;OAEG;IACI,QAAQ,EAAE,KAAK,CAAC;IAEvB;;OAEG;IACI,QAAQ,EAAE,SAAS,CAAC;IAE3B;;OAEG;IACI,QAAQ,EAAE,SAAS,CAAC;IAE3B;;OAEG;IACI,EAAE,EAAE,KAAK,CAAC;IAEjB;;OAEG;IACI,YAAY,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACI,QAAQ,EAAE,QAAQ,CAAC;IAE1B;;OAEG;IACI,MAAM,EAAE,QAAQ,CAAC;IAExB;;OAEG;IACI,OAAO,EAAE,OAAO,CAAC;IAExB;;OAEG;IACI,MAAM,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACI,QAAQ,EAAE,OAAO,CAAC;IAEzB;;;OAGG;gBACS,IAAI,EAAE,MAAM;IAIxB;;OAEG;IACH,IAAW,OAAO,IAAI,OAAO,CAO5B;IAED;;OAEG;IACI,eAAe,IAAI,IAAI;IAO9B;;OAEG;IACI,wBAAwB,IAAI,IAAI;IAQvC;;OAEG;IACH,IAAW,aAAa,IAAI,QAAQ,CAEnC;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,QAAQ,CAKjC;IAEM,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU;CAE3D"}
|
|
@@ -33,7 +33,7 @@ var TouchEvent = /** @class */ (function (_super) {
|
|
|
33
33
|
result.view = this.view;
|
|
34
34
|
result.containerNode = this.containerNode;
|
|
35
35
|
result.rootNode = this.rootNode;
|
|
36
|
-
result.
|
|
36
|
+
result.pickable = this.pickable;
|
|
37
37
|
result.material = this.material;
|
|
38
38
|
result.uv = this.uv;
|
|
39
39
|
result.position = this.position;
|
|
@@ -568,7 +568,7 @@ var MouseManager = /** @class */ (function () {
|
|
|
568
568
|
event.containerNode = collision.containerNode;
|
|
569
569
|
event.rootNode = collision.rootNode;
|
|
570
570
|
// Object.
|
|
571
|
-
event.
|
|
571
|
+
event.pickable = collision.pickable;
|
|
572
572
|
// UV.
|
|
573
573
|
event.uv = collision.uv;
|
|
574
574
|
// Position.
|
|
@@ -582,7 +582,7 @@ var MouseManager = /** @class */ (function () {
|
|
|
582
582
|
// Set all to null.
|
|
583
583
|
event.containerNode = null;
|
|
584
584
|
event.rootNode = null;
|
|
585
|
-
event.
|
|
585
|
+
event.pickable = null;
|
|
586
586
|
event.uv = null;
|
|
587
587
|
event.position = this._nullVector;
|
|
588
588
|
event.normal = this._nullVector;
|
package/index.ts
CHANGED
package/lib/display/Billboard.ts
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
PickEntity,
|
|
4
4
|
_Pick_PickableBase,
|
|
5
5
|
IEntity,
|
|
6
|
+
IPickable,
|
|
6
7
|
} from '@awayjs/view';
|
|
7
8
|
import {
|
|
8
|
-
RenderableEvent,
|
|
9
9
|
MaterialEvent,
|
|
10
10
|
IMaterial,
|
|
11
11
|
StyleEvent,
|
|
@@ -60,11 +60,13 @@ import { DisplayObjectContainer } from './DisplayObjectContainer';
|
|
|
60
60
|
* (in away3d Sprite3D extends on ObjectContainer3D)
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
|
-
export class Billboard extends DisplayObjectContainer {
|
|
63
|
+
export class Billboard extends DisplayObjectContainer implements IPickable {
|
|
64
64
|
private static _billboards: Array<Billboard> = new Array<Billboard>();
|
|
65
65
|
|
|
66
66
|
public static assetType: string = '[asset Billboard]';
|
|
67
67
|
|
|
68
|
+
public _pickObjects: Record<number, _Pick_PickableBase> = {};
|
|
69
|
+
|
|
68
70
|
private _width: number;
|
|
69
71
|
private _height: number;
|
|
70
72
|
private _billboardWidth: number;
|
|
@@ -190,6 +192,13 @@ export class Billboard extends DisplayObjectContainer {
|
|
|
190
192
|
this._sampler.smooth = smoothing;
|
|
191
193
|
}
|
|
192
194
|
|
|
195
|
+
public invalidateElements(): void {
|
|
196
|
+
for (const key in this._pickObjects)
|
|
197
|
+
this._pickObjects[key]._onInvalidateElements();
|
|
198
|
+
|
|
199
|
+
super.invalidateElements();
|
|
200
|
+
}
|
|
201
|
+
|
|
193
202
|
public advanceFrame(): void {
|
|
194
203
|
//override for billboard
|
|
195
204
|
}
|
|
@@ -423,42 +432,6 @@ export class _Render_Billboard extends _Render_RenderableBase {
|
|
|
423
432
|
* @class away.pool._Render_Shape
|
|
424
433
|
*/
|
|
425
434
|
export class _Pick_Billboard extends _Pick_PickableBase {
|
|
426
|
-
private _billboardBox: Box;
|
|
427
|
-
private _billboardBoxDirty: boolean = true;
|
|
428
|
-
private _onInvalidateElementsDelegate: (event: RenderableEvent) => void;
|
|
429
|
-
|
|
430
|
-
constructor() {
|
|
431
|
-
super();
|
|
432
|
-
|
|
433
|
-
this._onInvalidateElementsDelegate = (event: RenderableEvent) => this._onInvalidateElements(event);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* //TODO
|
|
438
|
-
*
|
|
439
|
-
* @param renderEntity
|
|
440
|
-
* @param shape
|
|
441
|
-
* @param level
|
|
442
|
-
* @param indexOffset
|
|
443
|
-
*/
|
|
444
|
-
public init(billboard: Billboard, pickEntity: PickEntity): void {
|
|
445
|
-
super.init(billboard, pickEntity);
|
|
446
|
-
|
|
447
|
-
this._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS, this._onInvalidateElementsDelegate);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
public _onInvalidateElements(event: RenderableEvent): void {
|
|
451
|
-
this._billboardBoxDirty = true;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
public onClear(event: AssetEvent): void {
|
|
455
|
-
this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS, this._onInvalidateElementsDelegate);
|
|
456
|
-
|
|
457
|
-
super.onClear(event);
|
|
458
|
-
|
|
459
|
-
this._billboardBox = null;
|
|
460
|
-
this._billboardBoxDirty = true;
|
|
461
|
-
}
|
|
462
435
|
|
|
463
436
|
public hitTestPoint(x: number, y: number, z: number): boolean {
|
|
464
437
|
return true;
|
|
@@ -467,19 +440,19 @@ export class _Pick_Billboard extends _Pick_PickableBase {
|
|
|
467
440
|
public getBoxBounds(
|
|
468
441
|
matrix3D: Matrix3D = null, strokeFlag: boolean = true, cache: Box = null, target: Box = null): Box {
|
|
469
442
|
|
|
470
|
-
if (this.
|
|
471
|
-
this.
|
|
443
|
+
if (this._orientedBoxBoundsDirty) {
|
|
444
|
+
this._orientedBoxBoundsDirty = false;
|
|
472
445
|
|
|
473
446
|
const billboardRect: Rectangle = (<Billboard> this._asset).billboardRect;
|
|
474
|
-
this.
|
|
447
|
+
this._orientedBoxBounds = new Box(
|
|
475
448
|
billboardRect.x, billboardRect.y, 0,
|
|
476
449
|
billboardRect.width, billboardRect.height, 0);
|
|
477
450
|
}
|
|
478
451
|
|
|
479
452
|
return (
|
|
480
453
|
matrix3D
|
|
481
|
-
? matrix3D.transformBox(this.
|
|
482
|
-
: this.
|
|
454
|
+
? matrix3D.transformBox(this._orientedBoxBounds)
|
|
455
|
+
: this._orientedBoxBounds).union(target, target || cache);
|
|
483
456
|
}
|
|
484
457
|
|
|
485
458
|
public getSphereBounds(
|
|
@@ -496,7 +469,7 @@ export class _Pick_Billboard extends _Pick_PickableBase {
|
|
|
496
469
|
collision.rayPosition.x + rayEntryDistance * collision.rayDirection.x,
|
|
497
470
|
collision.rayPosition.y + rayEntryDistance * collision.rayDirection.y);
|
|
498
471
|
|
|
499
|
-
collision.
|
|
472
|
+
collision.pickable = <IPickable> this._asset;
|
|
500
473
|
collision.rayEntryDistance = rayEntryDistance;
|
|
501
474
|
collision.position = position;
|
|
502
475
|
collision.normal = new Vector3D(0,0,1);
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
Vector3D,
|
|
8
8
|
AssetBase,
|
|
9
9
|
Loader,
|
|
10
|
-
IAbstraction,
|
|
11
10
|
} from '@awayjs/core';
|
|
12
11
|
|
|
13
12
|
import { BlendMode } from '@awayjs/stage';
|
|
@@ -23,15 +22,16 @@ import {
|
|
|
23
22
|
OrientationMode,
|
|
24
23
|
IContainer,
|
|
25
24
|
ContainerNode,
|
|
26
|
-
View
|
|
27
25
|
} from '@awayjs/view';
|
|
28
26
|
|
|
29
27
|
import {
|
|
30
28
|
IMaterial,
|
|
31
29
|
Style,
|
|
32
30
|
StyleEvent,
|
|
33
|
-
RenderableEvent,
|
|
34
31
|
ElementsType,
|
|
32
|
+
RenderEntity,
|
|
33
|
+
_Render_RenderableBase,
|
|
34
|
+
CacheRenderer,
|
|
35
35
|
} from '@awayjs/renderer';
|
|
36
36
|
|
|
37
37
|
import { DisplayObjectContainer } from './DisplayObjectContainer';
|
|
@@ -176,6 +176,9 @@ import { Settings } from '../Settings';
|
|
|
176
176
|
*/
|
|
177
177
|
export class DisplayObject extends AssetBase implements IBitmapDrawable, IContainer {
|
|
178
178
|
|
|
179
|
+
public _renderObjects: Record<number, RenderEntity | _Render_RenderableBase | CacheRenderer> = {};
|
|
180
|
+
public _containerNodes: Record<number, ContainerNode> = {};
|
|
181
|
+
|
|
179
182
|
private _mouseChildren: boolean = true;
|
|
180
183
|
public _material: IMaterial;
|
|
181
184
|
public _style: Style;
|
|
@@ -1775,9 +1778,8 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1775
1778
|
}
|
|
1776
1779
|
|
|
1777
1780
|
public _invalidateHierarchicalProperty(propDirty: HierarchicalProperty): void {
|
|
1778
|
-
for (const key in this.
|
|
1779
|
-
|
|
1780
|
-
(<ContainerNode> this._abstractionPool[key]).invalidateHierarchicalProperty(propDirty);
|
|
1781
|
+
for (const key in this._containerNodes)
|
|
1782
|
+
this._containerNodes[key].invalidateHierarchicalProperty(propDirty);
|
|
1781
1783
|
}
|
|
1782
1784
|
|
|
1783
1785
|
/**
|
|
@@ -1859,15 +1861,18 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1859
1861
|
}
|
|
1860
1862
|
|
|
1861
1863
|
public _invalidateMaterial(): void {
|
|
1862
|
-
|
|
1864
|
+
for (const key in this._renderObjects)
|
|
1865
|
+
this._renderObjects[key]._onInvalidateMaterial();
|
|
1863
1866
|
}
|
|
1864
1867
|
|
|
1865
1868
|
private _invalidateStyle(): void {
|
|
1866
|
-
|
|
1869
|
+
for (const key in this._renderObjects)
|
|
1870
|
+
this._renderObjects[key]._onInvalidateStyle();
|
|
1867
1871
|
}
|
|
1868
1872
|
|
|
1869
1873
|
public invalidateElements(): void {
|
|
1870
|
-
|
|
1874
|
+
for (const key in this._renderObjects)
|
|
1875
|
+
this._renderObjects[key]._onInvalidateElements();
|
|
1871
1876
|
}
|
|
1872
1877
|
|
|
1873
1878
|
protected _onInvalidateProperties(_event: StyleEvent = null): void {
|
|
@@ -172,8 +172,7 @@ export class DisplayObjectContainer extends DisplayObject implements IRenderCont
|
|
|
172
172
|
child._setParent(this);
|
|
173
173
|
|
|
174
174
|
for (const key in this._abstractionPool)
|
|
175
|
-
|
|
176
|
-
(<ContainerNode> this._abstractionPool[key]).addChildAt(child, index);
|
|
175
|
+
this._containerNodes[key].addChildAt(child, index);
|
|
177
176
|
|
|
178
177
|
return child;
|
|
179
178
|
}
|
|
@@ -534,8 +533,7 @@ export class DisplayObjectContainer extends DisplayObject implements IRenderCont
|
|
|
534
533
|
child._setParent(null);
|
|
535
534
|
|
|
536
535
|
for (const key in this._abstractionPool)
|
|
537
|
-
|
|
538
|
-
(<ContainerNode> this._abstractionPool[key]).removeChildAt(index);
|
|
536
|
+
this._containerNodes[key].removeChildAt(index);
|
|
539
537
|
|
|
540
538
|
return child;
|
|
541
539
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { PickingCollision, _Pick_PickableBase,
|
|
4
4
|
PickEntity, IEntityTraverser, IEntity } from '@awayjs/view';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { IMaterial } from '@awayjs/renderer';
|
|
7
7
|
|
|
8
8
|
import { DisplayObject } from './DisplayObject';
|
|
9
9
|
|
|
@@ -98,8 +98,6 @@ export class LineSegment extends DisplayObject {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
import { AssetEvent } from '@awayjs/core';
|
|
102
|
-
|
|
103
101
|
import { LineElements } from '@awayjs/renderer';
|
|
104
102
|
|
|
105
103
|
import { _Stage_ElementsBase, _Render_MaterialBase, _Render_RenderableBase,
|
|
@@ -156,47 +154,6 @@ export class _Render_LineSegment extends _Render_RenderableBase {
|
|
|
156
154
|
* @class away.pool._Render_Shape
|
|
157
155
|
*/
|
|
158
156
|
export class _Pick_LineSegment extends _Pick_PickableBase {
|
|
159
|
-
private _lineSegmentBox: Box;
|
|
160
|
-
private _lineSegmentBoxDirty: boolean = true;
|
|
161
|
-
private _lineSegmentSphere: Sphere;
|
|
162
|
-
private _lineSegmentSphereDirty: boolean = true;
|
|
163
|
-
private _onInvalidateElementsDelegate: (event: RenderableEvent) => void;
|
|
164
|
-
|
|
165
|
-
constructor() {
|
|
166
|
-
super();
|
|
167
|
-
|
|
168
|
-
this._onInvalidateElementsDelegate = (event: RenderableEvent) => this._onInvalidateElements(event);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* //TODO
|
|
173
|
-
*
|
|
174
|
-
* @param renderEntity
|
|
175
|
-
* @param shape
|
|
176
|
-
* @param level
|
|
177
|
-
* @param indexOffset
|
|
178
|
-
*/
|
|
179
|
-
public init(lineSegment: LineSegment, pickEntity: PickEntity): void {
|
|
180
|
-
super.init(lineSegment, pickEntity);
|
|
181
|
-
|
|
182
|
-
this._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS, this._onInvalidateElementsDelegate);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
public _onInvalidateElements(event: RenderableEvent): void {
|
|
186
|
-
this._lineSegmentBoxDirty = true;
|
|
187
|
-
this._lineSegmentSphereDirty = true;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
public onClear(event: AssetEvent): void {
|
|
191
|
-
this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS, this._onInvalidateElementsDelegate);
|
|
192
|
-
|
|
193
|
-
super.onClear(event);
|
|
194
|
-
|
|
195
|
-
this._lineSegmentBox = null;
|
|
196
|
-
this._lineSegmentBoxDirty = true;
|
|
197
|
-
this._lineSegmentSphere = null;
|
|
198
|
-
this._lineSegmentSphereDirty = true;
|
|
199
|
-
}
|
|
200
157
|
|
|
201
158
|
public hitTestPoint(x: number, y: number, z: number): boolean {
|
|
202
159
|
return true;
|
|
@@ -204,13 +161,13 @@ export class _Pick_LineSegment extends _Pick_PickableBase {
|
|
|
204
161
|
|
|
205
162
|
public getBoxBounds(matrix3D: Matrix3D = null, strokeFlag: boolean = true,
|
|
206
163
|
cache: Box = null, target: Box = null): Box {
|
|
207
|
-
if (this.
|
|
208
|
-
this.
|
|
164
|
+
if (this._orientedBoxBoundsDirty) {
|
|
165
|
+
this._orientedBoxBoundsDirty = false;
|
|
209
166
|
|
|
210
167
|
const startPosition: Vector3D = (<LineSegment> this._asset).startPosition;
|
|
211
168
|
const endPosition: Vector3D = (<LineSegment> this._asset).endPosition;
|
|
212
169
|
|
|
213
|
-
this.
|
|
170
|
+
this._orientedBoxBounds = new Box(Math.min(startPosition.x, endPosition.x),
|
|
214
171
|
Math.min(startPosition.y, endPosition.y),
|
|
215
172
|
Math.min(startPosition.z, endPosition.z),
|
|
216
173
|
Math.abs(startPosition.x - endPosition.x),
|
|
@@ -219,14 +176,14 @@ export class _Pick_LineSegment extends _Pick_PickableBase {
|
|
|
219
176
|
}
|
|
220
177
|
|
|
221
178
|
return (matrix3D ?
|
|
222
|
-
matrix3D.transformBox(this.
|
|
223
|
-
this.
|
|
179
|
+
matrix3D.transformBox(this._orientedBoxBounds) :
|
|
180
|
+
this._orientedBoxBounds).union(target, target || cache);
|
|
224
181
|
}
|
|
225
182
|
|
|
226
183
|
public getSphereBounds(center: Vector3D, matrix3D: Matrix3D = null, strokeFlag: boolean = true,
|
|
227
184
|
cache: Sphere = null, target: Sphere = null): Sphere {
|
|
228
|
-
if (this.
|
|
229
|
-
this.
|
|
185
|
+
if (this._orientedSphereBoundsDirty) {
|
|
186
|
+
this._orientedSphereBoundsDirty = false;
|
|
230
187
|
|
|
231
188
|
const startPosition: Vector3D = (<LineSegment> this._asset).startPosition;
|
|
232
189
|
const endPosition: Vector3D = (<LineSegment> this._asset).endPosition;
|
|
@@ -235,19 +192,19 @@ export class _Pick_LineSegment extends _Pick_PickableBase {
|
|
|
235
192
|
const halfHeight: number = (endPosition.y - startPosition.y) / 2;
|
|
236
193
|
const halfDepth: number = (endPosition.z - startPosition.z) / 2;
|
|
237
194
|
|
|
238
|
-
this.
|
|
195
|
+
this._orientedSphereBounds = new Sphere(startPosition.x + halfWidth,
|
|
239
196
|
startPosition.y + halfHeight,
|
|
240
197
|
startPosition.z + halfDepth,
|
|
241
198
|
Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight + halfDepth * halfDepth));
|
|
242
199
|
}
|
|
243
200
|
|
|
244
201
|
return (matrix3D ?
|
|
245
|
-
matrix3D.transformSphere(this.
|
|
246
|
-
this.
|
|
202
|
+
matrix3D.transformSphere(this._orientedSphereBounds) :
|
|
203
|
+
this._orientedSphereBounds).union(target, target || cache);
|
|
247
204
|
}
|
|
248
205
|
|
|
249
206
|
public testCollision(collision: PickingCollision, closestFlag: boolean): boolean {
|
|
250
|
-
collision.
|
|
207
|
+
collision.pickable = null;
|
|
251
208
|
//TODO
|
|
252
209
|
return false;
|
|
253
210
|
}
|
|
@@ -308,7 +308,7 @@ export class MorphSprite extends Sprite {
|
|
|
308
308
|
this._blendStyle(startPath, endPath, newPath, ratio);
|
|
309
309
|
this._blendContours(startPath, endPath, newPath, ratio);
|
|
310
310
|
|
|
311
|
-
destination.add_queued_path(newPath);
|
|
311
|
+
destination.add_queued_path(newPath, true);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
/**
|
package/lib/display/Skybox.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BlendMode, ImageCube } from '@awayjs/stage';
|
|
|
4
4
|
|
|
5
5
|
import { PickingCollision, BoundingVolumeType, INode, IEntity, ContainerNode } from '@awayjs/view';
|
|
6
6
|
|
|
7
|
-
import { IAnimationSet, IMaterial, ITexture,
|
|
7
|
+
import { IAnimationSet, IMaterial, ITexture,
|
|
8
8
|
MaterialEvent, Style, StyleEvent, IRenderContainer, ImageTextureCube, DefaultRenderer } from '@awayjs/renderer';
|
|
9
9
|
|
|
10
10
|
import { DisplayObjectContainer } from './DisplayObjectContainer';
|
|
@@ -22,7 +22,6 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
22
22
|
private _texture: ImageTextureCube;
|
|
23
23
|
private _animationSet: IAnimationSet;
|
|
24
24
|
public _blendMode: string = BlendMode.NORMAL;
|
|
25
|
-
private _owners: Array<IRenderContainer>;
|
|
26
25
|
private _onTextureInvalidateDelegate: (event: AssetEvent) => void;
|
|
27
26
|
|
|
28
27
|
public animateUVs: boolean = false;
|
|
@@ -70,15 +69,6 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
70
69
|
this.invalidate();
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
/**
|
|
74
|
-
* A list of the IRenderables that use this material
|
|
75
|
-
*
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
public get iOwners(): Array<IRenderContainer> {
|
|
79
|
-
return this._owners;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
72
|
/**
|
|
83
73
|
* The cube texture to use as the skybox.
|
|
84
74
|
*/
|
|
@@ -121,8 +111,6 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
121
111
|
|
|
122
112
|
this._onTextureInvalidateDelegate = (event: AssetEvent) => this.onTextureInvalidate(event);
|
|
123
113
|
|
|
124
|
-
this._owners = [this];
|
|
125
|
-
|
|
126
114
|
this.style = new Style();
|
|
127
115
|
if (imageColor instanceof ImageCube) {
|
|
128
116
|
this._style.image = <ImageCube> imageColor;
|
|
@@ -149,18 +137,6 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
149
137
|
this.dispatchEvent(new MaterialEvent(MaterialEvent.INVALIDATE_PASSES, this));
|
|
150
138
|
}
|
|
151
139
|
|
|
152
|
-
public invalidateElements(): void {
|
|
153
|
-
this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_ELEMENTS, this));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public invalidateMaterial(): void {
|
|
157
|
-
this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_MATERIAL, this));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
public invalidateStyle(): void {
|
|
161
|
-
this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_STYLE, this));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
140
|
public addTexture(texture: ITexture): void {
|
|
165
141
|
this._textures.push(texture);
|
|
166
142
|
|
|
@@ -182,7 +158,7 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
182
158
|
}
|
|
183
159
|
|
|
184
160
|
public _onInvalidateProperties(event: StyleEvent): void {
|
|
185
|
-
this.
|
|
161
|
+
this._invalidateMaterial();
|
|
186
162
|
this.invalidatePasses();
|
|
187
163
|
}
|
|
188
164
|
|
|
@@ -209,7 +185,7 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
209
185
|
}
|
|
210
186
|
|
|
211
187
|
public testCollision(collision: PickingCollision, closestFlag: boolean): boolean {
|
|
212
|
-
collision.
|
|
188
|
+
collision.pickable = null;
|
|
213
189
|
|
|
214
190
|
return false;
|
|
215
191
|
}
|
|
@@ -244,10 +220,10 @@ export class _Render_SkyboxMaterial extends _Render_MaterialPassBase {
|
|
|
244
220
|
this._pAddPass(this);
|
|
245
221
|
}
|
|
246
222
|
|
|
247
|
-
public onClear(
|
|
248
|
-
super.onClear(
|
|
223
|
+
public onClear(): void {
|
|
224
|
+
super.onClear();
|
|
249
225
|
|
|
250
|
-
this._texture.onClear(
|
|
226
|
+
this._texture.onClear();
|
|
251
227
|
this._texture = null;
|
|
252
228
|
|
|
253
229
|
this._skybox = null;
|
package/lib/events/FocusEvent.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventBase } from '@awayjs/core';
|
|
2
2
|
|
|
3
|
-
import { IEntity, View,
|
|
3
|
+
import { IEntity, View, INode, IPickable } from '@awayjs/view';
|
|
4
4
|
import FrameScriptManager from '../managers/FrameScriptManager';
|
|
5
5
|
/**
|
|
6
6
|
* A FocusEvent is dispatched when a entity is focused
|
|
@@ -32,9 +32,9 @@ export class FocusEvent extends EventBase {
|
|
|
32
32
|
public invokedByMouse: IEntity;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* The
|
|
35
|
+
* The pickable owner inside which the event took place.
|
|
36
36
|
*/
|
|
37
|
-
public
|
|
37
|
+
public pickable: IPickable;
|
|
38
38
|
|
|
39
39
|
public commonAncestor: INode;
|
|
40
40
|
|
package/lib/events/MouseEvent.ts
CHANGED
|
@@ -118,7 +118,7 @@ export class MouseEvent extends PointerEvent {
|
|
|
118
118
|
result.view = this.view;
|
|
119
119
|
result.containerNode = this.containerNode;
|
|
120
120
|
result.rootNode = this.rootNode;
|
|
121
|
-
result.
|
|
121
|
+
result.pickable = this.pickable;
|
|
122
122
|
result.material = this.material;
|
|
123
123
|
result.uv = this.uv;
|
|
124
124
|
result.position = this.position;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point, Vector3D, EventBase } from '@awayjs/core';
|
|
2
2
|
|
|
3
|
-
import { ContainerNode, INode,
|
|
3
|
+
import { ContainerNode, INode, View, IContainer, IPickable } from '@awayjs/view';
|
|
4
4
|
|
|
5
5
|
import { IMaterial } from '@awayjs/renderer';
|
|
6
6
|
|
|
@@ -39,9 +39,9 @@ export class PointerEvent extends EventBase {
|
|
|
39
39
|
public rootNode: INode;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* The
|
|
42
|
+
* The pickable owner inside which the event took place.
|
|
43
43
|
*/
|
|
44
|
-
public
|
|
44
|
+
public pickable: IPickable;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The material of the 3d element inside which the event took place.
|
package/lib/events/TouchEvent.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class TouchEvent extends PointerEvent {
|
|
|
78
78
|
result.view = this.view;
|
|
79
79
|
result.containerNode = this.containerNode;
|
|
80
80
|
result.rootNode = this.rootNode;
|
|
81
|
-
result.
|
|
81
|
+
result.pickable = this.pickable;
|
|
82
82
|
result.material = this.material;
|
|
83
83
|
result.uv = this.uv;
|
|
84
84
|
result.position = this.position;
|
|
@@ -682,7 +682,7 @@ export class MouseManager {
|
|
|
682
682
|
|
|
683
683
|
event.rootNode = collision.rootNode;
|
|
684
684
|
// Object.
|
|
685
|
-
event.
|
|
685
|
+
event.pickable = collision.pickable;
|
|
686
686
|
// UV.
|
|
687
687
|
event.uv = collision.uv;
|
|
688
688
|
// Position.
|
|
@@ -695,7 +695,7 @@ export class MouseManager {
|
|
|
695
695
|
// Set all to null.
|
|
696
696
|
event.containerNode = null;
|
|
697
697
|
event.rootNode = null;
|
|
698
|
-
event.
|
|
698
|
+
event.pickable = null;
|
|
699
699
|
event.uv = null;
|
|
700
700
|
event.position = this._nullVector;
|
|
701
701
|
event.normal = this._nullVector;
|