Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THREE.TextGeometry: .height -> .depth #27949

Merged
merged 2 commits into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/examples/en/geometries/TextGeometry.html
Expand Up @@ -38,7 +38,7 @@ <h2>Code Example</h2>
const geometry = new TextGeometry( 'Hello three.js!', {
font: font,
size: 80,
height: 5,
depth: 5,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 10,
Expand All @@ -64,7 +64,7 @@ <h3>[name]([param:String text], [param:Object parameters])</h3>
<ul>
<li>font — an instance of THREE.Font.</li>
<li>size — Float. Size of the text. Default is 100.</li>
<li>height — Float. Thickness to extrude text. Default is 50.</li>
<li>depth — Float. Thickness to extrude text. Default is 50.</li>
<li>curveSegments — Integer. Number of points on the curves. Default is 12.</li>
<li>bevelEnabled — Boolean. Turn on bevel. Default is False.</li>
<li>bevelThickness — Float. How deep into text bevel goes. Default is 10.</li>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/zh/geometries/TextGeometry.html
Expand Up @@ -38,7 +38,7 @@ <h2>代码示例</h2>
const geometry = new TextGeometry( 'Hello three.js!', {
font: font,
size: 80,
height: 5,
depth: 5,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 10,
Expand All @@ -63,7 +63,7 @@ <h3>[name]([param:String text], [param:Object parameters])</h3>
<ul>
<li>font — THREE.Font的实例。</li>
<li>size — Float。字体大小,默认值为100。</li>
<li>height — Float。挤出文本的厚度。默认值为50。</li>
<li>depth — Float。挤出文本的厚度。默认值为50。</li>
<li>curveSegments — Integer。(表示文本的)曲线上点的数量。默认值为12。</li>
<li>bevelEnabled — Boolean。是否开启斜角,默认为false。</li>
<li>bevelThickness — Float。文本上斜角的深度,默认值为20。</li>
Expand Down
12 changes: 10 additions & 2 deletions examples/jsm/geometries/TextGeometry.js
Expand Up @@ -5,7 +5,7 @@
* font: <THREE.Font>, // font
*
* size: <float>, // size of the text
* height: <float>, // thickness to extrude text
* depth: <float>, // thickness to extrude text
* curveSegments: <int>, // number of points on the curves
*
* bevelEnabled: <bool>, // turn on bevel
Expand Down Expand Up @@ -35,7 +35,15 @@ class TextGeometry extends ExtrudeGeometry {

// translate parameters to ExtrudeGeometry API

parameters.depth = parameters.height !== undefined ? parameters.height : 50;
if ( parameters.depth === undefined && parameters.height !== undefined ) {

console.warn( 'THREE.TextGeometry: .height is now depreciated. Please use .depth instead' ); // @deprecated, r163

}

parameters.depth = parameters.depth !== undefined ?
parameters.depth : parameters.height !== undefined ?
parameters.height : 50;

// defaults

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_camera_logarithmicdepthbuffer.html
Expand Up @@ -189,7 +189,7 @@
const labelgeo = new TextGeometry( labeldata[ i ].label, {
font: font,
size: labeldata[ i ].size,
height: labeldata[ i ].size / 2
depth: labeldata[ i ].size / 2
} );

labelgeo.computeBoundingSphere();
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_custom_attributes_lines.html
Expand Up @@ -110,7 +110,7 @@
font: font,

size: 50,
height: 15,
depth: 15,
curveSegments: 10,

bevelThickness: 5,
Expand Down
6 changes: 3 additions & 3 deletions examples/webgl_geometry_text.html
Expand Up @@ -50,7 +50,7 @@
fontName = 'optimer', // helvetiker, optimer, gentilis, droid sans, droid serif
fontWeight = 'bold'; // normal bold

const height = 20,
const depth = 20,
size = 70,
hover = 30,

Expand Down Expand Up @@ -298,7 +298,7 @@
font: font,

size: size,
height: height,
depth: depth,
curveSegments: curveSegments,

bevelThickness: bevelThickness,
Expand Down Expand Up @@ -328,7 +328,7 @@

textMesh2.position.x = centerOffset;
textMesh2.position.y = - hover;
textMesh2.position.z = height;
textMesh2.position.z = depth;

textMesh2.rotation.x = Math.PI;
textMesh2.rotation.y = Math.PI * 2;
Expand Down
6 changes: 3 additions & 3 deletions examples/webgl_loader_ttf.html
Expand Up @@ -35,7 +35,7 @@
let firstLetter = true;

let text = 'three.js';
const height = 20,
const depth = 20,
size = 70,
hover = 30,
curveSegments = 4,
Expand Down Expand Up @@ -193,7 +193,7 @@
font: font,

size: size,
height: height,
depth: depth,
curveSegments: curveSegments,

bevelThickness: bevelThickness,
Expand Down Expand Up @@ -224,7 +224,7 @@

textMesh2.position.x = centerOffset;
textMesh2.position.y = - hover;
textMesh2.position.z = height;
textMesh2.position.z = depth;

textMesh2.rotation.x = Math.PI;
textMesh2.rotation.y = Math.PI * 2;
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_materials_toon.html
Expand Up @@ -119,7 +119,7 @@
font: font,

size: 20,
height: 1,
depth: 1,
curveSegments: 1

} );
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_modifier_curve.html
Expand Up @@ -110,7 +110,7 @@
const geometry = new TextGeometry( 'Hello three.js!', {
font: font,
size: 0.2,
height: 0.05,
depth: 0.05,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.02,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_modifier_curve_instanced.html
Expand Up @@ -123,7 +123,7 @@
const geometry = new TextGeometry( 'Hello three.js!', {
font: font,
size: 0.2,
height: 0.05,
depth: 0.05,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.02,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_modifier_tessellation.html
Expand Up @@ -105,7 +105,7 @@
font: font,

size: 40,
height: 5,
depth: 5,
curveSegments: 3,

bevelThickness: 2,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_shadowmap.html
Expand Up @@ -203,7 +203,7 @@
font: font,

size: 200,
height: 50,
depth: 50,
curveSegments: 12,

bevelThickness: 2,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_shadowmap_performance.html
Expand Up @@ -173,7 +173,7 @@
font: font,

size: 200,
height: 50,
depth: 50,
curveSegments: 12,

bevelThickness: 2,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu_camera_logarithmicdepthbuffer.html
Expand Up @@ -201,7 +201,7 @@
const labelgeo = new TextGeometry( labeldata[ i ].label, {
font: font,
size: labeldata[ i ].size,
height: labeldata[ i ].size / 2
depth: labeldata[ i ].size / 2
} );

labelgeo.computeBoundingSphere();
Expand Down
2 changes: 1 addition & 1 deletion manual/en/primitives.html
Expand Up @@ -192,7 +192,7 @@ <h1>Primitives</h1>
const geometry = new TextGeometry('three.js', {
font: font,
size: 3.0,
height: .2,
depth: .2,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.15,
Expand Down
2 changes: 1 addition & 1 deletion manual/examples/primitives-text.html
Expand Up @@ -124,7 +124,7 @@
const geometry = new TextGeometry( 'three.js', {
font: font,
size: 3.0,
height: .2,
depth: .2,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.15,
Expand Down
2 changes: 1 addition & 1 deletion manual/examples/primitives.html
Expand Up @@ -361,7 +361,7 @@
const geometry = new TextGeometry( 'three.js', {
font: font,
size: 3.0,
height: .2,
depth: .2,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.15,
Expand Down
2 changes: 1 addition & 1 deletion manual/fr/primitives.html
Expand Up @@ -201,7 +201,7 @@ <h1>Primitives de </h1>
const geometry = new TextGeometry('three.js', {
font: font,
size: 3.0,
height: .2,
depth: .2,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.15,
Expand Down
2 changes: 1 addition & 1 deletion manual/ja/primitives.html
Expand Up @@ -169,7 +169,7 @@ <h1>のプリミティブ</h1>
const geometry = new TextGeometry('three.js', {
font: font,
size: 3.0,
height: .2,
depth: .2,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 0.15,
Expand Down
8 changes: 4 additions & 4 deletions manual/resources/threejs-primitives.js
Expand Up @@ -538,7 +538,7 @@ return geometry;
ui: {
text: { type: 'text', maxLength: 30, },
size: { type: 'range', min: 1, max: 10, precision: 1, },
height: { type: 'range', min: 1, max: 10, precision: 1, },
depth: { type: 'range', min: 1, max: 10, precision: 1, },
curveSegments: { type: 'range', min: 1, max: 20, },
// font', fonts ).onChange( generateGeometry );
// weight', weights ).onChange( generateGeometry );
Expand All @@ -548,7 +548,7 @@ return geometry;
bevelSegments: { type: 'range', min: 0, max: 8, },
},
addConstCode: false,
create( text = 'three.js', size = 3, height = 0.2, curveSegments = 12, bevelEnabled = true, bevelThickness = 0.15, bevelSize = 0.3, bevelSegments = 5 ) {
create( text = 'three.js', size = 3, depth = 0.2, curveSegments = 12, bevelEnabled = true, bevelThickness = 0.15, bevelSize = 0.3, bevelSegments = 5 ) {

return new Promise( ( resolve ) => {

Expand All @@ -557,7 +557,7 @@ return geometry;
resolve( new TextGeometry( text, {
font: font,
size,
height,
depth,
curveSegments,
bevelEnabled,
bevelThickness,
Expand All @@ -578,7 +578,7 @@ loader.load('../resources/threejs/fonts/helvetiker_regular.typeface.json', (font
const geometry = new THREE.TextGeometry(text, {
font: font,
size: 3, // ui: size
height: 0.2, // ui: height
depth: 0.2, // ui: depth
curveSegments: 12, // ui: curveSegments
bevelEnabled: true, // ui: bevelEnabled
bevelThickness: 0.15, // ui: bevelThickness
Expand Down