add demo volume code

This commit is contained in:
cuu
2022-09-04 21:02:32 +08:00
parent 548957a344
commit b826552d3d
12 changed files with 926 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/*
* ALGO : PROJ. : Volume
* RESEARCH : File : main.h
* : Date : 20100531.0725UTC
* : Email : mail@algoresearch.net
*/
#include <pthread.h>
typedef struct{
pthread_t pid_observer, pid_display, pid_event_loop;
int *space_i, *space_o;
unsigned int space_w, space_h, space_d, size_plane, size_space;
int dw, dh;
int a_sync, motion, mx, my;
float ax, ay, c_ax, c_ay;
int main, mapping, display;
unsigned int iter;
}SYS_TABLE;

View File

@@ -0,0 +1,12 @@
/*
* ALGO : PROJ. : Volume
* RESEARCH : File : observer.h
* : Date : 20100531.0725UTC
* : Email : mail@algoresearch.net
*/
#include "x.h"
#include "transform.h"
#include "space.h"
void create_observer(SYS_TABLE *sys);

View File

@@ -0,0 +1,13 @@
/*
* ALGO : PROJ. : Volume
* RESEARCH : File : space.h
* : Date : 20100531.0725UTC
* : Email : mail@algoresearch.net
*/
#include <stdlib.h>
#include <unistd.h>
void create_space(SYS_TABLE *sys, int w, int h, int d);
void iterative_space (SYS_TABLE *sys);
int cell_get(SYS_TABLE *sys, int x, int y, int z);

View File

@@ -0,0 +1,15 @@
/*
* ALGO : PROJ. : Volume
* RESEARCH : File : transform.h
* : Date : 20100531.0725UTC
* : Email : mail@algoresearch.net
*/
#include <math.h>
typedef struct{
float x, y, z;
int v;
}VERTEX;
void rotate_xy(VERTEX*, VERTEX*, float, float, VERTEX*);

45
demo/volume/include/x.h Normal file
View File

@@ -0,0 +1,45 @@
/*
* ALGO : PROJ. : Volume
* RESEARCH : File : x.h
* : Date : 20100531.0725UTC
* : Email : mail@algoresearch.net
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xutil.h>
extern Display *dpy;
extern GC gc;
extern Pixmap pixmap;
extern Atom delWin;
extern XEvent e;
extern unsigned long gray[], colors[], spectrum[];
typedef struct{
unsigned short int *image_16;
long *image_32;
XImage *screen;
int w, h, cx, cy;
unsigned long size;
}IMG;
int create_x(int, int, char*);
int create_image(IMG *, int, int);
void set_graymap();
void set_colormap();
void set_spectrum();
void clear_image(IMG *img);
void burn_image(IMG *img);
void draw_buffer(int, int, int, int);
void put_pixel(IMG *img, int, int, unsigned long);
void put_apixel(IMG *img, int, int, unsigned long, float alpha);
void draw_line (IMG *img, int x0, int y0, int x1, int y1, unsigned long c);
void clear_buffer(int, int, int, int);
void draw_image(IMG *img, int x, int y, int w, int h);