diff options
| author | degasus <wickmarkus@web.de> | 2014-01-24 15:16:52 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2014-01-31 07:19:34 +0100 |
| commit | b38ef39ab7b88eb7e4fa253deec64cecb72508aa (patch) | |
| tree | 33021b490fcaf4732eadb4b74101357e816f0f08 /Source/Core/VideoBackends | |
| parent | 210f4f3e559696afea64244c29994aed9685d483 (diff) | |
PortableVertexFormat: use AttributeFormat for normal attribute format
Diffstat (limited to 'Source/Core/VideoBackends')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp | 7 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp index 244df9bb5b..70dfe23df0 100644 --- a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp @@ -74,12 +74,13 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl) for (int i = 0; i < 3; i++) { - if (_vtx_decl.normal_offset[i] > 0) + format = &_vtx_decl.normals[i]; + if (format->enable) { m_elems[m_num_elems].SemanticName = "NORMAL"; m_elems[m_num_elems].SemanticIndex = i; - m_elems[m_num_elems].AlignedByteOffset = _vtx_decl.normal_offset[i]; - m_elems[m_num_elems].Format = VarToD3D(_vtx_decl.normal_gl_type, _vtx_decl.normal_gl_size, false); + m_elems[m_num_elems].AlignedByteOffset = format->offset; + m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer); m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA; ++m_num_elems; } diff --git a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp index 49098b24b4..88147aa755 100644 --- a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp @@ -75,10 +75,7 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl) SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, vtx_decl.position); for (int i = 0; i < 3; i++) { - if (vtx_decl.num_normals > i) { - glEnableVertexAttribArray(SHADER_NORM0_ATTRIB+i); - glVertexAttribPointer(SHADER_NORM0_ATTRIB+i, vtx_decl.normal_gl_size, VarToGL(vtx_decl.normal_gl_type), GL_TRUE, vtx_decl.stride, (u8*)NULL + vtx_decl.normal_offset[i]); - } + SetPointer(SHADER_NORM0_ATTRIB+i, vertex_stride, vtx_decl.normals[i]); } for (int i = 0; i < 2; i++) { |
