2013-04-18 05:09:55 +02:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2011-02-14 03:18:03 +01: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 22:44:56 +01:00
|
|
|
|
|
|
|
#ifndef _INDEXGENERATOR_H
|
|
|
|
#define _INDEXGENERATOR_H
|
2009-10-06 16:24:10 +02:00
|
|
|
#include "CommonTypes.h"
|
2009-09-29 20:27:41 +02:00
|
|
|
|
2008-12-08 05:46:09 +01:00
|
|
|
class IndexGenerator
|
|
|
|
{
|
2009-09-29 20:27:41 +02:00
|
|
|
public:
|
2013-02-22 02:10:00 +01:00
|
|
|
// Init
|
2013-04-08 19:39:43 +02:00
|
|
|
static void Init();
|
2014-01-15 21:44:46 +01:00
|
|
|
static void Start(u16 *Indexptr);
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2013-02-22 02:10:00 +01:00
|
|
|
static void AddIndices(int primitive, u32 numVertices);
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2013-02-22 02:10:00 +01:00
|
|
|
// Interface
|
2014-01-15 21:44:46 +01:00
|
|
|
static u32 GetNumIndices() {return numI;}
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2013-02-22 02:10:00 +01:00
|
|
|
// returns numprimitives
|
|
|
|
static u32 GetNumVerts() {return index;}
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2014-01-15 21:44:46 +01:00
|
|
|
static u32 GetIndexLen() {return (u32)(Iptr - BASEIptr);}
|
2013-10-29 06:23:17 +01:00
|
|
|
|
2013-03-23 00:18:35 +01:00
|
|
|
static u32 GetRemainingIndices();
|
2013-02-22 02:10:00 +01:00
|
|
|
/*
|
2009-09-29 20:27:41 +02:00
|
|
|
enum IndexPrimitiveType
|
|
|
|
{
|
2009-09-30 02:28:27 +02:00
|
|
|
Prim_None = 0,
|
|
|
|
Prim_List,
|
|
|
|
Prim_Strip,
|
|
|
|
Prim_Fan
|
2013-02-22 02:10:00 +01:00
|
|
|
};
|
|
|
|
*/
|
2009-09-29 20:27:41 +02:00
|
|
|
private:
|
2013-02-22 02:10:00 +01:00
|
|
|
// Triangles
|
2013-04-08 19:39:43 +02: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 02:51:12 +01:00
|
|
|
|
2013-02-22 02:10:00 +01:00
|
|
|
// Lines
|
|
|
|
static void AddLineList(u32 numVerts);
|
|
|
|
static void AddLineStrip(u32 numVerts);
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2013-02-22 02:10:00 +01:00
|
|
|
// Points
|
|
|
|
static void AddPoints(u32 numVerts);
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2013-04-08 19:39:43 +02:00
|
|
|
template <bool pr> static void WriteTriangle(u32 index1, u32 index2, u32 index3);
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2014-01-15 21:44:46 +01:00
|
|
|
static u16 *Iptr;
|
|
|
|
static u16 *BASEIptr;
|
2013-02-22 02:10:00 +01:00
|
|
|
// TODO: redundant variables
|
2014-01-15 21:44:46 +01:00
|
|
|
static u32 numI;
|
2013-02-22 02:10:00 +01:00
|
|
|
static u32 index;
|
2009-09-29 20:27:41 +02:00
|
|
|
};
|
|
|
|
|
2009-09-30 02:28:27 +02:00
|
|
|
#endif // _INDEXGENERATOR_H
|