2009-07-28 15:32:10 -06:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2008-12-25 14:44:56 -07:00
|
|
|
// This is currently only used by the DX plugin, but it may make sense to
|
|
|
|
// use it in the GL plugin or a future DX10 plugin too.
|
|
|
|
|
|
|
|
#ifndef _INDEXGENERATOR_H
|
|
|
|
#define _INDEXGENERATOR_H
|
2009-10-06 08:24:10 -06:00
|
|
|
#include "CommonTypes.h"
|
2009-09-29 12:27:41 -06:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
class IndexGenerator
|
|
|
|
{
|
2009-09-29 12:27:41 -06:00
|
|
|
public:
|
|
|
|
//Init
|
2009-10-06 08:24:10 -06:00
|
|
|
static void Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr);
|
2009-09-29 12:27:41 -06:00
|
|
|
//Triangles
|
2009-10-06 08:24:10 -06:00
|
|
|
static void AddList(int numVerts);
|
|
|
|
static void AddStrip(int numVerts);
|
|
|
|
static void AddFan(int numVerts);
|
|
|
|
static void AddQuads(int numVerts);
|
2009-09-29 12:27:41 -06:00
|
|
|
//Lines
|
2009-10-06 08:24:10 -06:00
|
|
|
static void AddLineList(int numVerts);
|
|
|
|
static void AddLineStrip(int numVerts);
|
2009-09-29 12:27:41 -06:00
|
|
|
//Points
|
2009-10-06 08:24:10 -06:00
|
|
|
static void AddPoints(int numVerts);
|
2009-09-29 12:27:41 -06:00
|
|
|
//Interface
|
2009-10-06 08:24:10 -06:00
|
|
|
static int GetNumTriangles() {used = true; return numT;}
|
|
|
|
static int GetNumLines() {used = true;return numL;}
|
|
|
|
static int GetNumPoints() {used = true;return numP;}
|
|
|
|
static int GetNumVerts() {return index;} //returns numprimitives
|
|
|
|
static int GetNumAdds() {return Tadds + Ladds + Padds;}
|
2010-05-22 15:58:43 -06:00
|
|
|
static int GetTriangleindexLen() {return (int)(Tptr - BASETptr);}
|
|
|
|
static int GetLineindexLen() {return (int)(Lptr - BASELptr);}
|
|
|
|
static int GetPointindexLen() {return (int)(Pptr - BASEPptr);}
|
2009-09-29 18:28:27 -06:00
|
|
|
|
2009-09-29 12:27:41 -06:00
|
|
|
enum IndexPrimitiveType
|
|
|
|
{
|
2009-09-29 18:28:27 -06:00
|
|
|
Prim_None = 0,
|
|
|
|
Prim_List,
|
|
|
|
Prim_Strip,
|
|
|
|
Prim_Fan
|
|
|
|
} ;
|
2009-09-29 12:27:41 -06:00
|
|
|
private:
|
2009-10-06 08:24:10 -06:00
|
|
|
static u16 *Tptr;
|
2010-05-22 15:58:43 -06:00
|
|
|
static u16 *BASETptr;
|
2009-10-06 08:24:10 -06:00
|
|
|
static u16 *Lptr;
|
2010-05-22 15:58:43 -06:00
|
|
|
static u16 *BASELptr;
|
2009-10-06 08:24:10 -06:00
|
|
|
static u16 *Pptr;
|
2010-05-22 15:58:43 -06:00
|
|
|
static u16 *BASEPptr;
|
2009-10-06 08:24:10 -06:00
|
|
|
static int numT;
|
|
|
|
static int numL;
|
|
|
|
static int numP;
|
|
|
|
static int index;
|
|
|
|
static int Tadds;
|
|
|
|
static int Ladds;
|
|
|
|
static int Padds;
|
|
|
|
static IndexPrimitiveType LastTPrimitive;
|
|
|
|
static IndexPrimitiveType LastLPrimitive;
|
|
|
|
static bool used;
|
2009-09-29 12:27:41 -06:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-09-29 18:28:27 -06:00
|
|
|
#endif // _INDEXGENERATOR_H
|