Cauldron3D.Bsp.Draw (Cauldron3D v0.2.2)

Copy Markdown View Source

The faces of a BSP world a view can see, as polygons for Cauldron3D.Render.

polygons = Cauldron3D.Bsp.Draw.polygons(bsp, view, surfaces: cache, light: light)

The world's faces come from the leaves the camera's leaf can see, its brush models' faces from where each model stands; faces turned away from the camera are left out. Solid faces are painted with their lit surfaces (Cauldron3D.Bsp.Surfaces) at a mip level chosen by distance, liquid faces ripple ({:warp, ...}), sky faces show the texture's :layers ({:sky, ...}), and hidden faces are not drawn.

Options

  • :surfaces — the surface cache (required where there are solid faces)
  • :light — the light map Cauldron3D.Bsp.Surfaces takes (required likewise)
  • :models — brush models to draw besides the world, each {model, origin}, {model, origin, {pitch, yaw, roll}} (degrees, turned as Cauldron3D.Camera turns, yaw about z first) or a map (see below)
  • :time — seconds, for liquid and sky movement, default 0.0
  • :liquid — options added to every {:warp, ...} paint, or a function of the liquid's texture giving them
  • :sky — options added to every {:sky, ...} paint
  • :skybox — six faces for {:skybox, ...} (see Cauldron3D.Paint.Rgba), drawn on sky faces instead of the texture's layers
  • :mip_bias — multiplies the distance a mip level is chosen at, default 1.0
  • :world? — whether to draw the world's own faces, default true
  • :rtlights — lights added over the solid and masked faces of the world and of unblended brush models (see Cauldron3D.Paint.Rgba's {:lit, ...}), each face lit by those whose sphere reaches its plane and its box

A brush model given as a map has :model and :origin, and may have:

  • :axes — {forward, left, up}, where the model's own x, y and z axes point; default the world's
  • :scale — how many times its own size it is drawn, default 1.0
  • :tint — {r, g, b, a} its faces' colours and alpha are multiplied by
  • :blend, :depth — as Cauldron3D.Polygon's, for every face
  • :alpha_test — given to its faces of kind :masked
  • :light — the light map its surfaces are made with instead of :light

Summary

Functions

The face indices of brush model model.

The polygons of the world and its brush models that view can see.

The world faces seen from point: those of every leaf its leaf can see, each once.

Functions

model_faces(bsp, model)

@spec model_faces(Cauldron3D.Bsp.t(), non_neg_integer()) :: [non_neg_integer()]

The face indices of brush model model.

polygons(bsp, view, opts \\ [])

The polygons of the world and its brush models that view can see.

world_faces(bsp, point)

@spec world_faces(Cauldron3D.Bsp.t(), Cauldron3D.Vec.t()) :: [non_neg_integer()]

The world faces seen from point: those of every leaf its leaf can see, each once.