DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

GuiModel.h (3181B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
     10 it under the terms of the GNU General Public License as published by
     11 the Free Software Foundation, either version 3 of the License, or
     12 (at your option) any later version.
     13 
     14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
     15 but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 GNU General Public License for more details.
     18 
     19 You should have received a copy of the GNU General Public License
     20 along with Doom 3 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code.  If not, please request a copy in writing from id Software at the address below.
     23 
     24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
     25 
     26 ===========================================================================
     27 */
     28 
     29 struct guiModelSurface_t {
     30 	const idMaterial *	material;
     31 	uint64				glState;
     32 	int					firstIndex;
     33 	int					numIndexes;
     34 	stereoDepthType_t		stereoType;
     35 };
     36 
     37 class idRenderMatrix;
     38 
     39 class idGuiModel {
     40 public:
     41 	idGuiModel();
     42 
     43 	void	Clear();
     44 
     45 	void	WriteToDemo( idDemoFile * demo );
     46 	void	ReadFromDemo( idDemoFile * demo );
     47 	
     48 	// allocates memory for verts and indexes in frame-temporary buffer memory
     49 	void	BeginFrame();
     50 
     51 	void	EmitToCurrentView( float modelMatrix[16], bool depthHack );
     52 	void	EmitFullScreen();
     53 
     54 	// the returned pointer will be in write-combined memory, so only make contiguous
     55 	// 32 bit writes and never read from it.
     56 	idDrawVert * AllocTris( int numVerts, const triIndex_t * indexes, int numIndexes, const idMaterial * material, 
     57 							const uint64 glState, const stereoDepthType_t stereoType );
     58 
     59 	//---------------------------
     60 private:
     61 	void	AdvanceSurf();
     62 	void	EmitSurfaces( float modelMatrix[16], float modelViewMatrix[16], 
     63 		bool depthHack, bool allowFullScreenStereoDepth, bool linkAsEntity );
     64 
     65 	guiModelSurface_t *			surf;
     66 
     67 	float						shaderParms[ MAX_ENTITY_SHADER_PARMS ];
     68 
     69 	static const float STEREO_DEPTH_NEAR;
     70 	static const float STEREO_DEPTH_MID;
     71 	static const float STEREO_DEPTH_FAR;
     72 
     73 	// if we exceed these limits we stop rendering GUI surfaces
     74 	static const int MAX_INDEXES = ( 20000 * 6 );
     75 	static const int MAX_VERTS	 = ( 20000 * 4 );
     76 
     77 	vertCacheHandle_t			vertexBlock;
     78 	vertCacheHandle_t			indexBlock;
     79 	idDrawVert *				vertexPointer;
     80 	triIndex_t *				indexPointer;
     81 
     82 	int		numVerts;
     83 	int		numIndexes;
     84 
     85 	idList<guiModelSurface_t, TAG_MODEL>	surfaces;
     86 };
     87