diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-01-12 12:27:55 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-01-12 12:27:55 +0000 |
| commit | 47a0525ab8f99180e1d7a1a74fb6ca620c08f7b5 (patch) | |
| tree | be5be984123acb9df49739c4daa50fc9ea92ff80 /src/engine/client/ec_gfx.c | |
| parent | 1c1677f02300e5ab10bca9c74ce7f49d4605b9d6 (diff) | |
| download | zcatch-47a0525ab8f99180e1d7a1a74fb6ca620c08f7b5.tar.gz zcatch-47a0525ab8f99180e1d7a1a74fb6ca620c08f7b5.zip | |
merged editor over to trunk
Diffstat (limited to 'src/engine/client/ec_gfx.c')
| -rw-r--r-- | src/engine/client/ec_gfx.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c index 70712ded..a87818bc 100644 --- a/src/engine/client/ec_gfx.c +++ b/src/engine/client/ec_gfx.c @@ -18,6 +18,8 @@ #define GL_COMPRESSED_RGB_ARB 0x84ED #define GL_COMPRESSED_RGBA_ARB 0x84EE +#define TEXTURE_MAX_ANISOTROPY_EXT 0x84FE + enum { DRAWING_QUADS=1, @@ -612,8 +614,31 @@ void gfx_screenshot() do_screenshot = 1; } +static int64 next_frame = 0; +static int record = 0; + void gfx_swap() { + if(record) + { + int w = screen_width; + int h = screen_height; + unsigned char *pixel_data = (unsigned char *)mem_alloc(w*(h+1)*3, 1); + /*unsigned char *temp_row = pixel_data+w*h*3;*/ + glReadPixels(0,0, w, h, GL_RGB, GL_UNSIGNED_BYTE, pixel_data); + + /* clean up */ + mem_free(pixel_data); + + if(next_frame) + next_frame += time_freq()/30; + else + next_frame = time_get() + time_freq()/30; + + while(time_get() < next_frame) + (void)0; + } + if(do_screenshot) { /* fetch image data */ @@ -642,8 +667,8 @@ void gfx_swap() for(; index < 1000; index++) { IOHANDLE io; - sprintf(filename, "screenshots/screenshot%04d.png", index); - engine_savepath(filename, wholepath, sizeof(wholepath)); + sprintf(wholepath, "/home/kma/Desktop/prq/blogimg/editor/screenshot%04d.png", index); + /*engine_savepath(filename, wholepath, sizeof(wholepath));*/ io = io_open(wholepath, IOFLAG_READ); if(io) @@ -783,6 +808,26 @@ void gfx_quads_setsubset(float tl_u, float tl_v, float br_u, float br_v) texture[3].v = br_v; } +void gfx_quads_setsubset_free( + float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3) +{ + texture[0].u = x0; + texture[0].v = y0; + + texture[1].u = x1; + texture[1].v = y1; + + texture[2].u = x2; + texture[2].v = y2; + + texture[3].u = x3; + texture[3].v = y3; +} + + static void rotate(VEC3 *center, VEC3 *point) { float x = point->x - center->x; |