SkyMeshDesc
SkyMeshDescクラスは、大気散乱による空と太陽・月を描画するメッシュです。物理ベースの大気散乱シミュレーションを使用して、リアルな空の表現を提供します。
太陽と月の位置は view.atmosphere.date に基づいて自動的に計算され、毎フレーム更新されます。
以下のプロパティに加えて、基底クラスの共通プロパティ(position、rotation、scale、matrix、matrixWorld、geodetic、visible)が利用できます。詳細は MeshDesc を参照してください。
Properties
Section titled “Properties”visible
Section titled “visible”Type: boolean
Description: スカイメッシュの表示/非表示を切り替えます。
Example:
{ visible: true }Type: boolean
Description: 太陽を表示するかどうかを指定します。
Default: true
Example:
{ sky: { sun: true, }}Type: boolean
Description: 月を表示するかどうかを指定します。
Default: true
Example:
{ sky: { moon: true, }}moonScale
Section titled “moonScale”Type: number
Description: 月のスケールを指定します。
Default: 1
Example:
{ sky: { moonScale: 1.5, }}moonIntensity
Section titled “moonIntensity”Type: number
Description: 月の明るさを指定します。
Default: 1
Example:
{ sky: { moonIntensity: 0.8, }}sunAngularRadius
Section titled “sunAngularRadius”Type: number
Description: 太陽の視角半径をラジアンで指定します。
Default: 0.004675
Example:
{ sky: { sunAngularRadius: 0.005, }}envMap
Section titled “envMap”Type: boolean
Description: 環境マップとしてレンダリングするかどうかを指定します。
Default: false
Example:
{ sky: { envMap: true, }}Usage Examples
Section titled “Usage Examples”import ThreeView from "@navaramap/three";import { SkyMeshDesc } from "@navaramap/three-default-descs";
const view = new ThreeView();view.registerMesh("sky", SkyMeshDesc);await view.init();
// SkyMeshDescを追加const skyDesc = view.addMesh<SkyMeshDesc>({ sky: { visible: true, sun: true, moon: true, moonScale: 1.2, moonIntensity: 0.9, sunAngularRadius: 0.004675, },});SkyMeshDescは、@takram/three-atmosphereライブラリを使用して実装されており、以下の機能を提供します:
- 物理ベースの大気散乱シミュレーション
- 太陽と月の位置に基づく動的なライティング
- 時刻に応じた空の色の変化
- 大気の影の長さの計算
スカイメッシュは、カメラの向きに応じて自動的に更新され、常にビューポート全体を覆います。