GregMiscellaneous: zzogl-pg:

* copy some vertex instead of re compute them twice
* pass vertex as reference avoid useless copy on the stack...


git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3964 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2010-10-23 17:59:10 +00:00
parent aa64da2561
commit 02efc340e8
3 changed files with 20 additions and 9 deletions

View File

@ -86,6 +86,17 @@ struct VertexGPU
{ {
f = ((s16)(v).f << 7) | 0x7f; f = ((s16)(v).f << 7) | 0x7f;
} }
void operator = (const VertexGPU &v) {
x = v.x;
y = v.y;
f = v.f;
rgba = v.rgba;
z = v.z;
s = v.s;
t = v.t;
q = v.q;
}
}; };
extern GSconf conf; extern GSconf conf;

View File

@ -279,7 +279,7 @@ void Kick::TriangleFan()
OUTPUT_VERT(p[2], 2); OUTPUT_VERT(p[2], 2);
} }
void Kick::SetKickVertex(VertexGPU *p, Vertex v, int next) void Kick::SetKickVertex(VertexGPU *p, Vertex &v, int next)
{ {
SET_VERTEX(p, next); SET_VERTEX(p, next);
p->move_z(v, vb[prim->ctxt].zprimmask); p->move_z(v, vb[prim->ctxt].zprimmask);
@ -314,17 +314,17 @@ void Kick::Sprite()
VertexGPU* p = curvb.pBufferData + curvb.nCount; VertexGPU* p = curvb.pBufferData + curvb.nCount;
// process sprite as 2 triangles. The common diagonal is 0,1 and 3,4
SetKickVertex(&p[0], gs.gsvertex[last], next); SetKickVertex(&p[0], gs.gsvertex[last], next);
SetKickVertex(&p[3], gs.gsvertex[last], next);
SetKickVertex(&p[1], gs.gsvertex[last], last); SetKickVertex(&p[1], gs.gsvertex[last], last);
SetKickVertex(&p[4], gs.gsvertex[last], last); // Duplicate the vertex
SetKickVertex(&p[2], gs.gsvertex[last], next); p[3] = p[0];
p[2] = p[0];
p[4] = p[1];
p[5] = p[1];
// Move some vertex x coord to create the others corners of the sprite
p[2].s = p[1].s; p[2].s = p[1].s;
p[2].x = p[1].x; p[2].x = p[1].x;
SetKickVertex(&p[5], gs.gsvertex[last], last);
p[5].s = p[0].s; p[5].s = p[0].s;
p[5].x = p[0].x; p[5].x = p[0].x;

View File

@ -29,7 +29,7 @@ class Kick
{ {
private: private:
void SET_VERTEX(VertexGPU *p, int i); void SET_VERTEX(VertexGPU *p, int i);
void SetKickVertex(VertexGPU *p, Vertex v, int next); void SetKickVertex(VertexGPU *p, Vertex &v, int next);
void OUTPUT_VERT(VertexGPU vert, u32 id); void OUTPUT_VERT(VertexGPU vert, u32 id);
public: public:
Kick() { } Kick() { }