Skip to main content

Draw

This item is only intended to be used by the module's authors. Private

The wave mesh's per-frame drawing, run in parallel by the Renderer's workers.

Functions​

Load​

Draw.Load(
d: Data,
share: number,
shares: number
) → ()

Takes over a new build: the whole mesh's data, and which share of it this copy draws.

Unload​

Draw.Unload() → ()

Forgets the build (the Renderer destroyed it).

ReadFrame​

Draw.ReadFrame(published: SharedTable) → Frame

The frame the Renderer published, as a plain table (reused).

Step​

Draw.Step(p: Frame) → number?

The maths of one update for this share: safe in parallel (it writes nothing). Returns false when there is nothing to draw (no build, or the frame is another build's), else how many vertices it updated.

Write​

Draw.Write() → ()

The writes of the last Step: serial only (Bone.Transform and EditableMesh can't be written in parallel).

Height​

Draw.Height(
x: number,
z: number,
inv: number
) → number

World Y of the surface as drawn at (x, z) (see Renderer): the wave sum at spacing inv, the weather layers there and obstacles, inverted like Waves.Height so the sideways shove is accounted for. Gathers its own layers: call it before Step, not during.

WaterColour​

Draw.WaterColour(now: number) → (
number,
number,
number
)

The water's colour from the global weather: halfway between its deep and shallow colours. Gathers its own layers: call it before Step, not during.

Show raw api
{
    "functions": [
        {
            "name": "Load",
            "desc": "Takes over a new build: the whole mesh's data, and which share of it this copy draws.",
            "params": [
                {
                    "name": "d",
                    "desc": "",
                    "lua_type": "Data"
                },
                {
                    "name": "share",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "shares",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 469,
                "path": "src/Ocean/Draw.luau"
            }
        },
        {
            "name": "Unload",
            "desc": "Forgets the build (the Renderer destroyed it).",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 498,
                "path": "src/Ocean/Draw.luau"
            }
        },
        {
            "name": "ReadFrame",
            "desc": "The frame the Renderer published, as a plain table (reused).",
            "params": [
                {
                    "name": "published",
                    "desc": "",
                    "lua_type": "SharedTable"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Frame\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 507,
                "path": "src/Ocean/Draw.luau"
            }
        },
        {
            "name": "Step",
            "desc": "The maths of one update for this share: safe in parallel (it writes nothing). Returns false when\nthere is nothing to draw (no build, or the frame is another build's), else how many vertices it\nupdated.",
            "params": [
                {
                    "name": "p",
                    "desc": "",
                    "lua_type": "Frame"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 549,
                "path": "src/Ocean/Draw.luau"
            }
        },
        {
            "name": "Write",
            "desc": "The writes of the last Step: serial only (Bone.Transform and EditableMesh can't be written in\nparallel).",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 775,
                "path": "src/Ocean/Draw.luau"
            }
        },
        {
            "name": "Height",
            "desc": "World Y of the surface as drawn at (x, z) (see Renderer): the wave sum at spacing `inv`, the\nweather layers there and obstacles, inverted like Waves.Height so the sideways shove is\naccounted for. Gathers its own layers: call it before Step, not during.",
            "params": [
                {
                    "name": "x",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "z",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "inv",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 807,
                "path": "src/Ocean/Draw.luau"
            }
        },
        {
            "name": "WaterColour",
            "desc": "The water's colour from the global weather: halfway between its deep and shallow colours.\nGathers its own layers: call it before Step, not during.",
            "params": [
                {
                    "name": "now",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 828,
                "path": "src/Ocean/Draw.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Draw",
    "desc": "The wave mesh's per-frame drawing, run in parallel by the Renderer's workers.",
    "private": true,
    "source": {
        "line": 43,
        "path": "src/Ocean/Draw.luau"
    }
}