#ifdef PLAN9 #include #include #include #include #include #include typedef char i8; typedef unsigned char u8; typedef short i16; typedef unsigned short u16; typedef int i32; typedef unsigned int u32; #else #include #include #include #include #include #include #define nil ((void*)0) typedef int8_t i8; typedef uint8_t u8; typedef int16_t i16; typedef uint16_t u16; typedef int32_t i32; typedef uint32_t u32; #endif #include "math.h" extern int running; extern int doBlend; extern int doZ; typedef struct Canvas Canvas; struct Canvas { u8 *fb; u32 *zbuf; int w, h; }; extern Canvas *canvas; typedef struct Texture Texture; struct Texture { u8 *pixels; int w, h; int wrap; }; extern Texture *curtex; typedef struct Point3 Point3; struct Point3 { int x, y, z; }; typedef struct Color Color; struct Color { i32 r, g, b, a; }; typedef struct Vertex Vertex; struct Vertex { Point3 v; float z, oneoverz; Color c; Vector2 st; }; Canvas *makecanvas(int w, int h); Texture *maketexture(int w, int h); void putpixel(Canvas *canvas, Point3 p, Color c); void clearcanvas(Canvas *canvas); void drawRect(Canvas *canvas, Point3 p1, Point3 p2, Color c); void drawLine(Canvas *canvas, Point3 p1, Point3 p2, Color c); void drawWireTri(Canvas *canvas, Point3 p1, Point3 p2, Point3 p3, Color c); void drawTriangle(Canvas *canvas, Vertex p1, Vertex p2, Vertex p3);