@awayjs/scene 0.13.328 → 0.13.331
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/lib/Scene.d.ts +1 -0
- package/dist/lib/Scene.d.ts.map +1 -1
- package/dist/lib/Scene.js +3 -2
- package/dist/lib/base/Timeline.d.ts.map +1 -1
- package/dist/lib/base/Timeline.js +19 -15
- package/dist/lib/display/Billboard.js +5 -4
- package/dist/lib/display/DisplayObject.d.ts +5 -7
- package/dist/lib/display/DisplayObject.d.ts.map +1 -1
- package/dist/lib/display/DisplayObject.js +48 -44
- package/dist/lib/display/TextField.d.ts.map +1 -1
- package/dist/lib/display/TextField.js +5 -3
- package/dist/lib/image/SceneImage2D.d.ts +2 -0
- package/dist/lib/image/SceneImage2D.d.ts.map +1 -1
- package/dist/lib/image/SceneImage2D.js +7 -9
- package/dist/lib/text/FNTGenerator.d.ts +1 -0
- package/dist/lib/text/FNTGenerator.d.ts.map +1 -1
- package/dist/lib/text/FNTGenerator.js +3 -2
- package/lib/Scene.ts +4 -1
- package/lib/base/Timeline.ts +24 -15
- package/lib/display/DisplayObject.ts +68 -53
- package/lib/display/TextField.ts +5 -3
- package/lib/image/SceneImage2D.ts +9 -10
- package/lib/text/FNTGenerator.ts +4 -2
- package/package.json +3 -4
|
@@ -3,7 +3,7 @@ import { PerspectiveProjection, CoordinateSystem, Transform, Vector3D } from '@a
|
|
|
3
3
|
import { BitmapImage2D } from '@awayjs/stage';
|
|
4
4
|
import { DefaultRenderer, RenderGroup } from '@awayjs/renderer';
|
|
5
5
|
import { DisplayObjectContainer } from '../display/DisplayObjectContainer';
|
|
6
|
-
import { View } from '@awayjs/view';
|
|
6
|
+
import { Partition, View } from '@awayjs/view';
|
|
7
7
|
import { Sprite } from '../display/Sprite';
|
|
8
8
|
import { FNTGeneratorBase } from './FNTGeneratrorBase';
|
|
9
9
|
var FNTGenerator = /** @class */ (function (_super) {
|
|
@@ -21,9 +21,10 @@ var FNTGenerator = /** @class */ (function (_super) {
|
|
|
21
21
|
//create the view
|
|
22
22
|
_this._view = new View(projection, _this._stage);
|
|
23
23
|
_this._root = new DisplayObjectContainer();
|
|
24
|
+
_this._partition = new Partition(_this._root);
|
|
24
25
|
_this._renderer = RenderGroup
|
|
25
26
|
.getInstance(DefaultRenderer)
|
|
26
|
-
.getRenderer(_this._view, _this.
|
|
27
|
+
.getRenderer(_this._view, _this._partition.globalNode);
|
|
27
28
|
//set the view properties
|
|
28
29
|
_this._renderer.view.projection = projection;
|
|
29
30
|
//set the renderer properties
|
package/lib/Scene.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ContainerNode,
|
|
12
12
|
INode,
|
|
13
13
|
IContainer,
|
|
14
|
+
Partition,
|
|
14
15
|
} from '@awayjs/view';
|
|
15
16
|
|
|
16
17
|
import { RendererBase, RenderGroup, IRendererClass, DefaultRenderer } from '@awayjs/renderer';
|
|
@@ -45,6 +46,7 @@ export class Scene {
|
|
|
45
46
|
private _camera: Camera;
|
|
46
47
|
private _renderer: RendererBase;
|
|
47
48
|
private _container: IContainer;
|
|
49
|
+
private _partition: Partition;
|
|
48
50
|
private _node: INode;
|
|
49
51
|
private _view: View;
|
|
50
52
|
private _pickPool: PickPool;
|
|
@@ -72,7 +74,8 @@ export class Scene {
|
|
|
72
74
|
this._mouseManager.unregisterPicker(this._mousePicker);
|
|
73
75
|
|
|
74
76
|
this._container = value;
|
|
75
|
-
this.
|
|
77
|
+
this._partition = new Partition(this._container);
|
|
78
|
+
this._node = this._partition.globalNode;
|
|
76
79
|
this._mousePicker = this._pickPool.getRaycastPicker(this._node);
|
|
77
80
|
this._tabPicker = this._pickPool.getTabPicker(this._node);
|
|
78
81
|
this._mousePicker.findClosestCollision = true;
|
package/lib/base/Timeline.ts
CHANGED
|
@@ -524,15 +524,22 @@ export class Timeline {
|
|
|
524
524
|
|
|
525
525
|
const new_matrix: Matrix3D = child.transform.matrix3D;
|
|
526
526
|
const props_stream = timeline.properties_stream_f32_mtx_all;
|
|
527
|
+
const raw = new_matrix._rawData;
|
|
528
|
+
const a = props_stream[i], b = props_stream[i + 1], c = props_stream[i + 2], d = props_stream[i + 3];
|
|
529
|
+
const tx = props_stream[i + 4], ty = props_stream[i + 5];
|
|
530
|
+
const rotScaleChanged = raw[0] !== a || raw[1] !== b || raw[4] !== c || raw[5] !== d;
|
|
531
|
+
const posChanged = raw[12] !== tx || raw[13] !== ty;
|
|
527
532
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
new_matrix._rawData[4] = props_stream[i++];
|
|
531
|
-
new_matrix._rawData[5] = props_stream[i++];
|
|
532
|
-
new_matrix._rawData[12] = props_stream[i++];
|
|
533
|
-
new_matrix._rawData[13] = props_stream[i];
|
|
533
|
+
if (!rotScaleChanged && !posChanged)
|
|
534
|
+
return;
|
|
534
535
|
|
|
535
|
-
|
|
536
|
+
new_matrix.setElements2D(a, b, c, d);
|
|
537
|
+
new_matrix.setPosition(tx, ty, raw[14]);
|
|
538
|
+
|
|
539
|
+
if (rotScaleChanged)
|
|
540
|
+
child.transform.invalidateComponents();
|
|
541
|
+
else
|
|
542
|
+
child.transform.invalidatePosition();
|
|
536
543
|
}
|
|
537
544
|
|
|
538
545
|
public static update_colortransform(
|
|
@@ -616,15 +623,15 @@ export class Timeline {
|
|
|
616
623
|
|
|
617
624
|
const new_matrix: Matrix3D = child.transform.matrix3D;
|
|
618
625
|
const props_stream = timeline.properties_stream_f32_mtx_scale_rot;
|
|
626
|
+
const raw = new_matrix._rawData;
|
|
627
|
+
const a = props_stream[i], b = props_stream[i + 1], c = props_stream[i + 2], d = props_stream[i + 3];
|
|
619
628
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
new_matrix._rawData[4] = props_stream[i++];
|
|
623
|
-
new_matrix._rawData[5] = props_stream[i];
|
|
629
|
+
if (raw[0] === a && raw[1] === b && raw[4] === c && raw[5] === d)
|
|
630
|
+
return;
|
|
624
631
|
|
|
625
|
-
|
|
632
|
+
new_matrix.setElements2D(a, b, c, d);
|
|
626
633
|
|
|
627
|
-
child.
|
|
634
|
+
child.transform.invalidateComponents();
|
|
628
635
|
}
|
|
629
636
|
|
|
630
637
|
public static update_mtx_pos(timeline: Timeline, child: DisplayObject, target_mc: MovieClip, i: number): void {
|
|
@@ -635,8 +642,10 @@ export class Timeline {
|
|
|
635
642
|
|
|
636
643
|
const new_matrix = child.transform.matrix3D;
|
|
637
644
|
|
|
638
|
-
new_matrix.
|
|
639
|
-
|
|
645
|
+
new_matrix.setPosition(
|
|
646
|
+
timeline.properties_stream_f32_mtx_pos[i++],
|
|
647
|
+
timeline.properties_stream_f32_mtx_pos[i],
|
|
648
|
+
new_matrix._rawData[14]);
|
|
640
649
|
|
|
641
650
|
child.transform.invalidatePosition();
|
|
642
651
|
}
|
|
@@ -7,10 +7,7 @@ import {
|
|
|
7
7
|
Vector3D,
|
|
8
8
|
AssetBase,
|
|
9
9
|
Loader,
|
|
10
|
-
|
|
11
|
-
IAsset,
|
|
12
|
-
IAbstraction,
|
|
13
|
-
AbstractionSet,
|
|
10
|
+
WeakAssetSet,
|
|
14
11
|
} from '@awayjs/core';
|
|
15
12
|
|
|
16
13
|
import { BlendMode } from '@awayjs/stage';
|
|
@@ -178,11 +175,7 @@ import { Settings } from '../Settings';
|
|
|
178
175
|
* display is not rendering. This is the case when the
|
|
179
176
|
* content is either minimized or obscured. </p>
|
|
180
177
|
*/
|
|
181
|
-
export class DisplayObject extends AssetBase implements IBitmapDrawable, IContainer
|
|
182
|
-
|
|
183
|
-
private static _store: IAbstraction[] = [];
|
|
184
|
-
|
|
185
|
-
readonly abstractions: AbstractionSet;
|
|
178
|
+
export class DisplayObject extends AssetBase implements IBitmapDrawable, IContainer {
|
|
186
179
|
|
|
187
180
|
public _renderObjects: Record<number, RenderEntity | _Render_RenderableBase | CacheRenderer> = {};
|
|
188
181
|
public _containerNodes: Record<number, ContainerNode> = {};
|
|
@@ -217,6 +210,14 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
217
210
|
|
|
218
211
|
protected _timelineMasks: DisplayObject[] | undefined;
|
|
219
212
|
protected _mask: DisplayObject | undefined;
|
|
213
|
+
// Display objects that use this object as a script or timeline mask.
|
|
214
|
+
// Set by the owner's mask / timelineMasks setters. A shared
|
|
215
|
+
// timeline mask has more than one entry. IHP invalidates these
|
|
216
|
+
// owners when this mask (or an ancestor) moves.
|
|
217
|
+
// Named separately from ContainerNode._maskOwners (ancestor nodes
|
|
218
|
+
// whose masks apply to this node). WeakAssetSet so a disposed owner
|
|
219
|
+
// can be collected.
|
|
220
|
+
public _maskOwners: WeakAssetSet<DisplayObject> | undefined;
|
|
220
221
|
|
|
221
222
|
private _mouseEnabled: boolean = true;
|
|
222
223
|
|
|
@@ -681,12 +682,14 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
681
682
|
|
|
682
683
|
// remove older script mask
|
|
683
684
|
if (this._mask)
|
|
684
|
-
this._mask.
|
|
685
|
+
this._mask._removeMaskOwner(this);
|
|
685
686
|
|
|
686
687
|
this._mask = value;
|
|
687
688
|
|
|
688
|
-
if (value)
|
|
689
|
+
if (value) {
|
|
689
690
|
value.maskMode = true;
|
|
691
|
+
value._addMaskOwner(this);
|
|
692
|
+
}
|
|
690
693
|
|
|
691
694
|
this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
|
|
692
695
|
}
|
|
@@ -832,9 +835,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
832
835
|
if (!this._registrationMatrix3D)
|
|
833
836
|
return;
|
|
834
837
|
|
|
835
|
-
this._registrationMatrix3D.
|
|
836
|
-
this._registrationMatrix3D._rawData[13] = 0;
|
|
837
|
-
this._registrationMatrix3D._rawData[14] = 0;
|
|
838
|
+
this._registrationMatrix3D.setPosition(0, 0, 0);
|
|
838
839
|
|
|
839
840
|
if (this._registrationMatrix3D.isIdentity())
|
|
840
841
|
this._registrationMatrix3D = null;
|
|
@@ -842,9 +843,10 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
842
843
|
if (!this._registrationMatrix3D)
|
|
843
844
|
this._registrationMatrix3D = new Matrix3D();
|
|
844
845
|
|
|
845
|
-
this._registrationMatrix3D.
|
|
846
|
-
|
|
847
|
-
|
|
846
|
+
this._registrationMatrix3D.setPosition(
|
|
847
|
+
-value.x / this._transform.scale.x,
|
|
848
|
+
-value.y / this._transform.scale.y,
|
|
849
|
+
-value.z / this._transform.scale.z);
|
|
848
850
|
}
|
|
849
851
|
|
|
850
852
|
this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
|
|
@@ -868,9 +870,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
868
870
|
if (!this._registrationMatrix3D)
|
|
869
871
|
return;
|
|
870
872
|
|
|
871
|
-
this._registrationMatrix3D.
|
|
872
|
-
this._registrationMatrix3D._rawData[5] = 1;
|
|
873
|
-
this._registrationMatrix3D._rawData[10] = 1;
|
|
873
|
+
this._registrationMatrix3D.setScale(1, 1, 1);
|
|
874
874
|
|
|
875
875
|
if (this._registrationMatrix3D.isIdentity())
|
|
876
876
|
this._registrationMatrix3D = null;
|
|
@@ -878,9 +878,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
878
878
|
if (!this._registrationMatrix3D)
|
|
879
879
|
this._registrationMatrix3D = new Matrix3D();
|
|
880
880
|
|
|
881
|
-
this._registrationMatrix3D.
|
|
882
|
-
this._registrationMatrix3D._rawData[5] = value.y;
|
|
883
|
-
this._registrationMatrix3D._rawData[10] = value.z;
|
|
881
|
+
this._registrationMatrix3D.setScale(value.x, value.y, value.z);
|
|
884
882
|
}
|
|
885
883
|
|
|
886
884
|
this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
|
|
@@ -1194,6 +1192,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1194
1192
|
}
|
|
1195
1193
|
|
|
1196
1194
|
if (invalidatePos) {
|
|
1195
|
+
this.invalidate();
|
|
1197
1196
|
this._transform.invalidatePosition();
|
|
1198
1197
|
|
|
1199
1198
|
if (value) {
|
|
@@ -1400,11 +1399,18 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1400
1399
|
}
|
|
1401
1400
|
}
|
|
1402
1401
|
|
|
1403
|
-
//
|
|
1402
|
+
// Drop this owner from masks no longer applied (keep maskMode
|
|
1403
|
+
// if another owner still shares the mask).
|
|
1404
1404
|
for (let i = oldMasks.length - 1; i >= 0 ; i--)
|
|
1405
|
-
oldMasks[i].
|
|
1405
|
+
oldMasks[i]._removeMaskOwner(this);
|
|
1406
1406
|
|
|
1407
1407
|
this._timelineMasks = masks;
|
|
1408
|
+
if (masks) {
|
|
1409
|
+
for (let i = 0; i < masks.length; i++) {
|
|
1410
|
+
if (masks[i])
|
|
1411
|
+
masks[i]._addMaskOwner(this);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1408
1414
|
|
|
1409
1415
|
this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
|
|
1410
1416
|
}
|
|
@@ -1465,7 +1471,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1465
1471
|
if (this._transform.position.x == val)
|
|
1466
1472
|
return;
|
|
1467
1473
|
|
|
1468
|
-
this._transform.matrix3D.
|
|
1474
|
+
this._transform.matrix3D.setPosition(val, this._transform.position.y, this._transform.position.z);
|
|
1469
1475
|
|
|
1470
1476
|
this._transform.invalidatePosition();
|
|
1471
1477
|
}
|
|
@@ -1488,7 +1494,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1488
1494
|
if (this._transform.position.y == val)
|
|
1489
1495
|
return;
|
|
1490
1496
|
|
|
1491
|
-
this._transform.matrix3D.
|
|
1497
|
+
this._transform.matrix3D.setPosition(this._transform.position.x, val, this._transform.position.z);
|
|
1492
1498
|
|
|
1493
1499
|
this._transform.invalidatePosition();
|
|
1494
1500
|
}
|
|
@@ -1520,7 +1526,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1520
1526
|
if (this._transform.position.z == val)
|
|
1521
1527
|
return;
|
|
1522
1528
|
|
|
1523
|
-
this._transform.matrix3D.
|
|
1529
|
+
this._transform.matrix3D.setPosition(this._transform.position.x, this._transform.position.y, val);
|
|
1524
1530
|
|
|
1525
1531
|
this._transform.invalidatePosition();
|
|
1526
1532
|
}
|
|
@@ -1536,7 +1542,6 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1536
1542
|
constructor() {
|
|
1537
1543
|
super();
|
|
1538
1544
|
|
|
1539
|
-
this.abstractions = new AbstractionSet(this);
|
|
1540
1545
|
this.cursorType = '';
|
|
1541
1546
|
this._isInFocus = false;
|
|
1542
1547
|
this._tabEnabled = false;
|
|
@@ -1549,6 +1554,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1549
1554
|
|
|
1550
1555
|
//creation of associated transform object
|
|
1551
1556
|
this._transform = new Transform(null);
|
|
1557
|
+
this._transform.separatePositionInvalidation = true;
|
|
1552
1558
|
|
|
1553
1559
|
//setup transform listeners
|
|
1554
1560
|
this._transform.addEventListener(
|
|
@@ -1556,6 +1562,11 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1556
1562
|
(_event: TransformEvent) => this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM)
|
|
1557
1563
|
);
|
|
1558
1564
|
|
|
1565
|
+
this._transform.addEventListener(
|
|
1566
|
+
TransformEvent.INVALIDATE_POSITION,
|
|
1567
|
+
(_event: TransformEvent) => this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_POSITION)
|
|
1568
|
+
);
|
|
1569
|
+
|
|
1559
1570
|
this._transform.addEventListener(
|
|
1560
1571
|
TransformEvent.INVALIDATE_COLOR_TRANSFORM,
|
|
1561
1572
|
(_event: TransformEvent) => this._invalidateHierarchicalProperty(HierarchicalProperty.COLOR_TRANSFORM)
|
|
@@ -1617,14 +1628,10 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1617
1628
|
displayObject.isSlice9ScaledMC = this.isSlice9ScaledMC;
|
|
1618
1629
|
displayObject.scale9Grid = this.scale9Grid?.clone();
|
|
1619
1630
|
|
|
1620
|
-
if (this._timelineMasks)
|
|
1621
|
-
|
|
1622
|
-
displayObject._timelineMasks = this._timelineMasks.slice();
|
|
1623
|
-
// manually call invalidation
|
|
1624
|
-
//displayObject._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
|
|
1625
|
-
}
|
|
1631
|
+
if (this._timelineMasks)
|
|
1632
|
+
displayObject.timelineMasks = this._timelineMasks.slice();
|
|
1626
1633
|
|
|
1627
|
-
displayObject.
|
|
1634
|
+
displayObject.mask = this._mask;
|
|
1628
1635
|
|
|
1629
1636
|
this._transform.copyRawDataTo(displayObject._transform);
|
|
1630
1637
|
}
|
|
@@ -1649,8 +1656,8 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1649
1656
|
|
|
1650
1657
|
this._pickObject = null;
|
|
1651
1658
|
|
|
1652
|
-
|
|
1653
|
-
|
|
1659
|
+
this.timelineMasks = undefined;
|
|
1660
|
+
this.mask = undefined;
|
|
1654
1661
|
}
|
|
1655
1662
|
|
|
1656
1663
|
/**
|
|
@@ -1679,9 +1686,11 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1679
1686
|
if (!this._registrationMatrix3D)
|
|
1680
1687
|
this._registrationMatrix3D = new Matrix3D();
|
|
1681
1688
|
|
|
1682
|
-
|
|
1683
|
-
this._registrationMatrix3D.
|
|
1684
|
-
|
|
1689
|
+
const raw = this._registrationMatrix3D._rawData;
|
|
1690
|
+
this._registrationMatrix3D.setPosition(
|
|
1691
|
+
raw[12] - dx / this._transform.scale.x,
|
|
1692
|
+
raw[13] - dy / this._transform.scale.y,
|
|
1693
|
+
raw[14] - dz / this._transform.scale.z);
|
|
1685
1694
|
|
|
1686
1695
|
this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
|
|
1687
1696
|
}
|
|
@@ -1733,6 +1742,24 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1733
1742
|
this._containerNodes[key].invalidateHierarchicalProperty(propDirty);
|
|
1734
1743
|
}
|
|
1735
1744
|
|
|
1745
|
+
private _addMaskOwner(owner: DisplayObject): void {
|
|
1746
|
+
if (!this._maskOwners)
|
|
1747
|
+
this._maskOwners = new WeakAssetSet<DisplayObject>();
|
|
1748
|
+
this._maskOwners.add(owner);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// maskMode is cleared when the last owner is removed.
|
|
1752
|
+
private _removeMaskOwner(owner: DisplayObject): void {
|
|
1753
|
+
const owners = this._maskOwners;
|
|
1754
|
+
if (!owners)
|
|
1755
|
+
return;
|
|
1756
|
+
owners.remove(owner);
|
|
1757
|
+
if (!owners.numAssets) {
|
|
1758
|
+
this._maskOwners = undefined;
|
|
1759
|
+
this.maskMode = false;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1736
1763
|
/**
|
|
1737
1764
|
* @internal
|
|
1738
1765
|
*/
|
|
@@ -1837,16 +1864,4 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IContai
|
|
|
1837
1864
|
protected _getDefaultBoundingVolume(): BoundingVolumeType {
|
|
1838
1865
|
return BoundingVolumeType.BOX_BOUNDS_FAST;
|
|
1839
1866
|
}
|
|
1840
|
-
|
|
1841
|
-
public requestAbstraction(asset: IAsset): IAbstraction {
|
|
1842
|
-
return DisplayObject._store.length ? DisplayObject._store.pop() : new ContainerNode();
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
public storeAbstraction(abstraction: IAbstraction): void {
|
|
1846
|
-
DisplayObject._store.push(abstraction);
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
public getNode(container: IContainer): ContainerNode {
|
|
1850
|
-
return this.abstractions.getAbstraction<ContainerNode>(container);
|
|
1851
|
-
}
|
|
1852
1867
|
}
|
package/lib/display/TextField.ts
CHANGED
|
@@ -1781,7 +1781,7 @@ export class TextField extends DisplayObjectContainer {
|
|
|
1781
1781
|
if (this._transform.position.x == val)
|
|
1782
1782
|
return;
|
|
1783
1783
|
|
|
1784
|
-
this._transform.matrix3D.
|
|
1784
|
+
this._transform.matrix3D.setPosition(val, this._transform.position.y, this._transform.position.z);
|
|
1785
1785
|
|
|
1786
1786
|
this._transform.invalidatePosition();
|
|
1787
1787
|
}
|
|
@@ -2339,10 +2339,12 @@ export class TextField extends DisplayObjectContainer {
|
|
|
2339
2339
|
this._width = 4 + newWidth;
|
|
2340
2340
|
|
|
2341
2341
|
if (this._autoSize == TextFieldAutoSize.RIGHT) {
|
|
2342
|
-
this._transform.
|
|
2342
|
+
const pos = this._transform.position;
|
|
2343
|
+
this._transform.matrix3D.setPosition(pos.x - (this._width - oldSize), pos.y, pos.z);
|
|
2343
2344
|
this._transform.invalidatePosition();
|
|
2344
2345
|
} else if (this._autoSize == TextFieldAutoSize.CENTER) {
|
|
2345
|
-
this._transform.
|
|
2346
|
+
const pos = this._transform.position;
|
|
2347
|
+
this._transform.matrix3D.setPosition(pos.x - (this._width - oldSize) / 2, pos.y, pos.z);
|
|
2346
2348
|
this._transform.invalidatePosition();
|
|
2347
2349
|
}
|
|
2348
2350
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { ContainerNode, View } from '@awayjs/view';
|
|
2
|
+
import { ContainerNode, Partition, View } from '@awayjs/view';
|
|
3
3
|
import { MaterialBase } from '@awayjs/materials';
|
|
4
4
|
import { DisplayObjectContainer } from '../display/DisplayObjectContainer';
|
|
5
5
|
import { DisplayObject } from '../display/DisplayObject';
|
|
@@ -76,8 +76,10 @@ export class SceneImage2D extends BitmapImage2D {
|
|
|
76
76
|
private static _billboardRenderer: DefaultRenderer;
|
|
77
77
|
private static _view: View;
|
|
78
78
|
private static _billboardView: View;
|
|
79
|
+
private static _partition: Partition;
|
|
79
80
|
private static _root: DisplayObjectContainer;
|
|
80
81
|
private static _rootNode: ContainerNode;
|
|
82
|
+
private static _billboardPartition: Partition;
|
|
81
83
|
private static _billboardRoot: DisplayObjectContainer;
|
|
82
84
|
private static _billboardRootNode: ContainerNode;
|
|
83
85
|
private static _billboard: Billboard;
|
|
@@ -189,7 +191,8 @@ export class SceneImage2D extends BitmapImage2D {
|
|
|
189
191
|
//create the view
|
|
190
192
|
SceneImage2D._view = new View(projection, this._stage);
|
|
191
193
|
SceneImage2D._root = new DisplayObjectContainer();
|
|
192
|
-
SceneImage2D.
|
|
194
|
+
SceneImage2D._partition = new Partition(SceneImage2D._root);
|
|
195
|
+
SceneImage2D._rootNode = SceneImage2D._partition.globalNode;
|
|
193
196
|
SceneImage2D._renderer = <DefaultRenderer> RenderGroup
|
|
194
197
|
.getInstance(DefaultRenderer)
|
|
195
198
|
.getRenderer(SceneImage2D._view, SceneImage2D._rootNode);
|
|
@@ -217,7 +220,8 @@ export class SceneImage2D extends BitmapImage2D {
|
|
|
217
220
|
//create the view
|
|
218
221
|
SceneImage2D._billboardView = new View(projection, this._stage);
|
|
219
222
|
SceneImage2D._billboardRoot = new DisplayObjectContainer();
|
|
220
|
-
SceneImage2D.
|
|
223
|
+
SceneImage2D._billboardPartition = new Partition(SceneImage2D._billboardRoot);
|
|
224
|
+
SceneImage2D._billboardRootNode = SceneImage2D._billboardPartition.globalNode;
|
|
221
225
|
SceneImage2D._billboardRenderer = <DefaultRenderer> RenderGroup
|
|
222
226
|
.getInstance(DefaultRenderer)
|
|
223
227
|
.getRenderer(SceneImage2D._billboardView, SceneImage2D._billboardRootNode);
|
|
@@ -709,13 +713,8 @@ export class SceneImage2D extends BitmapImage2D {
|
|
|
709
713
|
const m = root.transform.matrix3D;
|
|
710
714
|
|
|
711
715
|
m.identity();
|
|
712
|
-
|
|
713
|
-
m.
|
|
714
|
-
m._rawData[1] = -matrix.b;
|
|
715
|
-
m._rawData[4] = matrix.c;
|
|
716
|
-
m._rawData[5] = -matrix.d;
|
|
717
|
-
m._rawData[12] = matrix.tx;
|
|
718
|
-
m._rawData[13] = target.height - matrix.ty;
|
|
716
|
+
m.setElements2D(matrix.a, -matrix.b, matrix.c, -matrix.d);
|
|
717
|
+
m.setPosition(matrix.tx, target.height - matrix.ty, 0);
|
|
719
718
|
|
|
720
719
|
root.transform.invalidateComponents();
|
|
721
720
|
} else {
|
package/lib/text/FNTGenerator.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Stage, BitmapImage2D } from '@awayjs/stage';
|
|
|
7
7
|
import { DefaultRenderer, RenderGroup } from '@awayjs/renderer';
|
|
8
8
|
|
|
9
9
|
import { DisplayObjectContainer } from '../display/DisplayObjectContainer';
|
|
10
|
-
import { View } from '@awayjs/view';
|
|
10
|
+
import { Partition, View } from '@awayjs/view';
|
|
11
11
|
import { Sprite } from '../display/Sprite';
|
|
12
12
|
import { Shape } from '@awayjs/graphics';
|
|
13
13
|
import { FNTGeneratorBase } from './FNTGeneratrorBase';
|
|
@@ -15,6 +15,7 @@ import { FNTGeneratorBase } from './FNTGeneratrorBase';
|
|
|
15
15
|
export class FNTGenerator extends FNTGeneratorBase {
|
|
16
16
|
private _view: View;
|
|
17
17
|
private _root: DisplayObjectContainer;
|
|
18
|
+
private _partition: Partition;
|
|
18
19
|
private _renderer: DefaultRenderer;
|
|
19
20
|
|
|
20
21
|
constructor(stage: Stage) {
|
|
@@ -32,9 +33,10 @@ export class FNTGenerator extends FNTGeneratorBase {
|
|
|
32
33
|
//create the view
|
|
33
34
|
this._view = new View(projection, this._stage);
|
|
34
35
|
this._root = new DisplayObjectContainer();
|
|
36
|
+
this._partition = new Partition(this._root);
|
|
35
37
|
this._renderer = <DefaultRenderer> RenderGroup
|
|
36
38
|
.getInstance(DefaultRenderer)
|
|
37
|
-
.getRenderer(this._view, this.
|
|
39
|
+
.getRenderer(this._view, this._partition.globalNode);
|
|
38
40
|
|
|
39
41
|
//set the view properties
|
|
40
42
|
this._renderer.view.projection = projection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awayjs/scene",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.331",
|
|
4
4
|
"description": "AwayJS scene classes",
|
|
5
5
|
"main": "bundle/awayjs-scene.umd.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,13 +20,12 @@
|
|
|
20
20
|
"clean:dist": "npm run rimraf -- dist bundle",
|
|
21
21
|
"watch": "npm run tsc -- --w",
|
|
22
22
|
"eslint": "eslint ./lib --fix",
|
|
23
|
-
"eslint:commit": "npm run eslint &&
|
|
23
|
+
"eslint:commit": "npm run eslint && git diff --quiet ./lib || (git add ./lib && git commit -m \"fixed by eslint\")",
|
|
24
24
|
"gitdiff": "git diff --quiet && git diff --cached --quiet",
|
|
25
|
-
"preversion": "npm run gitdiff && npm run eslint:commit || exit 0",
|
|
26
25
|
"prebuild": "npm run clean:dist",
|
|
27
26
|
"build": "npm run tsc:build && npm run rollup",
|
|
28
27
|
"copyVersionToIndex": "node ./copyVersionToIndex && git add ./index.ts && git commit -m \"update version number in index.ts\"",
|
|
29
|
-
"version": "npm run
|
|
28
|
+
"version": "npm run eslint:commit && npm run copyVersionToIndex && npm run build || exit 0",
|
|
30
29
|
"postversion": "git push && git push --tags && npm publish"
|
|
31
30
|
},
|
|
32
31
|
"keywords": [
|