Model

Group
player
Extends
Mesh
Methods
21
Fields
None

Getting one

client:loadModel(…)
client:getScene():getSkybox()
client:loadModelData(…):light(…)

Methods

MethodReturnsDescription
getFaceColors1(){number}Each face's first lit colour (HSL).
getFaceColors2(){number}Each face's second lit colour.
getFaceColors3(){number}Each face's third lit colour: -1 for a flat-shaded face, -2 for a hidden one.
getFaceRenderPriorities(){number}?Each face's render priority (signed bytes), or nil when the model has none.
getBottomY()numberThe lowest point (largest y) once the bounds are calculated.
getRadius()numberThe bounding sphere's radius once the bounds are calculated.
getDiameter()numberThe bounding cylinder's diameter once the bounds are calculated.
getXYZMag()numberThe radius in the horizontal plane once the bounds are calculated.
calculateBoundsCylinder()()Calculate the height, bottom, radii and diameter, as the client does, if they are not already (on this copy: the client's model is not writ…
getAABB(number)AABBThe bounding box at orientation (0-2047), as the client computes it: extents at least 32 across, 8 more on a single-tile model. Raises ou…
useBoundingBox()booleanWhether a clickbox of this model is its bounding box alone (a single-tile NPC's is): the model's single-tile flag.
getTextureFaces(){number}?Each face's texture triangle as a signed byte (bit32.band(t, 255) indexes getTexIndices1/2/3()), -1 for a face with no texture mapping,…
getTexIndices1(){number}?Each texture triangle's first vertex (0-based): with the second and third, the triangle a textured face's mapping is taken from; nil when…
getTexIndices2(){number}?Each texture triangle's second vertex; nil when getTextureFaces() is.
getTexIndices3(){number}?Each texture triangle's third vertex; nil when getTextureFaces() is.
getFaceBias(){number}?Each face's depth bias as a signed byte (how much nearer the face sorts), or nil when the model has none (in a model the client merged fr…
getTransparency()numberThe model's transparency as a signed byte: an actor's fade now, 0 for opaque (bit32.band(t, 255) of 255 is fully clear).
getOverrideAmount()numberHow far the colour override pulls the model's colours (127 full), 0 for none: an actor's recolour or a highlighted NPC's tint.
getOverrideHue()numberThe colour override's hue (HSL, as JagexColor packs it), 0 when there is none.
getOverrideSaturation()numberThe colour override's saturation, 0 when there is none.
getOverrideLuminance()numberThe colour override's luminance, 0 when there is none.

Returned by

MethodReturnsDescription
Actor.getModelModel?The model the client builds for the actor this frame, a copy; nil in HD, off the game thread or once the actor is gone.
Client.loadModelModel?(Client, number) -> Model?: Cache model id, lit with ModelData's defaults; nil when the cache has no such model (the SD model in ei…
DynamicObject.getModelZbufModel?Its model without the animation: nil while it plays a sequence; else its loc type's model for its shape, orientation and place (the type…
ModelData.lightModel?(ModelData, number, number, number, number, number) -> Model?: The model, lit with ambient, contrast and light direction x, y, `z…
Renderable.getModelModel?Its model now: the model itself (a copy) for a Model or a static loc's renderable, read when asked (in HD, the SD model rebuilt from the…
Scene.getSkyboxModel?The skybox the client draws behind the scene, centred on the camera, before anything else: the model the server's skybox id names, lit as t…

Method details

getFaceColors3

getFaceColors3: (Model) -> {number}

Each face's third lit colour: -1 for a flat-shaded face, -2 for a hidden one.

getFaceRenderPriorities

getFaceRenderPriorities: (Model) -> {number}?

Each face's render priority (signed bytes), or nil when the model has none.

getBottomY

getBottomY: (Model) -> number

The lowest point (largest y) once the bounds are calculated.

getRadius

getRadius: (Model) -> number

The bounding sphere's radius once the bounds are calculated.

getDiameter

getDiameter: (Model) -> number

The bounding cylinder's diameter once the bounds are calculated.

getXYZMag

getXYZMag: (Model) -> number

The radius in the horizontal plane once the bounds are calculated.

calculateBoundsCylinder

calculateBoundsCylinder: (Model) -> ()

Calculate the height, bottom, radii and diameter, as the client does, if they are not already (on this copy: the client's model is not written).

getAABB

getAABB: (Model, number) -> AABB

The bounding box at orientation (0-2047), as the client computes it: extents at least 32 across, 8 more on a single-tile model. Raises outside 0-2047.

useBoundingBox

useBoundingBox: (Model) -> boolean

Whether a clickbox of this model is its bounding box alone (a single-tile NPC's is): the model's single-tile flag.

getTextureFaces

getTextureFaces: (Model) -> {number}?

Each face's texture triangle as a signed byte (bit32.band(t, 255) indexes getTexIndices1/2/3()), -1 for a face with no texture mapping, or nil when the model has no texture coordinates.

getTexIndices1

getTexIndices1: (Model) -> {number}?

Each texture triangle's first vertex (0-based): with the second and third, the triangle a textured face's mapping is taken from; nil when getTextureFaces() is.

getTexIndices2

getTexIndices2: (Model) -> {number}?

Each texture triangle's second vertex; nil when getTextureFaces() is.

getTexIndices3

getTexIndices3: (Model) -> {number}?

Each texture triangle's third vertex; nil when getTextureFaces() is.

getFaceBias

getFaceBias: (Model) -> {number}?

Each face's depth bias as a signed byte (how much nearer the face sorts), or nil when the model has none (in a model the client merged from parts, a part with no bias reads -1 per face).

getTransparency

getTransparency: (Model) -> number

The model's transparency as a signed byte: an actor's fade now, 0 for opaque (bit32.band(t, 255) of 255 is fully clear).

getOverrideAmount

getOverrideAmount: (Model) -> number

How far the colour override pulls the model's colours (127 full), 0 for none: an actor's recolour or a highlighted NPC's tint.

getOverrideHue

getOverrideHue: (Model) -> number

The colour override's hue (HSL, as JagexColor packs it), 0 when there is none.