コンテンツにスキップ

SphereMeshDesc

SphereMeshDescクラスは、球体(Sphere)ジオメトリを描画するためのメッシュです。半径や分割数などを指定して球体を作成できます。

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

Type: number

Description: 球体の半径を指定します。

Default: 1

Example:

{
sphere: {
radius: 100,
}
}

Type: number

Description: 横方向(水平)のセグメント数を指定します。

Default: 32

Example:

{
sphere: {
widthSegments: 64,
}
}

Type: number

Description: 縦方向(垂直)のセグメント数を指定します。

Default: 16

Example:

{
sphere: {
heightSegments: 32,
}
}

Type: number

Description: 水平方向の開始角度をラジアンで指定します。

Default: 0

Example:

{
sphere: {
phiStart: Math.PI / 4,
}
}

Type: number

Description: 水平方向の中心角をラジアンで指定します。

Default: Math.PI * 2

Example:

{
sphere: {
phiLength: Math.PI,
}
}

Type: number

Description: 垂直方向の開始角度をラジアンで指定します。

Default: 0

Example:

{
sphere: {
thetaStart: Math.PI / 6,
}
}

Type: number

Description: 垂直方向の中心角をラジアンで指定します。

Default: Math.PI

Example:

{
sphere: {
thetaLength: Math.PI / 2,
}
}

Type: Color

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

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

Example:

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

Type: boolean

Description: 球体が影を投影するかどうかを指定します。

Default: false

Example:

{
sphere: {
castShadow: true,
}
}

Type: boolean

Description: 球体が影を受けるかどうかを指定します。

Default: false

Example:

{
sphere: {
receiveShadow: true,
}
}

Type: Color

Description: 球体の発光色をColorインスタンスで指定します。

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

Example:

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

Type: number

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

Default: 0

Example:

{
sphere: {
emissiveIntensity: 1.0,
}
}

Type: number

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

Default: 1

Example:

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

Type: boolean

Description: 球体を半透明にするかどうかを指定します。

Default: false

Example:

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

Type: string[] (optional)

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

Example:

{
sphere: {
effectIds: ["bloom-effect", "outline-effect"],
}
}
import ThreeView, { Color } from "@navaramap/three";
import { SphereMeshDesc } from "@navaramap/three-default-descs";
const view = new ThreeView();
view.registerMesh("sphere", SphereMeshDesc);
await view.init();
// SphereMeshDescを追加
const sphereDesc = view.addMesh<SphereMeshDesc>({
sphere: {
radius: 100,
widthSegments: 32,
heightSegments: 16,
color: new Color().setHex(0xff0000),
castShadow: true,
},
position: { x: 0, y: 0, z: 1000 },
});