2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 04:46:09 +00: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/
|
|
|
|
|
2011-02-14 02:18:03 +00:00
|
|
|
// This is currently only used by the DX backend, but it may make sense to
|
|
|
|
// use it in the GL backend or a future DX10 backend too.
|
2008-12-25 21:44:56 +00:00
|
|
|
|
|
|
|
#ifndef _INDEXGENERATOR_H
|
|
|
|
#define _INDEXGENERATOR_H
|
2009-10-06 14:24:10 +00:00
|
|
|
#include "CommonTypes.h"
|
2009-09-29 18:27:41 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
class IndexGenerator
|
|
|
|
{
|
2009-09-29 18:27:41 +00:00
|
|
|
public:
|
2013-02-22 01:10:00 +00:00
|
|
|
// Init
|
2013-04-08 17:39:43 +00:00
|
|
|
static void Init();
|
2009-10-06 14:24:10 +00:00
|
|
|
static void Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr);
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
static void AddIndices(int primitive, u32 numVertices);
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
// Interface
|
|
|
|
static u32 GetNumTriangles() {return numT;}
|
|
|
|
static u32 GetNumLines() {return numL;}
|
|
|
|
static u32 GetNumPoints() {return numP;}
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
// returns numprimitives
|
|
|
|
static u32 GetNumVerts() {return index;}
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
static u32 GetTriangleindexLen() {return (u32)(Tptr - BASETptr);}
|
|
|
|
static u32 GetLineindexLen() {return (u32)(Lptr - BASELptr);}
|
|
|
|
static u32 GetPointindexLen() {return (u32)(Pptr - BASEPptr);}
|
2013-03-22 23:18:35 +00:00
|
|
|
|
|
|
|
static u32 GetRemainingIndices();
|
2013-02-22 01:10:00 +00:00
|
|
|
/*
|
2009-09-29 18:27:41 +00:00
|
|
|
enum IndexPrimitiveType
|
|
|
|
{
|
2009-09-30 00:28:27 +00:00
|
|
|
Prim_None = 0,
|
|
|
|
Prim_List,
|
|
|
|
Prim_Strip,
|
|
|
|
Prim_Fan
|
2013-02-22 01:10:00 +00:00
|
|
|
};
|
|
|
|
*/
|
2009-09-29 18:27:41 +00:00
|
|
|
private:
|
2013-02-22 01:10:00 +00:00
|
|
|
// Triangles
|
2013-04-08 17:39:43 +00:00
|
|
|
template <bool pr> static void AddList(u32 numVerts);
|
|
|
|
template <bool pr> static void AddStrip(u32 numVerts);
|
|
|
|
template <bool pr> static void AddFan(u32 numVerts);
|
|
|
|
template <bool pr> static void AddQuads(u32 numVerts);
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
// Lines
|
|
|
|
static void AddLineList(u32 numVerts);
|
|
|
|
static void AddLineStrip(u32 numVerts);
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
// Points
|
|
|
|
static void AddPoints(u32 numVerts);
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-04-08 17:39:43 +00:00
|
|
|
template <bool pr> static void WriteTriangle(u32 index1, u32 index2, u32 index3);
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2009-10-06 14:24:10 +00:00
|
|
|
static u16 *Tptr;
|
2010-05-22 21:58:43 +00:00
|
|
|
static u16 *BASETptr;
|
2009-10-06 14:24:10 +00:00
|
|
|
static u16 *Lptr;
|
2010-05-22 21:58:43 +00:00
|
|
|
static u16 *BASELptr;
|
2009-10-06 14:24:10 +00:00
|
|
|
static u16 *Pptr;
|
2010-05-22 21:58:43 +00:00
|
|
|
static u16 *BASEPptr;
|
2013-02-22 01:10:00 +00:00
|
|
|
// TODO: redundant variables
|
|
|
|
static u32 numT;
|
|
|
|
static u32 numL;
|
|
|
|
static u32 numP;
|
|
|
|
static u32 index;
|
2009-09-29 18:27:41 +00:00
|
|
|
};
|
|
|
|
|
2009-09-30 00:28:27 +00:00
|
|
|
#endif // _INDEXGENERATOR_H
|