# HG changeset patch # User gongo # Date 1203072263 -32400 # Node ID c964110017c8001fb211cf1a96c680ac2451197b # Parent 7927e00fb8e245637b4e7d008be3f9b7e4a86ca2 *** empty log message *** diff -r 7927e00fb8e2 -r c964110017c8 TaskManager/Test/simple_render/Makefile --- a/TaskManager/Test/simple_render/Makefile Fri Feb 15 19:36:08 2008 +0900 +++ b/TaskManager/Test/simple_render/Makefile Fri Feb 15 19:44:23 2008 +0900 @@ -8,7 +8,7 @@ TASK_OBJS = $(TASK_SRCS:.cpp=.o) CC = g++ -CFLAGS = -O9 -g -Wall -DDEBUG +CFLAGS = -O9 -g -Wall# -DDEBUG INCLUDE = -I../../../include/TaskManager -I. EXTRA_CFLAGS = `sdl-config --cflags` `xml2-config --cflags`\ diff -r 7927e00fb8e2 -r c964110017c8 TaskManager/Test/simple_render/viewer.cpp --- a/TaskManager/Test/simple_render/viewer.cpp Fri Feb 15 19:36:08 2008 +0900 +++ b/TaskManager/Test/simple_render/viewer.cpp Fri Feb 15 19:44:23 2008 +0900 @@ -4,8 +4,6 @@ #include #include #include "polygon.h" -//#include "demonstration.h" -//#include "scene.h" #include "viewer.h" #include "sys.h" using namespace std; @@ -72,31 +70,20 @@ } -void Viewer::write_pixel(int x, int y,float z, Uint32 rgb) { +void +Viewer::write_pixel(int x, int y,float z, Uint32 rgb) +{ SDL_PixelFormat *pf; pf = screen->format; - //printf("x:%d y:%d z:%d\n",x,y,z); - - //cout << "write_pixel" << endl; - //cout << x << " " << y << endl; - - //cout << SDL_MapRGB(pf,0,0,150) << endl; - x += width/2; y += height/2; static int diffz,diffz1; + diffz1 = diffz; diffz = (zRow[x][y]>z); - if(diffz != diffz1) { - //printf("diffz :%d zRow[%d][%d] = %f z = %f\n",diffz,x,y,zRow[x][y],z); - } - //printf("x:%d,y:%d,z:%f,zRow:%f\n",x,y,z,zRow[x][y]); - if(z < zRow[x][y]) { -// printf("x:%d,y:%d,z:%d\n",x,y,z,zRow); - if(x < width && x > 0 && y > 0 && y < height) - { - //pixels[width*y + x] = SDL_MapRGB(pf,70,70,71); + if (z < zRow[x][y]) { + if (x < width && x > 0 && y > 0 && y < height) { zRow[x][y] = z; y = height - y; pixels[width*y + x] = rgb; @@ -104,14 +91,10 @@ } } -void Viewer::write_line(float x1, float y1, float x2, float y2, Uint32 rgb) +void +Viewer::write_line(float x1, float y1, float x2, float y2, Uint32 rgb) { - //cout << "write_line("<< x1 << "," << y1 << "," << x2 << "," << y2 << ")"<< endl; - - //Uint32 rgb = 9830400; - - if(x1 > x2) - { + if (x1 > x2) { float x=0; float y=0; x=x1; @@ -121,71 +104,56 @@ x2 = x; y2 = y; } + float s = y1; - if((int)x1 == (int)x2) - { - if(y1 > y2) - { + if ((int)x1 == (int)x2) { + if (y1 > y2) { float y=0; y = y1; y1 = y2; y2 = y; } - for(float i=y1; i= 1) - { - //write_pixel((int)i,(int)s); + + if (f >= 1) { write_pixel((int)i,(int)s,0,rgb); f = 0; s++; @@ -255,6 +223,9 @@ int fd; arg->start_time = get_ticks(); + arg->this_time = 0; + arg->frames = 0; + arg->pf = screen->format; arg->background = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); arg->p = new Polygon; @@ -337,7 +308,6 @@ SDL_BlitSurface(arg->bitmap, NULL, screen, NULL); SDL_UpdateRect(screen, 0, 0, 0, 0); - //swap_buffers(); arg->frames++; fd = manager->open("ViewerRunLoop");