SuperAPI AI 工具集

threejs-syntax-geometries

通用与其它

查看项目

更新于 10-15 22:18

技能介绍

用途:在 Three.js 中创建 3D 形状、自定义几何体与实例化网格时的语法参考,帮助避免忘记 dispose()、未设置 needsUpdate 等常见错误。

主要能力:

  1. BufferGeometry 核心属性与方法的速查,如 attributes、index、groups、boundingBox、setAttribute、computeVertexNormals、toNonIndexed、translate、dispose 等。
  2. BufferAttribute 构造函数与属性(array、itemSize、count、needsUpdate、usage),以及 Float32BufferAttribute、Uint16BufferAttribute 等类型化便捷类。
  3. 全部 21 种内置几何体的关键参数,含基础图元、多面体、路径类(ExtrudeGeometry、ShapeGeometry、LatheGeometry、TubeGeometry)与工具类(EdgesGeometry、WireframeGeometry)。
  4. Shape 类的 2D 路径绘制方法(moveTo、lineTo、bezierCurveTo、splineThru、arc 等)与挖孔用法。
  5. Morph Targets 与 InstancedMesh(instanceMatrix、setMatrixAt、setColorAt、自定义每实例属性)。
  6. 多材质分组、InterleavedBuffer、性能建议与释放规则。

必要用法与限制:修改 BufferAttribute 后必须设置 needsUpdate = true,否则改动不会上传 GPU;boundingBox/boundingSphere 默认为 null,需显式调用 computeBoundingBox()/computeBoundingSphere();自定义几何体需光照时要调用 computeVertexNormals();永久移除几何体时必须调用 geometry.dispose(),共享几何体需等所有网格移除后再释放;不要在动画循环中调用 translate()、rotateX()、scale() 等原地变换方法。实例化相关:调用 setMatrixAt() 后需设置 instanceMatrix.needsUpdate = true;计划每帧更新属性数据时,应在首次渲染前设置 DynamicDrawUsage。

适用场景:Three.js 自定义几何体构建、实例化网格渲染、挤出与路径几何体、变形目标与多材质分组等开发场景。

限制:资料未提供该技能的安装方式、收费信息与平台支持范围,暂未提供。