mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-11 10:39:59 +00:00
VideoCommon: Handle emboss texgen with only a single normal
Fixes a large number of effects in Rogue Squadron 2 and 3.
This commit is contained in:
parent
39b2854b98
commit
2a5c77f43f
14 changed files with 138 additions and 62 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "VideoCommon/Statistics.h"
|
||||
#include "VideoCommon/VertexLoaderBase.h"
|
||||
#include "VideoCommon/VertexLoaderManager.h"
|
||||
#include "VideoCommon/VertexShaderManager.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
|
@ -90,10 +91,7 @@ void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_
|
|||
TransformUnit::TransformPosition(&m_vertex, outVertex);
|
||||
outVertex->normal = {};
|
||||
if (VertexLoaderManager::g_current_components & VB_HAS_NORMAL)
|
||||
{
|
||||
TransformUnit::TransformNormal(
|
||||
&m_vertex, (VertexLoaderManager::g_current_components & VB_HAS_BINORMAL) != 0, outVertex);
|
||||
}
|
||||
TransformUnit::TransformNormal(&m_vertex, outVertex);
|
||||
TransformUnit::TransformColor(&m_vertex, outVertex);
|
||||
TransformUnit::TransformTexCoord(&m_vertex, outVertex);
|
||||
|
||||
|
@ -230,6 +228,18 @@ void SWVertexLoader::ParseVertex(const PortableVertexDeclaration& vdec, int inde
|
|||
{
|
||||
ReadVertexAttribute<float>(&m_vertex.normal[i][0], src, vdec.normals[i], 0, 3, false);
|
||||
}
|
||||
if (!vdec.normals[1].enable)
|
||||
{
|
||||
m_vertex.normal[1][0] = VertexShaderManager::constants.cached_tangent[0];
|
||||
m_vertex.normal[1][1] = VertexShaderManager::constants.cached_tangent[1];
|
||||
m_vertex.normal[1][2] = VertexShaderManager::constants.cached_tangent[2];
|
||||
}
|
||||
if (!vdec.normals[2].enable)
|
||||
{
|
||||
m_vertex.normal[2][0] = VertexShaderManager::constants.cached_binormal[0];
|
||||
m_vertex.normal[2][1] = VertexShaderManager::constants.cached_binormal[1];
|
||||
m_vertex.normal[2][2] = VertexShaderManager::constants.cached_binormal[2];
|
||||
}
|
||||
|
||||
ParseColorAttributes(&m_vertex, src, vdec);
|
||||
|
||||
|
|
|
@ -90,22 +90,14 @@ void TransformPosition(const InputVertexData* src, OutputVertexData* dst)
|
|||
}
|
||||
}
|
||||
|
||||
void TransformNormal(const InputVertexData* src, bool nbt, OutputVertexData* dst)
|
||||
void TransformNormal(const InputVertexData* src, OutputVertexData* dst)
|
||||
{
|
||||
const float* mat = &xfmem.normalMatrices[(src->posMtx & 31) * 3];
|
||||
|
||||
if (nbt)
|
||||
{
|
||||
MultiplyVec3Mat33(src->normal[0], mat, dst->normal[0]);
|
||||
MultiplyVec3Mat33(src->normal[1], mat, dst->normal[1]);
|
||||
MultiplyVec3Mat33(src->normal[2], mat, dst->normal[2]);
|
||||
dst->normal[0].Normalize();
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiplyVec3Mat33(src->normal[0], mat, dst->normal[0]);
|
||||
dst->normal[0].Normalize();
|
||||
}
|
||||
MultiplyVec3Mat33(src->normal[0], mat, dst->normal[0]);
|
||||
MultiplyVec3Mat33(src->normal[1], mat, dst->normal[1]);
|
||||
MultiplyVec3Mat33(src->normal[2], mat, dst->normal[2]);
|
||||
dst->normal[0].Normalize();
|
||||
}
|
||||
|
||||
static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum,
|
||||
|
|
|
@ -9,7 +9,7 @@ struct OutputVertexData;
|
|||
namespace TransformUnit
|
||||
{
|
||||
void TransformPosition(const InputVertexData* src, OutputVertexData* dst);
|
||||
void TransformNormal(const InputVertexData* src, bool nbt, OutputVertexData* dst);
|
||||
void TransformNormal(const InputVertexData* src, OutputVertexData* dst);
|
||||
void TransformColor(const InputVertexData* src, OutputVertexData* dst);
|
||||
void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst);
|
||||
} // namespace TransformUnit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue