mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-15 22:48:14 +00:00
Merge pull request #723 from raven02/patch-1
Stylish the case DEC_U8_2/DEC_U16_2/DEC_FLOAT_2
This commit is contained in:
commit
cba9baaca6
@ -197,7 +197,7 @@ void VertexDecoder::Step_Color5551() const
|
||||
c[0] = Convert5To8(cdata & 0x1f);
|
||||
c[1] = Convert5To8((cdata>>5) & 0x1f);
|
||||
c[2] = Convert5To8((cdata>>10) & 0x1f);
|
||||
c[3] = (cdata>>15) ? 255 : 0;
|
||||
c[3] = (cdata>>15) ? 255.0f : 0.0f;
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_Color4444() const
|
||||
@ -222,15 +222,15 @@ void VertexDecoder::Step_Color565Morph() const
|
||||
{
|
||||
float w = gstate_c.morphWeights[n];
|
||||
u16 cdata = *(u16*)(ptr_ + onesize_*n + coloff);
|
||||
col[0] += w * (cdata & 0x1f) / 31.f;
|
||||
col[1] += w * ((cdata>>5) & 0x3f) / 63.f;
|
||||
col[2] += w * ((cdata>>11) & 0x1f) / 31.f;
|
||||
col[0] += w * (cdata & 0x1f) / 31.0f;
|
||||
col[1] += w * ((cdata>>5) & 0x3f) / 63.0f;
|
||||
col[2] += w * ((cdata>>11) & 0x1f) / 31.0f;
|
||||
}
|
||||
u8 *c = decoded_ + decFmt.c0off;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
c[i] = (u8)(col[i] * 255.0f);
|
||||
}
|
||||
c[3] = 255;
|
||||
c[3] = 255.0f;
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_Color5551Morph() const
|
||||
@ -240,9 +240,9 @@ void VertexDecoder::Step_Color5551Morph() const
|
||||
{
|
||||
float w = gstate_c.morphWeights[n];
|
||||
u16 cdata = *(u16*)(ptr_ + onesize_*n + coloff);
|
||||
col[0] += w * (cdata & 0x1f) / 31.f;
|
||||
col[1] += w * ((cdata>>5) & 0x1f) / 31.f;
|
||||
col[2] += w * ((cdata>>10) & 0x1f) / 31.f;
|
||||
col[0] += w * (cdata & 0x1f) / 31.0f;
|
||||
col[1] += w * ((cdata>>5) & 0x1f) / 31.0f;
|
||||
col[2] += w * ((cdata>>10) & 0x1f) / 31.0f;
|
||||
col[3] += w * ((cdata>>15) ? 1.0f : 0.0f);
|
||||
}
|
||||
u8 *c = decoded_ + decFmt.c0off;
|
||||
@ -259,7 +259,7 @@ void VertexDecoder::Step_Color4444Morph() const
|
||||
float w = gstate_c.morphWeights[n];
|
||||
u16 cdata = *(u16*)(ptr_ + onesize_*n + coloff);
|
||||
for (int j = 0; j < 4; j++)
|
||||
col[j] += w * ((cdata >> (j * 4)) & 0xF) / 15.f;
|
||||
col[j] += w * ((cdata >> (j * 4)) & 0xF) / 15.0f;
|
||||
}
|
||||
u8 *c = decoded_ + decFmt.c0off;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@ -346,7 +346,7 @@ void VertexDecoder::Step_NormalS16Morph() const
|
||||
multiplier = -multiplier;
|
||||
}
|
||||
const s16 *sv = (const s16 *)(ptr_ + onesize_*n + nrmoff);
|
||||
multiplier *= (1.0f/32767.f);
|
||||
multiplier *= (1.0f/32767.0f);
|
||||
for (int j = 0; j < 3; j++)
|
||||
normal[j] += sv[j] * multiplier;
|
||||
}
|
||||
|
@ -239,23 +239,29 @@ public:
|
||||
}
|
||||
|
||||
void ReadUV(float uv[2]) {
|
||||
const u8 *b = (const u8 *)(data_ + decFmt_.uvoff);
|
||||
const u16 *s = (const u16 *)(data_ + decFmt_.uvoff);
|
||||
const float *f = (const float *)(data_ + decFmt_.uvoff);
|
||||
switch (decFmt_.uvfmt) {
|
||||
case DEC_U8_2:
|
||||
uv[0] = b[0] * (1.f / 128.f);
|
||||
uv[1] = b[1] * (1.f / 128.f);
|
||||
{
|
||||
const u8 *b = (const u8 *)(data_ + decFmt_.uvoff);
|
||||
uv[0] = b[0] * (1.f / 128.f);
|
||||
uv[1] = b[1] * (1.f / 128.f);
|
||||
}
|
||||
break;
|
||||
|
||||
case DEC_U16_2:
|
||||
uv[0] = s[0] * (1.f / 32768.f);
|
||||
uv[1] = s[1] * (1.f / 32768.f);
|
||||
{
|
||||
const u16 *s = (const u16 *)(data_ + decFmt_.uvoff);
|
||||
uv[0] = s[0] * (1.f / 32768.f);
|
||||
uv[1] = s[1] * (1.f / 32768.f);
|
||||
}
|
||||
break;
|
||||
|
||||
case DEC_FLOAT_2:
|
||||
uv[0] = f[0] * 2.0f;
|
||||
uv[1] = f[1] * 2.0f;
|
||||
{
|
||||
const float *f = (const float *)(data_ + decFmt_.uvoff);
|
||||
uv[0] = f[0] * 2.0f;
|
||||
uv[1] = f[1] * 2.0f;
|
||||
}
|
||||
break;
|
||||
|
||||
case DEC_U16A_2:
|
||||
|
Loading…
x
Reference in New Issue
Block a user