From f1e955e7e9719aa82d1b32dac2bce62f26f75df7 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 2 Apr 2016 21:10:03 +0200 Subject: Auxiliary fields (WIP). --- src/renderer.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/renderer.c') diff --git a/src/renderer.c b/src/renderer.c index eee6e6d..9cf8db3 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -367,6 +367,7 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, size_t width, height, x, y, z; uint8_t *pixels; int pitch; + float scale; if (xsection->frame_index && xsection->frame_index == sim->frame_index && @@ -385,10 +386,14 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, height = fi->depth; } - if (flags & XSECTION_E) + if (flags & XSECTION_E) { field = sim->fields[1].E; - else + scale = 1; + } + else { field = sim->fields[1].H; + scale = IMPEDANCE_ZERO; + } if (frac < 0.0f) frac = 0.0f; @@ -416,9 +421,9 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, point = field + z * fi->zstr + y * fi->ystr + x * fi->xstr; - pixel[0] = r_float_to_u8(point[0]); - pixel[1] = r_float_to_u8(point[1]); - pixel[2] = r_float_to_u8(point[2]); + pixel[0] = r_float_to_u8(point[0] * scale); + pixel[1] = r_float_to_u8(point[1] * scale); + pixel[2] = r_float_to_u8(point[2] * scale); } } else if (flags & XSECTION_XZ) { y = frac * fi->height; @@ -434,9 +439,9 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, point = field + z * fi->zstr + y * fi->ystr + x * fi->xstr; - pixel[0] = r_float_to_u8(point[0]); - pixel[1] = r_float_to_u8(point[1]); - pixel[2] = r_float_to_u8(point[2]); + pixel[0] = r_float_to_u8(point[0] * scale); + pixel[1] = r_float_to_u8(point[1] * scale); + pixel[2] = r_float_to_u8(point[2] * scale); } } else { x = frac * fi->width; @@ -452,9 +457,9 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, phy_sim *sim, point = field + z * fi->zstr + y * fi->ystr + x * fi->xstr; - pixel[0] = r_float_to_u8(point[0]); - pixel[1] = r_float_to_u8(point[1]); - pixel[2] = r_float_to_u8(point[2]); + pixel[0] = r_float_to_u8(point[0] * scale); + pixel[1] = r_float_to_u8(point[1] * scale); + pixel[2] = r_float_to_u8(point[2] * scale); } } -- cgit