dolphin/Source/Core/VideoCommon/IndexGenerator.h

63 lines
1.4 KiB
C
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// 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.
#ifndef _INDEXGENERATOR_H
#define _INDEXGENERATOR_H
#include "CommonTypes.h"
class IndexGenerator
{
public:
2013-02-22 01:10:00 +00:00
// Init
2013-04-08 17:39:43 +00:00
static void Init();
static void Start(u16 *Indexptr);
2013-02-22 01:10:00 +00:00
static void AddIndices(int primitive, u32 numVertices);
2013-02-22 01:10:00 +00:00
// Interface
static u32 GetNumIndices() {return numI;}
2013-02-22 01:10:00 +00:00
// returns numprimitives
static u32 GetNumVerts() {return index;}
static u32 GetIndexLen() {return (u32)(Iptr - BASEIptr);}
static u32 GetRemainingIndices();
2013-02-22 01:10:00 +00:00
/*
enum IndexPrimitiveType
{
Prim_None = 0,
Prim_List,
Prim_Strip,
Prim_Fan
2013-02-22 01:10:00 +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-02-22 01:10:00 +00:00
// Lines
static void AddLineList(u32 numVerts);
static void AddLineStrip(u32 numVerts);
2013-02-22 01:10:00 +00:00
// Points
static void AddPoints(u32 numVerts);
2013-04-08 17:39:43 +00:00
template <bool pr> static void WriteTriangle(u32 index1, u32 index2, u32 index3);
static u16 *Iptr;
static u16 *BASEIptr;
2013-02-22 01:10:00 +00:00
// TODO: redundant variables
static u32 numI;
2013-02-22 01:10:00 +00:00
static u32 index;
};
#endif // _INDEXGENERATOR_H