diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-02-29 22:25:50 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-02-29 22:25:50 (GMT) |
| commit | 830629be3fcf401a9147b5348328c5c05c683ec9 (patch) | |
| tree | 7fae0ee0f8b636372c482cc77fa86107febfe9c7 /src | |
| parent | d21c61aa52682b496bcc7cbaa764ae91b1d46cc2 (diff) | |
| download | powder-830629be3fcf401a9147b5348328c5c05c683ec9.zip powder-830629be3fcf401a9147b5348328c5c05c683ec9.tar.gz | |
Rotate/reflect particle, air, and fan velocities in transform_save
Diffstat (limited to 'src')
| -rw-r--r-- | src/save.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -2299,6 +2299,7 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl float (*pvn)[XRES/CELL] = calloc((YRES/CELL)*(XRES/CELL), sizeof(float)); int i, x, y, nx, ny, w, h, nw, nh; vector2d pos, tmp, ctl, cbr; + vector2d vel; vector2d cornerso[4]; unsigned char *odatac = odata; if (parse_save(odata, *size, 0, 0, 0, bmapo, vxo, vyo, pvo, fvxo, fvyo, signst, partst, pmapt)) @@ -2373,6 +2374,10 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl } partst[i].x = nx; partst[i].y = ny; + vel = v2d_new(partst[i].vx, partst[i].vy); + vel = m2d_multiply_v2d(transform, vel); + partst[i].vx = vel.x; + partst[i].vy = vel.y; } for (y=0; y<YRES/CELL; y++) for (x=0; x<XRES/CELL; x++) @@ -2388,12 +2393,16 @@ void *transform_save(void *odata, int *size, matrix2d transform, vector2d transl bmapn[ny][nx] = bmapo[y][x]; if (bmapo[y][x]==WL_FAN) { - fvxn[ny][nx] = fvxo[y][x]; - fvyn[ny][nx] = fvyo[y][x]; + vel = v2d_new(fvxo[y][x], fvyo[y][x]); + vel = m2d_multiply_v2d(transform, vel); + fvxn[ny][nx] = vel.x; + fvyn[ny][nx] = vel.y; } } - vxn[ny][nx] = vxo[y][x]; - vyn[ny][nx] = vyo[y][x]; + vel = v2d_new(vxo[y][x], vyo[y][x]); + vel = m2d_multiply_v2d(transform, vel); + vxn[ny][nx] = vel.x; + vyn[ny][nx] = vel.y; pvn[ny][nx] = pvo[y][x]; } ndata = build_save(size,0,0,nw,nh,bmapn,vxn,vyn,pvn,fvxn,fvyn,signst,partst); |
