summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2014-01-24 15:16:52 +0100
committerdegasus <wickmarkus@web.de>2014-01-31 07:19:34 +0100
commitb38ef39ab7b88eb7e4fa253deec64cecb72508aa (patch)
tree33021b490fcaf4732eadb4b74101357e816f0f08 /Source/Core/VideoCommon
parent210f4f3e559696afea64244c29994aed9685d483 (diff)
PortableVertexFormat: use AttributeFormat for normal attribute format
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/NativeVertexFormat.h5
-rw-r--r--Source/Core/VideoCommon/VertexLoader.cpp20
2 files changed, 7 insertions, 18 deletions
diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h
index 127d8f7b8e..9e389a2d64 100644
--- a/Source/Core/VideoCommon/NativeVertexFormat.h
+++ b/Source/Core/VideoCommon/NativeVertexFormat.h
@@ -86,11 +86,8 @@ struct PortableVertexDeclaration
int stride;
AttributeFormat position;
+ AttributeFormat normals[3];
- int num_normals;
- int normal_offset[3];
- VarType normal_gl_type;
- int normal_gl_size;
VarType color_gl_type; // always GL_UNSIGNED_BYTE
int color_offset[2];
VarType texcoord_gl_type[8];
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp
index 968e98676a..42fa6a7b0c 100644
--- a/Source/Core/VideoCommon/VertexLoader.cpp
+++ b/Source/Core/VideoCommon/VertexLoader.cpp
@@ -594,7 +594,6 @@ void VertexLoader::CompileVertexTranslator()
vtx_decl.position.integer = false;
// Normals
- vtx_decl.num_normals = 0;
if (m_VtxDesc.Normal != NOT_PRESENT)
{
m_VertexSize += VertexLoader_Normal::GetSize(m_VtxDesc.Normal,
@@ -611,20 +610,13 @@ void VertexLoader::CompileVertexTranslator()
}
WriteCall(pFunc);
- vtx_decl.num_normals = vtx_attr.NormalElements ? 3 : 1;
- vtx_decl.normal_offset[0] = -1;
- vtx_decl.normal_offset[1] = -1;
- vtx_decl.normal_offset[2] = -1;
- vtx_decl.normal_gl_type = VAR_FLOAT;
- vtx_decl.normal_gl_size = 3;
- vtx_decl.normal_offset[0] = nat_offset;
- nat_offset += 12;
-
- if (vtx_attr.NormalElements)
+ for (int i = 0; i < (vtx_attr.NormalElements ? 3 : 1); i++)
{
- vtx_decl.normal_offset[1] = nat_offset;
- nat_offset += 12;
- vtx_decl.normal_offset[2] = nat_offset;
+ vtx_decl.normals[i].components = 3;
+ vtx_decl.normals[i].enable = true;
+ vtx_decl.normals[i].offset = nat_offset;
+ vtx_decl.normals[i].type = VAR_FLOAT;
+ vtx_decl.normals[i].integer = false;
nat_offset += 12;
}