introduce tags, structs, and reticles
this was meant to be split into smaller changes, but I realised I edited my existing revision too late.
This commit is contained in:
parent
8356b6c750
commit
5b7d9586ea
26 changed files with 1113 additions and 351 deletions
|
@ -1,6 +1,6 @@
|
|||
use alloc::vec::Vec;
|
||||
|
||||
use crate::{compiler::ClosureSpec, system::ChunkId};
|
||||
use crate::{bytecode::TagId, compiler::ClosureSpec, system::ChunkId};
|
||||
|
||||
// TODO: Probably needs some pretty hardcore space optimization.
|
||||
// Maybe when we have static typing.
|
||||
|
@ -9,6 +9,7 @@ pub enum Value {
|
|||
Nil,
|
||||
False,
|
||||
True,
|
||||
Tag(TagId),
|
||||
Number(f32),
|
||||
Vec4(Vec4),
|
||||
Rgba(Rgba),
|
||||
|
@ -73,6 +74,12 @@ pub struct Vec2 {
|
|||
pub y: f32,
|
||||
}
|
||||
|
||||
impl Vec2 {
|
||||
pub fn new(x: f32, y: f32) -> Self {
|
||||
Self { x, y }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec4> for Vec2 {
|
||||
fn from(value: Vec4) -> Self {
|
||||
Self {
|
||||
|
@ -90,6 +97,17 @@ pub struct Vec4 {
|
|||
pub w: f32,
|
||||
}
|
||||
|
||||
impl From<Vec2> for Vec4 {
|
||||
fn from(value: Vec2) -> Self {
|
||||
Self {
|
||||
x: value.x,
|
||||
y: value.y,
|
||||
z: 0.0,
|
||||
w: 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)]
|
||||
#[repr(C)]
|
||||
pub struct Rgba {
|
||||
|
@ -123,6 +141,7 @@ pub enum Ref {
|
|||
List(List),
|
||||
Shape(Shape),
|
||||
Scribble(Scribble),
|
||||
Reticle(Reticle),
|
||||
}
|
||||
|
||||
impl Ref {
|
||||
|
@ -206,3 +225,8 @@ pub enum Scribble {
|
|||
Stroke(Stroke),
|
||||
Fill(Fill),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Reticle {
|
||||
Dotter { draw: Value },
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue