comparison Renderer/Engine/polygon.cc @ 1130:5addc6c1d5c4 draft

fix.
author root@dolphins.cr.ie.u-ryukyu.ac.jp
date Sun, 13 Feb 2011 22:34:44 +0900
parents a8bffdb5d2e3
children 786e800abfb4
comparison
equal deleted inserted replaced
1129:a8bffdb5d2e3 1130:5addc6c1d5c4
13 #include "error.h" 13 #include "error.h"
14 #include "viewer_types.h" 14 #include "viewer_types.h"
15 using namespace std; 15 using namespace std;
16 16
17 17
18 Polygon::Polygon(void) 18
19 { 19
20 Polygon::Polygon()
21 {
22 matrix = (float*)polygon_allocate(sizeof(float)*16);
23 real_matrix = (float*)polygon_allocate(sizeof(float)*16);
24 texture_info = (texture_list*)polygon_allocate(sizeof(texture_list));
20 position_init(); 25 position_init();
21 } 26 }
22 27
23 void 28 void
24 Polygon::position_init(void) 29 Polygon::position_init(void)
219 { 224 {
220 SDL_PixelFormat *fmt; 225 SDL_PixelFormat *fmt;
221 //Uint32 temp, pixel; 226 //Uint32 temp, pixel;
222 Uint8 red, green, blue; 227 Uint8 red, green, blue;
223 228
224 fmt = texture_info.texture_image->format; 229 fmt = texture_info->texture_image->format;
225 230
226 if (tx<0) tx = 0; 231 if (tx<0) tx = 0;
227 if (texture_info.texture_image->w-1< tx) tx = texture_info.texture_image->w-1 ; 232 if (texture_info->texture_image->w-1< tx) tx = texture_info->texture_image->w-1 ;
228 if (ty<0) ty = 0; 233 if (ty<0) ty = 0;
229 if (texture_info.texture_image->h-1< ty) ty = texture_info.texture_image->h-1 ; 234 if (texture_info->texture_image->h-1< ty) ty = texture_info->texture_image->h-1 ;
230 235
231 236
232 //SDL_LockSurface(texture_image); 237 //SDL_LockSurface(texture_image);
233 char *p = get_pixel(tx,ty,texture_info.texture_image); 238 char *p = get_pixel(tx,ty,texture_info->texture_image);
234 blue = (Uint8) p[0]; 239 blue = (Uint8) p[0];
235 green = (Uint8) p[1]; 240 green = (Uint8) p[1];
236 red = (Uint8) p[2]; 241 red = (Uint8) p[2];
237 242
238 //printf("tx = %d ty = %d ", tx,ty); 243 //printf("tx = %d ty = %d ", tx,ty);