← scene3d · version 0.7.0
24 public items, in source order. Generated from the registry index, which re-derives them from the package source at publish time — so a signature here is the one that version actually ships.
pub struct Scene { into: integer, sky: i64, land: gpu::Pipeline, values: gpu::Block, atlas: gpu::Texture, lights: gpu::Texture, torch_map: gpu::Texture, reach_atlas: gpu::Texture, torch_ids: vector<integer>, reaches: vector<vector<single>>, glows: vector<float>, colours: vector<float>, pictures: integer, places: vector<integer>, taken: vector<boolean>, first_free: integer, slots: hash<Slot[key]>, faces: vector<vector<single>>, buffers: vector<gpu::Buffer>, counts: vector<integer>, walls: vector<vector<integer>>, solids: vector<vector<float>>, bounds: vector<vector<float>>, hidden: vector<integer>, actors: vector<single>, keep: integer, cards: gpu::Buffer, card_count: integer, over: gpu::Pipeline, over_quad: gpu::Buffer, over_picture: gpu::Texture, over_on: boolean, backdrop: gpu::Texture?, back_quad: gpu::Buffer?, free: boolean, view: vector<float>, eye: vector<float>, right_x: float, right_z: float, cam_x: integer, cam_y: integer, width: integer, height: integer }
A scene on a device: its pictures, its tiles, the cells' light, this frame's actors and the camera.
pub fn new_scene(dev: const gpu::Device, into: integer, sky: i64) -> Scene?
A scene for passes into into (gpu::INTO_WINDOW, gpu::INTO_COLOUR_DEPTH for a target with depth), sky (0xAARRGGBB) where nothing is, on a screen the size of the device's window. Null on a device whose backend this library has no shader source for.
pub fn resize(self: Scene, width: integer, height: integer)
The screen's size: what the fixed camera shows (a cell WIDE of these across) and the overlay is laid out on. In a window of another size the screen is drawn as large as fits, in its own shape, in the middle, with black beside it: a view made for 800 x 480 fills a whole-screen window so, showing what it showed. A pass into a target (draw_into) covers the whole target.
pub fn placed(self: const Scene, wide: integer, high: integer) -> (integer, integer, integer, integer)
Where the screen lies in a window wide x high: its left, its bottom, its width and its height in the window's pixels.
pub fn screen_point(self: const Scene, wide: integer, high: integer, x: integer, y: integer) -> (integer, integer)
The screen's pixel under the window's pixel (x, y), both from the top-left: where a pointer is on the screen. It lies outside 0 .. width, 0 .. height when the pointer is beside it.
pub fn add_picture(self: Scene, texels: const vector<i32>) -> integer
A picture, 16 x 16 RGB565 texels row by row (NONE where it is clear): its number, for a face or an actor; -1 when the texels are too few or the scene holds no more. The form a small machine's pictures ship in; add_image takes the picture as it was drawn.
pub fn add_image(self: Scene, texels: const vector<u32>, width: integer) -> integer
A picture of any size up to the atlas's 1024 each way, width texels a row, row by row as 0xAARRGGBB (imaging's rgba()): its number, for a face or an actor. A face's u and v run 0 .. 1 over it whatever its size, and a texel under half opacity is clear. -1 when it has no texels, is larger than the atlas, or the atlas has no room left for it.
pub fn set_tile(self: Scene, dev: const gpu::Device, key: integer, d: const vector<single>)
Tile key's faces, in place of the ones it had (none: it is empty). Faces follow one another in d: the picture, the group it is hidden with (-1: none), its corners n, where its light comes from (the cell x, y, its layer, and a factor; layer NO_LIGHT: its corners' own), then n times x, y, z, u, v, light — u and v 0 .. 1 over the picture, light 0 .. 1.
pub fn drop_tile(self: Scene, key: integer)
Tile key gone.
pub fn tiles(self: const Scene) -> integer
How many tiles hold faces now.
pub fn set_light(self: Scene, d: const vector<single>)
The light of cells as data: d is the layer, the box's corner (x0, y0), its width and height, then each cell's light (0 .. 1) row by row. The faces lit from those cells are lit by it from the next frame; no face is given again.
pub fn offers_torches(self: const Scene) -> boolean
Whether this implementation lights torches of their own: it does. One that does not is given the cells' light with the torches in it.
pub fn set_torch_reach(self: Scene, d: const vector<single>) -> boolean
A torch's reach: d is its id, the layer, the box's corner (x0, y0), its width and height (15 cells at most each way), then the light it gives each cell of the box (0 .. 1) row by row, 0 where it does not reach. Given when the torch is new, has moved, or burns otherwise; walls stop it where the reach says so. False, and nothing kept, when the box is too large or the scene holds its 64 torches already.
pub fn drop_torch(self: Scene, id: integer)
Torch id gone: its light with it.
pub fn set_torches(self: Scene, d: const vector<single>)
This frame's torches, nine numbers each in d: its id, its place (x, y, z as a face's corners), the shade it starts at, its glow (0 .. 1: how brightly it burns now, a flicker eased), and its colour (red, green, blue, 0 .. 1). A torch whose reach was given and that is not named burns dark this frame; one named with no reach given is not drawn. A flicker is these numbers alone: nothing else is given again.
pub fn torches(self: const Scene) -> integer
How many torches' reaches the scene holds.
pub fn set_actors(self: Scene, d: const vector<single>, keep_seen: integer)
This frame's actors, eleven numbers each in d: an id, the picture, the bottom middle (x, y, z) of the picture as it stands unturned, its size in cells, its light, how far it is turned (degrees clockwise as the camera sees it), the point of the picture it turns about (u, v: 0 .. 1 across and down) and whether it is mirrored (1) or not (0). A card stands upright and faces the camera: for the fixed camera in the plane it looks at, for the free one turned about its foot so its width lies across the view. The actor keep_seen is never hidden: the wall groups between the camera and its card are cut away, and shown again when they no longer are (-1: none).
pub fn hidden_groups(self: const Scene) -> vector<integer>
The groups hidden now: the walls cut away between the camera and the actor never hidden.
pub fn set_overlay(self: Scene, dev: const gpu::Device, px: const vector<i32>, w: integer, h: integer, scale: integer)
A picture over everything — the status line, talk bubbles — w x h RGB565 values row by row, NONE where it is clear, each drawn scale x scale from the screen's top-left. One with too few values takes it away.
pub fn offers_free_camera(self: const Scene) -> boolean
Whether this implementation offers a free camera: it does. One on a CPU offers the fixed camera only, so a view asks before it chooses.
pub fn free_camera(self: Scene, eye: (float, float, float), at: (float, float, float), field: float)
The free camera: an eye, a point looked at, and a field of view in degrees, in perspective. The cards turn to face it, and the walls between the eye and the actor never hidden are cut away, whichever of the camera and the actors is given first.
pub fn fixed_camera(self: Scene, px: integer, py: integer)
The fixed camera, from the south: the screen's top-left at world pixel (px, py), where cell (x, z) on layer y lies at (x * WIDE, z * DEEP - y * TALL).
pub fn draw(self: Scene, dev: gpu::Device)
Draw the scene into the window: a pass of its own, cleared to the sky. Where the window is not the screen's size (resize), the screen is drawn as large as fits in the middle of it and the rest is black.
pub fn draw_into(self: Scene, dev: gpu::Device, target: const gpu::Target)
Draw the scene into target (made for the kind the scene was made for).