Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-primitives-mesh

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Build primitive geometry, Mesh buffers and MeshRenderer bindings. Use for vertex attributes, indices, wireframes or AIR_E_PRIMITIVE_DESCRIPTOR validation.

  • 9 files
  • 64.8 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-primitives-mesh

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescontext.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Working context

Use package imports and shipped docs for an application; use source paths and repository commands only in a confirmed AIR checkout. A copied host skill is not a runtime installation.

Read the shared environment rules when locating these roots. If sibling resources are unavailable, use the installed canonical chapter and disclose the limitation. Tool declarations identify workflow capabilities; they do not authorize installation, writes, publication or any action outside the user and host scope.

Related skills

  • cocosair - routing and shared Code First constraints; reuse it if already loaded.
  • cocosair-scene-graph - Node, Layers.Enum.DEFAULT, component enabled and release ordering a MeshRenderer rides on.
  • cocosair-materials-effects - the material and overridePipelineStates that turn a Mesh into pixels; this skill only produces geometry.
  • cocosair-rendering - the camera, lighting and shadow gates that decide whether an attached MeshRenderer is drawn at all.
  • cocosair-math - Vec3 bounds and transforms used by translate/scale and by hand-written minPos/maxPos.

Skinning weight binding (joint attributes), morph target authoring, asset loading and disposal policy, and performance of many instances belong to the cocosair-skinning-morph, cocosair-assets and cocosair-performance skills; load the matching existing skill when the task needs it. This skill owns only the MeshRenderer write contract below: bakeSettings, morph setWeight and setInstancedAttribute.

Original entry guidance

The original entry wording below is an on-demand archive, not a second routing source.

Use the environment rules to locate the checkout or installed package; sibling skills are optional direct dependencies, not a recursive load list.

Generate procedural geometry in code, convert it into a renderable Mesh asset, and know exactly where a MeshRenderer will accept it.

Read references/quick-start.md when constructing the minimal example. It preserves the complete setup and teardown sequence; select the source-checkout or npm-consumer environment first.

Read references/context.md to select the owner of this step and only its directly needed dependencies. Reuse already loaded skills; this is not a recursive load list.

Original mistake navigation

Before implementing the relevant path, read its wrong/right examples in references/common-mistakes.md:

  • [HIGH] Assigning the createPrimitiveGeometry result straight to MeshRenderer.mesh
  • [HIGH] Passing a shape outside the four-type whitelist to createPrimitiveGeometry
  • [HIGH] Calling primitives.cone with an options object
  • [MEDIUM] Expecting includeNormal to strip a channel from a descriptor shape
  • [MEDIUM] Reading an attribute with a gfx.ATTRIB_POSITION constant

Original metadata

Description and description_en

The two original fields contained exactly the same value, retained once here.

Builds and attaches procedural geometry in a Cocos AIR Code First scene - the nine primitives.* shape generators and their parameter defaults, the createPrimitiveGeometry(descriptor) helper whose box, sphere, cylinder, cone whitelist, integer segment cap of 1024, predicted-vertex cap and arc range throw RangeError AIR_E_PRIMITIVE_DESCRIPTOR, turning the returned IGeometry into a Mesh with utils.createMesh, hand-authoring a Mesh struct from gfx.Attribute and Format rows and reading or copying vertex attributes and indices, and driving MeshRenderer hooks such as bakeSettings, setInstancedAttribute and morph setWeight. Use when generating a box, sphere, cylinder or cone without a Creator asset, wiring a BufferGeometry-style object to a renderer, hitting AIR_E_PRIMITIVE_DESCRIPTOR, choosing new Mesh plus struct versus primitives.box, reading mesh vertex attributes, or exporting geometry as OBJ or wireframe.

Keywords

Cocos AIR, cocosair.js, primitives, mesh

References

  • primitive-shapes.md - the nine primitives.* generators with call signatures and source-level defaults, plane orientation, circle's four quirks, the translate/scale/wireframed edits, the deprecated helpers, the Primitive asset PrimitiveType ordinals, and the three capability layers.
  • mesh-attributes.md - Mesh.IStruct/IVertexBundle/ISubMesh/IBufferView/ICreateInfo field maps, reset/assign/initialize, the gfx.Attribute constructor and AttributeName table, default Format per channel with byte sizes, index format promotion, interleaving and copy rules, the full read/copy attribute and index API with null-versus-throw behavior, the MeshRenderer hook table (bakeSettings, morph setWeight, setInstancedAttribute) and the reachable converter names.
  • create-primitive-geometry.md - the AirPrimitiveDescriptor union, per-shape field whitelist, exact numeric and segment caps with source lines, the predicted-vertex formulas and arc range, the RangeError AIR_E_PRIMITIVE_DESCRIPTOR failure contract, the includeNormal/includeUV no-op, and reachability plus test coverage.

Canonical docs

docs/manual/primitives.md, docs/manual/custom-buffergeometry.md, docs/manual/primitive-descriptors.md.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "generate a box, sphere, cylinder or cone",
  "attach procedural geometry to a renderer",
  "author custom vertex buffers and indices",
  "read or copy mesh attributes",
  "a primitive descriptor fails validation"
]
owns
[
  "primitive-geometry",
  "mesh-buffers",
  "vertex-attributes",
  "mesh-indices",
  "mesh-renderer",
  "wireframe"
]
not_for
[
  "draw-call batching and instancing -> cocosair-performance",
  "skeletal binding or morph weights -> cocosair-skinning-morph",
  "material uniforms and effects -> cocosair-materials-effects"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "构建基本几何和原生 Mesh,检查顶点属性、索引、边界与渲染器写入契约。用于代码生成几何或自定义网格。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-primitives-mesh