milkyWayTexture関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The Milky Way painted as a texture for a WebGL sky (or a canvas): a picture twice as wide as it is high covering the whole sky, coloured from the brightness grid by a ramp. It is read with
detail (1 by default, see MilkyWayDetailOptions), so the dust lanes (the Great Rift, the Coalsack, the Cygnus Rift) are sharper than the plain grid gives them. Made from the package's
numbers alone: no photograph is read. Pure: it returns new pixels and keeps nothing but the grid it unpacks once.
Seen from inside a sphere, the sky runs the other way round from a map: give a sphere this texture with its across direction flipped (in three.js, texture.wrapS = RepeatWrapping and
texture.repeat.x = -1), or turn the sphere inside out by scaling it by -1 across.
インポート
import { milkyWayTexture } from "@johnmorrisdotca/hoshi-stars/milky-way";
定義
function milkyWayTexture(options?: MilkyWayTextureOptions): MilkyWayTexturePixels
引数
| 名前 | 型 | 説明 |
|---|---|---|
options (省略可) | MilkyWayTextureOptions |
|
戻り値
MilkyWayTexturePixels
The pixels.
例
import { milkyWayTexture } from "@johnmorrisdotca/hoshi-stars/milky-way";
const { width, height, data } = milkyWayTexture({ width: 2048 });
// a canvas: context.putImageData(new ImageData(data, width, height), 0, 0)
// three.js: new DataTexture(data, width, height) with flipY true, colorSpace SRGBColorSpace and needsUpdate true
console.log(width, height); // 2048 10242048 1024出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。