diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2016-04-03 17:01:06 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2016-04-03 17:01:06 +0200 |
commit | 3ef209bad0cd7c1ae83a65702633e43f5a91c97f (patch) | |
tree | ce124f04fdd363499243afeeb45e1449a76f7a81 /src/renderer.c | |
parent | f1e955e7e9719aa82d1b32dac2bce62f26f75df7 (diff) |
Compute fake conductivity (for PML).
Diffstat (limited to 'src/renderer.c')
-rw-r--r-- | src/renderer.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/renderer.c b/src/renderer.c index 9cf8db3..94f0333 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -376,14 +376,14 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, return 0; // nothing's changed if (flags & XSECTION_XY) { - width = fi->width; - height = fi->height; + width = fi->dims[0]; + height = fi->dims[1]; } else if (flags & XSECTION_XZ) { - width = fi->width; - height = fi->depth; + width = fi->dims[0]; + height = fi->dims[2]; } else { - width = fi->height; - height = fi->depth; + width = fi->dims[1]; + height = fi->dims[2]; } if (flags & XSECTION_E) { @@ -408,12 +408,12 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, SDL_LockTexture(xsection->texture, NULL, (void**)&pixels, &pitch); if (flags & XSECTION_XY) { - z = frac * fi->depth; - if (z >= fi->depth) - z = fi->depth - 1; + z = frac * fi->dims[2]; + if (z >= fi->dims[2]) + z = fi->dims[2] - 1; - for (y = 0; y < fi->height; y++) - for (x = 0; x < fi->width; x++) { + for (y = 0; y < fi->dims[1]; y++) + for (x = 0; x < fi->dims[0]; x++) { uint8_t *pixel; float *point; @@ -426,12 +426,12 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, pixel[2] = r_float_to_u8(point[2] * scale); } } else if (flags & XSECTION_XZ) { - y = frac * fi->height; - if (y >= fi->height) - y = fi->height - 1; + y = frac * fi->dims[1]; + if (y >= fi->dims[1]) + y = fi->dims[1] - 1; - for (z = 0; z < fi->depth; z++) - for (x = 0; x < fi->width; x++) { + for (z = 0; z < fi->dims[2]; z++) + for (x = 0; x < fi->dims[0]; x++) { uint8_t *pixel; float *point; @@ -444,12 +444,12 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, pixel[2] = r_float_to_u8(point[2] * scale); } } else { - x = frac * fi->width; - if (x >= fi->width) - x = fi->width - 1; + x = frac * fi->dims[0]; + if (x >= fi->dims[0]) + x = fi->dims[0] - 1; - for (z = 0; z < fi->depth; z++) - for (y = 0; y < fi->height; y++) { + for (z = 0; z < fi->dims[2]; z++) + for (y = 0; y < fi->dims[1]; y++) { uint8_t *pixel; float *point; |