From 3ef209bad0cd7c1ae83a65702633e43f5a91c97f Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 3 Apr 2016 17:01:06 +0200 Subject: Compute fake conductivity (for PML). --- src/renderer.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/renderer.c') 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; -- cgit