summaryrefslogtreecommitdiff
path: root/src/renderer.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2016-04-02 21:10:03 +0200
committerPaweł Redman <pawel.redman@gmail.com>2016-04-02 21:10:03 +0200
commitf1e955e7e9719aa82d1b32dac2bce62f26f75df7 (patch)
treeeee5d1cd4a68c9cb065384bbd3f5584bd4445bd5 /src/renderer.c
parente40ab41ae226e257d57a73c69d9bdd8d19f64cb5 (diff)
Auxiliary fields (WIP).
Diffstat (limited to 'src/renderer.c')
-rw-r--r--src/renderer.c27
1 files changed, 16 insertions, 11 deletions
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);
}
}