@babylonjs/core 6.4.0 → 6.4.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.
- package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +2 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.d.ts +1 -0
- package/Engines/WebGPU/webgpuMaterialContext.js +1 -0
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.d.ts +3 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +2 -0
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Maths/math.path.d.ts +33 -0
- package/Maths/math.path.js +116 -0
- package/Maths/math.path.js.map +1 -1
- package/Meshes/Builders/index.d.ts +1 -0
- package/Meshes/Builders/index.js +1 -0
- package/Meshes/Builders/index.js.map +1 -1
- package/Meshes/Builders/textBuilder.d.ts +51 -0
- package/Meshes/Builders/textBuilder.js +210 -0
- package/Meshes/Builders/textBuilder.js.map +1 -0
- package/Meshes/meshBuilder.d.ts +2 -0
- package/Meshes/meshBuilder.js +2 -0
- package/Meshes/meshBuilder.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Scene } from "../../scene";
|
|
2
|
+
import type { Nullable } from "../../types";
|
|
3
|
+
import { Mesh } from "../mesh";
|
|
4
|
+
/**
|
|
5
|
+
* Parser inspired by https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FontLoader.js
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Represents glyph data generated by http://gero3.github.io/facetype.js/
|
|
9
|
+
*/
|
|
10
|
+
export interface IGlyphData {
|
|
11
|
+
/** Commands used to draw (line, move, curve, etc..) */
|
|
12
|
+
o: string;
|
|
13
|
+
/** Width */
|
|
14
|
+
ha: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents font data generated by http://gero3.github.io/facetype.js/
|
|
18
|
+
*/
|
|
19
|
+
export interface IFontData {
|
|
20
|
+
/**
|
|
21
|
+
* Font resolution
|
|
22
|
+
*/
|
|
23
|
+
resolution: number;
|
|
24
|
+
/** Underline tickness */
|
|
25
|
+
underlineThickness: number;
|
|
26
|
+
/** Bounding box */
|
|
27
|
+
boundingBox: {
|
|
28
|
+
yMax: number;
|
|
29
|
+
yMin: number;
|
|
30
|
+
};
|
|
31
|
+
/** List of supported glyphs */
|
|
32
|
+
glyphs: {
|
|
33
|
+
[key: string]: IGlyphData;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a text mesh
|
|
38
|
+
* @param name defines the name of the mesh
|
|
39
|
+
* @param text defines the text to use to build the mesh
|
|
40
|
+
* @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)
|
|
41
|
+
* @param options defines options used to create the mesh
|
|
42
|
+
* @param scene defines the hosting scene
|
|
43
|
+
* @returns a new Mesh
|
|
44
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/text
|
|
45
|
+
*/
|
|
46
|
+
export declare function CreateText(name: string, text: string, fontData: IFontData, options?: {
|
|
47
|
+
size?: number;
|
|
48
|
+
resolution?: number;
|
|
49
|
+
depth?: number;
|
|
50
|
+
sideOrientation?: number;
|
|
51
|
+
}, scene?: Nullable<Scene>): Nullable<Mesh>;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { Path2 } from "../../Maths/math.path.js";
|
|
2
|
+
import { Vector3 } from "../../Maths/math.vector.js";
|
|
3
|
+
import { Mesh } from "../mesh.js";
|
|
4
|
+
import { ExtrudePolygon } from "./polygonBuilder.js";
|
|
5
|
+
// Shape functions
|
|
6
|
+
class ShapePath {
|
|
7
|
+
/** Create the ShapePath used to support glyphs */
|
|
8
|
+
constructor(resolution) {
|
|
9
|
+
this._paths = [];
|
|
10
|
+
this._tempPaths = [];
|
|
11
|
+
this._holes = [];
|
|
12
|
+
this._resolution = resolution;
|
|
13
|
+
}
|
|
14
|
+
/** Move the virtual cursor to a coordinate */
|
|
15
|
+
moveTo(x, y) {
|
|
16
|
+
this._currentPath = new Path2(x, y);
|
|
17
|
+
this._tempPaths.push(this._currentPath);
|
|
18
|
+
}
|
|
19
|
+
/** Draw a line from the virtual cursor to a given coordinate */
|
|
20
|
+
lineTo(x, y) {
|
|
21
|
+
this._currentPath.addLineTo(x, y);
|
|
22
|
+
}
|
|
23
|
+
/** Create a quadratic curve from the virtual cursor to a given coordinate */
|
|
24
|
+
quadraticCurveTo(cpx, cpy, x, y) {
|
|
25
|
+
this._currentPath.addQuadraticCurveTo(cpx, cpy, x, y, this._resolution);
|
|
26
|
+
}
|
|
27
|
+
/** Create a bezier curve from the virtual cursor to a given coordinate */
|
|
28
|
+
bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y) {
|
|
29
|
+
this._currentPath.addBezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y, this._resolution);
|
|
30
|
+
}
|
|
31
|
+
/** Extract holes based on CW / CCW */
|
|
32
|
+
extractHoles() {
|
|
33
|
+
for (const path of this._tempPaths) {
|
|
34
|
+
if (path.area() > 0) {
|
|
35
|
+
this._holes.push(path);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this._paths.push(path);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!this._paths.length && this._holes.length) {
|
|
42
|
+
const temp = this._holes;
|
|
43
|
+
this._holes = this._paths;
|
|
44
|
+
this._paths = temp;
|
|
45
|
+
}
|
|
46
|
+
this._tempPaths.length = 0;
|
|
47
|
+
}
|
|
48
|
+
/** Gets the list of paths */
|
|
49
|
+
get paths() {
|
|
50
|
+
return this._paths;
|
|
51
|
+
}
|
|
52
|
+
/** Gets the list of holes */
|
|
53
|
+
get holes() {
|
|
54
|
+
return this._holes;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Utility functions
|
|
58
|
+
function CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData) {
|
|
59
|
+
const glyph = fontData.glyphs[char] || fontData.glyphs["?"];
|
|
60
|
+
if (!glyph) {
|
|
61
|
+
// return if there is no glyph data
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const shapePath = new ShapePath(resolution);
|
|
65
|
+
if (glyph.o) {
|
|
66
|
+
const outline = glyph.o.split(" ");
|
|
67
|
+
for (let i = 0, l = outline.length; i < l;) {
|
|
68
|
+
const action = outline[i++];
|
|
69
|
+
switch (action) {
|
|
70
|
+
case "m": {
|
|
71
|
+
// moveTo
|
|
72
|
+
const x = parseInt(outline[i++]) * scale + offsetX;
|
|
73
|
+
const y = parseInt(outline[i++]) * scale + offsetY;
|
|
74
|
+
shapePath.moveTo(x, y);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "l": {
|
|
78
|
+
// lineTo
|
|
79
|
+
const x = parseInt(outline[i++]) * scale + offsetX;
|
|
80
|
+
const y = parseInt(outline[i++]) * scale + offsetY;
|
|
81
|
+
shapePath.lineTo(x, y);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "q": {
|
|
85
|
+
// quadraticCurveTo
|
|
86
|
+
const cpx = parseInt(outline[i++]) * scale + offsetX;
|
|
87
|
+
const cpy = parseInt(outline[i++]) * scale + offsetY;
|
|
88
|
+
const cpx1 = parseInt(outline[i++]) * scale + offsetX;
|
|
89
|
+
const cpy1 = parseInt(outline[i++]) * scale + offsetY;
|
|
90
|
+
shapePath.quadraticCurveTo(cpx1, cpy1, cpx, cpy);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "b": {
|
|
94
|
+
// bezierCurveTo
|
|
95
|
+
const cpx = parseInt(outline[i++]) * scale + offsetX;
|
|
96
|
+
const cpy = parseInt(outline[i++]) * scale + offsetY;
|
|
97
|
+
const cpx1 = parseInt(outline[i++]) * scale + offsetX;
|
|
98
|
+
const cpy1 = parseInt(outline[i++]) * scale + offsetY;
|
|
99
|
+
const cpx2 = parseInt(outline[i++]) * scale + offsetX;
|
|
100
|
+
const cpy2 = parseInt(outline[i++]) * scale + offsetY;
|
|
101
|
+
shapePath.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Extract holes (based on clockwise data)
|
|
108
|
+
shapePath.extractHoles();
|
|
109
|
+
return { offsetX: glyph.ha * scale, shapePath: shapePath };
|
|
110
|
+
}
|
|
111
|
+
function CreateShapePaths(text, size, resolution, fontData) {
|
|
112
|
+
const chars = Array.from(text);
|
|
113
|
+
const scale = size / fontData.resolution;
|
|
114
|
+
const line_height = (fontData.boundingBox.yMax - fontData.boundingBox.yMin + fontData.underlineThickness) * scale;
|
|
115
|
+
const shapePaths = [];
|
|
116
|
+
let offsetX = 0, offsetY = 0;
|
|
117
|
+
for (let i = 0; i < chars.length; i++) {
|
|
118
|
+
const char = chars[i];
|
|
119
|
+
if (char === "\n") {
|
|
120
|
+
offsetX = 0;
|
|
121
|
+
offsetY -= line_height;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const ret = CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData);
|
|
125
|
+
if (ret) {
|
|
126
|
+
offsetX += ret.offsetX;
|
|
127
|
+
shapePaths.push(ret.shapePath);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return shapePaths;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Create a text mesh
|
|
135
|
+
* @param name defines the name of the mesh
|
|
136
|
+
* @param text defines the text to use to build the mesh
|
|
137
|
+
* @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)
|
|
138
|
+
* @param options defines options used to create the mesh
|
|
139
|
+
* @param scene defines the hosting scene
|
|
140
|
+
* @returns a new Mesh
|
|
141
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/text
|
|
142
|
+
*/
|
|
143
|
+
export function CreateText(name, text, fontData, options = {
|
|
144
|
+
size: 50,
|
|
145
|
+
resolution: 8,
|
|
146
|
+
depth: 1.0,
|
|
147
|
+
}, scene = null) {
|
|
148
|
+
// First we need to generate the paths
|
|
149
|
+
const shapePaths = CreateShapePaths(text, options.size || 50, options.resolution || 8, fontData);
|
|
150
|
+
// And extrude them
|
|
151
|
+
const meshes = [];
|
|
152
|
+
for (const shapePath of shapePaths) {
|
|
153
|
+
if (!shapePath.paths.length) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const holes = shapePath.holes.slice(); // Copy it as we will update the copy
|
|
157
|
+
for (const path of shapePath.paths) {
|
|
158
|
+
const holeVectors = [];
|
|
159
|
+
const shapeVectors = [];
|
|
160
|
+
const points = path.getPoints();
|
|
161
|
+
for (const point of points) {
|
|
162
|
+
shapeVectors.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane
|
|
163
|
+
}
|
|
164
|
+
// Holes
|
|
165
|
+
const localHolesCopy = holes.slice();
|
|
166
|
+
for (const hole of localHolesCopy) {
|
|
167
|
+
const points = hole.getPoints();
|
|
168
|
+
let found = false;
|
|
169
|
+
for (const point of points) {
|
|
170
|
+
if (path.isPointInside(point)) {
|
|
171
|
+
found = true;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (!found) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const holePoints = [];
|
|
179
|
+
for (const point of points) {
|
|
180
|
+
holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane
|
|
181
|
+
}
|
|
182
|
+
holeVectors.push(holePoints);
|
|
183
|
+
// Remove the hole as it was already used
|
|
184
|
+
holes.splice(holes.indexOf(hole), 1);
|
|
185
|
+
}
|
|
186
|
+
// Extrusion!
|
|
187
|
+
const mesh = ExtrudePolygon(name, {
|
|
188
|
+
shape: shapeVectors,
|
|
189
|
+
holes: holeVectors.length ? holeVectors : undefined,
|
|
190
|
+
depth: options.depth || 1.0,
|
|
191
|
+
sideOrientation: Mesh._GetDefaultSideOrientation(options.sideOrientation || Mesh.DOUBLESIDE),
|
|
192
|
+
}, scene);
|
|
193
|
+
meshes.push(mesh);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Then we can merge everyone into one single mesh
|
|
197
|
+
const newMesh = Mesh.MergeMeshes(meshes, true, true);
|
|
198
|
+
if (newMesh) {
|
|
199
|
+
// Move pivot to center
|
|
200
|
+
const bbox = newMesh === null || newMesh === void 0 ? void 0 : newMesh.getBoundingInfo();
|
|
201
|
+
newMesh.position.x = -(bbox === null || bbox === void 0 ? void 0 : bbox.boundingBox.extendSizeWorld._x);
|
|
202
|
+
newMesh.position.y = -(bbox === null || bbox === void 0 ? void 0 : bbox.boundingBox.extendSizeWorld._y);
|
|
203
|
+
newMesh.position.z = -(bbox === null || bbox === void 0 ? void 0 : bbox.boundingBox.extendSizeWorld._z);
|
|
204
|
+
newMesh.name = name;
|
|
205
|
+
newMesh.rotation.x = -Math.PI / 2;
|
|
206
|
+
newMesh.bakeCurrentTransformIntoVertices();
|
|
207
|
+
}
|
|
208
|
+
return newMesh;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=textBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textBuilder.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Meshes/Builders/textBuilder.ts"],"names":[],"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Ae,CAAC,EAAE,CAAA,CAAC;QAC3D,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAEpB,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAElC,OAAO,CAAC,gCAAgC,EAAE,CAAC;KAC9C;IAED,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import { Path2 } from \"../../Maths/math.path\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { ExtrudePolygon } from \"./polygonBuilder\";\r\n\r\n/**\r\n * Parser inspired by https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FontLoader.js\r\n */\r\n\r\n// Interfaces\r\n\r\n/**\r\n * Represents glyph data generated by http://gero3.github.io/facetype.js/\r\n */\r\nexport interface IGlyphData {\r\n /** Commands used to draw (line, move, curve, etc..) */\r\n o: string;\r\n\r\n /** Width */\r\n ha: number;\r\n}\r\n\r\n/**\r\n * Represents font data generated by http://gero3.github.io/facetype.js/\r\n */\r\nexport interface IFontData {\r\n /**\r\n * Font resolution\r\n */\r\n resolution: number;\r\n /** Underline tickness */\r\n underlineThickness: number;\r\n /** Bounding box */\r\n boundingBox: {\r\n yMax: number;\r\n yMin: number;\r\n };\r\n /** List of supported glyphs */\r\n glyphs: { [key: string]: IGlyphData };\r\n}\r\n\r\n// Shape functions\r\nclass ShapePath {\r\n private _paths: Path2[] = [];\r\n private _tempPaths: Path2[] = [];\r\n private _holes: Path2[] = [];\r\n private _currentPath: Path2;\r\n private _resolution: number;\r\n\r\n /** Create the ShapePath used to support glyphs */\r\n constructor(resolution: number) {\r\n this._resolution = resolution;\r\n }\r\n\r\n /** Move the virtual cursor to a coordinate */\r\n moveTo(x: number, y: number) {\r\n this._currentPath = new Path2(x, y);\r\n this._tempPaths.push(this._currentPath);\r\n }\r\n\r\n /** Draw a line from the virtual cursor to a given coordinate */\r\n lineTo(x: number, y: number) {\r\n this._currentPath.addLineTo(x, y);\r\n }\r\n\r\n /** Create a quadratic curve from the virtual cursor to a given coordinate */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number) {\r\n this._currentPath.addQuadraticCurveTo(cpx, cpy, x, y, this._resolution);\r\n }\r\n\r\n /** Create a bezier curve from the virtual cursor to a given coordinate */\r\n bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number) {\r\n this._currentPath.addBezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y, this._resolution);\r\n }\r\n\r\n /** Extract holes based on CW / CCW */\r\n extractHoles() {\r\n for (const path of this._tempPaths) {\r\n if (path.area() > 0) {\r\n this._holes.push(path);\r\n } else {\r\n this._paths.push(path);\r\n }\r\n }\r\n\r\n if (!this._paths.length && this._holes.length) {\r\n const temp = this._holes;\r\n this._holes = this._paths;\r\n this._paths = temp;\r\n }\r\n\r\n this._tempPaths.length = 0;\r\n }\r\n\r\n /** Gets the list of paths */\r\n get paths() {\r\n return this._paths;\r\n }\r\n\r\n /** Gets the list of holes */\r\n get holes() {\r\n return this._holes;\r\n }\r\n}\r\n\r\n// Utility functions\r\nfunction CreateShapePath(\r\n char: string,\r\n scale: number,\r\n offsetX: number,\r\n offsetY: number,\r\n resolution: number,\r\n fontData: IFontData\r\n): Nullable<{\r\n offsetX: number;\r\n shapePath: ShapePath;\r\n}> {\r\n const glyph = fontData.glyphs[char] || fontData.glyphs[\"?\"];\r\n\r\n if (!glyph) {\r\n // return if there is no glyph data\r\n return null;\r\n }\r\n\r\n const shapePath = new ShapePath(resolution);\r\n\r\n if (glyph.o) {\r\n const outline = glyph.o.split(\" \");\r\n\r\n for (let i = 0, l = outline.length; i < l; ) {\r\n const action = outline[i++];\r\n\r\n switch (action) {\r\n case \"m\": {\r\n // moveTo\r\n const x = parseInt(outline[i++]) * scale + offsetX;\r\n const y = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.moveTo(x, y);\r\n break;\r\n }\r\n case \"l\": {\r\n // lineTo\r\n const x = parseInt(outline[i++]) * scale + offsetX;\r\n const y = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.lineTo(x, y);\r\n break;\r\n }\r\n case \"q\": {\r\n // quadraticCurveTo\r\n const cpx = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.quadraticCurveTo(cpx1, cpy1, cpx, cpy);\r\n break;\r\n }\r\n case \"b\": {\r\n // bezierCurveTo\r\n const cpx = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx2 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy2 = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Extract holes (based on clockwise data)\r\n shapePath.extractHoles();\r\n\r\n return { offsetX: glyph.ha * scale, shapePath: shapePath };\r\n}\r\n\r\nfunction CreateShapePaths(text: string, size: number, resolution: number, fontData: IFontData) {\r\n const chars = Array.from(text);\r\n const scale = size / fontData.resolution;\r\n const line_height = (fontData.boundingBox.yMax - fontData.boundingBox.yMin + fontData.underlineThickness) * scale;\r\n\r\n const shapePaths: ShapePath[] = [];\r\n\r\n let offsetX = 0,\r\n offsetY = 0;\r\n\r\n for (let i = 0; i < chars.length; i++) {\r\n const char = chars[i];\r\n\r\n if (char === \"\\n\") {\r\n offsetX = 0;\r\n offsetY -= line_height;\r\n } else {\r\n const ret = CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData);\r\n\r\n if (ret) {\r\n offsetX += ret.offsetX;\r\n shapePaths.push(ret.shapePath);\r\n }\r\n }\r\n }\r\n\r\n return shapePaths;\r\n}\r\n\r\n/**\r\n * Create a text mesh\r\n * @param name defines the name of the mesh\r\n * @param text defines the text to use to build the mesh\r\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\r\n * @param options defines options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/text\r\n */\r\nexport function CreateText(\r\n name: string,\r\n text: string,\r\n fontData: IFontData,\r\n options: {\r\n size?: number;\r\n resolution?: number;\r\n depth?: number;\r\n sideOrientation?: number;\r\n } = {\r\n size: 50,\r\n resolution: 8,\r\n depth: 1.0,\r\n },\r\n scene: Nullable<Scene> = null\r\n): Nullable<Mesh> {\r\n // First we need to generate the paths\r\n const shapePaths = CreateShapePaths(text, options.size || 50, options.resolution || 8, fontData);\r\n\r\n // And extrude them\r\n const meshes: Mesh[] = [];\r\n for (const shapePath of shapePaths) {\r\n if (!shapePath.paths.length) {\r\n continue;\r\n }\r\n\r\n const holes = shapePath.holes.slice(); // Copy it as we will update the copy\r\n for (const path of shapePath.paths) {\r\n const holeVectors: Vector3[][] = [];\r\n const shapeVectors: Vector3[] = [];\r\n const points = path.getPoints();\r\n for (const point of points) {\r\n shapeVectors.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n\r\n // Holes\r\n const localHolesCopy = holes.slice();\r\n for (const hole of localHolesCopy) {\r\n const points = hole.getPoints();\r\n\r\n let found = false;\r\n for (const point of points) {\r\n if (path.isPointInside(point)) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n continue;\r\n }\r\n\r\n const holePoints: Vector3[] = [];\r\n for (const point of points) {\r\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n holeVectors.push(holePoints);\r\n\r\n // Remove the hole as it was already used\r\n holes.splice(holes.indexOf(hole), 1);\r\n }\r\n\r\n // Extrusion!\r\n const mesh = ExtrudePolygon(\r\n name,\r\n {\r\n shape: shapeVectors,\r\n holes: holeVectors.length ? holeVectors : undefined,\r\n depth: options.depth || 1.0,\r\n sideOrientation: Mesh._GetDefaultSideOrientation(options.sideOrientation || Mesh.DOUBLESIDE),\r\n },\r\n scene\r\n );\r\n meshes.push(mesh);\r\n }\r\n }\r\n\r\n // Then we can merge everyone into one single mesh\r\n const newMesh = Mesh.MergeMeshes(meshes, true, true);\r\n\r\n if (newMesh) {\r\n // Move pivot to center\r\n const bbox = newMesh?.getBoundingInfo();\r\n newMesh.position.x = -bbox?.boundingBox.extendSizeWorld._x;\r\n newMesh.position.y = -bbox?.boundingBox.extendSizeWorld._y;\r\n newMesh.position.z = -bbox?.boundingBox.extendSizeWorld._z;\r\n newMesh.name = name;\r\n\r\n newMesh.rotation.x = -Math.PI / 2;\r\n\r\n newMesh.bakeCurrentTransformIntoVertices();\r\n }\r\n\r\n return newMesh;\r\n}\r\n"]}
|
package/Meshes/meshBuilder.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { CreateDecal } from "./Builders/decalBuilder";
|
|
|
20
20
|
import { CreateCapsule } from "./Builders/capsuleBuilder";
|
|
21
21
|
import { CreateGeodesic } from "./Builders/geodesicBuilder";
|
|
22
22
|
import { CreateGoldberg } from "./Builders/goldbergBuilder";
|
|
23
|
+
import { CreateText } from "./Builders/textBuilder";
|
|
23
24
|
/**
|
|
24
25
|
* Class containing static functions to help procedurally build meshes
|
|
25
26
|
*/
|
|
@@ -52,4 +53,5 @@ export declare const MeshBuilder: {
|
|
|
52
53
|
CreateGoldberg: typeof CreateGoldberg;
|
|
53
54
|
CreateDecal: typeof CreateDecal;
|
|
54
55
|
CreateCapsule: typeof CreateCapsule;
|
|
56
|
+
CreateText: typeof CreateText;
|
|
55
57
|
};
|
package/Meshes/meshBuilder.js
CHANGED
|
@@ -21,6 +21,7 @@ import { CreateDecal } from "./Builders/decalBuilder.js";
|
|
|
21
21
|
import { CreateCapsule } from "./Builders/capsuleBuilder.js";
|
|
22
22
|
import { CreateGeodesic } from "./Builders/geodesicBuilder.js";
|
|
23
23
|
import { CreateGoldberg } from "./Builders/goldbergBuilder.js";
|
|
24
|
+
import { CreateText } from "./Builders/textBuilder.js";
|
|
24
25
|
/**
|
|
25
26
|
* Class containing static functions to help procedurally build meshes
|
|
26
27
|
*/
|
|
@@ -53,5 +54,6 @@ export const MeshBuilder = {
|
|
|
53
54
|
CreateGoldberg,
|
|
54
55
|
CreateDecal,
|
|
55
56
|
CreateCapsule,
|
|
57
|
+
CreateText,
|
|
56
58
|
};
|
|
57
59
|
//# sourceMappingURL=meshBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshBuilder.js","sourceRoot":"","sources":["../../../../lts/core/generated/Meshes/meshBuilder.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;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EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,SAAS;IACT,cAAc;IACd,YAAY;IACZ,UAAU;IACV,eAAe;IACf,YAAY;IACZ,cAAc;IACd,WAAW;IACX,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,kBAAkB;IAClB,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,yBAAyB;IACzB,aAAa;IACb,cAAc;IACd,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,WAAW;IACX,aAAa;IACb,UAAU;CACb,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { CreateRibbon } from \"./Builders/ribbonBuilder\";\r\nimport { CreateDisc } from \"./Builders/discBuilder\";\r\nimport { CreateBox } from \"./Builders/boxBuilder\";\r\nimport { CreateTiledBox } from \"./Builders/tiledBoxBuilder\";\r\nimport { CreateSphere } from \"./Builders/sphereBuilder\";\r\nimport { CreateCylinder } from \"./Builders/cylinderBuilder\";\r\nimport { CreateTorus } from \"./Builders/torusBuilder\";\r\nimport { CreateTorusKnot } from \"./Builders/torusKnotBuilder\";\r\nimport { CreateDashedLines, CreateLineSystem, CreateLines } from \"./Builders/linesBuilder\";\r\nimport { CreatePolygon, ExtrudePolygon } from \"./Builders/polygonBuilder\";\r\nimport { ExtrudeShape, ExtrudeShapeCustom } from \"./Builders/shapeBuilder\";\r\nimport { CreateLathe } from \"./Builders/latheBuilder\";\r\nimport { CreatePlane } from \"./Builders/planeBuilder\";\r\nimport { CreateTiledPlane } from \"./Builders/tiledPlaneBuilder\";\r\nimport { CreateGround, CreateGroundFromHeightMap, CreateTiledGround } from \"./Builders/groundBuilder\";\r\nimport { CreateTube } from \"./Builders/tubeBuilder\";\r\nimport { CreatePolyhedron } from \"./Builders/polyhedronBuilder\";\r\nimport { CreateIcoSphere } from \"./Builders/icoSphereBuilder\";\r\nimport { CreateDecal } from \"./Builders/decalBuilder\";\r\nimport { CreateCapsule } from \"./Builders/capsuleBuilder\";\r\nimport { CreateGeodesic } from \"./Builders/geodesicBuilder\";\r\nimport { CreateGoldberg } from \"./Builders/goldbergBuilder\";\r\nimport { CreateText } from \"./Builders/textBuilder\";\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nexport const MeshBuilder = {\r\n CreateBox,\r\n CreateTiledBox,\r\n CreateSphere,\r\n CreateDisc,\r\n CreateIcoSphere,\r\n CreateRibbon,\r\n CreateCylinder,\r\n CreateTorus,\r\n CreateTorusKnot,\r\n CreateLineSystem,\r\n CreateLines,\r\n CreateDashedLines,\r\n ExtrudeShape,\r\n ExtrudeShapeCustom,\r\n CreateLathe,\r\n CreateTiledPlane,\r\n CreatePlane,\r\n CreateGround,\r\n CreateTiledGround,\r\n CreateGroundFromHeightMap,\r\n CreatePolygon,\r\n ExtrudePolygon,\r\n CreateTube,\r\n CreatePolyhedron,\r\n CreateGeodesic,\r\n CreateGoldberg,\r\n CreateDecal,\r\n CreateCapsule,\r\n CreateText,\r\n};\r\n"]}
|