#+title: Todo

- [X] Fix quads
- [ ] Check if bounding boxes are excessively big
  - [ ] they definately are. fix it now!!!
- [X] Fix gradients
- [X] Fix radial gradients
- [X] Move things using 4 point custom shapes to quad sdfs
- [X] test all shapes under all conditions
- [X] test all fill parameters
- [ ] do more testing with shadows (like when should they run? and what parameters
- [ ] sdf text for zooming in
- [X] dithering for gradients
- [X] reimplement multigradients
- [X] reimplement gradient lines
- [X] trying to draw a grid of squares shows gaps between them. rects are not
  exact, also quads.
- [ ] test with all feature combinations
- [ ] advertise better
- [X] rich text outline and bg fill
- [X] docs
- [ ] move rich text to UI and change syntax to be like markdown. probably need to change to a different method of adding colours like with |red| instead
- [X] move to stable rust
- [X] support underline colour and style (wavy?)
- [ ] shiny metallic fill effect like the image
- [ ] fill effects based on distance
- [-] High priority bugs:
  - [X] tailwind colors are wrong. oklch conversion is probably wrong
  - [ ] transparency
  colors and a bit of refactoring.
     that they can be batch drawn together. use instancing for grouped circles
- [ ] texture/atlas particles
- [ ] sound rotation
  - i wrote this forever ago. what could this possibly mean?
- [ ] have a look at texture atlasses and see if we can make something good for 2d platformer levels. maybe an add colliders toggle
- [ ] some kinda mf https://docs.rs/macroquad/latest/macroquad/telemetry/index.html
- [ ] miniquad backend + web
- [ ] bitmap fonts
- [ ] multiplayer "notifications" (itty messages)
- [ ] ui slideshow from markdown render to textures
- [X] css colours
- [ ] unload refs
- [ ] set target fps
- [ ] get screen to world ray
- [X] take screenshot
- [X] load image from texture
- [ ] ui dropdown
- [ ] draw something behind something else
- [ ] animate in by checking if the state exists, or if the state was updated last frame and then transitioning in. could do anything...
- [ ] load image from screen
- [ ] add post frame callback
- [ ] play_sound_looped
- [ ] stop_sound
- [ ] safe multithreading
- [ ] 3d scene for point lights
- [ ] ui routing with wrapper widget with back and forward buttons and title at
  the top
- [X] ui resizable, like docking and panels
- [ ] ui span support, so i can have links and stuff inside a paragraph
- [ ] ui select text
- [ ] ui select in text edit
- [ ] ui text box
- [ ] ui drop file, with example that opens an image if dropped onto area
- [ ] ui dropdown
- [ ] material ui library
- [ ] ui toasts
- [ ] ui toggle
- [ ] ui checkbox
- [ ] ui radio buttons
- [ ] ui navbar
- [X] ui dotted border
  floating window
- [ ] dirty struct macro, which automatically keeps track of what is dirty, and you can define computations as impls with a function that takes some fields and returns a value and adds that as a field on the struct with methods for getting and getting mut and setting fields which deals with making things dirty
- [ ] more filters
  - [ ] crt
  - [ ] wobbly
  - [ ] chromatic abboration
  - [ ] glitch
  - [ ] fish eye
  - [ ] pixel sort
  - [ ] custom
- [ ] coroutines, some kind of future management so that the user can ask to run some code at the end of the frame, in some number of frames, after some time, or when something next happens
- [ ] make the ui more performant
- [ ] re-add profiling
- [ ] measure startup and runtime performance
  - [ ] make sure things aren't using up performance when the user isnt even using
       that part of the engine
- [ ] revamp should add tests
  onscreen thingy.
  more text, but just for that one draw queue
  - no more textures are drawn, not just ones from the same texture atlas. nothing.
- [ ] text bg function that doesnt measure before but uses the dimensions returned
  from the drawing function and slots it in with a lower Z
- [ ] different 3d projections for high fov (pannini)
- [ ] particle stress test. spawn particles until AVG FPS drops below 60. print number
- [ ] test if it works on windows
  - [ ] compile
  - [ ] run
- [ ] i think we need to refactor shapes into something that is just for math, and then a rendering (color) layer on top
- [ ] ui scroll culling (?)
- [ ] custom post processing
- [ ] include folder should convert meshes objects (maybe some way of including materials) and textures and tile maps/ scenes when we get there and sounds when we get there
- [ ] allow user to use all collision shapes supported by rapier2d
- [ ] just put the scissor and culling on row/col. problem solved
  - yeah no
  - [ ] maybe create a raw row/col that works as it does currently
- [ ] 3d physics
- [ ] 3d FPS controller and camera
- [ ] pannini can just be a post processing effect
- [ ] bundled fonts should be togglable with a feature flag, at least until we get a build system
- [ ] ooh for the build system what if you have an engine.toml file where you can include stuff and that gets parsed by a build.rs file or a macro
- [ ] something is broken evident in shapes_3d example
  - [ ] needs gouraud shading
- [ ] sphere SDF
- [ ] video
- [X] screenshake
- [ ] sepia
- [ ] edge detection
- [X] sharpen
- [ ] 3d scene with lights and shadow
- [ ] list view builder where it only generates the nodes that are actually visible
- [ ] loading spinner
  - [ ] needs arcs
- [X] player controllers
- [X] probably add bold and italic to rich text. so we need fonts to be packaged
  with all three and make bold and italics optional, and fall back to default
- [ ] automatic interpolated values for ui elements
- [ ] you should be able to delete textures and images and stuff
- [ ] scissor example
- [ ] now we have logging. log things
- [ ] SI Unit system
- [ ] clipping/masking
- [ ] drop shadows 2d
- [ ] fix culling
- [ ] cull glyph textures out of view
- [ ] test transform 2 and 3D
- [ ] Compute shaders.
- [ ] draw Sphere
- [ ] like retaining 2d shape state would be pretty efficient ngl
  - maybe dont have to do culling every frame, like every 5 frames or something.
    zoo wee mama!!!
- [ ] match material HashMap<Material, Mesh>
- [ ] Circle anti aliasing between outline and fill is non existent
- [ ] also fix anti aliasing in pattern fills
- [ ] Dithering to reduce colour banding
- [ ] Signed distance field / https://raytracing.github.io/books/RayTracingInOneWeekend.html
- [-] arbritrary rotation and custom material for all 2d shapes
  - [X] rotation
  - [ ] custom material
- [-] TEXT RENDERING!!!
  - [X] fonts
  - [X] multiline
  - [X] layout / text wrapping / text alignment
  - [X] rich text
  - [X] text measurement
  - [ ] text scale and rotation
  - [ ] sdf?
  - [ ] 3d
- [-] Animation support
  - [X] Needs some sort of retained state.
  - [X] Maybe generic over types that implement some trait.
    - [X] Implement for all numerics, transform3D, colour, vectors.
  - [X] Struct contains start, end, time, and interpolation function.
  - [X] Interpolation function trait.
    - [X] So you could have structs with configurable interpolation.
  - [ ] sprite animation
    - (needs spritesheets/atlasses) ✅
  - [ ] maybe have my own proc-macro based compiler to turn a folder of sprites
    into a sprite sheet, indexable by a perfect &'static str hash table
    - [ ] would be nice to also have a type safe enum based approach, idk how i'd
      do that though. automatically generate the enum from the file names,
      converted to camel case? that would certainly be nice, and you'd get
      compiler errors when you update the name of one of the files or remove a sprite.
  - [ ] https://docs.rs/macroquad/latest/macroquad/experimental/animation/index.html
  - [ ] Animation state machine
  - [ ] pause animation controller
- [ ] egui_dock
  positions of it in the paint program for better curves
- [ ] image texture pair struct with builtin methods and maybe a `dirty`
- [ ] software: draw thick line function for circles or something, see if instancing circles is good enough
- [ ] let users access intermediary depth textures only if they want it
- [ ] multiple cameras outputting to textures
  - [ ] maybe a use_cameras function
  this should make it possible to add post processing effects easily
- [ ] scene ui element
- [X] Documentation
- [X] arcs/slices of circles
- [ ] splines
- [ ] let people write [a, b] instead of vec2(a, b)
- [ ] Transform example
- [ ] test colours
- [ ] test everything
- [ ] 2D custom materials
  - [ ] use_material & use_default_material functions
  - [ ] add default 2d material to render pipeline
  - [ ] hashmap of material ref to mesh
- [ ] https://github.com/not-fl3/macroquad/blob/master/examples/screen_texture.rs
- [ ] better 2D physics. platformer
- [ ] is this ECS?
  - [ ] this could totally work lets be REAL https://docs.rs/hecs/latest/hecs/
- [ ] lua scripting support
- [ ] 2D & 3D wireframe mode. automatic. can disregard material (maybe? vertex shaders?)
- [ ] Memory/GPU profiler
- [ ] Asset packing
  - [ ] and loading
  - [ ] a build system???
  - [ ] and a loading screen? customizable maybe just tell give the user some
    statistics about progress and they can render it themselves. sounds good to me
- [ ] benchmarks
- [ ] normal mapping in 2d and 3d
- [X] metaballs
  - [X] SDF in 2D?
- [ ] Svelte(fire) style macro for multiplayer. just have some kind of struct /
  macro thing that detects the difference between the state of the struct
  between frames and automatically handles that between players
  - very high trust level. could be improved. very simple though
  - so, so simple
- [ ] The... web :(
- [ ] Mobile :(
- [-] Sound
  - [X] 2D sound
  - [X] Include sound
  - [ ] 3D sound
  - [X] Not happy with sound. need to look into it more
- [X] Convert 2D Primitives to use Z-indexing so batching isnt a problem
- [-] 3D
  - [X] Camera
  - [ ] Primitives
  - [X] Drawing
  - [ ] Culling
  - [X] Importing OBJs
  - [ ] Importing more complex objects that have materials (glTF?)
  - [ ] SDFs
  - [ ] Ray tracing
  - [ ] Instanced ~draw_many~.
  - [ ] Lights
  - [X] Import from blender like godot does (why cant i be more like godot)
  - [X] add mirror BVec3 to transform3d
  - [ ] LOD
- [ ] include sound
- [X] OPTIMIZATION: do all the draws at the same time. requires adding back vertex
  - [X] draw queue with consecutive poly and circle draw calls grouped together so
- [X] toggle using positive y up
- [X] add mf draw wireframe and shit
- [X] examples for all the ui elements
- [X] colour picker
- [X] fix scenes
- [X] load_sound
- [X] load_sound_from_bytes
- [X] space invaders using some new features
- [X] constant particle emitters
- [X] port debug vis to sge_ui, and make egui non default feature, reduce number of crates pulled in greatly
- [X] ecs
- [X] play_sound_once
- [X] set_sound_volume
- [X] all unnececary features behind feature gates (e.g. audio, input, gamepad, etc.)
- [X] add must use to _ex sounds builder
- [X] draggable/resizable floating window
- [X] functions to change cursor icon
- [X] solid triangle arrow functions
- [X] expandable <details> type thing
- [X] slider
- [X] underline and strikethrough text
- [X] rich text ui
- [X] ui hyperlink
- [X] ui tooltips
- [X] ui modal that dims the rest of the screen, like a pop up instead of a
- [X] 2d scene for optimising static geometry
- [X] render geometry to scene or texture
- [X] render to scene yeah, so like more macro shit to add to_scene functions and maybe just have a 2d renderer trait and have draw queue 2d and scene implement it and then have draw_to take a 2d renderer reference
- [X] macro based wrappers around structs for persistent (fs) storage and network sync
  - [X] fs
    - [X] implement macro
    - [X] add support for engine types
  - [X] network
- [X] fs/network functions sync/async that taps into the async runtime being worked on
- [X] make API consistent
- [X] outline on shape trait with rotation and everything
- [X] macro as much as possible based on traits
- [X] poly circles as new function / optional
- [X] cache projection matrix
- [X] cull off screen world draws
- [X] Logging system, that can log to stdout/stderr (like env_logger), or to an
- [X] functions to change speed of physics time
- [X] FIX: if you render too much text it just gives up and stops rendering any
- [X] camera shake controller. there's no reason you couldn't use this with another camera controller, but we may want to just create a master camera controller for 2D and 3D
- [X] fix bloom (should be easy for someone like me)
- [X] more collision shapes
- [X] ui text wrapping
- [X] ui multiline text
- [X] convert colors/data to a build.rs script using quote/prettyplease so that i
- [X] easier physics
- [X] physics could look like this
#+begin_src rust
struct Player {
    sprite: TextureRef,
    controller: PlayerController
}

struct Block {
    item: Item,
    collider: FixedCollider,
}

fn main() {
    let world = World::new();

    let mut player = Player {
        sprite: ...,
        controller: world.create_player_controller(),
    };

    // world would return a worldref, and is stored somewhere,
    // that means that controller would return a reference to (world, item inside world)
    // and you can do player.controller.update(), to take in input and move and collide

    player.controller.set_binds()
        .forward(KeyCode::KeyW) // impl Into<Key> or whatever from sge_input generic over mouse and keyboard
        .back(KeyCode::S);

    // the set_binds can just return a set binds struct that only contains a player controller reference
    // so calling .forward(...) doesnt mutate the set bind struct at all, and you dont have to call build or anything

    player.controller.velocity();
    player.controller.set_double_jumps(2);
    player.controller.set_coyote_time(200);
    player.controller.is_on_ground();
    player.controller.is_really_on_ground(); // no coyote time
    player.controller.collisions_last_frame();
    player.controller.can_jump();
    player.controller.handle_jump();
    player.controller.can_double_jump();
    player.controller.handle_double_jump();
    player.controller.set_max_floor_angle(f32::FRAC_PI_4)

    // https://docs.godotengine.org/en/stable/classes/class_characterbody2d.html
}
#+end_src

- [X] proper sound
- [X] particle system
- [X] proper sound
- [X] rename compoenents and widgets to base and library
  - [X] w95 library
- [X] gradient fill ui node
- [X] radial gradient
- [X] easy physics like godot where you can say is_on_floor is_in_air is_on_wall etc.
- [X] platformer example
- [X] input
- [X] number input
- [X] slider
- [X] button
- [X] align
- [X] aspect-ratio
- [X] grid
- [X] stack (overlay)
- [X] ui rich text (parse outside hot loop)
- [X] text bold
- [X] text italic
- [X] scissor box
- [X] fix issue of current_z sometimes exceeding 1.0 in draw queue
- [X] add underline and strikethrough text to rich text
- [X] way to put if button_clicked anywhere in your ui code, for convenience
- [X] test ui only rerender on input event
- [X] text example is broken
- [X] rounded rectangle primitive
  https://www.shadertoy.com/view/Nlc3zf
  https://www.youtube.com/watch?v=62-pRVZuS5c
  https://www.youtube.com/watch?v=s5NGeUV2EyU
  #+begin_src glsl
float box(vec2 position, vec2 halfSize, float cornerRadius) {
   position = abs(position) - halfSize + cornerRadius;
   return length(max(position, 0.0)) + min(max(position.x, position.y), 0.0) - cornerRadius;
}

vec4 drawBox(vec2 center, vec2 size, float cornerRadius, vec4 color, vec2 fragCoord) {
    vec2 position = (2.0 * (fragCoord - center) - iResolution.xy) / iResolution.y;
    vec2 halfSize = size / 2.0;
    float d = box(position, halfSize, cornerRadius);

    return vec4(1.0) - vec4(sign(d)) * color;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 center = vec2(100.0, 0.0);
    vec2 size = vec2(1.0, 0.5);
    float cornerRadius = 0.2; // clamp to between 0 and (shortest side length / 2)
	fragColor = drawBox(center, size, cornerRadius, vec4(1.0, 1.0, 1.0, 1.0), fragCoord);
}

  #+end_src
- [X] probably split into multiple crates
- [X] Reduce build time
- [X] frame time in debug
- [X] color schemes? like built in struct called colour scheme with gruvbox and
  cattpucin and stuff?
- [X] Fix examples now get_input() doesnt exist SPC / get_input
- [X] use bump allocators for per-frame data that gets cleared
- [X] texture atlasses
- [X] clipboard interaction
- [X] Serde feature to make everything publicly facing serializable.
  - [X] automatic saving and loading support with efficient binary format
- [X] Transparency is fucked
  - [X] Very fucked
  - [X] Someone needs to do something about this
- [X] debug AABB draw lines on ::new() in wireframe feature
- [X] draw line 3D
- [X] draw cube
- [X] draw cuboid from Vec3
- [X] https://github.com/sqrew/tunes
- [X] Move draw param overrides to the material
- [X] Custom materials
- [X] Custom programs
- [X] Post processing [7/7]
  - [X] Bloom
  - [X] Pixelate
    - [X] Would be nice if this actually made it render less pixels but we may
      just need to advise people to use the custom texture rendering method
      below if they care about performance. (documentation!!!)
  - [X] Saturation
  - [X] Hue rotate
  - [X] Brightness
  - [X] Vignette
  - [X] Sharpen?
- [X] finish drawing circle outlines and add support for elipsis and arcs, this can all be one shader if you try hard enough.
- [X] Render to custom texture
  - [X] Create new render pipeline
    - [X] Should be refactored into it's own struct
    - [X] Contains all render queues + some sort of output descriptor
      - [X] May need refactoring for camera's and stuff to use the custom output size
  - [X] Let you use the texture however, like render it to the screen or use it in
    a compute shader like for game of life.
    - [X] Or render to a lower resolution texture and scale it up for a pixelated effect.
- [X] draw hexagon poly thing
- [X] good api for creating and managing and drawing spritesheets
- [X] transparant textures?
- [X] controller support
  - [X] Implementation
  - [X] Testing
  - [X] Examples
- [X] drag and drop files?
- [X] winit input helper fork add precise mouse movemnt so that i can have all the
- [X] make implementing ui like clicking and hovering easier
- [X] hardware: rounded line function (with circle end caps). can replace a bunch of boiler plate in api.rs
- [X] expose egui charts if not already
- [X] impl mul TransformXD for VecX
- [X] impl mul Transform * Transform
- [X] .translate_point method
- [X] area perimiter methods on shapes
- [X] draw line through many points (path)
- [X] Macros for all this *Ref stuff
- [X] draw text
  - [X] draw_fps function
- [X] 2d mouse camera controller, like whats in the examples but built into the engine
- [X] Custom keybind/action map struct generic over action enum/struct
- [X] https://docs.rs/macroquad/latest/macroquad/experimental/collections/storage/index.html
- [X] Render pass
  #+begin_src rust
    pub struct RenderPass {
        pub color_texture: Texture2D,
        pub depth_texture: Option<Texture2D>,
        pub(crate) render_pass: Arc<miniquad::RenderPass>,
    }
    #+end_src
  - [X] we need a function for creating an empty texture and one for creating a render pass from existing textures or just a resolution
  - [X] function to render a texture to the screen as a fullscreen quad
  - [X] just let the user create a render pipeline which has the various draw queues, and let the draw queues also contain their proj matrices so it can be drawn with just a reference to the engine state.
  - [X] let the engine use a default render pipeline, and have it be a vector of impl RenderPipelinePass which is implemented by draw_queue 2 and 3d and for drawing the UI in case the user wants to put things above that.
- [X] drawing curves
  - [X] lines that connect points
  - [X] bezier
  - [X] cubic
  - [X] quadratic
- [X] 2d grid
- [X] function to get screen size, width, height
- [X] Fix backface culling
- [X] export all colours as normal consts
- [X] change cursor icons
- [X] Reorganize everything, especially draw_queue2d.rs and shapes2d.rs
- [X] replace anyhow with concrete error types
- [X] more warnings and better errors
- [X] Colors from hex code
- [X] Custom 3D material example
- [X] Batch textures
- [X] Arbritrary transform of 2D shapes
  - [X] Transform2D struct
  - [X] functions to specify arbritrary transform of 2d shapes
- [X] draw pixel
- [X] draw pixel line
- [X] crates.io
