dolphin/Source/Core/VideoCommon/IndexGenerator.h

49 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.
#pragma once
#include "Common/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
// returns numprimitives
static u32 GetNumVerts() {return base_index;}
static u32 GetIndexLen() {return (u32)(index_buffer_current - BASEIptr);}
static u32 GetRemainingIndices();
2014-01-16 12:56:20 +00:00
private:
2013-02-22 01:10:00 +00:00
// Triangles
template <bool pr> static u16* AddList(u16 *Iptr, u32 numVerts, u32 index);
template <bool pr> static u16* AddStrip(u16 *Iptr, u32 numVerts, u32 index);
template <bool pr> static u16* AddFan(u16 *Iptr, u32 numVerts, u32 index);
template <bool pr> static u16* AddQuads(u16 *Iptr, u32 numVerts, u32 index);
template <bool pr> static u16* AddQuads_nonstandard(u16 *Iptr, u32 numVerts, u32 index);
2013-02-22 01:10:00 +00:00
// Lines
static u16* AddLineList(u16 *Iptr, u32 numVerts, u32 index);
static u16* AddLineStrip(u16 *Iptr, u32 numVerts, u32 index);
2013-02-22 01:10:00 +00:00
// Points
static u16* AddPoints(u16 *Iptr, u32 numVerts, u32 index);
template <bool pr> static u16* WriteTriangle(u16 *Iptr, u32 index1, u32 index2, u32 index3);
static u16 *index_buffer_current;
static u16 *BASEIptr;
static u32 base_index;
};