npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cesium-ez-tree

v0.1.1

Published

Procedural EzTree vegetation primitive for CesiumJS.

Readme

cesium-ez-tree

CI Pages npm version License: MIT

English README

cesium-ez-tree 是一个面向 CesiumJS 的程序化植被 Primitive,用于渲染 实例化的树木、草地、花朵和岩石。

本项目借鉴并部分源自 Daniel Greenheck 的 EZ-Tree。EZ-Tree 是一个 Three.js 程序化树木生成库;本项目将相关思路适配到 CesiumJS Primitive、实例化渲染、 Cesium 渲染命令、Cesium worker 调度和地理空间放置场景中。

在线示例:https://xiaobai-grow.github.io/cesium-ez-tree/

兼容性

首个版本面向 CesiumJS 1.141.x@cesium/engine 25.x

本包会导入 Cesium engine 内部的 Source/* 模块,例如 Renderer/BufferRenderer/DrawCommandScene/DracoLoaderCore/TaskProcessor。 请将 [email protected]@cesium/[email protected] 视为必需的 peer dependencies。未来版本的 Cesium 可能可以工作,但在测试确认前不做兼容承诺。

安装

npm i cesium-ez-tree

资源与 Worker 配置

包内包含运行时资源 assets/,执行 npm run build 后还会生成 worker bundle 到 dist/workers/

在应用中,请将这些目录复制到可公开访问的静态路径,并在创建 Primitive 前配置:

import { configureEzTree } from "cesium-ez-tree";

configureEzTree({
  assetBaseUrl: "/cesium-ez-tree/assets/",
  workerBaseUrl: "/cesium-ez-tree/workers/",
});

如果你的应用暂时不能提供自定义 worker 文件,可以关闭 worker。库仍然可以运行, 但生成或打包大量实例时会花费更长时间:

configureEzTree({
  assetBaseUrl: "/cesium-ez-tree/assets/",
  useWorkers: false,
});

基础用法

import * as Cesium from "cesium";
import {
  EzTreePrimitive,
  configureEzTree,
} from "cesium-ez-tree";

configureEzTree({
  assetBaseUrl: "/cesium-ez-tree/assets/",
  workerBaseUrl: "/cesium-ez-tree/workers/",
});

const center = Cesium.Cartesian3.fromDegrees(-122.38985, 37.61864, 16.0);
const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);

const instances = await EzTreePrimitive.createVegetationInstancesAsync({
  width: 420,
  depth: 320,
  seed: 12,
  treeDensity: 18,
  grassDensity: 650,
  flowerDensity: 45,
  rockDensity: 8,
  treeScale: 0.58,
});

viewer.scene.primitives.add(
  new EzTreePrimitive({
    modelMatrix,
    instances,
    windStrength: 0.1,
    windFrequency: 0.8,
    windScale: 85,
    roundedLeafNormals: true,
    maximumGrassDistance: 800,
    maximumFlowerDistance: 600,
    maximumRockDistance: 1800,
  }),
);

为了兼容旧的 Sandcastle 风格示例,也可以把 API 挂到 Cesium 命名空间:

import * as Cesium from "cesium";
import { installEzTree } from "cesium-ez-tree";

installEzTree(Cesium);

const primitive = new Cesium.EzTreePrimitive({ instances });

主要 API

  • configureEzTree(options):设置 assetBaseUrlworkerBaseUrl、显式 workerUrlsuseWorkers
  • EzTreePrimitive:用于渲染程序化植被的 Cesium Primitive。
  • EzTreePrimitive.createVegetationInstances(options):同步生成实例。
  • EzTreePrimitive.createVegetationInstancesAsync(options):使用 worker 生成实例, 并提供同步 fallback。
  • EzTreeOptionsEzTreeGeneratorgenerateTreeGeometry(options):底层树木 参数与几何生成工具。
  • TreePreset / loadEzTreePreset(name):内置树木预设,例如 Oak MediumPine MediumAspen MediumBush 2

开发

npm install
npm run test
npm run build
npm run build:pages
npm run dev
npm run pack:dry-run

npm run dev 会启动 examples/basic 里的独立 Vite 示例。 打开地址:http://127.0.0.1:5173/examples/basic/

问题反馈

欢迎提交问题、bug 报告、功能建议和使用示例。如果你遇到问题,请在 GitHub Issue 中尽量附上 Cesium 版本、浏览器、运行环境配置,以及可以复现问题的最小示例。

致谢

  • EZ-Tree: https://github.com/dgreenheck/ez-tree
  • CesiumJS: https://github.com/CesiumGS/cesium
  • 资源署名细节记录在 NOTICE.mdassets/ 内各目录的 README 文件中。

许可证

MIT。详见 LICENSENOTICE.md