1 /******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *****************************************************************************/
22 #ifndef RSP_VERTEX_MANAGER_H_
23 #define RSP_VERTEX_MANAGER_H_
25 //Forward declarations
27 class RSPMatrixManager;
28 class RSPLightManager;
38 //-----------------------------------------------------------------------------
39 //! Signal Processor Vertex
40 //-----------------------------------------------------------------------------
47 float xClip, yClip, zClip;
51 //*****************************************************************************
52 //! RSP Vertex Manager
53 //*****************************************************************************
54 class RSPVertexManager
58 //Constructor / Destructor
62 bool initialize(OpenGLManager* openGLMgr, Memory* memory, RSPMatrixManager* matrixMgr, RSPLightManager* lightMgr);
65 void setVertices( unsigned int address, unsigned int numVertices, unsigned int firstVertexIndex);
66 void modifyVertex( unsigned int vtx, unsigned int where, unsigned int val );
67 void setVertexColor(unsigned int vertexIndex, float r, float g, float b, float a);
68 void setVertexTextureCoord(unsigned int vertexIndex, float s, float t);
70 void ciVertex(unsigned int segmentAddress, unsigned int n, unsigned int v0 );
72 void addConkerVertices(unsigned int segmentAddress, unsigned int n, unsigned int v0 );
74 void DMAVertex( unsigned int v, unsigned int n, unsigned int v0 );
75 void DMAOffsets( unsigned int mtxoffset, unsigned int vtxoffset );
76 void setVertexColorBase( unsigned int rdramAddress ) { m_colorBaseRDRAMAddress = rdramAddress; }
78 bool add1Triangle( unsigned int v0, unsigned int v1, unsigned int v2);
79 void add2Triangles( int v00, int v01, int v02, int flag0,
80 int v10, int v11, int v12, int flag1 );
81 void add4Triangles( int v00, int v01, int v02,
82 int v10, int v11, int v12,
83 int v20, int v21, int v22,
84 int v30, int v31, int v32 );
85 void addDMATriangles( unsigned int tris, unsigned int n );
86 void add1Quadrangle( int v0, int v1, int v2, int v4 );
87 void setTexCoordGenType(TexCoordGenType texCoordGenType) { m_texCoordGenType = texCoordGenType; }
89 void setRDRAMOffset(unsigned int offset) { m_rdramOffset = offset; }
90 void setBillboard(unsigned int billboard) { m_billboard = billboard; }
91 unsigned int getBillboard() { return m_billboard; }
93 void setConkerAddress(unsigned int segmentAddress);
97 SPVertex* getVertex(unsigned int index) { return &m_vertices[index]; }
101 void _processVertex( unsigned int v );
105 OpenGLManager* m_openGLMgr;
107 RSPMatrixManager* m_matrixMgr;
108 RSPLightManager* m_lightMgr;
111 static const unsigned int MAX_VERTICES = 300;
112 SPVertex m_vertices[MAX_VERTICES];
114 unsigned int m_colorBaseRDRAMAddress; //!< Address in RDRAM where colors for vertices are located (used by Perfect Dark)
116 unsigned int m_rdramOffset;
118 unsigned int m_billboard;
119 TexCoordGenType m_texCoordGenType; //!< Texture Coordinate Generation Technique
121 unsigned int m_conkerRDRAMAddress;