| 
									
										
										
										
											2015-05-24 06:55:12 +02:00
										 |  |  | // Copyright 2008 Dolphin Emulator Project
 | 
					
						
							| 
									
										
										
										
											2015-05-18 01:08:10 +02:00
										 |  |  | // Licensed under GPLv2+
 | 
					
						
							| 
									
										
										
										
											2013-04-17 23:09:55 -04:00
										 |  |  | // Refer to the license.txt file included.
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-10 13:54:46 -05:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-17 05:18:15 -05:00
										 |  |  | #include "Common/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-21 19:10:00 -06: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-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-21 19:10:00 -06:00
										 |  |  | 	static void AddIndices(int primitive, u32 numVertices); | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-21 19:10:00 -06:00
										 |  |  | 	// returns numprimitives
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	static u32 GetNumVerts() {return base_index;} | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	static u32 GetIndexLen() {return (u32)(index_buffer_current - BASEIptr);} | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-23 00:18:35 +01:00
										 |  |  | 	static u32 GetRemainingIndices(); | 
					
						
							| 
									
										
										
										
											2014-01-16 13:56:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-29 18:27:41 +00:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-02-21 19:10:00 -06:00
										 |  |  | 	// Triangles
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	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); | 
					
						
							| 
									
										
										
										
											2014-05-17 11:55:32 -07:00
										 |  |  | 	template <bool pr> static u16* AddQuads_nonstandard(u16 *Iptr, u32 numVerts, u32 index); | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-21 19:10:00 -06:00
										 |  |  | 	// Lines
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	static u16* AddLineList(u16 *Iptr, u32 numVerts, u32 index); | 
					
						
							|  |  |  | 	static u16* AddLineStrip(u16 *Iptr, u32 numVerts, u32 index); | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-21 19:10:00 -06:00
										 |  |  | 	// Points
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	static u16* AddPoints(u16 *Iptr, u32 numVerts, u32 index); | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	template <bool pr> static u16* WriteTriangle(u16 *Iptr, u32 index1, u32 index2, u32 index3); | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	static u16 *index_buffer_current; | 
					
						
							| 
									
										
										
										
											2014-01-15 21:44:46 +01:00
										 |  |  | 	static u16 *BASEIptr; | 
					
						
							| 
									
										
										
										
											2014-01-16 14:30:17 +01:00
										 |  |  | 	static u32 base_index; | 
					
						
							| 
									
										
										
										
											2009-09-29 18:27:41 +00:00
										 |  |  | }; |