| author | Hans Nieser <hnsr@xs4all.nl> | 2011-05-09 11:54:31 (GMT) |
|---|---|---|
| committer | Hans Nieser <hnsr@xs4all.nl> | 2011-05-09 11:54:31 (GMT) |
| commit | 41b6fc40f8fbbddea28ceb9b5c4fc5fe6a7f90ca (patch) (side-by-side diff) | |
| tree | 5d3c8d8a8a4e73c968fcc41078a0b7d60b74f8fa | |
| parent | 2f6eedc1088b192e5047f73351ec872872ba5861 (diff) | |
| download | glum-master.zip glum-master.tar.gz glum-master.tar.bz2 | |
| -rw-r--r-- | SConstruct | 2 | ||||
| -rw-r--r-- | src/draw.c | 24 | ||||
| -rw-r--r-- | src/draw.x86.asm | 2 | ||||
| -rw-r--r-- | src/draw.x86_64.asm | 2 | ||||
| -rw-r--r-- | src/main.c | 14 | ||||
| -rw-r--r-- | util.py | 2 |
6 files changed, 23 insertions, 23 deletions
@@ -38,7 +38,7 @@ if platform == 'win32': gtk_path + '\\include\\gtk-2.0', gtk_path + '\\lib\\gtk-2.0\\include', gtk_path + '\\include\\libglade-2.0']) - env_generic.Append(LIBPATH = [devil_path + '\\lib', + env_generic.Append(LIBPATH = [devil_path + '\\lib', gtk_path + '\\lib']) env_generic.Append(LIBS = ['devil', 'ilu', 'glade-2.0', 'glib-2.0', 'gtk-win32-2.0', 'gobject-2.0', 'gdk-win32-2.0']) @@ -109,7 +109,7 @@ static inline unsigned int pack_color(float r, float g, float b, float a) static inline unsigned int get_texel_nearest(Texture *texture, float u, float v) { int x, y; - + // Optimised power-of-two modulus, 50% faster than normal modulus and only marginally slower // than no modulus at all. The unsigned int mask with a signed integer seems to work because // of two's complement (consider that u/v coords can be negative) @@ -125,7 +125,7 @@ static inline unsigned int get_texel_nearest(Texture *texture, float u, float v) static inline void get_texels_bilinear(Texture *texture, unsigned int *samples, float u, float v) { int x, y, x1, y1; - + x = ((int) u) & texture->width_mod_mask; y = ((int) v) & texture->height_mod_mask; x1 = (x+1) & texture->width_mod_mask; @@ -170,7 +170,7 @@ static inline void lerp_colors(unsigned int scale, unsigned int *dst, unsigned i tmp_ag = ((src_ag - dst_ag) * scale) >> 8; tmp_br = ((src_br - dst_br) * scale) >> 8; - + tmp_ag = ((tmp_ag + dst_ag) << 8) & 0xFF00FF00; tmp_br = (tmp_br + dst_br) & 0x00FF00FF; @@ -413,7 +413,7 @@ static void draw_scan(Context *context, Triangle *triangle, Edge *left, Edge *ri // TODO: This code duplication is a bit inconvenient, but using a function pointer for // get_texel is too costly and the overhead of branching around get_texel is too big... if (context->fill_mode == GLUM_FILLMODE_TEXBILINEAR) { - + while (count--) { z = 1.0f/zi; @@ -570,7 +570,7 @@ static void calculate_gradients(Triangle *t) t->dvz_dx = dxi * ( (t->vz[1] - t->vz[2]) * (y0_min_y2) - (t->vz[0] - t->vz[2]) * (y1_min_y2) ); - + t->dzi_dy = dyi * ( (t->zi[1] - t->zi[2]) * (x0_min_x2) - (t->zi[0] - t->zi[2]) * (x1_min_x2) ); @@ -580,7 +580,7 @@ static void calculate_gradients(Triangle *t) t->dvz_dy = dyi * ( (t->vz[1] - t->vz[2]) * (x0_min_x2) - (t->vz[0] - t->vz[2]) * (x1_min_x2) ); - + t->dcz_dx[0] = dxi * ( (t->cz[1][0] - t->cz[2][0]) * (y0_min_y2) - (t->cz[0][0] - t->cz[2][0]) * (y1_min_y2) ); @@ -593,7 +593,7 @@ static void calculate_gradients(Triangle *t) t->dcz_dx[3] = dxi * ( (t->cz[1][3] - t->cz[2][3]) * (y0_min_y2) - (t->cz[0][3] - t->cz[2][3]) * (y1_min_y2) ); - + t->dcz_dy[0] = dyi * ( (t->cz[1][0] - t->cz[2][0]) * (x0_min_x2) - (t->cz[0][0] - t->cz[2][0]) * (x1_min_x2) ); @@ -602,7 +602,7 @@ static void calculate_gradients(Triangle *t) t->dcz_dy[2] = dyi * ( (t->cz[1][2] - t->cz[2][2]) * (x0_min_x2) - (t->cz[0][2] - t->cz[2][2]) * (x1_min_x2) ); - + t->dcz_dy[3] = dyi * ( (t->cz[1][3] - t->cz[2][3]) * (x0_min_x2) - (t->cz[0][3] - t->cz[2][3]) * (x1_min_x2) ); } @@ -662,7 +662,7 @@ void glum_draw_triangle(Context *context, float *triangle) memcpy(t.coords, triangle, sizeof(float)*3); memcpy(t.coords[1], &(triangle[3]), sizeof(float)*3); memcpy(t.coords[2], &(triangle[6]), sizeof(float)*3); - + memcpy(t.uv_coords, &(triangle[9]), sizeof(float)*2); memcpy(t.uv_coords[1], &(triangle[11]), sizeof(float)*2); memcpy(t.uv_coords[2], &(triangle[13]), sizeof(float)*2); @@ -671,7 +671,7 @@ void glum_draw_triangle(Context *context, float *triangle) t.coords[1][3] = 1.0f; t.coords[2][3] = 1.0f; - + // Transform by modelview matrix -> view-space math_transform_v4(context->modelview[context->modelview_stackpos], t.coords[0]); math_transform_v4(context->modelview[context->modelview_stackpos], t.coords[1]); @@ -700,7 +700,7 @@ void glum_draw_triangle(Context *context, float *triangle) math_transform_v4(context->projection[context->projection_stackpos], t.coords[2]); - // Culling/Clipping by frustrum planes + // Culling/Clipping by frustrum planes // TODO @@ -709,7 +709,7 @@ void glum_draw_triangle(Context *context, float *triangle) // Discard triangle, w <= 0.0001 for one or more vertices. return; - + // Viewport transform -> screen-space math_transform_v4(context->viewport, t.coords[0]); math_transform_v4(context->viewport, t.coords[1]); diff --git a/src/draw.x86.asm b/src/draw.x86.asm index a3c74c6..1a08fb9 100644 --- a/src/draw.x86.asm +++ b/src/draw.x86.asm @@ -14,7 +14,7 @@ _glum_clear_asm: push edi ; preserve caller's edi -; [ebp] == caller's ebp +; [ebp] == caller's ebp ; [ebp+4] == return address ; [ebp+8] == fb ; [ebp+12] == pixels diff --git a/src/draw.x86_64.asm b/src/draw.x86_64.asm index 938bf1e..522582c 100644 --- a/src/draw.x86_64.asm +++ b/src/draw.x86_64.asm @@ -46,7 +46,7 @@ _glum_clear_asm2: shr ecx, 1 mov eax, edx ; copy color into lower 32bits of rax - shl eax, 32 ; move them to the upper 32bits, + shl eax, 32 ; move them to the upper 32bits, add rax, rdx ; add color to it to fill the lower 32 bits rep stosq @@ -164,7 +164,7 @@ static void context_init(int width, int height) if (context) return; context = glum_context_new(width, height); - + textures[0] = glum_texture_from_file("../data/border.png"); textures[1] = glum_texture_from_file("../data/grid.png"); textures[2] = glum_texture_from_file("../data/gras.jpg"); @@ -199,7 +199,7 @@ static void ui_init(void) // Get handle to image drawingarea and match its size request to the current image size. drawingarea_image = glade_xml_get_widget(gxml, "drawingarea_image"); g_assert( NULL != drawingarea_image ); - + // Already rendering to an offscreen buffer so don't need GTK+'s double buffering (disabling it // gives a decent speed up). gtk_widget_set_double_buffered(drawingarea_image, FALSE); @@ -268,7 +268,7 @@ GLADE_CB gboolean window_main_key_press_event_cb(GtkWidget *widget, GdkEventKey gpointer user_data) { switch(event->keyval) { - + case GDK_y: if (context->fill_mode == GLUM_FILLMODE_TEXBILINEAR) { context->fill_mode = GLUM_FILLMODE_TEXNEAREST; @@ -367,7 +367,7 @@ GLADE_CB gboolean window_main_key_release_event_cb(GtkWidget *widget, GdkEventKe gpointer user_data) { switch(event->keyval) { - + case GDK_w: moving_forward = 0; break; @@ -419,7 +419,7 @@ GLADE_CB void drawingarea_image_expose_event_cb(GtkWidget *widget, GdkEventExpos { #ifndef SKIP_GTK static GdkGC *gc = NULL; - + context_init(widget->allocation.width, widget->allocation.height); viewport_mapped = 1; @@ -496,7 +496,7 @@ int main(int argc, char **argv) if (moving_forward) glum_camera_move(camera, GLUM_FORWARD, GLUM_CAMERA_RELATIVE, move_speed*tdelta); - if (moving_back) + if (moving_back) glum_camera_move(camera, GLUM_BACK, GLUM_CAMERA_RELATIVE, move_speed*tdelta); if (moving_left) glum_camera_move(camera, GLUM_LEFT, GLUM_CAMERA_RELATIVE, move_speed*tdelta); @@ -510,7 +510,7 @@ int main(int argc, char **argv) glum_camera_turn(camera, GLUM_LEFT, turn_speed*tdelta); if (turning_right) glum_camera_turn(camera, GLUM_RIGHT, turn_speed*tdelta); - if (turning_up) + if (turning_up) glum_camera_turn(camera, GLUM_UP, turn_speed*tdelta); if (turning_down) glum_camera_turn(camera, GLUM_DOWN, turn_speed*tdelta); @@ -32,7 +32,7 @@ def get_arch(): # Sometimes Python on Windows returns an empty string, so as a last resort, just assume it's # either x86 or x86_64 and use platform.architecture() to figure out which it is... elif machine == '' and platform == 'win32': - + (bits, linkage) = platform.architecture() if bits == '32bit': |
