summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2022-04-13 22:03:34 -0700
committerPokechu22 <Pokechu022@gmail.com>2022-04-22 16:54:38 -0700
commit2a5c77f43ff1d69e78f12f13435a38c5eb2ed854 (patch)
tree5fe9bb681e4b8d4471f7efee278c96a24556b33b /Source/Core/VideoBackends/Software/SWVertexLoader.cpp
parent39b2854b981aadec1576254ad5e4d91dc21c9709 (diff)
VideoCommon: Handle emboss texgen with only a single normal
Fixes a large number of effects in Rogue Squadron 2 and 3.
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWVertexLoader.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/SWVertexLoader.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
index 7d9b64f01d..4b9825132e 100644
--- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
+++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
@@ -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);