TPT: Rotate/reflect particle, air, and fan velocities in transform_save 830629be3f
This commit is contained in:
parent
ce7d749dda
commit
d03a9c8fe5
@ -734,18 +734,25 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
|
||||
void *ndata;
|
||||
unsigned char (*bmapo)[XRES/CELL] = (unsigned char (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(unsigned char));
|
||||
unsigned char (*bmapn)[XRES/CELL] = (unsigned char (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(unsigned char));
|
||||
Particle *partst = (Particle *)calloc(sizeof(Particle), NPART);
|
||||
sign *signst = (sign *)calloc(MAXSIGNS, sizeof(sign));
|
||||
Particle *partst = (Particle*)calloc(sizeof(Particle), NPART);
|
||||
sign *signst = (sign*)calloc(MAXSIGNS, sizeof(sign));
|
||||
unsigned (*pmapt)[XRES] = (unsigned (*)[XRES])calloc(YRES*XRES, sizeof(unsigned));
|
||||
float (*fvxo)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*fvyo)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*fvxn)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*fvyn)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*vxo)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*vyo)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*vxn)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*vyn)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*pvo)[XRES/CELL] = (float (*)[XRES/CELL])calloc((YRES/CELL)*(XRES/CELL), sizeof(float));
|
||||
float (*pvn)[XRES/CELL] = (float (*)[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 = (unsigned char *)odata;
|
||||
//*if (parse_save(odata, *size, 0, 0, 0, bmapo, fvxo, fvyo, signst, partst, pmapt)) TODO: IMPLEMENT
|
||||
//if (parse_save(odata, *size, 0, 0, 0, bmapo, vxo, vyo, pvo, fvxo, fvyo, signst, partst, pmapt)) //TODO: Implement
|
||||
{
|
||||
free(bmapo);
|
||||
free(bmapn);
|
||||
@ -756,6 +763,12 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
|
||||
free(fvyo);
|
||||
free(fvxn);
|
||||
free(fvyn);
|
||||
free(vxo);
|
||||
free(vyo);
|
||||
free(vxn);
|
||||
free(vyn);
|
||||
free(pvo);
|
||||
free(pvn);
|
||||
return odata;
|
||||
}
|
||||
w = odatac[6]*CELL;
|
||||
@ -811,6 +824,10 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
|
||||
}
|
||||
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++)
|
||||
@ -826,12 +843,19 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
|
||||
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;
|
||||
}
|
||||
}
|
||||
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,fvxn,fvyn,signst,partst); TODO: IMPLEMENT
|
||||
//ndata = build_save(size,0,0,nw,nh,bmapn,vxn,vyn,pvn,fvxn,fvyn,signst,partst); //TODO: IMPLEMENT
|
||||
free(bmapo);
|
||||
free(bmapn);
|
||||
free(partst);
|
||||
@ -841,6 +865,12 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
|
||||
free(fvyo);
|
||||
free(fvxn);
|
||||
free(fvyn);
|
||||
free(vxo);
|
||||
free(vyo);
|
||||
free(vxn);
|
||||
free(vyn);
|
||||
free(pvo);
|
||||
free(pvn);
|
||||
return ndata;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user