コンテンツにスキップ

StarsDesc

StarsDescクラスは、星空を描画するメッシュです。実際の天体カタログに基づいたポイントスプライトを使用して、リアルな星空を表現します。

星の位置は view.atmosphere.date に基づいて地球の自転が考慮され、太陽の位置によって可視性が自動調整されます。

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

Type: boolean

Description: 星の表示/非表示を切り替えます。

Default: true

Example:

{ visible: true }

Type: number

Description: 星のポイントサイズを指定します。

Default: 1

Example:

{
stars: {
pointSize: 1.5,
}
}

Type: number

Description: 星の明るさの強度を指定します。

Default: 10

Example:

{
stars: {
intensity: 15,
}
}

Type: boolean

Description: 背景として表示するかどうかを指定します。

Default: true

Example:

{
stars: {
background: true,
}
}

Type: string

Description: 星のデータファイルのURLを指定します。

Example:

{
stars: {
assetsUrl: "https://example.com/stars.bin",
}
}
import ThreeView from "@navaramap/three";
import { StarsDesc } from "@navaramap/three-default-descs";
const view = new ThreeView();
view.registerMesh("stars", StarsDesc);
await view.init();
// StarsDescを追加
const starsDesc = view.addMesh<StarsDesc>({
stars: {
visible: true,
pointSize: 1.2,
intensity: 12,
background: true,
},
});

StarsDescは、@takram/three-atmosphereライブラリを使用して実装されており、以下の機能を提供します:

  • 実際の天体カタログデータに基づく星の配置
  • 太陽の位置に基づく星の可視性の自動調整
  • 地球の自転に基づく星の回転
  • 大気の影響を考慮した星の明るさの調整

星のデータは非同期で読み込まれ、読み込みが完了するとシーンに追加されます。