some adjustments in Normal loading to improve lighting in dx9.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6874 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c24cedc03b
commit
279664df7b
|
@ -315,9 +315,9 @@ void VertexLoader::CompileVertexTranslator()
|
|||
case FORMAT_UBYTE:
|
||||
case FORMAT_BYTE:
|
||||
{
|
||||
vtx_decl.normal_gl_type = (vtx_attr.NormalFormat == FORMAT_BYTE)? VAR_BYTE : VAR_UNSIGNED_BYTE;
|
||||
vtx_decl.normal_gl_type = VAR_BYTE;
|
||||
int native_size = 4;
|
||||
if (vtx_attr.NormalFormat == FORMAT_BYTE && !g_Config.backend_info.bAllowSignedBytes)
|
||||
if (!g_Config.backend_info.bAllowSignedBytes)
|
||||
{
|
||||
vtx_decl.normal_gl_type = VAR_SHORT;
|
||||
native_size = 8;
|
||||
|
@ -335,7 +335,7 @@ void VertexLoader::CompileVertexTranslator()
|
|||
}
|
||||
case FORMAT_USHORT:
|
||||
case FORMAT_SHORT:
|
||||
vtx_decl.normal_gl_type = (vtx_attr.NormalFormat == FORMAT_SHORT)? VAR_SHORT : VAR_UNSIGNED_SHORT;
|
||||
vtx_decl.normal_gl_type = VAR_SHORT;
|
||||
vtx_decl.normal_gl_size = 4;
|
||||
vtx_decl.normal_offset[0] = nat_offset;
|
||||
nat_offset += 8;
|
||||
|
|
|
@ -159,9 +159,12 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectByte()
|
|||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte_Expand16()
|
||||
{
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = DataReadS8() << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = DataReadS8() << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = DataReadS8() << 8;
|
||||
s8 temp = DataReadS8();
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)temp) << 8) | (temp & 0x7F);
|
||||
temp = DataReadS8();
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)temp) << 8) | (temp & 0x7F);
|
||||
temp = DataReadS8();
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)temp) << 8) | (temp & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -202,9 +205,12 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectByte3_Expand16()
|
|||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = DataReadS8() << 8;
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = DataReadS8() << 8;
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = DataReadS8() << 8;
|
||||
s8 temp = DataReadS8();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)temp) << 8) | (temp & 0x7F);
|
||||
temp = DataReadS8();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)temp) << 8) | (temp & 0x7F);
|
||||
temp = DataReadS8();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)temp) << 8) | (temp & 0x7F);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -254,9 +260,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte_Expand16()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const s8* pData = (const s8 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = pData[0] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = pData[1] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = pData[2] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)pData[0]) << 8) | (pData[0] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)pData[1]) << 8) | (pData[1] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)pData[2]) << 8) | (pData[2] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -305,9 +311,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices1_Expand16()
|
|||
const s8* pData = (const s8*)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = pData[3 * i] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = pData[3 * i + 1] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = pData[3 * i + 2] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)pData[3 * i]) << 8) | (pData[3 * i] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)pData[3 * i + 1]) << 8) | (pData[3 * i + 1] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)pData[3 * i + 2]) << 8) | (pData[3 * i + 2] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -363,9 +369,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices3_Expand16()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const s8* pData = (const s8 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = pData[0] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = pData[1] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = pData[2] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)pData[0]) << 8) | (pData[0] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)pData[1]) << 8) | (pData[1] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)pData[2]) << 8) | (pData[2] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -420,9 +426,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte_Expand16()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const s8* pData = (const s8 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = pData[0] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = pData[1] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = pData[2] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)pData[0]) << 8) | (pData[0] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)pData[1]) << 8) | (pData[1] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)pData[2]) << 8) | (pData[3] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -487,9 +493,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices1_Expand16()
|
|||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = pData[3 * i] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = pData[3 * i + 1] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = pData[3 * i + 2] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)pData[3 * i]) << 8) | (pData[3 * i] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)pData[3 * i + 1]) << 8) | (pData[3 * i + 1] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)pData[3 * i + 2]) << 8) | (pData[3 * i + 2] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
@ -547,9 +553,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices3_Expand16()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const s8* pData = (const s8 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = pData[0] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = pData[1] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = pData[2] << 8;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = (((s16)pData[0]) << 8) | (pData[0] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = (((s16)pData[1]) << 8) | (pData[1] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[2] = (((s16)pData[2]) << 8) | (pData[3] & 0x7F);
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[3] = 0;
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
|
|
Loading…
Reference in New Issue