Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit8d45df8664

README.md

ecs.ShaderData

Component spec for ecs.ShaderData, which maps to the native ShaderData: four vec4 lanes an entity's draws carry to its material's shader. The shader reads lane k back as zero_object_data(in.instance_id, k), so one material serves many entities that differ in what the lanes hold — an age, a seed, a colour, a mask. The engine attaches no meaning to a lane; the shader and whatever writes the lanes agree on it.

A procedural graph's elements carry the lanes through the attributes data0 .. data3, one Vec4 each, so a value made per element reaches the shader of whatever the element becomes.

Fields

  • lane0: { x, y, z, w }? — read by the shader as lane 0.
  • lane1: { x, y, z, w }? — lane 1.
  • lane2: { x, y, z, w }? — lane 2.
  • lane3: { x, y, z, w }? — lane 3.

Types

  • EcsVec4 = { x: number, y: number, z: number, w: number }

Usage

ecs.set(id, ecs.ShaderData{ lane0 = { x = 1, y = 0.5, z = 0, w = 1 } })