MCPcopy
hub / github.com/sparkjsdev/spark / snowBox

Function snowBox

src/generators/snow.ts:89–274  ·  view source on GitHub ↗
({
  // min and max box extents of the snowBox
  box,
  // minimum y-coordinate to clamp particle position, which can be used to
  // fake hitting a ground plane and lingering there for a bit
  minY,
  // number of Gsplats to generate (default: calculated from box and density)
  numSplats,
  // density of Gsplats per unit volume (default: 100)
  density,
  // The xyz anisotropic scale of the Gsplat, which can be used for example
  // to elongate rain particles (default: (1, 1, 1))
  anisoScale,
  // Minimum Gsplat particle scale (default: 0.001)
  minScale,
  // Maximum Gsplat particle scale (default: 0.005)
  maxScale,
  // The average direction of fall (default: (0, -1, 0))
  fallDirection,
  // The average speed of the fall (multiplied with fallDirection) (default: 0.02)
  fallVelocity,
  // The world scale of wandering overlay motion (default: 0.01)
  wanderScale,
  // Controls how uniformly the particles wander in sync, more variance mean
  // more randomness in the motion (default: 2)
  wanderVariance,
  // Color 1 of the two colors interpolated between (default: (1, 1, 1))
  color1,
  // Color 2 of the two colors interpolated between (default: (0.5, 0.5, 1))
  color2,
  // The base opacity of the Gsplats (default: 1)
  opacity,
  // Optional callback function to call each frame.
  onFrame,
}: {
  box?: THREE.Box3;
  minY?: number;
  numSplats?: number;
  density?: number;
  anisoScale?: THREE.Vector3;
  minScale?: number;
  maxScale?: number;
  fallDirection?: THREE.Vector3;
  fallVelocity?: number;
  wanderScale?: number;
  wanderVariance?: number;
  color1?: THREE.Color;
  color2?: THREE.Color;
  opacity?: number;
  onFrame?: ({
    object,
    time,
    deltaTime,
  }: { object: SplatGenerator; time: number; deltaTime: number }) => void;
})

Source from the content-addressed store, hash-verified

87// - anisoScale: the vec3 uniform of the snowBox anisotropic scale
88
89export function snowBox({
90 // min and max box extents of the snowBox
91 box,
92 // minimum y-coordinate to clamp particle position, which can be used to
93 // fake hitting a ground plane and lingering there for a bit
94 minY,
95 // number of Gsplats to generate (default: calculated from box and density)
96 numSplats,
97 // density of Gsplats per unit volume (default: 100)
98 density,
99 // The xyz anisotropic scale of the Gsplat, which can be used for example
100 // to elongate rain particles (default: (1, 1, 1))
101 anisoScale,
102 // Minimum Gsplat particle scale (default: 0.001)
103 minScale,
104 // Maximum Gsplat particle scale (default: 0.005)
105 maxScale,
106 // The average direction of fall (default: (0, -1, 0))
107 fallDirection,
108 // The average speed of the fall (multiplied with fallDirection) (default: 0.02)
109 fallVelocity,
110 // The world scale of wandering overlay motion (default: 0.01)
111 wanderScale,
112 // Controls how uniformly the particles wander in sync, more variance mean
113 // more randomness in the motion (default: 2)
114 wanderVariance,
115 // Color 1 of the two colors interpolated between (default: (1, 1, 1))
116 color1,
117 // Color 2 of the two colors interpolated between (default: (0.5, 0.5, 1))
118 color2,
119 // The base opacity of the Gsplats (default: 1)
120 opacity,
121 // Optional callback function to call each frame.
122 onFrame,
123}: {
124 box?: THREE.Box3;
125 minY?: number;
126 numSplats?: number;
127 density?: number;
128 anisoScale?: THREE.Vector3;
129 minScale?: number;
130 maxScale?: number;
131 fallDirection?: THREE.Vector3;
132 fallVelocity?: number;
133 wanderScale?: number;
134 wanderVariance?: number;
135 color1?: THREE.Color;
136 color2?: THREE.Color;
137 opacity?: number;
138 onFrame?: ({
139 object,
140 time,
141 deltaTime,
142 }: { object: SplatGenerator; time: number; deltaTime: number }) => void;
143}) {
144 box =
145 box ??
146 new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1));

Callers

nothing calls this directly

Calls 15

applyGsplatMethod · 0.95
updateMethod · 0.95
updateVersionMethod · 0.95
dynoFloatFunction · 0.90
dynoVec3Function · 0.90
subFunction · 0.90
dynoBlockFunction · 0.90
hashVec4Function · 0.90
splitFunction · 0.90
vec3Function · 0.90
fractFunction · 0.90
mulFunction · 0.90

Tested by

no test coverage detected