@threenative/procedural-animals API

Every public function and class in @threenative/procedural-animals. Optional, bake-first procedural animal content for ThreeNative.

On this page

Generated from the engine's capability manifest: 7 functions. Each entry is the exported signature, what it is for, and a working example. Start with the package overview.

createAnimalActor

function · import { createAnimalActor } from "@threenative/procedural-animals"

Own one actor's pose/lifetime, accepting the completed physics state as its only root writer.

ts
function createAnimalActor(bake: IAnimalBake, options: IAnimalActorOptions)

Needs

  • npm i @threenative/procedural-animals

Use it to

  • follow a baked animal from accepted fixed-step Rapier state

Example

ts
const wolf = createAnimalActor(bake, { motion, material, ground });

Good to know

  • identity parent required; material and motion are editable game source; no move/Mixer/composer writer exists

createAnimalGeometry

function · import { createAnimalGeometry } from "@threenative/procedural-animals"

Validates all bytes before constructing geometry with the bake's skin and rig attributes.

ts
function createAnimalGeometry(buffer: ArrayBuffer):

Needs

  • npm i @threenative/procedural-animals

Use it to

  • construct a Three.js geometry from a validated procedural wolf bake

Example

ts
const { bake, geometry } = createAnimalGeometry(bytes);

Good to know

  • this creates bind geometry only; game-owned DQS material and animated bounds remain required

loadAnimalBake

function · import { loadAnimalBake } from "@threenative/procedural-animals"

Resolves and loads a prebuilt wolf through the game's ordinary asset resolver.

ts
async function loadAnimalBake( assets: IAnimalAssetResolver, logicalPath: string, options:

Needs

  • npm i @threenative/procedural-animals

Use it to

  • load a cooked animal from ctx.assets without runtime generation

Example

ts
const bake = await loadAnimalBake(ctx.assets, "wolf.animal");

Good to know

  • a corrupt served bake rejects rather than falling back to a different file

parseAnimalBake

function · import { parseAnimalBake } from "@threenative/procedural-animals"

Validates a pinned wolf PANM bake before constructing any renderer resource.

ts
function parseAnimalBake(buffer: ArrayBuffer): IAnimalBake

Needs

  • npm i @threenative/procedural-animals

Use it to

  • validate a baked procedural animal before allocating geometry

Example

ts
const bake = parseAnimalBake(bytes);

Good to know

  • unknown revisions, malformed sections, indices and skin weights throw by name

animalBakePass

function · import { animalBakePass } from "@threenative/procedural-animals/build"

Validate staged PANM sources inside the existing asset compiler; it owns the hashed manifest.

ts
function animalBakePass()

Needs

  • npm i @threenative/procedural-animals

Use it to

  • cook staged animal bakes through the ordinary asset pipeline

Example

ts
await compileAssets({ passes: [animalBakePass()] });

Good to know

  • only .animal inputs are interpreted; corruption fails the cook, without regeneration

bakeWolf

function · import { bakeWolf } from "@threenative/procedural-animals/build"

Bake the pinned wolf on the build machine, never on the portable runtime path.

ts
async function bakeWolf(options: IWolfBakeOptions): Promise<ArrayBuffer>

Needs

  • npm i @threenative/procedural-animals

Use it to

  • bake high and crowd wolf geometry before the ordinary asset cook

Example

ts
const bytes = await bakeWolf({ seed: 7, tier: "crowd" });

Good to know

  • exact pinned Node runtime, donor revision, options and generated bytes are validated; no worker is created

bakeWolfToFile

function · import { bakeWolfToFile } from "@threenative/procedural-animals/build"

Stage a validated source bake with a same-directory atomic rename, then use compileAssets.

ts
async function bakeWolfToFile( options: IWolfBakeOptions, destination: string, ): Promise<string>

Needs

  • npm i @threenative/procedural-animals

Use it to

  • publish a generated wolf without replacing the last valid bake on interruption

Example

ts
await bakeWolfToFile({ seed: 7, tier: "crowd" }, "assets/wolf-crowd.animal");

Good to know

  • validation and generation complete before the destination is touched; temporary files are removed on failure
View source on GitHub ↗