mirror of
https://github.com/holub/mame
synced 2025-06-10 06:47:18 +03:00
Update the recent Model3 changes for the new rgbaint_t class, nw
This commit is contained in:
parent
1bef19e984
commit
d0c5740466
@ -2266,19 +2266,17 @@ void model3_renderer::draw_scanline_solid(INT32 scanline, const extent_t &extent
|
||||
float in = extent.param[1].start;
|
||||
float inz = extent.param[1].dpdx;
|
||||
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, polydata.color);
|
||||
rgbaint_t color(polydata.color);
|
||||
|
||||
for (int x = extent.startx; x < extent.stopx; x++)
|
||||
{
|
||||
if (z <= zb[x])
|
||||
{
|
||||
rgbint c = color;
|
||||
int ii = (int)(in);
|
||||
rgbaint_t c(color);
|
||||
|
||||
rgbint_scale_immediate_and_clamp(&c, ii);
|
||||
c.scale_imm_and_clamp((int)in);
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&c);
|
||||
fb[x] = 0xff000000 | c.to_rgba_clamp();
|
||||
zb[x] = z;
|
||||
}
|
||||
|
||||
@ -2298,8 +2296,7 @@ void model3_renderer::draw_scanline_solid_trans(INT32 scanline, const extent_t &
|
||||
float in = extent.param[1].start;
|
||||
float inz = extent.param[1].dpdx;
|
||||
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, polydata.color);
|
||||
rgbaint_t color(polydata.color);
|
||||
|
||||
int trans = (polydata.transparency << 3) | (polydata.transparency >> 2);
|
||||
|
||||
@ -2307,21 +2304,16 @@ void model3_renderer::draw_scanline_solid_trans(INT32 scanline, const extent_t &
|
||||
{
|
||||
if (z <= zb[x])
|
||||
{
|
||||
rgbint c = color;
|
||||
rgbaint_t c(color);
|
||||
|
||||
int ii = (int)(in);
|
||||
|
||||
rgbint_scale_immediate_and_clamp(&c, ii);
|
||||
c.scale_imm_and_clamp((int)in);
|
||||
|
||||
if (trans != 0xff)
|
||||
{
|
||||
rgbint fbcolor;
|
||||
UINT32 orig = fb[x];
|
||||
rgb_to_rgbint(&fbcolor, orig);
|
||||
rgbint_blend(&c, &fbcolor, trans);
|
||||
c.blend(rgbaint_t(fb[x]), trans);
|
||||
}
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&c);
|
||||
fb[x] = 0xff000000 | c.to_rgba_clamp();
|
||||
}
|
||||
|
||||
in += inz;
|
||||
@ -2387,15 +2379,13 @@ void model3_renderer::draw_scanline_tex(INT32 scanline, const extent_t &extent,
|
||||
if (z <= zb[x])
|
||||
{
|
||||
UINT32 texel;
|
||||
TEX_FETCH(); // TODO fetch rgbint instead
|
||||
TEX_FETCH(); // TODO fetch rgbaint_t instead
|
||||
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, texel);
|
||||
rgbaint_t color(texel);
|
||||
|
||||
int ii = (int)(in);
|
||||
rgbint_scale_immediate_and_clamp(&color, ii);
|
||||
color.scale_imm_and_clamp((int)in);
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color);
|
||||
fb[x] = 0xff000000 | color.to_rgba_clamp();
|
||||
zb[x] = z;
|
||||
}
|
||||
|
||||
@ -2428,25 +2418,21 @@ void model3_renderer::draw_scanline_tex_colormod(INT32 scanline, const extent_t
|
||||
UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1;
|
||||
UINT32 width = 6 + texture->width;
|
||||
|
||||
rgbint polycolor;
|
||||
rgb_to_rgbint(&polycolor, polydata.color);
|
||||
rgbaint_t polycolor(polydata.color);
|
||||
|
||||
for (int x = extent.startx; x < extent.stopx; x++)
|
||||
{
|
||||
if (z <= zb[x])
|
||||
{
|
||||
UINT32 texel;
|
||||
TEX_FETCH(); // TODO fetch rgbint instead
|
||||
TEX_FETCH(); // TODO fetch rgbaint_t instead
|
||||
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, texel);
|
||||
rgbaint_t color(texel);
|
||||
|
||||
rgbint_scale_channel_and_clamp(&color, &polycolor);
|
||||
color.scale_and_clamp(polycolor);
|
||||
color.scale_imm_and_clamp((int)in);
|
||||
|
||||
int ii = (int)(in);
|
||||
rgbint_scale_immediate_and_clamp(&color, ii);
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color);
|
||||
fb[x] = 0xff000000 | color.to_rgba_clamp();
|
||||
zb[x] = z;
|
||||
}
|
||||
|
||||
@ -2479,8 +2465,7 @@ void model3_renderer::draw_scanline_tex_contour(INT32 scanline, const extent_t &
|
||||
UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1;
|
||||
UINT32 width = 6 + texture->width;
|
||||
|
||||
rgbint polycolor;
|
||||
rgb_to_rgbint(&polycolor, polydata.color);
|
||||
rgbaint_t polycolor(polydata.color);
|
||||
|
||||
for (int x = extent.startx; x < extent.stopx; x++)
|
||||
{
|
||||
@ -2492,20 +2477,13 @@ void model3_renderer::draw_scanline_tex_contour(INT32 scanline, const extent_t &
|
||||
UINT32 fa = texel >> 24;
|
||||
if (fa >= 0xf8)
|
||||
{
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, texel);
|
||||
rgbaint_t color(texel);
|
||||
|
||||
rgbint_scale_channel_and_clamp(&color, &polycolor);
|
||||
color.scale_and_clamp(polycolor);
|
||||
color.scale_imm_and_clamp((int)in);
|
||||
color.blend(rgbaint_t(fb[x]), fa);
|
||||
|
||||
int ii = (int)(in);
|
||||
rgbint_scale_immediate_and_clamp(&color, ii);
|
||||
|
||||
rgbint fbcolor;
|
||||
UINT32 orig = fb[x];
|
||||
rgb_to_rgbint(&fbcolor, orig);
|
||||
rgbint_blend(&color, &fbcolor, fa);
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color);
|
||||
fb[x] = 0xff000000 | color.to_rgba_clamp();
|
||||
zb[x] = z;
|
||||
}
|
||||
}
|
||||
@ -2541,8 +2519,7 @@ void model3_renderer::draw_scanline_tex_trans(INT32 scanline, const extent_t &ex
|
||||
UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1;
|
||||
UINT32 width = 6 + texture->width;
|
||||
|
||||
rgbint polycolor;
|
||||
rgb_to_rgbint(&polycolor, polydata.color);
|
||||
rgbaint_t polycolor(polydata.color);
|
||||
|
||||
for (int x = extent.startx; x < extent.stopx; x++)
|
||||
{
|
||||
@ -2551,21 +2528,13 @@ void model3_renderer::draw_scanline_tex_trans(INT32 scanline, const extent_t &ex
|
||||
UINT32 texel;
|
||||
TEX_FETCH();
|
||||
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, texel);
|
||||
rgbaint_t color(texel);
|
||||
|
||||
rgbint_scale_channel_and_clamp(&color, &polycolor);
|
||||
color.scale_and_clamp(polycolor);
|
||||
color.scale_imm_and_clamp((int)in);
|
||||
color.blend(rgbaint_t(fb[x]), trans);
|
||||
|
||||
int ii = (int)in;
|
||||
|
||||
rgbint_scale_immediate_and_clamp(&color, ii);
|
||||
|
||||
rgbint fbcolor;
|
||||
UINT32 orig = fb[x];
|
||||
rgb_to_rgbint(&fbcolor, orig);
|
||||
rgbint_blend(&color, &fbcolor, trans);
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color);
|
||||
fb[x] = 0xff000000 | color.to_rgba_clamp();
|
||||
}
|
||||
|
||||
ooz += dooz;
|
||||
@ -2610,19 +2579,12 @@ void model3_renderer::draw_scanline_tex_alpha(INT32 scanline, const extent_t &ex
|
||||
UINT32 fa = texel >> 24;
|
||||
if (fa != 0)
|
||||
{
|
||||
rgbint color;
|
||||
rgb_to_rgbint(&color, texel);
|
||||
rgbaint_t color(texel);
|
||||
|
||||
int ii = (int)in;
|
||||
color.scale_imm_and_clamp((int)in);
|
||||
color.blend(rgbaint_t(fb[x]), fa);
|
||||
|
||||
rgbint_scale_immediate_and_clamp(&color, ii);
|
||||
|
||||
rgbint fbcolor;
|
||||
UINT32 orig = fb[x];
|
||||
rgb_to_rgbint(&fbcolor, orig);
|
||||
rgbint_blend(&color, &fbcolor, fa);
|
||||
|
||||
fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color);
|
||||
fb[x] = 0xff000000 | color.to_rgba_clamp();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user