SphereMeshDesc
SphereMeshDescクラスは、球体(Sphere)ジオメトリを描画するためのメッシュです。半径や分割数などを指定して球体を作成できます。
以下のプロパティに加えて、基底クラスの共通プロパティ(position、rotation、scale、matrix、matrixWorld、geodetic、pickable、visible)が利用できます。詳細は MeshDesc を参照してください。
Properties
Section titled “Properties”radius
Section titled “radius”Type: number
Description: 球体の半径を指定します。
Default: 1
Example:
{ sphere: { radius: 100, }}widthSegments
Section titled “widthSegments”Type: number
Description: 横方向(水平)のセグメント数を指定します。
Default: 32
Example:
{ sphere: { widthSegments: 64, }}heightSegments
Section titled “heightSegments”Type: number
Description: 縦方向(垂直)のセグメント数を指定します。
Default: 16
Example:
{ sphere: { heightSegments: 32, }}phiStart
Section titled “phiStart”Type: number
Description: 水平方向の開始角度をラジアンで指定します。
Default: 0
Example:
{ sphere: { phiStart: Math.PI / 4, }}phiLength
Section titled “phiLength”Type: number
Description: 水平方向の中心角をラジアンで指定します。
Default: Math.PI * 2
Example:
{ sphere: { phiLength: Math.PI, }}thetaStart
Section titled “thetaStart”Type: number
Description: 垂直方向の開始角度をラジアンで指定します。
Default: 0
Example:
{ sphere: { thetaStart: Math.PI / 6, }}thetaLength
Section titled “thetaLength”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), }}castShadow
Section titled “castShadow”Type: boolean
Description: 球体が影を投影するかどうかを指定します。
Default: false
Example:
{ sphere: { castShadow: true, }}receiveShadow
Section titled “receiveShadow”Type: boolean
Description: 球体が影を受けるかどうかを指定します。
Default: false
Example:
{ sphere: { receiveShadow: true, }}emissiveColor
Section titled “emissiveColor”Type: Color
Description: 球体の発光色をColorインスタンスで指定します。
Default: new Color().setHex(0x000000)
Example:
import { Color } from "@navaramap/three";
{ sphere: { emissiveColor: new Color().setHex(0xff0000), }}emissiveIntensity
Section titled “emissiveIntensity”Type: number
Description: 発光の強度を指定します。
Default: 0
Example:
{ sphere: { emissiveIntensity: 1.0, }}opacity
Section titled “opacity”Type: number
Description: 球体の不透明度を0.0から1.0の範囲で指定します。transparentをtrueに設定する必要があります。
Default: 1
Example:
{ sphere: { opacity: 0.5, transparent: true, }}transparent
Section titled “transparent”Type: boolean
Description: 球体を半透明にするかどうかを指定します。
Default: false
Example:
{ sphere: { transparent: true, opacity: 0.5, }}Config
Section titled “Config”effectIds
Section titled “effectIds”Type: string[] (optional)
Description: このメッシュに適用するセレクティブエフェクトIDの配列を指定します。
Example:
{ sphere: { effectIds: ["bloom-effect", "outline-effect"], }}Usage Examples
Section titled “Usage Examples”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 },});