2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2011-02-13 19:18:03 -07: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 14:44:56 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/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:
|
2016-06-24 02:43:46 -06:00
|
|
|
// Init
|
|
|
|
static void Init();
|
|
|
|
static void Start(u16* Indexptr);
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
static void AddIndices(int primitive, u32 numVertices);
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2018-11-27 00:16:53 -07:00
|
|
|
static void AddExternalIndices(const u16* indices, u32 num_indices, u32 num_vertices);
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// returns numprimitives
|
|
|
|
static u32 GetNumVerts() { return base_index; }
|
|
|
|
static u32 GetIndexLen() { return (u32)(index_buffer_current - BASEIptr); }
|
|
|
|
static u32 GetRemainingIndices();
|
2014-01-16 05:56:20 -07:00
|
|
|
|
2009-09-29 12:27:41 -06:00
|
|
|
private:
|
2016-06-24 02:43:46 -06: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);
|
|
|
|
|
|
|
|
// Lines
|
|
|
|
static u16* AddLineList(u16* Iptr, u32 numVerts, u32 index);
|
|
|
|
static u16* AddLineStrip(u16* Iptr, u32 numVerts, u32 index);
|
|
|
|
|
|
|
|
// 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;
|
2009-09-29 12:27:41 -06:00
|
|
|
};
|