/* qbism.h * * Copyright (C) 2005 by Andy Goth . * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ #include /* All suppoted transformation operations. */ typedef enum { XOP_PROJECTION, XOP_SHIFT, XOP_SHIFTBACK, XOP_ROTATE, XOP_ROTATE2, XOP_MULTIPLY, XOP_SINE, XOP_CONDITIONAL, XOP_COMPLEMENT, XOP_COUNT } xform_op_t; /* A single transformation instruction. */ typedef struct { xform_op_t opcode; /* Operation to perform. */ int source; /* Index of the source register. */ int control; /* Index of the control register. */ int dest; /* Index of the destination register. */ } xform_t; /* A sequence of transformation instructions. */ typedef struct { xform_t* seq; /* The sequence of instructions. */ int num_steps; /* Number of instructions in the sequence. */ int num_regs; /* Number of registers needed. */ } algo_t; /* A register. Consists of red, green, and blue channels. */ typedef float reg_t[3]; /* Function prototypes. */ void* xmalloc(size_t bytes); void* xrealloc(void* buf, size_t bytes); void algo_read_qbe(algo_t* algo, FILE* in); void algo_write_qbe(algo_t* algo, FILE* out); void qbism_render(algo_t* algo, int width, int height, int oversample, FILE* out); /* vim: set ts=4 sts=4 sw=4 tw=80 et: */