From c4ca9b595636aab10b113d3b7bd3d7b9fe6d4d57 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Wed, 19 Dec 2012 21:29:02 +0100 Subject: [PATCH] Get rid of the DecodedVertex struct. --- GPU/GLES/VertexDecoder.cpp | 32 ++++++++++++++++++++++++++------ GPU/GLES/VertexDecoder.h | 16 +++------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/GPU/GLES/VertexDecoder.cpp b/GPU/GLES/VertexDecoder.cpp index fd94ecae31..4cfc4a321a 100644 --- a/GPU/GLES/VertexDecoder.cpp +++ b/GPU/GLES/VertexDecoder.cpp @@ -22,12 +22,32 @@ #include "VertexDecoder.h" -void PrintDecodedVertex(const DecodedVertex &vtx, u32 vtype) { - if (vtype & GE_VTYPE_NRM_MASK) printf("N: %f %f %f\n", vtx.normal[0], vtx.normal[1], vtx.normal[2]); - if (vtype & GE_VTYPE_TC_MASK) printf("TC: %f %f\n", vtx.uv[0], vtx.uv[1]); - if (vtype & GE_VTYPE_COL_MASK) printf("C: %02x %02x %02x %02x\n", vtx.color[0], vtx.color[1], vtx.color[2], vtx.color[3]); - if (vtype & GE_VTYPE_WEIGHT_MASK) printf("W: TODO\n"); - printf("P: %f %f %f\n", vtx.pos[0], vtx.pos[1], vtx.pos[2]); +void PrintDecodedVertex(VertexReader &vtx) { + if (vtx.hasNormal()) + { + float nrm[3]; + vtx.ReadNrm(nrm); + printf("N: %f %f %f\n", nrm[0], nrm[1], nrm[2]); + } + if (vtx.hasUV()) { + float uv[2]; + vtx.ReadUV(uv); + printf("TC: %f %f\n", uv[0], uv[1]); + } + if (vtx.hasColor0()) { + float col0[4]; + vtx.ReadColor0(col0); + printf("C0: %f %f %f %f\n", col0[0], col0[1], col0[2], col0[3]); + } + if (vtx.hasColor0()) { + float col1[3]; + vtx.ReadColor1(col1); + printf("C1: %f %f %f\n", col1[0], col1[1], col1[2]); + } + // Etc.. + float pos[3]; + vtx.ReadPos(pos); + printf("P: %f %f %f\n", pos[0], pos[1], pos[2]); } const int tcsize[4] = {0,2,4,8}, tcalign[4] = {0,1,2,4}; diff --git a/GPU/GLES/VertexDecoder.h b/GPU/GLES/VertexDecoder.h index b2b3b2eee8..72048d9bcf 100644 --- a/GPU/GLES/VertexDecoder.h +++ b/GPU/GLES/VertexDecoder.h @@ -50,16 +50,6 @@ struct DecVtxFormat { short stride; }; -// This is going away soon enough. -struct DecodedVertex -{ - float pos[3]; // in case of morph, preblend during decode - float normal[3]; // in case of morph, preblend during decode - float uv[2]; // scaled by uscale, vscale, if there - u8 color[4]; // unlit - float weights[8]; // ugh, expensive -}; - // This struct too. struct TransformedVertex { @@ -192,12 +182,12 @@ public: } } - void ReadColor1(float color[4]) { + void ReadColor1(float color[3]) { switch (decFmt_.c1fmt) { case DEC_U8_4: { u8 *p = (u8 *)(data_ + decFmt_.c1off); - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) color[i] = p[i] / 255.0f; } break; @@ -237,6 +227,6 @@ private: }; // Debugging utilities -void PrintDecodedVertex(const DecodedVertex &vtx, u32 vtype); +void PrintDecodedVertex(VertexReader &vtx);