ModelDef
Interface of @v12-engine/client
export interface ModelDefA model made elsewhere, a glTF file in public/models
Members
animationFiles
animationFiles?: Record<string, AnimationFileDef>;Animation files laid on it, by their paths (animations/<name>.anim.glb), with how (AnimationFileDef): each is a clip of the model's named by that path, whatever else names it (animations, casts, client.playClip). A file that animations or casts names needs a line here only for a table of its bones. client.applyAnimation is the same at run time
animations
animations?: Partial<Record<AnimationKind, string>>;Which clip each animation is, when it is not the usual one: a clip's name, or an animation file by its path (animations/walk.anim.glb, saved from the Animation panel): that file is laid on the model as animationFiles says
blends
blends?: BlendDef[];Seconds one clip takes to give way to another, by the two (BlendDef): 0.16 for any it does not name
casts
casts?: Record<string, string>;Animations for casting this or that ability, by its id, where the one for casting anything is not it: a clip's name, or an animation file; '' for none, the ability goes off without a gesture
castTimes
castTimes?: Record<string, number>;Seconds the animation of an ability is played over, by its id, when that is not the time until it goes off: a leap lasts as long as the flight
clips
clips?: Record<string, ClipDef>;What it says of its clips, by their names (ClipDef): their marks (the attack clip's hit, where the blow lands; foot, fx, the game's own) and the part of each that is looped. Model Setup's Animation tab writes them
clipsFile
clipsFile?: string;A file of more clips for it, by its path under public/models like src: <model>.clips.glb, written beside it by Model Setup's Import clips (makeClipsFile of @v12-engine/editor, editor.importClips). Its clips play on the model's nodes by their names, ahead of its own where a name is both's. A file that does not load is said, and the model is drawn without them
detail
detail?: DetailLevel[];How it is drawn by its distance from the camera (DetailLevel): its full self first, then lighter ones, a picture, nothing. The game's and the map's say over it (GameView.world.detail, MapEnvironment.detail). At full always when left out
glow
glow?: number | false | ModelGlow;How what its maker made emissive glows past its edges (WorldGlow): 1 as made (when left out), more or less, false none; or by day and by night and in a colour of its own (ModelGlow). Nothing of a model glows that was not made to shine
hide
hide?: string[];Meshes of the file that are left out, by name. Characters come with every weapon they could hold
hold
hold?: {
src: string;
at: string;
}[];Other models held by a point of this one (points) or a node of it, like a sword in handslot.r
lights
lights?: ModelLightDef[];The light it gives (ModelLightDef): a lamp's glass, a torch, a forge's mouth. Every copy of it, a unit's or a building's or the scenery's, gives it where it is, turned and scaled with it; on a point of it (points), or a node of the file, moving with the clips. Out while a unit cannot be seen
material
material?: Record<string, MaterialDef>;Its materials as the look would have them (MaterialDef), by their names in the file, '*' for every one (a name's own is laid over it): a colour, a picture, what shines. Every copy of it alike, a crowd's and an impostor's too as far as they can be (docs/world/materials.md). One unit's alone: kit.setMaterial. The editor's Material panel writes it
materials
materials?: ModelMaterials;How its materials are drawn: standard (lit as the client's own shapes are, which every model of the example's is made for) or pbr, as the model's maker made them (metal, roughness, normal maps), lit by the scene's environment too. The game's (GameView.units.materials) when left out, pbr for a file the map brought
merge
merge?: boolean;Whether a copy of it with a skeleton of its own (a unit up close, a portrait, a cinematic's prop) has the parts that move with one skeleton and are painted alike merged into one mesh: one draw rather than one a part (nine for the knight), in the view and in every shadow pass. false keeps its parts, each a mesh of its own by its name in the file (kit.model(id).meshes), for code that hides, recolours or swaps one of them. The game's (GameView.units.merge, true) when left out. Decided as each copy is built; the copies of a baked crowd are one mesh either way. client.looks.set with another says so to the units up close, each built again a frame with room
node
node?: string;Only this node of the file, for files that hold a collection of models
points
points?: Record<string, PointDef>;Places on it by name, like launch (where its shots leave from), hand.right or overhead: on a bone, they move with the clips. Code finds them in the world with kit.point
raise
raise?: number;How much higher it is drawn, in world units, for a model whose origin is not at its feet: one made around its middle, or a boat that sits too deep. Down when less than 0
scale
scale: number;How much bigger or smaller it is drawn than it was made
src
src: string;Path under public/models, like 'characters/knight.glb'
stride
stride?: number;How far it gets in a second with the walk played at normal speed, so the feet keep to the ground
team
team?: [number, number][];Cells of the texture, counted from the top left of a grid of 8 by 4, that take the colour of the owner
tint
tint?: [number, number, number];Its colours multiplied by this, 0 to 1 each, once, as it is made: a building borrowed from another side and darkened, a winter skin. Every copy of it alike, the shared models of buildings too (tintFor is per unit)
turn
turn?: number;Rotation around the y axis, in radians, for models that do not face the way the entity does
up
up?: 'y' | 'z';Which way is up in its file: 'z' for one made Z-up (a Blender export with +Y Up off), stood upright wherever it is drawn. Left out for the usual, glTF's Y. Model Setup's Turn upright sets it; modelAnatomy(...).up tells which a file is