@awayjs/scene 0.13.226 → 0.13.232
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 +865 -387
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/Settings.d.ts +3 -0
- package/dist/lib/Settings.d.ts.map +1 -1
- package/dist/lib/Settings.js +14 -0
- package/dist/lib/display/TextField.d.ts +36 -5
- package/dist/lib/display/TextField.d.ts.map +1 -1
- package/dist/lib/display/TextField.js +227 -138
- package/dist/lib/image/SceneImage2D.d.ts.map +1 -1
- package/dist/lib/image/SceneImage2D.js +33 -8
- package/dist/lib/text/FNTGenerator.d.ts +5 -4
- package/dist/lib/text/FNTGenerator.d.ts.map +1 -1
- package/dist/lib/text/FNTGenerator.js +15 -11
- package/dist/lib/text/FNTGeneratorCanvas.d.ts +23 -0
- package/dist/lib/text/FNTGeneratorCanvas.d.ts.map +1 -0
- package/dist/lib/text/FNTGeneratorCanvas.js +205 -0
- package/dist/lib/text/FNTGeneratrorBase.d.ts +8 -0
- package/dist/lib/text/FNTGeneratrorBase.d.ts.map +1 -0
- package/dist/lib/text/FNTGeneratrorBase.js +7 -0
- package/dist/lib/text/TesselatedFontChar.d.ts +6 -4
- package/dist/lib/text/TesselatedFontChar.d.ts.map +1 -1
- package/dist/lib/text/TesselatedFontChar.js +8 -3
- package/dist/lib/text/TesselatedFontTable.d.ts +19 -3
- package/dist/lib/text/TesselatedFontTable.d.ts.map +1 -1
- package/dist/lib/text/TesselatedFontTable.js +339 -225
- package/dist/lib/text/TextShape.d.ts +6 -3
- package/dist/lib/text/TextShape.d.ts.map +1 -1
- package/dist/lib/text/TextShape.js +27 -2
- package/index.ts +1 -1
- package/lib/Settings.ts +20 -1
- package/lib/display/TextField.ts +317 -145
- package/lib/image/SceneImage2D.ts +81 -9
- package/lib/text/FNTGenerator.ts +5 -7
- package/lib/text/FNTGeneratorCanvas.ts +288 -0
- package/lib/text/FNTGeneratrorBase.ts +11 -0
- package/lib/text/TesselatedFontChar.ts +8 -12
- package/lib/text/TesselatedFontTable.ts +438 -255
- package/lib/text/TextShape.ts +30 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextShape.d.ts","sourceRoot":"","sources":["../../../lib/text/TextShape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,SAAS;
|
|
1
|
+
{"version":3,"file":"TextShape.d.ts","sourceRoot":"","sources":["../../../lib/text/TextShape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,SAAS;aAsDJ,MAAM,EAAE,UAAU;aAClB,OAAO,EAAE,MAAM;IArDzB,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAM;IAChC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,CAAM;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,YAAY,CAAC;IAC1B,QAAQ,EAAE,gBAAgB,CAAC;IAElC,OAAO,CAAC,OAAO,CAAa;IAC5B,IAAW,MAAM,IAIM,MAAM,CAF5B;IAED,IAAW,MAAM,CAAC,GAAG,EAAE,MAAM,EAkC5B;IAED,IAAW,KAAK,YAEf;gBAGgB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM;IAMzB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,YAAY;IAkBxD,IAAW,IAAI,iBAEd;CACD"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
var TextShape = /** @class */ (function () {
|
|
2
|
-
function TextShape() {
|
|
2
|
+
function TextShape(format, cacheId) {
|
|
3
|
+
this.format = format;
|
|
4
|
+
this.cacheId = cacheId;
|
|
3
5
|
this.verts = [];
|
|
6
|
+
this.uvs = [];
|
|
4
7
|
this._length = 0;
|
|
5
8
|
this.verts = [];
|
|
9
|
+
this.uvs = [];
|
|
6
10
|
}
|
|
7
11
|
Object.defineProperty(TextShape.prototype, "length", {
|
|
8
12
|
get: function () {
|
|
@@ -13,9 +17,11 @@ var TextShape = /** @class */ (function () {
|
|
|
13
17
|
return;
|
|
14
18
|
}
|
|
15
19
|
var verts = this.verts;
|
|
20
|
+
var uvs = this.uvs;
|
|
16
21
|
if (val === 0) {
|
|
17
22
|
this._length = 0;
|
|
18
23
|
verts.length = 0;
|
|
24
|
+
uvs.length = 0;
|
|
19
25
|
return;
|
|
20
26
|
}
|
|
21
27
|
var index = 0;
|
|
@@ -27,6 +33,9 @@ var TextShape = /** @class */ (function () {
|
|
|
27
33
|
if (size < 0) {
|
|
28
34
|
// resize buffer
|
|
29
35
|
verts[index - 1] = verts[index - 1].subarray(0, size + verts[index - 1].length);
|
|
36
|
+
if (uvs[index - 1]) {
|
|
37
|
+
uvs[index - 1] = uvs[index - 1].subarray(0, size + uvs[index - 1].length);
|
|
38
|
+
}
|
|
30
39
|
}
|
|
31
40
|
verts.length = index;
|
|
32
41
|
this._length = val;
|
|
@@ -34,9 +43,25 @@ var TextShape = /** @class */ (function () {
|
|
|
34
43
|
enumerable: true,
|
|
35
44
|
configurable: true
|
|
36
45
|
});
|
|
37
|
-
TextShape.prototype
|
|
46
|
+
Object.defineProperty(TextShape.prototype, "hasUV", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return this.uvs.length > 0;
|
|
49
|
+
},
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true
|
|
52
|
+
});
|
|
53
|
+
TextShape.prototype.addChunk = function (buffer, uvs) {
|
|
54
|
+
if (this.verts.length !== this.uvs.length && uvs) {
|
|
55
|
+
throw 'You can\'t mix TextShape with UV and without in same place';
|
|
56
|
+
}
|
|
57
|
+
if (uvs && buffer.length !== uvs.length) {
|
|
58
|
+
throw 'Position buffer and UV buffer should has equal size';
|
|
59
|
+
}
|
|
38
60
|
this._length += buffer.length;
|
|
39
61
|
this.verts.push(buffer);
|
|
62
|
+
if (uvs) {
|
|
63
|
+
this.uvs.push(uvs);
|
|
64
|
+
}
|
|
40
65
|
};
|
|
41
66
|
Object.defineProperty(TextShape.prototype, "tall", {
|
|
42
67
|
get: function () {
|
package/index.ts
CHANGED
package/lib/Settings.ts
CHANGED
|
@@ -10,7 +10,10 @@ export interface ISceneSettings {
|
|
|
10
10
|
USE_UNSAFE_BLENDS: boolean;
|
|
11
11
|
CPU_COPY_PIXELS_COUNT: number;
|
|
12
12
|
REMAP_BLEND_MODE: boolean;
|
|
13
|
-
BLEND_MODE_REMAP_TABLE: Record<string, string
|
|
13
|
+
BLEND_MODE_REMAP_TABLE: Record<string, string>;
|
|
14
|
+
FONT_TESSELATION_QUALITY: number;
|
|
15
|
+
USE_UNSAFE_FNT: boolean;
|
|
16
|
+
TEXT_SHAPE_ROUND_PRECISION: number;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export const Settings: ISceneSettings = {
|
|
@@ -61,4 +64,20 @@ export const Settings: ISceneSettings = {
|
|
|
61
64
|
* @description How many pixels can be processed on CPU for `copyPixel` operation for avoid run GPU
|
|
62
65
|
*/
|
|
63
66
|
CPU_COPY_PIXELS_COUNT: 64 * 64,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description Quality factor for pre-tesselated font shapes,
|
|
70
|
+
* values greater 1 no make sense, 1/10 produce normal font result for small fonts (14px)
|
|
71
|
+
*/
|
|
72
|
+
FONT_TESSELATION_QUALITY: 1 / 10,
|
|
73
|
+
/**
|
|
74
|
+
* @description Use unsafe FNT (pre-cached font shapes onto texture)
|
|
75
|
+
*/
|
|
76
|
+
USE_UNSAFE_FNT: false,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @description Precision of text building for rounding a vertices placement of text shape.
|
|
80
|
+
* Used for correction text blurring when pixel is missposited
|
|
81
|
+
*/
|
|
82
|
+
TEXT_SHAPE_ROUND_PRECISION: 0.1,
|
|
64
83
|
};
|