FoliageCellDrawing

Package: Libraries.Game.Graphics.Worlds · Inherits from: Libraries.Language.Object

A FoliageCellDrawing is one model drawing some of a foliage cell's copies at one level of detail. A FoliageCellItem uses up to three: the level the cell is drawn at; the next level, which a growing share of the copies fade into near its distance; and a shadow stand-in, a simpler level drawn only into the shadows in place of a detailed one. A drawing works out every copy's transform, color and a number from 0 to 1 fixed by where the copy stands (Make), then draws only the copies whose number falls in a range (Keep), so thinning and fading pick the same copies each time. Copies are placed where the cell puts them, plus the asset's lean, slope and tint.

Example Code

use Libraries.Game.Graphics.Worlds.FoliageCellDrawing

FoliageCellDrawing drawing

Actions

Configure(boolean shadows, boolean onlyShadow, boolean mouse, Libraries.Game.Graphics.Worlds.FoliageAsset asset)

This action sets how the model draws: whether it casts shadows, whether it draws only its shadow (a stand-in), whether it takes the mouse, and the asset's wind.

Parameters

Dispose(Libraries.Interface.Item3D owner)

This action takes the model out of the cell item and disposes it.

Parameters

GetDrawnCount()

This action returns how many copies are drawn now; a card's planes count as one each.

Returns

integer: The count.

GetLevel()

This action returns the level of detail drawn, or -1 before Load.

Returns

integer: The level.

GetModel()

This action returns the model.

Returns

Libraries.Game.Graphics.Model: The model, or undefined before Load.

GetReach()

This action returns how tall the tallest copy reaches above where it stands, after Make.

Returns

number: The height, in world units.

Keep(number low, number high, Libraries.Interface.Item3D owner)

This action draws only the copies whose number is at least low and below high, adding the model to the cell item, or taking it out when none are kept, since a model without copies would be drawn once at the origin. Nothing is redone if the range hasn't changed since the last Keep or Make.

Parameters

  • low number: The lowest number kept, from 0 to 1.
  • high number: The number kept below, from 0 to 1.
  • owner Libraries.Interface.Item3D: The cell item the model belongs to.

Load(Libraries.Interface.Item3D owner, integer levelNumber, boolean isCard, Libraries.System.File file, Libraries.Game.Graphics.Texture cardTexture)

This action loads a level's model, or for a card level, makes an upright picture one unit tall. It returns the card's picture, loaded if it wasn't given, so the cell can keep it.

Parameters

Returns

Libraries.Game.Graphics.Texture: The card's picture, or undefined for a model.

Make(Libraries.Game.Graphics.Worlds.FoliageCell cell, Libraries.Game.Graphics.Worlds.FoliageAsset asset, Libraries.Game.Graphics.Worlds.TerrainData ground)

This action works out every copy's transform, color and number, from the cell and the asset; Keep then draws them. A copy stands at its place, turned about the up axis by its turn plus the asset's, and scaled. It leans with the ground if the asset says so, then by the asset's fixed lean plus a random lean, each copy in its own direction. A card has one entry per plane: the plane lies flat, so it is pitched -90 degrees, which stands it with the picture's top up, raised by half its height. With more than one plane, each plane after the first takes its own steady random turn, and each leans a little its own way, so the planes don't form a fixed X.

Parameters

Inherited Actions

3 actions from Libraries.Language.Object