コンテンツにスキップ

TubeMeshDesc

TubeMeshDescクラスは、チューブ(Tube)ジオメトリを描画するためのメッシュです。カトマル・ロム曲線に沿ったチューブ形状を作成できます。

以下のプロパティに加えて、基底クラスの共通プロパティ(positionrotationscalematrixmatrixWorldgeodeticpickablevisible)が利用できます。詳細は MeshDesc を参照してください。

Type: XYZ[]

Description: チューブの経路を定義する3D座標の配列を指定します。最低2点が必要です。

Example:

{
tube: {
points: [
{ x: 0, y: 0, z: 0 },
{ x: 100, y: 50, z: 0 },
{ x: 200, y: 0, z: 0 }
],
}
}

Type: number

Description: チューブの長さ方向のセグメント数を指定します。

Default: 64

Example:

{
tube: {
tubularSegments: 128,
}
}

Type: number

Description: チューブの半径を指定します。

Default: 1

Example:

{
tube: {
radius: 10,
}
}

Type: number

Description: チューブの円周方向のセグメント数を指定します。

Default: 8

Example:

{
tube: {
radialSegments: 16,
}
}

Type: boolean

Description: チューブを閉じた形状にするかどうかを指定します。

Default: false

Example:

{
tube: {
closed: true,
}
}

Type: number

Description: カトマル・ロム曲線の張力を指定します。0に近いほど直線的になります。

Default: 0.5

Example:

{
tube: {
tension: 0.8,
}
}

Type: Color

Description: チューブの色をColorインスタンスで指定します。Colorクラスは16進数カラーコードやCSS形式の色指定をサポートします。

Default: new Color().setStyle("#ffffff")

Example:

import { Color } from "@navaramap/three";
{
tube: {
color: new Color().setHex(0xff8800),
}
}

Type: boolean | undefined

Description: チューブが影を投影するかどうかを指定します。

Default: false

Example:

{
tube: {
castShadow: true,
}
}

Type: boolean | undefined

Description: チューブが影を受けるかどうかを指定します。

Default: false

Example:

{
tube: {
receiveShadow: true,
}
}

Type: Color

Description: チューブの発光色をColorインスタンスで指定します。

Default: new Color().setHex(0x000000)

Example:

import { Color } from "@navaramap/three";
{
tube: {
emissiveColor: new Color().setHex(0xff8800),
}
}

Type: number

Description: 発光の強度を指定します。

Default: 0

Example:

{
tube: {
emissiveIntensity: 1.0,
}
}

Type: number

Description: チューブの不透明度を0.0から1.0の範囲で指定します。transparenttrueに設定する必要があります。

Default: 1

Example:

{
tube: {
opacity: 0.5,
transparent: true,
}
}

Type: boolean

Description: チューブを半透明にするかどうかを指定します。

Default: false

Example:

{
tube: {
transparent: true,
opacity: 0.5,
}
}

Type: string[] (optional)

Description: このメッシュに適用するセレクティブエフェクトIDの配列を指定します。

Example:

{
tube: {
effectIds: ["bloom-effect", "outline-effect"],
}
}
import ThreeView, { Color } from "@navaramap/three";
import { TubeMeshDesc } from "@navaramap/three-default-descs";
const view = new ThreeView();
view.registerMesh("tube", TubeMeshDesc);
await view.init();
// TubeMeshDescを追加
const tubeDesc = view.addMesh<TubeMeshDesc>({
tube: {
points: [
{ x: 0, y: 0, z: 1000 },
{ x: 100, y: 50, z: 1100 },
{ x: 200, y: -50, z: 1000 },
{ x: 300, y: 0, z: 1000 },
],
radius: 10,
tubularSegments: 128,
radialSegments: 16,
color: new Color().setHex(0xff8800),
tension: 0.5,
},
});