Skip to content

feat(cientos): <Decal> ergonomics for GLB / <primitive> sub-meshes #1415

Description

@alvarosabu

Follow-up from the <Decal> roadmap (previously tracked in packages/cientos/src/core/abstractions/Decal/ROADMAP.md).

Problem

Attaching a <Decal> to a sub-mesh of a loaded .glb today means extracting it manually:

```vue




```

<primitive :object> can't accept Vue children, so a <Decal> cannot be dropped directly inside a loaded model. For models with many named nodes this gets verbose fast.

Directions

A — codegen à la pmndrs/gltfjsx / gltf.pmnd.rs: a CLI that parses a .glb and emits a typed Vue wrapper exposing each named node as a ref. Host writes <MyModel><Decal :mesh="model.Helmet" ... /></MyModel>. Most ergonomic; requires a build step.

B — discoverable prop on <Decal>, e.g. <Decal :inside="modelRef" name="Helmet" /> that walks modelRef's scene graph for a child named Helmet. Zero codegen, slightly magic, fails silently if the name is typo'd (mitigated with a console.warn).

C — provide-based bridge: the loaded model component provide()s a Map<name, MeshRef>; Decals inject and pick by name. Works inside Vue's component tree, no runtime traversal, but every model wrapper must opt in.

Direction A is canonical across the pmndrs ecosystem; direction B is the cheap "good enough" alternative if a full codegen tool feels too heavy for cientos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cientosIssues related to @tresjs/cientosdxfeaturep2-to-be-discussedEnhancement under consideration (priority)pending-triageTicket is pending to be prioritised

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions