Annotation of src/3d.h, revision 1.1

1.1     ! root        1: /* Simple 3D graphics routines */
        !             2: 
        !             3: /* Written by Bernie Roehl, November 1994 for VictorMaxx Technologies */
        !             4: 
        !             5: /* Redistribute at will, but charge nothing */
        !             6: 
        !             7: typedef struct { float x, y, z; } Vector;
        !             8: 
        !             9: typedef float Matrix[3][3];
        !            10: 
        !            11: typedef struct
        !            12:        {
        !            13:        int start;    /* index into vertex array of start of edge */
        !            14:        int end;      /* index into vertex array of end of edge */
        !            15:        int color;    /* color to draw this edge in */
        !            16:        } Edge;
        !            17: 
        !            18: typedef struct
        !            19:        {
        !            20:        Vector location;      /* location of object in the world */
        !            21:        Matrix orientation;   /* orientation matrix for the object */
        !            22:        int nvertices;        /* number of vertices in the object */
        !            23:        Vector *vertices;     /* array of vertices */
        !            24:        int nedges;           /* number of edges in the object */
        !            25:        Edge *edges;          /* array of edges */
        !            26:        } Object;
        !            27: 
        !            28: /* Math routines */
        !            29: 
        !            30: void BuildTrigTables(void);  /* called once at start of application */
        !            31: float sine(int angle);
        !            32: float cosine(int angle);
        !            33: 
        !            34: /* Vector operations */
        !            35: 
        !            36: void VectorAdd(Vector *result, Vector *a, Vector *b);
        !            37: void VectorSubtract(Vector *result, Vector *a, Vector *b);
        !            38: void VectorRotate(Vector *result, Matrix rotmat, Vector *v);
        !            39: 
        !            40: /* Matrix operations */
        !            41: 
        !            42: void MatrixIdentity(Matrix result);
        !            43: void MatrixMultiply(Matrix result, Matrix a, Matrix b);
        !            44: void MatrixMakeXrot(Matrix result, int angle);
        !            45: void MatrixMakeYrot(Matrix result, int angle);
        !            46: void MatrixMakeZrot(Matrix result, int angle);
        !            47: 
        !            48: /* Low-level screen operations */
        !            49: 
        !            50: int DisplayInitialize(int ntsc);
        !            51: void DisplayUninitialize(void);
        !            52: void DisplayClear(int color);
        !            53: void DisplayLine(int x1, int y1, int x2, int y2, int color);
        !            54: void DisplayCopyLine(unsigned char far *data, unsigned int line, int length);
        !            55: void DisplaySetPalette(unsigned char *palette);
        !            56: void DisplayUpdate(void);
        !            57: void DisplaySetEye(int eye);  /* eye is zero for left, non-zero for right */
        !            58: extern int DisplayWidth, DisplayHeight;
        !            59: 
        !            60: /* CTM support */
        !            61: 
        !            62: int CTM_initialize(int port);
        !            63: void CTM_uninitialize(void);
        !            64: void CTM_read(int *yaw, int *pitch, int *roll);
        !            65: void CTM_float_read(float *yaw, float *pitch, float *roll);
        !            66: 
        !            67: /* Renderer */
        !            68: 
        !            69: void Render(Object *object, Matrix eye_matrix, float eye_offset, int x_shift);
        !            70: void RenderSetZoom(float value);
        !            71: 
        !            72: /* End of 3d.h */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.