playscii/docs/design/old/20150101.txt

29 lines
1.6 KiB
Text

first design approach notes, started 2014-12-31 abandoned 2015-01-03
geo + uvs + color data for all layers on a frame are precomputed for each frame. when renderables animate they just bind different arrays
art.vert_array, art.elem_array: geo is same across all frames
ArtFrame.uv/fg/bg_array: uv/fg/bg color arrays for all layers
Art.init(): initialize lists for 1 frame with 1 blank layer of specified size, update all tiles' char/fg/bg
ArtFromDisk.init(): populate lists from saved data, update all tiles' char/fg/bg
art.build_geo(): create vert and elem arrays for given size and update all tiles' char/colors - okay if it's slower because this only happens on init/resize
ArtFrame.build_arrays(): creates uv/fgcolor/bgcolor arrays
art.set_char_index/color_at(): only called by user or sim edits, update internal lists only, add each changed tile to "to update" lists: "characters to update", "fg/bg colors to update"
art.update(): called from app.update(): process "to update" lists, calling art.update_char_array etc as needed (theoretrically this could be parallelized if lots of chars + colors are changing?)
art.update_char_array: computes index into uv array for given tile, sets uvs
art.update_color_array(fg=True): computers index into color array for given tile, sets color data
art.do_test(): add layers and frames, set chars and colors manually
renderable.update(): called from app.update(): has our art updated, or is it time to swap in a new animation frame? update buffers from art's arrays accordingly
- investigate whether storing color (vec4) per vertex is better than color index (U of 1D color texture?)