SnowMeshDesc
The SnowMeshDesc class is a mesh descriptor that displays snow particle effects. It creates realistic snowfall effects using texture-based point sprites.
In addition to the properties below, the common properties from the base class (position, rotation, scale, matrix, matrixWorld, visible) are available. See MeshDesc for details.
Common Properties
Section titled “Common Properties”position
Section titled “position”Type: { x: number, y: number, z: number } | Vector3
Description: Specifies the center position of the snow particle effect in the ECEF coordinate system. You can convert from latitude/longitude using the geodeticToVector3 function.
Example:
import { geodeticToVector3, degreeToRadian, LLE } from "@navaramap/three";
const position = geodeticToVector3( new LLE( degreeToRadian(35.67564356091717), // Latitude degreeToRadian(139.74511454748298), // Longitude 10, // Altitude ),);
{ position: position, snow: { ... }}visible
Section titled “visible”Type: boolean
Description: Controls the visibility of the object.
Default: true
Example:
{ visible: false, snow: { ... }}Snow Properties
Section titled “Snow Properties”particleCount
Section titled “particleCount”Type: number
Description: Specifies the number of snowflake particles.
Default: 30000
Example:
{ snow: { particleCount: 3000, }}radius
Section titled “radius”Type: number
Description: Specifies the distribution radius of the snow.
Default: 10
Example:
{ snow: { radius: 15, }}areaWidth
Section titled “areaWidth”Type: number
Description: Specifies the width of the snowfall area.
Default: 500
Example:
{ snow: { areaWidth: 500, }}areaHeight
Section titled “areaHeight”Type: number
Description: Specifies the height of the snowfall area.
Default: 1000
Example:
{ snow: { areaHeight: 1000, }}Type: number
Description: Specifies the falling speed of the snowflakes.
Default: 0.00005
Example:
{ snow: { speed: 0.001, }}movementStrength
Section titled “movementStrength”Type: { x: number, y: number, z: number }
Description: Specifies the strength of wind-driven movement of snowflakes for each axis.
Default: { x: 50, y: 20, z: 50 }
Example:
{ snow: { movementStrength: { x: 0.5, y: 0, z: 0.5 }, }}movementSpeed
Section titled “movementSpeed”Type: { x: number, y: number, z: number }
Description: Specifies the speed of wind-driven movement of snowflakes for each axis.
Default: { x: 0.0005, y: 0.0002, z: 0.0005 }
Example:
{ snow: { movementSpeed: { x: 0.001, y: 0, z: 0.001 }, }}Type: number
Description: Specifies the size of the snowflakes.
Default: 3
Example:
{ snow: { size: 0.05, }}Type: number
Description: The color of the snowflakes.
Default: 0xffffff
Example:
import { Color } from "@navaramap/three";
{ snow: { color: new Color().setStyle("#eeeeff").toHex(), }}opacity
Section titled “opacity”Type: number
Description: Specifies the opacity of the snowflakes.
Default: 1
Example:
{ snow: { opacity: 0.8, }}followCamera
Section titled “followCamera”Type: boolean
Description: Specifies whether the mesh follows the camera.
Default: true
Example:
{ snow: { followCamera: true, }}maxHeight
Section titled “maxHeight”Type: number
Description: Specifies the maximum altitude. Opacity decreases proportionally with camera altitude.
Default: 3000
Example:
{ snow: { maxHeight: 5000, }}Usage Examples
Section titled “Usage Examples”Basic Usage
Section titled “Basic Usage”import ThreeView from "@navaramap/three";import { SnowMeshDesc } from "@navaramap/three_default_descs";
const view = new ThreeView();view.registerMesh("snow", SnowMeshDesc);await view.init();
// Add a SnowMeshDescconst snowDesc = view.addMesh<SnowMeshDesc>({ snow: { particleCount: 3000, areaWidth: 500, areaHeight: 1000, speed: 0.001, movementStrength: { x: 0.3, y: 0, z: 0.3 }, movementSpeed: { x: 0.0005, y: 0, z: 0.0005 }, size: 0.05, opacity: 0.8, followCamera: true, },});Placing Snow at a Specific Location
Section titled “Placing Snow at a Specific Location”import ThreeView, { Color, geodeticToVector3, degreeToRadian, LLE } from "@navaramap/three";import { SnowMeshDesc } from "@navaramap/three_default_descs";
const view = new ThreeView({ animation: true });view.registerMesh("snow", SnowMeshDesc);await view.init();
// Calculate the position of Tokyoconst position = geodeticToVector3( new LLE( degreeToRadian(35.67564356091717), degreeToRadian(139.74511454748298), 10, ),);
// Add a SnowMeshDesc at a specific positionconst snowDesc = view.addMesh<SnowMeshDesc>({ visible: true, position: position, snow: { particleCount: 3000, speed: 0.001, color: new Color().setHex(0xffffff).toHex(), opacity: 0.8, },});
// Toggle visibilitysnowDesc.visible = false;