doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tr_local.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 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 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 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 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 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 #ifndef __TR_LOCAL_H__
30 #define __TR_LOCAL_H__
31 
32 #include "Image.h"
33 #include "MegaTexture.h"
34 
35 class idRenderWorldLocal;
36 
37 // everything that is needed by the backend needs
38 // to be double buffered to allow it to run in
39 // parallel on a dual cpu machine
40 const int SMP_FRAMES = 1;
41 
42 const int FALLOFF_TEXTURE_SIZE = 64;
43 
44 const float DEFAULT_FOG_DISTANCE = 500.0f;
45 
46 const int FOG_ENTER_SIZE = 64;
47 const float FOG_ENTER = (FOG_ENTER_SIZE+1.0f)/(FOG_ENTER_SIZE*2);
48 // picky to get the bilerp correct at terminator
49 
50 
51 // idScreenRect gets carried around with each drawSurf, so it makes sense
52 // to keep it compact, instead of just using the idBounds class
53 class idScreenRect {
54 public:
55  short x1, y1, x2, y2; // inclusive pixel bounds inside viewport
56  float zmin, zmax; // for depth bounds test
57 
58  void Clear(); // clear to backwards values
59  void AddPoint( float x, float y ); // adds a point
60  void Expand(); // expand by one pixel each way to fix roundoffs
61  void Intersect( const idScreenRect &rect );
62  void Union( const idScreenRect &rect );
63  bool Equals( const idScreenRect &rect ) const;
64  bool IsEmpty() const;
65 };
66 
68 void R_ShowColoredScreenRect( const idScreenRect &rect, int colorIndex );
69 
70 typedef enum {
87 
88 /*
89 ==============================================================================
90 
91 SURFACES
92 
93 ==============================================================================
94 */
95 
96 #include "ModelDecal.h"
97 #include "ModelOverlay.h"
98 #include "Interaction.h"
99 
100 
101 // drawSurf_t structures command the back end to render surfaces
102 // a given srfTriangles_t may be used with multiple viewEntity_t,
103 // as when viewed in a subview or multiple viewport render, or
104 // with multiple shaders when skinned, or, possibly with multiple
105 // lights, although currently each lighting interaction creates
106 // unique srfTriangles_t
107 
108 // drawSurf_t are always allocated and freed every frame, they are never cached
109 static const int DSF_VIEW_INSIDE_SHADOW = 1;
110 
111 typedef struct drawSurf_s {
113  const struct viewEntity_s *space;
114  const idMaterial *material; // may be NULL for shadow volumes
115  float sort; // material->sort, modified by gui / entity sort offsets
116  const float *shaderRegisters; // evaluated and adjusted for referenceShaders
117  const struct drawSurf_s *nextOnLight; // viewLight chains
118  idScreenRect scissorRect; // for scissor clipping, local inside renderView viewport
119  int dsFlags; // DSF_VIEW_INSIDE_SHADOW, etc
120  struct vertCache_s *dynamicTexCoords; // float * in vertex cache memory
121  // specular directions for non vertex program cards, skybox texcoords, etc
122 } drawSurf_t;
123 
124 
125 typedef struct {
126  int numPlanes; // this is always 6 for now
127  idPlane planes[6];
128  // positive sides facing inward
129  // plane 5 is always the plane the projection is going to, the
130  // other planes are just clip planes
131  // all planes are in global coordinates
132 
134  // a projected light with a single frustum needs to make sil planes
135  // from triangles that clip against side planes, but a point light
136  // that has adjacent frustums doesn't need to
138 
139 
140 // areas have references to hold all the lights and entities in them
141 typedef struct areaReference_s {
142  struct areaReference_s *areaNext; // chain in the area
144  struct areaReference_s *ownerNext; // chain on either the entityDef or lightDef
145  idRenderEntityLocal * entity; // only one of entity / light will be non-NULL
146  idRenderLightLocal * light; // only one of entity / light will be non-NULL
147  struct portalArea_s * area; // so owners can find all the areas they are in
149 
150 
151 // idRenderLight should become the new public interface replacing the qhandle_t to light defs in the idRenderWorld interface
153 public:
154  virtual ~idRenderLight() {}
155 
156  virtual void FreeRenderLight() = 0;
157  virtual void UpdateRenderLight( const renderLight_t *re, bool forceUpdate = false ) = 0;
158  virtual void GetRenderLight( renderLight_t *re ) = 0;
159  virtual void ForceUpdate() = 0;
160  virtual int GetIndex() = 0;
161 };
162 
163 
164 // idRenderEntity should become the new public interface replacing the qhandle_t to entity defs in the idRenderWorld interface
166 public:
167  virtual ~idRenderEntity() {}
168 
169  virtual void FreeRenderEntity() = 0;
170  virtual void UpdateRenderEntity( const renderEntity_t *re, bool forceUpdate = false ) = 0;
171  virtual void GetRenderEntity( renderEntity_t *re ) = 0;
172  virtual void ForceUpdate() = 0;
173  virtual int GetIndex() = 0;
174 
175  // overlays are extra polygons that deform with animating models for blood and damage marks
176  virtual void ProjectOverlay( const idPlane localTextureAxis[2], const idMaterial *material ) = 0;
177  virtual void RemoveDecals() = 0;
178 };
179 
180 
182 public:
184 
185  virtual void FreeRenderLight();
186  virtual void UpdateRenderLight( const renderLight_t *re, bool forceUpdate = false );
187  virtual void GetRenderLight( renderLight_t *re );
188  virtual void ForceUpdate();
189  virtual int GetIndex();
190 
191  renderLight_t parms; // specification
192 
193  bool lightHasMoved; // the light has changed its position since it was
194  // first added, so the prelight model is not valid
195 
196  float modelMatrix[16]; // this is just a rearrangement of parms.axis and parms.origin
197 
199  int index; // in world lightdefs
200 
201  int areaNum; // if not -1, we may be able to cull all the light's
202  // interactions if !viewDef->connectedAreas[areaNum]
203 
204  int lastModifiedFrameNum; // to determine if it is constantly changing,
205  // and should go in the dynamic frame memory, or kept
206  // in the cached memory
207  bool archived; // for demo writing
208 
209 
210  // derived information
212 
213  const idMaterial * lightShader; // guaranteed to be valid, even if parms.shader isn't
215 
216  idVec3 globalLightOrigin; // accounting for lightCenter and parallel
217 
218 
219  idPlane frustum[6]; // in global space, positive side facing out, last two are front/back
220  idWinding * frustumWindings[6]; // used for culling
221  srfTriangles_t * frustumTris; // triangulated frustumWindings[]
222 
223  int numShadowFrustums; // one for projected lights, usually six for point lights
225 
226  int viewCount; // if == tr.viewCount, the light is on the viewDef->viewLights list
228 
229  areaReference_t * references; // each area the light is present in will have a lightRef
230  idInteraction * firstInteraction; // doubly linked list
232 
234 };
235 
236 
238 public:
240 
241  virtual void FreeRenderEntity();
242  virtual void UpdateRenderEntity( const renderEntity_t *re, bool forceUpdate = false );
243  virtual void GetRenderEntity( renderEntity_t *re );
244  virtual void ForceUpdate();
245  virtual int GetIndex();
246 
247  // overlays are extra polygons that deform with animating models for blood and damage marks
248  virtual void ProjectOverlay( const idPlane localTextureAxis[2], const idMaterial *material );
249  virtual void RemoveDecals();
250 
252 
253  float modelMatrix[16]; // this is just a rearrangement of parms.axis and parms.origin
254 
256  int index; // in world entityDefs
257 
258  int lastModifiedFrameNum; // to determine if it is constantly changing,
259  // and should go in the dynamic frame memory, or kept
260  // in the cached memory
261  bool archived; // for demo writing
262 
263  idRenderModel * dynamicModel; // if parms.model->IsDynamicModel(), this is the generated data
264  int dynamicModelFrameCount; // continuously animating dynamic models will recreate
265  // dynamicModel if this doesn't == tr.viewCount
267 
268  idBounds referenceBounds; // the local bounds used to place entityRefs, either from parms or a model
269 
270  // a viewEntity_t is created whenever a idRenderEntityLocal is considered for inclusion
271  // in a given view, even if it turns out to not be visible
272  int viewCount; // if tr.viewCount == viewCount, viewEntity is valid,
273  // but the entity may still be off screen
274  struct viewEntity_s * viewEntity; // in frame temporary memory
275 
277  // if tr.viewCount == visibleCount, at least one ambient
278  // surface has actually been added by R_AddAmbientDrawsurfs
279  // note that an entity could still be in the view frustum and not be visible due
280  // to portal passing
281 
282  idRenderModelDecal * decals; // chain of decals that have been projected on this model
283  idRenderModelOverlay * overlay; // blood overlays on animated models
284 
285  areaReference_t * entityRefs; // chain of all references
286  idInteraction * firstInteraction; // doubly linked list
288 
290 };
291 
292 
293 // viewLights are allocated on the frame temporary stack memory
294 // a viewLight contains everything that the back end needs out of an idRenderLightLocal,
295 // which the front end may be modifying simultaniously if running in SMP mode.
296 // a viewLight may exist even without any surfaces, and may be relevent for fogging,
297 // but should never exist if its volume does not intersect the view frustum
298 typedef struct viewLight_s {
299  struct viewLight_s * next;
300 
301  // back end should NOT reference the lightDef, because it can change when running SMP
303 
304  // for scissor clipping, local inside renderView viewport
305  // scissorRect.Empty() is true if the viewEntity_t was never actually
306  // seen through any portals
308 
309  // if the view isn't inside the light, we can use the non-reversed
310  // shadow drawing, avoiding the draws of the front and rear caps
312 
313  // true if globalLightOrigin is inside the view frustum, even if it may
314  // be obscured by geometry. This allows us to skip shadows from non-visible objects
316 
317  // if !viewInsideLight, the corresponding bit for each of the shadowFrustum
318  // projection planes that the view is on the negative side of will be set,
319  // allowing us to skip drawing the projected caps of shadows if we can't see the face
321 
322  idVec3 globalLightOrigin; // global light origin used by backend
323  idPlane lightProject[4]; // light project used by backend
324  idPlane fogPlane; // fog plane for backend fog volume rendering
325  const srfTriangles_t * frustumTris; // light frustum for backend fog volume rendering
326  const idMaterial * lightShader; // light shader used by backend
327  const float * shaderRegisters; // shader registers used by backend
328  idImage * falloffImage; // falloff image used by backend
329 
330  const struct drawSurf_s *globalShadows; // shadow everything
331  const struct drawSurf_s *localInteractions; // don't get local shadows
332  const struct drawSurf_s *localShadows; // don't shadow local Surfaces
333  const struct drawSurf_s *globalInteractions; // get shadows from everything
334  const struct drawSurf_s *translucentInteractions; // get shadows from everything
335 } viewLight_t;
336 
337 
338 // a viewEntity is created whenever a idRenderEntityLocal is considered for inclusion
339 // in the current view, but it may still turn out to be culled.
340 // viewEntity are allocated on the frame temporary stack memory
341 // a viewEntity contains everything that the back end needs out of a idRenderEntityLocal,
342 // which the front end may be modifying simultaniously if running in SMP mode.
343 // A single entityDef can generate multiple viewEntity_t in a single frame, as when seen in a mirror
344 typedef struct viewEntity_s {
346 
347  // back end should NOT reference the entityDef, because it can change when running SMP
349 
350  // for scissor clipping, local inside renderView viewport
351  // scissorRect.Empty() is true if the viewEntity_t was never actually
352  // seen through any portals, but was created for shadow casting.
353  // a viewEntity can have a non-empty scissorRect, meaning that an area
354  // that it is in is visible, and still not be visible.
356 
359 
360  float modelMatrix[16]; // local coords to global coords
361  float modelViewMatrix[16]; // local coords to eye coords
362 } viewEntity_t;
363 
364 
365 const int MAX_CLIP_PLANES = 1; // we may expand this to six for some subview issues
366 
367 // viewDefs are allocated on the frame temporary stack memory
368 typedef struct viewDef_s {
369  // specified in the call to DrawScene()
371 
372  float projectionMatrix[16];
374 
376 
377  float floatTime;
378 
380  // Used to find the portalArea that view flooding will take place from.
381  // for a normal view, the initialViewOrigin will be renderView.viewOrg,
382  // but a mirror may put the projection origin outside
383  // of any valid area, or in an unconnected area of the map, so the view
384  // area must be based on a point just off the surface of the mirror / subview.
385  // It may be possible to get a failed portal pass if the plane of the
386  // mirror intersects a portal, and the initialViewAreaOrigin is on
387  // a different side than the renderView.viewOrg is.
388 
389  bool isSubview; // true if this view is not the main view
390  bool isMirror; // the portal is a mirror, invert the face culling
392 
393  bool isEditor;
394 
395  int numClipPlanes; // mirrors will often use a single clip plane
396  idPlane clipPlanes[MAX_CLIP_PLANES]; // in world space, the positive side
397  // of the plane is the visible side
398  idScreenRect viewport; // in real pixels and proper Y flip
399 
401  // for scissor clipping, local inside renderView viewport
402  // subviews may only be rendering part of the main view
403  // these are real physical pixel values, possibly scaled and offset from the
404  // renderView x/y/width/height
405 
406  struct viewDef_s * superView; // never go into an infinite subview loop
408 
409  // drawSurfs are the visible surfaces of the viewEntities, sorted
410  // by the material sort parameter
411  drawSurf_t ** drawSurfs; // we don't use an idList for this, because
412  int numDrawSurfs; // it is allocated in frame temporary memory
413  int maxDrawSurfs; // may be resized
414 
415  struct viewLight_s *viewLights; // chain of all viewLights effecting view
416  struct viewEntity_s *viewEntitys; // chain of all viewEntities effecting view, including off screen ones casting shadows
417  // we use viewEntities as a check to see if a given view consists solely
418  // of 2D rendering, which we can optimize in certain ways. A 2D view will
419  // not have any viewEntities
420 
421  idPlane frustum[5]; // positive sides face outward, [4] is the front clip plane
423 
424  int areaNum; // -1 = not in a valid area
425 
427  // An array in frame temporary memory that lists if an area can be reached without
428  // crossing a closed door. This is used to avoid drawing interactions
429  // when the light is behind a closed door.
430 
431 } viewDef_t;
432 
433 
434 // complex light / surface interactions are broken up into multiple passes of a
435 // simple interaction shader
436 typedef struct {
437  const drawSurf_t * surf;
438 
444 
445  idVec4 diffuseColor; // may have a light color baked into it, will be < tr.backEndRendererMaxLight
446  idVec4 specularColor; // may have a light color baked into it, will be < tr.backEndRendererMaxLight
447  stageVertexColor_t vertexColor; // applies to both diffuse and specular
448 
449  int ambientLight; // use tr.ambientNormalMap instead of normalization cube map
450  // (not a bool just to avoid an uninitialized memory check of the pad region by valgrind)
451 
452  // these are loaded into the vertex program
455  idVec4 lightProjection[4]; // in local coordinates, possibly with a texture matrix baked in
456  idVec4 bumpMatrix[2];
457  idVec4 diffuseMatrix[2];
458  idVec4 specularMatrix[2];
460 
461 
462 /*
463 =============================================================
464 
465 RENDERER BACK END COMMAND QUEUE
466 
467 TR_CMDS
468 
469 =============================================================
470 */
471 
472 typedef enum {
477  RC_SWAP_BUFFERS // can't just assume swap at end of list because
478  // of forced list submission before syncs
480 
481 typedef struct {
482  renderCommand_t commandId, *next;
484 
485 typedef struct {
486  renderCommand_t commandId, *next;
490 
491 typedef struct {
492  renderCommand_t commandId, *next;
495 
496 typedef struct {
497  renderCommand_t commandId, *next;
498  int x, y, imageWidth, imageHeight;
500  int cubeFace; // when copying to a cubeMap
502 
503 
504 //=======================================================================
505 
506 // this is the inital allocation for max number of drawsurfs
507 // in a given view, but it will automatically grow if needed
508 const int INITIAL_DRAWSURFS = 0x4000;
509 
510 // a request for frame memory will never fail
511 // (until malloc fails), but it may force the
512 // allocation of a new memory block that will
513 // be discontinuous with the existing memory
514 typedef struct frameMemoryBlock_s {
516  int size;
517  int used;
518  int poop; // so that base is 16 byte aligned
519  byte base[4]; // dynamically allocated as [size]
521 
522 // all of the information needed by the back end must be
523 // contained in a frameData_t. This entire structure is
524 // duplicated so the front and back end can run in parallel
525 // on an SMP machine (OBSOLETE: this capability has been removed)
526 typedef struct {
527  // one or more blocks of memory for all frame
528  // temporary allocations
530 
531  // alloc will point somewhere into the memory chain
533 
536 
537  int memoryHighwater; // max used on any frame
538 
539  // the currently building command list
540  // commands can be inserted at the front if needed, as for required
541  // dynamically generated textures
542  emptyCommand_t *cmdHead, *cmdTail; // may be of other command type based on commandId
543 } frameData_t;
544 
545 extern frameData_t *frameData;
546 
547 //=======================================================================
548 
549 void R_LockSurfaceScene( viewDef_t *parms );
550 void R_ClearCommandChain( void );
551 void R_AddDrawViewCmd( viewDef_t *parms );
552 
553 void R_ReloadGuis_f( const idCmdArgs &args );
554 void R_ListGuis_f( const idCmdArgs &args );
555 
556 void *R_GetCommandBuffer( int bytes );
557 
558 // this allows a global override of all materials
559 bool R_GlobalShaderOverride( const idMaterial **shader );
560 
561 // this does various checks before calling the idDeclSkin
562 const idMaterial *R_RemapShaderBySkin( const idMaterial *shader, const idDeclSkin *customSkin, const idMaterial *customShader );
563 
564 
565 //====================================================
566 
567 
568 /*
569 ** performanceCounters_t
570 */
571 typedef struct {
572  int c_sphere_cull_in, c_sphere_cull_clip, c_sphere_cull_out;
573  int c_box_cull_in, c_box_cull_out;
574  int c_createInteractions; // number of calls to idInteraction::CreateInteraction
579  int c_alloc, c_free; // counts for R_StaticAllc/R_StaticFree
583  int c_numViews; // number of total views rendered
584  int c_deformedSurfaces; // idMD5Mesh::GenerateSurface
585  int c_deformedVerts; // idMD5Mesh::GenerateSurface
586  int c_deformedIndexes; // idMD5Mesh::GenerateSurface
587  int c_tangentIndexes; // R_DeriveTangents()
588  int c_entityUpdates, c_lightUpdates, c_entityReferences, c_lightReferences;
590  int frontEndMsec; // sum of time in all RE_RenderScene's in a frame
592 
593 
594 typedef struct {
598  int texEnv;
600 } tmu_t;
601 
603 typedef struct {
606 
609  bool forceGlState; // the next GL_State will ignore glStateBits and set everything
610 } glstate_t;
611 
612 
613 typedef struct {
617  int c_indexes; // one set per pass
618  int c_totalIndexes; // counting all passes
619 
625 
629 
631  float c_overDraw;
632 
633  float maxLightValue; // for light scale
634  int msec; // total msec for backend run
636 
637 // all state modified by the back end is separated
638 // from the front end state
639 typedef struct {
640  int frameCount; // used to track all images used in a frame
643 
644  const viewEntity_t *currentSpace; // for detecting when a matrix must change
646  // for scissor clipping, local inside renderView viewport
647 
649  int depthFunc; // GLS_DEPTHFUNC_EQUAL, or GLS_DEPTHFUNC_LESS for translucent
650  float lightTextureMatrix[16]; // only if lightStage->texture.hasMatrix
651  float lightColor[4]; // evaluation of current light's color stage
652 
653  float lightScale; // Every light color calaculation will be multiplied by this,
654  // which will guarantee that the result is < tr.backEndRendererMaxLight
655  // A card with high dynamic range will have this set to 1.0
656  float overBright; // The amount that all light interactions must be multiplied by
657  // with post processing to get the desired total light level.
658  // A high dynamic range card will have this set to 1.0.
659 
660  bool currentRenderCopied; // true if any material has already referenced _currentRender
661 
662  // our OpenGL state deltas
664 
667 
668 
669 const int MAX_GUI_SURFACES = 1024; // default size of the drawSurfs list for guis, will
670  // be automatically expanded as needed
671 
672 typedef enum {
679 } backEndName_t;
680 
681 typedef struct {
682  int x, y, width, height; // these are in physical, OpenGL Y-at-bottom pixels
683 } renderCrop_t;
684 static const int MAX_RENDER_CROPS = 8;
685 
686 /*
687 ** Most renderer globals are defined here.
688 ** backend functions should never modify any of these fields,
689 ** but may read fields that aren't dynamically modified
690 ** by the frontend.
691 */
693 public:
694  // external functions
695  virtual void Init( void );
696  virtual void Shutdown( void );
697  virtual void InitOpenGL( void );
698  virtual void ShutdownOpenGL( void );
699  virtual bool IsOpenGLRunning( void ) const;
700  virtual bool IsFullScreen( void ) const;
701  virtual int GetScreenWidth( void ) const;
702  virtual int GetScreenHeight( void ) const;
703  virtual idRenderWorld * AllocRenderWorld( void );
704  virtual void FreeRenderWorld( idRenderWorld *rw );
705  virtual void BeginLevelLoad( void );
706  virtual void EndLevelLoad( void );
707  virtual bool RegisterFont( const char *fontName, fontInfoEx_t &font );
708  virtual void SetColor( const idVec4 &rgba );
709  virtual void SetColor4( float r, float g, float b, float a );
710  virtual void DrawStretchPic ( const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material,
711  bool clip = true, float x = 0.0f, float y = 0.0f, float w = 640.0f, float h = 0.0f );
712  virtual void DrawStretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, const idMaterial *material );
713 
714  virtual void DrawStretchTri ( idVec2 p1, idVec2 p2, idVec2 p3, idVec2 t1, idVec2 t2, idVec2 t3, const idMaterial *material );
715  virtual void GlobalToNormalizedDeviceCoordinates( const idVec3 &global, idVec3 &ndc );
716  virtual void GetGLSettings( int& width, int& height );
717  virtual void PrintMemInfo( MemInfo_t *mi );
718 
719  virtual void DrawSmallChar( int x, int y, int ch, const idMaterial *material );
720  virtual void DrawSmallStringExt( int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material );
721  virtual void DrawBigChar( int x, int y, int ch, const idMaterial *material );
722  virtual void DrawBigStringExt( int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material );
723  virtual void WriteDemoPics();
724  virtual void DrawDemoPics();
725  virtual void BeginFrame( int windowWidth, int windowHeight );
726  virtual void EndFrame( int *frontEndMsec, int *backEndMsec );
727  virtual void TakeScreenshot( int width, int height, const char *fileName, int downSample, renderView_t *ref );
728  virtual void CropRenderSize( int width, int height, bool makePowerOfTwo = false, bool forceDimensions = false );
729  virtual void CaptureRenderToImage( const char *imageName );
730  virtual void CaptureRenderToFile( const char *fileName, bool fixAlpha );
731  virtual void UnCrop();
732  virtual void GetCardCaps( bool &oldCard, bool &nv10or20 );
733  virtual bool UploadImage( const char *imageName, const byte *data, int width, int height );
734 
735 public:
736  // internal functions
737  idRenderSystemLocal( void );
738  ~idRenderSystemLocal( void );
739 
740  void Clear( void );
741  void SetBackEndRenderer(); // sets tr.backEndRenderer based on cvars
742  void RenderViewToViewport( const renderView_t *renderView, idScreenRect *viewport );
743 
744 public:
745  // renderer globals
746  bool registered; // cleared at shutdown, set at InitOpenGL
747 
749 
750  int frameCount; // incremented every frame
751  int viewCount; // incremented every view (twice a scene if subviewed)
752  // and every R_MarkFragments call
753 
754  int staticAllocCount; // running total of bytes allocated
755 
756  float frameShaderTime; // shader time for all non-world 2D rendering
757 
758  int viewportOffset[2]; // for doing larger-than-window tiled renderings
760 
761  // determines which back end to use, and if vertex programs are in use
764  float backEndRendererMaxLight; // 1.0 for standard, unlimited for floats
765  // determines how much overbrighting needs
766  // to be done post-process
767 
768  idVec4 ambientLightVector; // used for "ambient bump mapping"
769 
770  float sortOffset; // for determinist sorting of equal sort materials
771 
773 
777  // many console commands need to know which world they should operate on
778 
783 
784  idImage * ambientCubeImage; // hack for testing dependent ambient lighting
785 
787 
788  performanceCounters_t pc; // performance counters
789 
790  drawSurfsCommand_t lockSurfacesCmd; // use this when r_lockSurfaces = 1
791 
792  viewEntity_t identitySpace; // can use if we don't know viewDef->worldSpace is valid
793  FILE * logFile; // for logging GL calls and frame breaks
794 
795  int stencilIncr, stencilDecr; // GL_INCR / INCR_WRAP_EXT, GL_DECR / GL_DECR_EXT
796 
797  renderCrop_t renderCrops[MAX_RENDER_CROPS];
799 
800  // GUI drawing variables for surface creation
801  int guiRecursionLevel; // to prevent infinite overruns
804 
805  unsigned short gammaTable[256]; // brightness / gamma modify this
806 };
807 
808 extern backEndState_t backEnd;
809 extern idRenderSystemLocal tr;
810 extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init
811 
812 
813 //
814 // cvars
815 //
817 
818 extern idCVar r_glDriver; // "opengl32", etc
819 extern idCVar r_mode; // video mode number
820 extern idCVar r_displayRefresh; // optional display refresh rate option for vid mode
821 extern idCVar r_fullscreen; // 0 = windowed, 1 = full screen
822 extern idCVar r_multiSamples; // number of antialiasing samples
823 
824 extern idCVar r_ignore; // used for random debugging without defining new vars
825 extern idCVar r_ignore2; // used for random debugging without defining new vars
826 extern idCVar r_znear; // near Z clip plane
827 
828 extern idCVar r_finish; // force a call to glFinish() every frame
829 extern idCVar r_frontBuffer; // draw to front buffer for debugging
830 extern idCVar r_swapInterval; // changes wglSwapIntarval
831 extern idCVar r_offsetFactor; // polygon offset parameter
832 extern idCVar r_offsetUnits; // polygon offset parameter
833 extern idCVar r_singleTriangle; // only draw a single triangle per primitive
834 extern idCVar r_logFile; // number of frames to emit GL logs
835 extern idCVar r_clear; // force screen clear every frame
836 extern idCVar r_shadows; // enable shadows
837 extern idCVar r_subviewOnly; // 1 = don't render main view, allowing subviews to be debugged
838 extern idCVar r_lightScale; // all light intensities are multiplied by this, which is normally 2
839 extern idCVar r_flareSize; // scale the flare deforms from the material def
840 
841 extern idCVar r_gamma; // changes gamma tables
842 extern idCVar r_brightness; // changes gamma tables
843 
844 extern idCVar r_renderer; // arb, nv10, nv20, r200, gl2, etc
845 
846 extern idCVar r_cgVertexProfile; // arbvp1, vp20, vp30
847 extern idCVar r_cgFragmentProfile; // arbfp1, fp30
848 
849 extern idCVar r_checkBounds; // compare all surface bounds with precalculated ones
850 
851 extern idCVar r_useNV20MonoLights; // 1 = allow an interaction pass optimization
852 extern idCVar r_useLightPortalFlow; // 1 = do a more precise area reference determination
853 extern idCVar r_useTripleTextureARB; // 1 = cards with 3+ texture units do a two pass instead of three pass
854 extern idCVar r_useShadowSurfaceScissor;// 1 = scissor shadows by the scissor rect of the interaction surfaces
855 extern idCVar r_useConstantMaterials; // 1 = use pre-calculated material registers if possible
856 extern idCVar r_useInteractionTable; // create a full entityDefs * lightDefs table to make finding interactions faster
857 extern idCVar r_useNodeCommonChildren; // stop pushing reference bounds early when possible
858 extern idCVar r_useSilRemap; // 1 = consider verts with the same XYZ, but different ST the same for shadows
859 extern idCVar r_useCulling; // 0 = none, 1 = sphere, 2 = sphere + box
860 extern idCVar r_useLightCulling; // 0 = none, 1 = box, 2 = exact clip of polyhedron faces
861 extern idCVar r_useLightScissors; // 1 = use custom scissor rectangle for each light
862 extern idCVar r_useClippedLightScissors;// 0 = full screen when near clipped, 1 = exact when near clipped, 2 = exact always
863 extern idCVar r_useEntityCulling; // 0 = none, 1 = box
864 extern idCVar r_useEntityScissors; // 1 = use custom scissor rectangle for each entity
865 extern idCVar r_useInteractionCulling; // 1 = cull interactions
866 extern idCVar r_useInteractionScissors; // 1 = use a custom scissor rectangle for each interaction
867 extern idCVar r_useFrustumFarDistance; // if != 0 force the view frustum far distance to this distance
868 extern idCVar r_useShadowCulling; // try to cull shadows from partially visible lights
869 extern idCVar r_usePreciseTriangleInteractions; // 1 = do winding clipping to determine if each ambiguous tri should be lit
870 extern idCVar r_useTurboShadow; // 1 = use the infinite projection with W technique for dynamic shadows
871 extern idCVar r_useExternalShadows; // 1 = skip drawing caps when outside the light volume
872 extern idCVar r_useOptimizedShadows; // 1 = use the dmap generated static shadow volumes
873 extern idCVar r_useShadowVertexProgram; // 1 = do the shadow projection in the vertex program on capable cards
874 extern idCVar r_useShadowProjectedCull; // 1 = discard triangles outside light volume before shadowing
875 extern idCVar r_useDeferredTangents; // 1 = don't always calc tangents after deform
876 extern idCVar r_useCachedDynamicModels; // 1 = cache snapshots of dynamic models
877 extern idCVar r_useTwoSidedStencil; // 1 = do stencil shadows in one pass with different ops on each side
878 extern idCVar r_useInfiniteFarZ; // 1 = use the no-far-clip-plane trick
879 extern idCVar r_useScissor; // 1 = scissor clip as portals and lights are processed
880 extern idCVar r_usePortals; // 1 = use portals to perform area culling, otherwise draw everything
881 extern idCVar r_useStateCaching; // avoid redundant state changes in GL_*() calls
882 extern idCVar r_useCombinerDisplayLists;// if 1, put all nvidia register combiner programming in display lists
883 extern idCVar r_useVertexBuffers; // if 0, don't use ARB_vertex_buffer_object for vertexes
884 extern idCVar r_useIndexBuffers; // if 0, don't use ARB_vertex_buffer_object for indexes
885 extern idCVar r_useEntityCallbacks; // if 0, issue the callback immediately at update time, rather than defering
886 extern idCVar r_lightAllBackFaces; // light all the back faces, even when they would be shadowed
887 extern idCVar r_useDepthBoundsTest; // use depth bounds test to reduce shadow fill
888 
889 extern idCVar r_skipPostProcess; // skip all post-process renderings
890 extern idCVar r_skipSuppress; // ignore the per-view suppressions
891 extern idCVar r_skipInteractions; // skip all light/surface interaction drawing
892 extern idCVar r_skipFrontEnd; // bypasses all front end work, but 2D gui rendering still draws
893 extern idCVar r_skipBackEnd; // don't draw anything
894 extern idCVar r_skipCopyTexture; // do all rendering, but don't actually copyTexSubImage2D
895 extern idCVar r_skipRender; // skip 3D rendering, but pass 2D
896 extern idCVar r_skipRenderContext; // NULL the rendering context during backend 3D rendering
897 extern idCVar r_skipTranslucent; // skip the translucent interaction rendering
898 extern idCVar r_skipAmbient; // bypasses all non-interaction drawing
899 extern idCVar r_skipNewAmbient; // bypasses all vertex/fragment program ambients
900 extern idCVar r_skipBlendLights; // skip all blend lights
901 extern idCVar r_skipFogLights; // skip all fog lights
902 extern idCVar r_skipSubviews; // 1 = don't render any mirrors / cameras / etc
903 extern idCVar r_skipGuiShaders; // 1 = don't render any gui elements on surfaces
904 extern idCVar r_skipParticles; // 1 = don't render any particles
905 extern idCVar r_skipUpdates; // 1 = don't accept any entity or light updates, making everything static
906 extern idCVar r_skipDeforms; // leave all deform materials in their original state
907 extern idCVar r_skipDynamicTextures; // don't dynamically create textures
908 extern idCVar r_skipLightScale; // don't do any post-interaction light scaling, makes things dim on low-dynamic range cards
909 extern idCVar r_skipBump; // uses a flat surface instead of the bump map
910 extern idCVar r_skipSpecular; // use black for specular
911 extern idCVar r_skipDiffuse; // use black for diffuse
912 extern idCVar r_skipOverlays; // skip overlay surfaces
913 extern idCVar r_skipROQ;
914 
915 extern idCVar r_ignoreGLErrors;
916 
917 extern idCVar r_forceLoadImages; // draw all images to screen after registration
918 extern idCVar r_demonstrateBug; // used during development to show IHV's their problems
919 extern idCVar r_screenFraction; // for testing fill rate, the resolution of the entire screen can be changed
920 
921 extern idCVar r_showUnsmoothedTangents; // highlight geometry rendered with unsmoothed tangents
922 extern idCVar r_showSilhouette; // highlight edges that are casting shadow planes
923 extern idCVar r_showVertexColor; // draws all triangles with the solid vertex color
924 extern idCVar r_showUpdates; // report entity and light updates and ref counts
925 extern idCVar r_showDemo; // report reads and writes to the demo file
926 extern idCVar r_showDynamic; // report stats on dynamic surface generation
927 extern idCVar r_showLightScale; // report the scale factor applied to drawing for overbrights
928 extern idCVar r_showIntensity; // draw the screen colors based on intensity, red = 0, green = 128, blue = 255
929 extern idCVar r_showDefs; // report the number of modeDefs and lightDefs in view
930 extern idCVar r_showTrace; // show the intersection of an eye trace with the world
931 extern idCVar r_showSmp; // show which end (front or back) is blocking
932 extern idCVar r_showDepth; // display the contents of the depth buffer and the depth range
933 extern idCVar r_showImages; // draw all images to screen instead of rendering
934 extern idCVar r_showTris; // enables wireframe rendering of the world
935 extern idCVar r_showSurfaceInfo; // show surface material name under crosshair
936 extern idCVar r_showNormals; // draws wireframe normals
937 extern idCVar r_showEdges; // draw the sil edges
938 extern idCVar r_showViewEntitys; // displays the bounding boxes of all view models and optionally the index
939 extern idCVar r_showTexturePolarity; // shade triangles by texture area polarity
940 extern idCVar r_showTangentSpace; // shade triangles by tangent space
941 extern idCVar r_showDominantTri; // draw lines from vertexes to center of dominant triangles
942 extern idCVar r_showTextureVectors; // draw each triangles texture (tangent) vectors
943 extern idCVar r_showLights; // 1 = print light info, 2 = also draw volumes
944 extern idCVar r_showLightCount; // colors surfaces based on light count
945 extern idCVar r_showShadows; // visualize the stencil shadow volumes
946 extern idCVar r_showShadowCount; // colors screen based on shadow volume depth complexity
947 extern idCVar r_showLightScissors; // show light scissor rectangles
948 extern idCVar r_showEntityScissors; // show entity scissor rectangles
949 extern idCVar r_showInteractionFrustums;// show a frustum for each interaction
950 extern idCVar r_showInteractionScissors;// show screen rectangle which contains the interaction frustum
951 extern idCVar r_showMemory; // print frame memory utilization
952 extern idCVar r_showCull; // report sphere and box culling stats
953 extern idCVar r_showInteractions; // report interaction generation activity
954 extern idCVar r_showSurfaces; // report surface/light/shadow counts
955 extern idCVar r_showPrimitives; // report vertex/index/draw counts
956 extern idCVar r_showPortals; // draw portal outlines in color based on passed / not passed
957 extern idCVar r_showAlloc; // report alloc/free counts
958 extern idCVar r_showSkel; // draw the skeleton when model animates
959 extern idCVar r_showOverDraw; // show overdraw
960 extern idCVar r_jointNameScale; // size of joint names when r_showskel is set to 1
961 extern idCVar r_jointNameOffset; // offset of joint names when r_showskel is set to 1
962 
963 extern idCVar r_testGamma; // draw a grid pattern to test gamma levels
964 extern idCVar r_testStepGamma; // draw a grid pattern to test gamma levels
965 extern idCVar r_testGammaBias; // draw a grid pattern to test gamma levels
966 
967 extern idCVar r_testARBProgram; // experiment with vertex/fragment programs
968 
969 extern idCVar r_singleLight; // suppress all but one light
970 extern idCVar r_singleEntity; // suppress all but one entity
971 extern idCVar r_singleArea; // only draw the portal area the view is actually in
972 extern idCVar r_singleSurface; // suppress all but one surface on each entity
973 extern idCVar r_shadowPolygonOffset; // bias value added to depth test for stencil shadow drawing
974 extern idCVar r_shadowPolygonFactor; // scale value for stencil shadow drawing
975 
976 extern idCVar r_jitter; // randomly subpixel jitter the projection matrix
977 extern idCVar r_lightSourceRadius; // for soft-shadow sampling
978 extern idCVar r_lockSurfaces;
979 extern idCVar r_orderIndexes; // perform index reorganization to optimize vertex use
980 
981 extern idCVar r_debugLineDepthTest; // perform depth test on debug lines
982 extern idCVar r_debugLineWidth; // width of debug lines
983 extern idCVar r_debugArrowStep; // step size of arrow cone line rotation in degrees
985 
986 extern idCVar r_materialOverride; // override all materials
987 
989 
990 /*
991 ====================================================================
992 
993 GL wrapper/helper functions
994 
995 ====================================================================
996 */
997 
998 void GL_SelectTexture( int unit );
999 void GL_CheckErrors( void );
1000 void GL_ClearStateDelta( void );
1001 void GL_State( int stateVector );
1002 void GL_TexEnv( int env );
1003 void GL_Cull( int cullType );
1004 
1005 const int GLS_SRCBLEND_ZERO = 0x00000001;
1006 const int GLS_SRCBLEND_ONE = 0x0;
1007 const int GLS_SRCBLEND_DST_COLOR = 0x00000003;
1008 const int GLS_SRCBLEND_ONE_MINUS_DST_COLOR = 0x00000004;
1009 const int GLS_SRCBLEND_SRC_ALPHA = 0x00000005;
1010 const int GLS_SRCBLEND_ONE_MINUS_SRC_ALPHA = 0x00000006;
1011 const int GLS_SRCBLEND_DST_ALPHA = 0x00000007;
1012 const int GLS_SRCBLEND_ONE_MINUS_DST_ALPHA = 0x00000008;
1013 const int GLS_SRCBLEND_ALPHA_SATURATE = 0x00000009;
1014 const int GLS_SRCBLEND_BITS = 0x0000000f;
1015 
1016 const int GLS_DSTBLEND_ZERO = 0x0;
1017 const int GLS_DSTBLEND_ONE = 0x00000020;
1018 const int GLS_DSTBLEND_SRC_COLOR = 0x00000030;
1019 const int GLS_DSTBLEND_ONE_MINUS_SRC_COLOR = 0x00000040;
1020 const int GLS_DSTBLEND_SRC_ALPHA = 0x00000050;
1021 const int GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA = 0x00000060;
1022 const int GLS_DSTBLEND_DST_ALPHA = 0x00000070;
1023 const int GLS_DSTBLEND_ONE_MINUS_DST_ALPHA = 0x00000080;
1024 const int GLS_DSTBLEND_BITS = 0x000000f0;
1025 
1026 
1027 // these masks are the inverse, meaning when set the glColorMask value will be 0,
1028 // preventing that channel from being written
1029 const int GLS_DEPTHMASK = 0x00000100;
1030 const int GLS_REDMASK = 0x00000200;
1031 const int GLS_GREENMASK = 0x00000400;
1032 const int GLS_BLUEMASK = 0x00000800;
1033 const int GLS_ALPHAMASK = 0x00001000;
1034 const int GLS_COLORMASK = (GLS_REDMASK|GLS_GREENMASK|GLS_BLUEMASK);
1035 
1036 const int GLS_POLYMODE_LINE = 0x00002000;
1037 
1038 const int GLS_DEPTHFUNC_ALWAYS = 0x00010000;
1039 const int GLS_DEPTHFUNC_EQUAL = 0x00020000;
1040 const int GLS_DEPTHFUNC_LESS = 0x0;
1041 
1042 const int GLS_ATEST_EQ_255 = 0x10000000;
1043 const int GLS_ATEST_LT_128 = 0x20000000;
1044 const int GLS_ATEST_GE_128 = 0x40000000;
1045 const int GLS_ATEST_BITS = 0x70000000;
1046 
1048 
1049 void R_Init( void );
1050 void R_InitOpenGL( void );
1051 
1052 void R_DoneFreeType( void );
1053 
1054 void R_SetColorMappings( void );
1055 
1056 void R_ScreenShot_f( const idCmdArgs &args );
1057 void R_StencilShot( void );
1058 
1059 bool R_CheckExtension( char *name );
1060 
1061 
1062 /*
1063 ====================================================================
1064 
1065 IMPLEMENTATION SPECIFIC FUNCTIONS
1066 
1067 ====================================================================
1068 */
1069 
1070 typedef struct {
1071  int width;
1072  int height;
1074  bool stereo;
1077 } glimpParms_t;
1078 
1079 bool GLimp_Init( glimpParms_t parms );
1080 // If the desired mode can't be set satisfactorily, false will be returned.
1081 // The renderer will then reset the glimpParms to "safe mode" of 640x480
1082 // fullscreen and try again. If that also fails, the error will be fatal.
1083 
1084 bool GLimp_SetScreenParms( glimpParms_t parms );
1085 // will set up gl up with the new parms
1086 
1087 void GLimp_Shutdown( void );
1088 // Destroys the rendering context, closes the window, resets the resolution,
1089 // and resets the gamma ramps.
1090 
1091 void GLimp_SwapBuffers( void );
1092 // Calls the system specific swapbuffers routine, and may also perform
1093 // other system specific cvar checks that happen every frame.
1094 // This will not be called if 'r_drawBuffer GL_FRONT'
1095 
1096 void GLimp_SetGamma( unsigned short red[256],
1097  unsigned short green[256],
1098  unsigned short blue[256] );
1099 // Sets the hardware gamma ramps for gamma and brightness adjustment.
1100 // These are now taken as 16 bit values, so we can take full advantage
1101 // of dacs with >8 bits of precision
1102 
1103 
1104 bool GLimp_SpawnRenderThread( void (*function)( void ) );
1105 // Returns false if the system only has a single processor
1106 
1107 void * GLimp_BackEndSleep( void );
1108 void GLimp_FrontEndSleep( void );
1109 void GLimp_WakeBackEnd( void *data );
1110 // these functions implement the dual processor syncronization
1111 
1112 void GLimp_ActivateContext( void );
1113 void GLimp_DeactivateContext( void );
1114 // These are used for managing SMP handoffs of the OpenGL context
1115 // between threads, and as a performance tunining aid. Setting
1116 // 'r_skipRenderContext 1' will call GLimp_DeactivateContext() before
1117 // the 3D rendering code, and GLimp_ActivateContext() afterwards. On
1118 // most OpenGL implementations, this will result in all OpenGL calls
1119 // being immediate returns, which lets us guage how much time is
1120 // being spent inside OpenGL.
1121 
1122 void GLimp_EnableLogging( bool enable );
1123 
1124 
1125 /*
1126 ====================================================================
1127 
1128 MAIN
1129 
1130 ====================================================================
1131 */
1132 
1133 void R_RenderView( viewDef_t *parms );
1134 
1135 // performs radius cull first, then corner cull
1136 bool R_CullLocalBox( const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes );
1137 bool R_RadiusCullLocalBox( const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes );
1138 bool R_CornerCullLocalBox( const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes );
1139 
1140 void R_AxisToModelMatrix( const idMat3 &axis, const idVec3 &origin, float modelMatrix[16] );
1141 
1142 // note that many of these assume a normalized matrix, and will not work with scaled axis
1143 void R_GlobalPointToLocal( const float modelMatrix[16], const idVec3 &in, idVec3 &out );
1144 void R_GlobalVectorToLocal( const float modelMatrix[16], const idVec3 &in, idVec3 &out );
1145 void R_GlobalPlaneToLocal( const float modelMatrix[16], const idPlane &in, idPlane &out );
1146 void R_PointTimesMatrix( const float modelMatrix[16], const idVec4 &in, idVec4 &out );
1147 void R_LocalPointToGlobal( const float modelMatrix[16], const idVec3 &in, idVec3 &out );
1148 void R_LocalVectorToGlobal( const float modelMatrix[16], const idVec3 &in, idVec3 &out );
1149 void R_LocalPlaneToGlobal( const float modelMatrix[16], const idPlane &in, idPlane &out );
1150 void R_TransformEyeZToWin( float src_z, const float *projectionMatrix, float &dst_z );
1151 
1152 void R_GlobalToNormalizedDeviceCoordinates( const idVec3 &global, idVec3 &ndc );
1153 
1154 void R_TransformModelToClip( const idVec3 &src, const float *modelMatrix, const float *projectionMatrix, idPlane &eye, idPlane &dst );
1155 
1156 void R_TransformClipToDevice( const idPlane &clip, const viewDef_t *view, idVec3 &normalized );
1157 
1158 void R_TransposeGLMatrix( const float in[16], float out[16] );
1159 
1160 void R_SetViewMatrix( viewDef_t *viewDef );
1161 
1162 void myGlMultMatrix( const float *a, const float *b, float *out );
1163 
1164 /*
1165 ============================================================
1166 
1167 LIGHT
1168 
1169 ============================================================
1170 */
1171 
1172 void R_ListRenderLightDefs_f( const idCmdArgs &args );
1173 void R_ListRenderEntityDefs_f( const idCmdArgs &args );
1174 
1177 
1180 
1181 void R_AddDrawSurf( const srfTriangles_t *tri, const viewEntity_t *space, const renderEntity_t *renderEntity,
1182  const idMaterial *shader, const idScreenRect &scissor );
1183 
1184 void R_LinkLightSurf( const drawSurf_t **link, const srfTriangles_t *tri, const viewEntity_t *space,
1185  const idRenderLightLocal *light, const idMaterial *shader, const idScreenRect &scissor, bool viewInsideShadow );
1186 
1187 bool R_CreateAmbientCache( srfTriangles_t *tri, bool needsLighting );
1188 bool R_CreateLightingCache( const idRenderEntityLocal *ent, const idRenderLightLocal *light, srfTriangles_t *tri );
1191 
1192 /*
1193 ============================================================
1194 
1195 LIGHTRUN
1196 
1197 ============================================================
1198 */
1199 
1200 void R_RegenerateWorld_f( const idCmdArgs &args );
1201 
1202 void R_ModulateLights_f( const idCmdArgs &args );
1203 
1204 void R_SetLightProject( idPlane lightProject[4], const idVec3 origin, const idVec3 targetPoint,
1205  const idVec3 rightVector, const idVec3 upVector, const idVec3 start, const idVec3 stop );
1206 
1207 void R_AddLightSurfaces( void );
1208 void R_AddModelSurfaces( void );
1209 void R_RemoveUnecessaryViewLights( void );
1210 
1211 void R_FreeDerivedData( void );
1212 void R_ReCreateWorldReferences( void );
1213 
1215 void R_CreateLightRefs( idRenderLightLocal *light );
1216 
1217 void R_DeriveLightData( idRenderLightLocal *light );
1220 
1222 void R_FreeEntityDefDerivedData( idRenderEntityLocal *def, bool keepDecals, bool keepCachedDynamicModel );
1226 void R_FreeEntityDefFadedDecals( idRenderEntityLocal *def, int time );
1227 
1229 
1230 /*
1231 ============================================================
1232 
1233 POLYTOPE
1234 
1235 ============================================================
1236 */
1237 
1238 srfTriangles_t *R_PolytopeSurface( int numPlanes, const idPlane *planes, idWinding **windings );
1239 
1240 /*
1241 ============================================================
1242 
1243 RENDER
1244 
1245 ============================================================
1246 */
1247 
1249 void RB_EnterModelDepthHack( float depth );
1250 void RB_LeaveDepthHack();
1251 void RB_DrawElementsImmediate( const srfTriangles_t *tri );
1252 void RB_RenderTriangleSurface( const srfTriangles_t *tri );
1253 void RB_T_RenderTriangleSurface( const drawSurf_t *surf );
1254 void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs,
1255  void (*triFunc_)( const drawSurf_t *) );
1256 void RB_RenderDrawSurfChainWithFunction( const drawSurf_t *drawSurfs,
1257  void (*triFunc_)( const drawSurf_t *) );
1258 void RB_DrawShaderPasses( drawSurf_t **drawSurfs, int numDrawSurfs );
1259 void RB_LoadShaderTextureMatrix( const float *shaderRegisters, const textureStage_t *texture );
1260 void RB_GetShaderTextureMatrix( const float *shaderRegisters, const textureStage_t *texture, float matrix[16] );
1261 void RB_CreateSingleDrawInteractions( const drawSurf_t *surf, void (*DrawInteraction)(const drawInteraction_t *) );
1262 
1263 const shaderStage_t *RB_SetLightTexture( const idRenderLightLocal *light );
1264 
1265 void RB_DrawView( const void *data );
1266 
1267 void RB_DetermineLightScale( void );
1268 void RB_STD_LightScale( void );
1269 void RB_BeginDrawingView (void);
1270 
1271 /*
1272 ============================================================
1273 
1274 DRAW_STANDARD
1275 
1276 ============================================================
1277 */
1278 
1279 void RB_DrawElementsWithCounters( const srfTriangles_t *tri );
1280 void RB_DrawShadowElementsWithCounters( const srfTriangles_t *tri, int numIndexes );
1281 void RB_STD_FillDepthBuffer( drawSurf_t **drawSurfs, int numDrawSurfs );
1282 void RB_BindVariableStageImage( const textureStage_t *texture, const float *shaderRegisters );
1283 void RB_BindStageTexture( const float *shaderRegisters, const textureStage_t *texture, const drawSurf_t *surf );
1284 void RB_FinishStageTexture( const textureStage_t *texture, const drawSurf_t *surf );
1285 void RB_StencilShadowPass( const drawSurf_t *drawSurfs );
1286 void RB_STD_DrawView( void );
1287 void RB_STD_FogAllLights( void );
1288 void RB_BakeTextureMatrixIntoTexgen( idPlane lightProject[3], const float textureMatrix[16] );
1289 
1290 /*
1291 ============================================================
1292 
1293 DRAW_*
1294 
1295 ============================================================
1296 */
1297 
1298 void RB_ARB_DrawInteractions( void );
1299 
1300 void R_R200_Init( void );
1301 void RB_R200_DrawInteractions( void );
1302 
1303 void R_NV10_Init( void );
1304 void RB_NV10_DrawInteractions( void );
1305 
1306 void R_NV20_Init( void );
1307 void RB_NV20_DrawInteractions( void );
1308 
1309 void R_ARB2_Init( void );
1310 void RB_ARB2_DrawInteractions( void );
1311 void R_ReloadARBPrograms_f( const idCmdArgs &args );
1312 int R_FindARBProgram( GLenum target, const char *program );
1313 
1314 typedef enum {
1335 } program_t;
1336 
1337 /*
1338 
1339  All vertex programs use the same constant register layout:
1340 
1341 c[4] localLightOrigin
1342 c[5] localViewOrigin
1343 c[6] lightProjection S
1344 c[7] lightProjection T
1345 c[8] lightProjection Q
1346 c[9] lightFalloff S
1347 c[10] bumpMatrix S
1348 c[11] bumpMatrix T
1349 c[12] diffuseMatrix S
1350 c[13] diffuseMatrix T
1351 c[14] specularMatrix S
1352 c[15] specularMatrix T
1353 
1354 
1355 c[20] light falloff tq constant
1356 
1357 // texture 0 was cube map
1358 // texture 1 will be the per-surface bump map
1359 // texture 2 will be the light falloff texture
1360 // texture 3 will be the light projection texture
1361 // texture 4 is the per-surface diffuse map
1362 // texture 5 is the per-surface specular map
1363 // texture 6 is the specular half angle cube map
1364 
1365 */
1366 
1367 typedef enum {
1382 
1383  PP_LIGHT_FALLOFF_TQ = 20 // only for NV programs
1385 
1386 
1387 /*
1388 ============================================================
1389 
1390 TR_STENCILSHADOWS
1391 
1392 "facing" should have one more element than tri->numIndexes / 3, which should be set to 1
1393 
1394 ============================================================
1395 */
1396 
1398 
1399 typedef enum {
1400  SG_DYNAMIC, // use infinite projections
1401  SG_STATIC, // clip to bounds
1402  SG_OFFLINE // perform very time consuming optimizations
1403 } shadowGen_t;
1404 
1406  const srfTriangles_t *tri, const idRenderLightLocal *light,
1407  shadowGen_t optimize, srfCullInfo_t &cullInfo );
1408 
1409 /*
1410 ============================================================
1411 
1412 TR_TURBOSHADOW
1413 
1414 Fast, non-clipped overshoot shadow volumes
1415 
1416 "facing" should have one more element than tri->numIndexes / 3, which should be set to 1
1417 calling this function may modify "facing" based on culling
1418 
1419 ============================================================
1420 */
1421 
1423  const srfTriangles_t *tri, const idRenderLightLocal *light,
1424  srfCullInfo_t &cullInfo );
1425 
1427  const srfTriangles_t *tri, const idRenderLightLocal *light,
1428  srfCullInfo_t &cullInfo );
1429 
1430 /*
1431 ============================================================
1432 
1433 util/shadowopt3
1434 
1435 dmap time optimization of shadow volumes, called from R_CreateShadowVolume
1436 
1437 ============================================================
1438 */
1439 
1440 
1441 typedef struct {
1442  idVec3 *verts; // includes both front and back projections, caller should free
1444  glIndex_t *indexes; // caller should free
1445 
1446  // indexes must be sorted frontCap, rearCap, silPlanes so the caps can be removed
1447  // when the viewer is in a position that they don't need to see them
1453 
1454 optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes,
1455  idPlane projectionPlane, idVec3 projectionOrigin );
1456 
1458 
1459 /*
1460 ============================================================
1461 
1462 TRISURF
1463 
1464 ============================================================
1465 */
1466 
1467 #define USE_TRI_DATA_ALLOCATOR
1468 
1469 void R_InitTriSurfData( void );
1470 void R_ShutdownTriSurfData( void );
1471 void R_PurgeTriSurfData( frameData_t *frame );
1472 void R_ShowTriSurfMemory_f( const idCmdArgs &args );
1473 
1476 void R_AllocStaticTriSurfVerts( srfTriangles_t *tri, int numVerts );
1477 void R_AllocStaticTriSurfIndexes( srfTriangles_t *tri, int numIndexes );
1478 void R_AllocStaticTriSurfShadowVerts( srfTriangles_t *tri, int numVerts );
1479 void R_AllocStaticTriSurfPlanes( srfTriangles_t *tri, int numIndexes );
1480 void R_ResizeStaticTriSurfVerts( srfTriangles_t *tri, int numVerts );
1481 void R_ResizeStaticTriSurfIndexes( srfTriangles_t *tri, int numIndexes );
1482 void R_ResizeStaticTriSurfShadowVerts( srfTriangles_t *tri, int numVerts );
1483 void R_ReferenceStaticTriSurfVerts( srfTriangles_t *tri, const srfTriangles_t *reference );
1484 void R_ReferenceStaticTriSurfIndexes( srfTriangles_t *tri, const srfTriangles_t *reference );
1486 void R_FreeStaticTriSurf( srfTriangles_t *tri );
1489 void R_FreeDeferredTriSurfs( frameData_t *frame );
1490 int R_TriSurfMemory( const srfTriangles_t *tri );
1491 
1492 void R_BoundTriSurf( srfTriangles_t *tri );
1494 void R_CreateSilIndexes( srfTriangles_t *tri );
1496 void R_RemoveUnusedVerts( srfTriangles_t *tri );
1497 void R_RangeCheckIndexes( const srfTriangles_t *tri );
1498 void R_CreateVertexNormals( srfTriangles_t *tri ); // also called by dmap
1499 void R_DeriveFacePlanes( srfTriangles_t *tri ); // also called by renderbump
1500 void R_CleanupTriangles( srfTriangles_t *tri, bool createNormals, bool identifySilEdges, bool useUnsmoothedTangents );
1501 void R_ReverseTriangles( srfTriangles_t *tri );
1502 
1503 // Only deals with vertexes and indexes, not silhouettes, planes, etc.
1504 // Does NOT perform a cleanup triangles, so there may be duplicated verts in the result.
1505 srfTriangles_t * R_MergeSurfaceList( const srfTriangles_t **surfaces, int numSurfaces );
1506 srfTriangles_t * R_MergeTriangles( const srfTriangles_t *tri1, const srfTriangles_t *tri2 );
1507 
1508 // if the deformed verts have significant enough texture coordinate changes to reverse the texture
1509 // polarity of a triangle, the tangents will be incorrect
1510 void R_DeriveTangents( srfTriangles_t *tri, bool allocFacePlanes = true );
1511 
1512 // deformable meshes precalculate as much as possible from a base frame, then generate
1513 // complete srfTriangles_t from just a new set of vertexes
1514 typedef struct deformInfo_s {
1516 
1517  // numOutputVerts may be smaller if the input had duplicated or degenerate triangles
1518  // it will often be larger if the input had mirrored texture seams that needed
1519  // to be busted for proper tangent spaces
1521 
1524 
1527 
1529 
1531  int * dupVerts;
1532 
1535 
1537 } deformInfo_t;
1538 
1539 
1540 deformInfo_t * R_BuildDeformInfo( int numVerts, const idDrawVert *verts, int numIndexes, const int *indexes, bool useUnsmoothedTangents );
1541 void R_FreeDeformInfo( deformInfo_t *deformInfo );
1542 int R_DeformInfoMemoryUsed( deformInfo_t *deformInfo );
1543 
1544 /*
1545 ============================================================
1546 
1547 SUBVIEW
1548 
1549 ============================================================
1550 */
1551 
1552 bool R_PreciseCullSurface( const drawSurf_t *drawSurf, idBounds &ndcBounds );
1553 bool R_GenerateSubViews( void );
1554 
1555 /*
1556 ============================================================
1557 
1558 SCENE GENERATION
1559 
1560 ============================================================
1561 */
1562 
1563 void R_InitFrameData( void );
1564 void R_ShutdownFrameData( void );
1565 int R_CountFrameData( void );
1566 void R_ToggleSmpFrame( void );
1567 void *R_FrameAlloc( int bytes );
1568 void *R_ClearedFrameAlloc( int bytes );
1569 void R_FrameFree( void *data );
1570 
1571 void *R_StaticAlloc( int bytes ); // just malloc with error checking
1572 void *R_ClearedStaticAlloc( int bytes ); // with memset
1573 void R_StaticFree( void *data );
1574 
1575 
1576 /*
1577 =============================================================
1578 
1579 RENDERER DEBUG TOOLS
1580 
1581 =============================================================
1582 */
1583 
1584 float RB_DrawTextLength( const char *text, float scale, int len );
1585 void RB_AddDebugText( const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align, const int lifetime, const bool depthTest );
1586 void RB_ClearDebugText( int time );
1587 void RB_AddDebugLine( const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifeTime, const bool depthTest );
1588 void RB_ClearDebugLines( int time );
1589 void RB_AddDebugPolygon( const idVec4 &color, const idWinding &winding, const int lifeTime, const bool depthTest );
1590 void RB_ClearDebugPolygons( int time );
1591 void RB_DrawBounds( const idBounds &bounds );
1592 void RB_ShowLights( drawSurf_t **drawSurfs, int numDrawSurfs );
1593 void RB_ShowLightCount( drawSurf_t **drawSurfs, int numDrawSurfs );
1594 void RB_PolygonClear( void );
1595 void RB_ScanStencilBuffer( void );
1596 void RB_ShowDestinationAlpha( void );
1597 void RB_ShowOverdraw( void );
1598 void RB_RenderDebugTools( drawSurf_t **drawSurfs, int numDrawSurfs );
1599 void RB_ShutdownDebugTools( void );
1600 
1601 /*
1602 =============================================================
1603 
1604 TR_BACKEND
1605 
1606 =============================================================
1607 */
1608 
1609 void RB_SetDefaultGLState( void );
1610 void RB_SetGL2D( void );
1611 
1612 // write a comment to the r_logFile if it is enabled
1613 void RB_LogComment( const char *comment, ... ) id_attribute((format(printf,1,2)));
1614 
1615 void RB_ShowImages( void );
1616 
1618 
1619 
1620 /*
1621 =============================================================
1622 
1623 TR_GUISURF
1624 
1625 =============================================================
1626 */
1627 
1628 void R_SurfaceToTextureAxis( const srfTriangles_t *tri, idVec3 &origin, idVec3 axis[3] );
1629 void R_RenderGuiSurf( idUserInterface *gui, drawSurf_t *drawSurf );
1630 
1631 /*
1632 =============================================================
1633 
1634 TR_ORDERINDEXES
1635 
1636 =============================================================
1637 */
1638 
1639 void R_OrderIndexes( int numIndexes, glIndex_t *indexes );
1640 
1641 /*
1642 =============================================================
1643 
1644 TR_DEFORM
1645 
1646 =============================================================
1647 */
1648 
1649 void R_DeformDrawSurf( drawSurf_t *drawSurf );
1650 
1651 /*
1652 =============================================================
1653 
1654 TR_TRACE
1655 
1656 =============================================================
1657 */
1658 
1659 typedef struct {
1660  float fraction;
1661  // only valid if fraction < 1.0
1664  int indexes[3];
1665 } localTrace_t;
1666 
1667 localTrace_t R_LocalTrace( const idVec3 &start, const idVec3 &end, const float radius, const srfTriangles_t *tri );
1668 void RB_ShowTrace( drawSurf_t **drawSurfs, int numDrawSurfs );
1669 
1670 /*
1671 =============================================================
1672 
1673 TR_SHADOWBOUNDS
1674 
1675 =============================================================
1676 */
1678  const idRenderEntityLocal * entityDef,
1679  const viewDef_t * viewDef );
1680 
1681 //=============================================
1682 
1683 #include "RenderWorld_local.h"
1684 #include "GuiModel.h"
1685 #include "VertexCache.h"
1686 
1687 #endif /* !__TR_LOCAL_H__ */
GLenum
Definition: qgl.h:120
backEndState_t backEnd
Definition: tr_backend.cpp:35
shadowGen_t
Definition: tr_local.h:1399
idPlane frustum[5]
Definition: tr_local.h:421
idRenderWorldLocal * world
Definition: tr_local.h:255
void R_ModulateLights_f(const idCmdArgs &args)
virtual void ForceUpdate()=0
virtual void FreeRenderWorld(idRenderWorld *rw)
void R_InitFrameData(void)
Definition: tr_main.cpp:246
const int GLS_DSTBLEND_ONE
Definition: tr_local.h:1017
GLubyte g
Definition: glext.h:4662
idCVar r_singleTriangle
idCVar r_showDominantTri
const idMaterial * lightShader
Definition: tr_local.h:213
bool weaponDepthHack
Definition: tr_local.h:357
byte color[4]
Definition: MegaTexture.cpp:54
idRenderModel * dynamicModel
Definition: tr_local.h:263
idCVar r_lockSurfaces
idVec4 localLightOrigin
Definition: tr_local.h:453
idCVar r_useTurboShadow
deformInfo_t * R_BuildDeformInfo(int numVerts, const idDrawVert *verts, int numIndexes, const int *indexes, bool useUnsmoothedTangents)
idCVar r_lightSourceRadius
void RB_ScanStencilBuffer(void)
idCVar r_finish
idCVar r_showMemory
void RB_ClearDebugPolygons(int time)
const int GLS_SRCBLEND_ONE_MINUS_DST_ALPHA
Definition: tr_local.h:1012
int numClipPlanes
Definition: tr_local.h:395
void R_ShutdownFrameData(void)
Definition: tr_main.cpp:220
void CleanupOptimizedShadowTris(srfTriangles_t *tri)
const srfTriangles_t * geo
Definition: tr_local.h:112
void R_CreateLightDefFogPortals(idRenderLightLocal *ldef)
idCVar r_jointNameScale
viewEntity_t worldSpace
Definition: tr_local.h:373
Definition: Image.h:146
const int GLS_DEPTHFUNC_LESS
Definition: tr_local.h:1040
void RB_ShowLights(drawSurf_t **drawSurfs, int numDrawSurfs)
struct doublePortal_s * foggedPortals
Definition: tr_local.h:233
idCVar r_useCulling
void RB_RenderDrawSurfChainWithFunction(const drawSurf_t *drawSurfs, void(*triFunc_)(const drawSurf_t *))
Definition: tr_render.cpp:280
void GL_ClearStateDelta(void)
Definition: tr_backend.cpp:228
void R_RegenerateWorld_f(const idCmdArgs &args)
idCVar r_showEdges
virtual int GetIndex()
bool * connectedAreas
Definition: tr_local.h:426
void RB_BindVariableStageImage(const textureStage_t *texture, const float *shaderRegisters)
Definition: tr_render.cpp:378
idImage * falloffImage
Definition: tr_local.h:328
float zmax
Definition: tr_local.h:56
srfTriangles_t * R_MergeTriangles(const srfTriangles_t *tri1, const srfTriangles_t *tri2)
virtual void RemoveDecals()=0
idScreenRect R_ScreenRectFromViewFrustumBounds(const idBounds &bounds)
Definition: tr_main.cpp:151
bool viewSeesGlobalLightOrigin
Definition: tr_local.h:315
const int GLS_DSTBLEND_ONE_MINUS_DST_ALPHA
Definition: tr_local.h:1023
idPlane frustum[6]
Definition: tr_local.h:219
void R_FreeEntityDefDecals(idRenderEntityLocal *def)
virtual void WriteDemoPics()
struct viewEntity_s viewEntity_t
idCVar r_skipOverlays
const int GLS_BLUEMASK
Definition: tr_local.h:1032
float overBright
Definition: tr_local.h:656
bool makeClippedPlanes
Definition: tr_local.h:133
struct viewEntity_s * viewEntity
Definition: tr_local.h:274
idCVar r_skipROQ
idCVar r_skipUpdates
idCVar r_useSilRemap
const int GLS_DSTBLEND_DST_ALPHA
Definition: tr_local.h:1022
void RB_STD_FillDepthBuffer(drawSurf_t **drawSurfs, int numDrawSurfs)
const int GLS_SRCBLEND_SRC_ALPHA
Definition: tr_local.h:1009
int multiSamples
Definition: tr_local.h:1076
const int GLS_POLYMODE_LINE
Definition: tr_local.h:1036
idCVar r_singleSurface
const int GLS_SRCBLEND_ONE_MINUS_DST_COLOR
Definition: tr_local.h:1008
stageVertexColor_t vertexColor
Definition: tr_local.h:447
virtual bool UploadImage(const char *imageName, const byte *data, int width, int height)
float sort
Definition: tr_local.h:115
idCVar r_showSilhouette
GLenum GLsizei GLenum format
Definition: glext.h:2846
short x2
Definition: tr_local.h:55
drawSurf_t ** drawSurfs
Definition: tr_local.h:411
idCVar r_useEntityCulling
int areaNum
Definition: tr_local.h:424
backEndCounters_t pc
Definition: tr_local.h:642
class idGuiModel * guiModel
Definition: tr_local.h:802
GLuint GLenum matrix
Definition: glext.h:5179
idCVar r_useInteractionScissors
bool fullScreen
Definition: tr_local.h:1073
virtual void FreeRenderEntity()
const int GLS_SRCBLEND_ALPHA_SATURATE
Definition: tr_local.h:1013
virtual void ProjectOverlay(const idPlane localTextureAxis[2], const idMaterial *material)=0
idCVar r_showTris
idCVar r_skipParticles
const int GLS_DSTBLEND_SRC_COLOR
Definition: tr_local.h:1018
void R_ClearCommandChain(void)
void R_ListRenderLightDefs_f(const idCmdArgs &args)
Definition: RenderWorld.cpp:39
const int FALLOFF_TEXTURE_SIZE
Definition: tr_local.h:42
#define const
Definition: getdate.c:251
bool R_CreateAmbientCache(srfTriangles_t *tri, bool needsLighting)
Definition: tr_light.cpp:52
struct deformInfo_s deformInfo_t
float floatTime
Definition: tr_local.h:377
virtual void UpdateRenderLight(const renderLight_t *re, bool forceUpdate=false)
idCVar r_skipFogLights
srfTriangles_t * R_PolytopeSurface(int numPlanes, const idPlane *planes, idWinding **windings)
Definition: tr_polytope.cpp:44
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:4804
idScreenRect scissorRect
Definition: tr_local.h:307
areaReference_t * entityRefs
Definition: tr_local.h:285
idCVar r_mode
const int GLS_ALPHAMASK
Definition: tr_local.h:1033
const int GLS_REDMASK
Definition: tr_local.h:1030
virtual void SetColor4(float r, float g, float b, float a)
idCVar r_shadowPolygonFactor
const int GLS_COLORMASK
Definition: tr_local.h:1034
int c_copyFrameBuffer
Definition: tr_local.h:665
void R_ReloadARBPrograms_f(const idCmdArgs &args)
Definition: draw_arb2.cpp:505
virtual void FreeRenderEntity()=0
void RB_ARB_DrawInteractions(void)
Definition: draw_arb.cpp:522
const int MAX_GUI_SURFACES
Definition: tr_local.h:669
float maxLightValue
Definition: tr_local.h:633
void RB_SetGL2D(void)
Definition: tr_backend.cpp:423
idCVar r_testGamma
void RB_AddDebugPolygon(const idVec4 &color, const idWinding &winding, const int lifeTime, const bool depthTest)
void R_CreateEntityRefs(idRenderEntityLocal *def)
idVec3 normal
Definition: tr_local.h:1663
idCVar r_useTwoSidedStencil
GLenum GLint GLint y
Definition: glext.h:2849
idCVar r_showLightCount
idCVar r_showTexturePolarity
void R_RemoveUnusedVerts(srfTriangles_t *tri)
drawSurfsCommand_t lockSurfacesCmd
Definition: tr_local.h:790
idCVar r_znear
virtual void CaptureRenderToImage(const char *imageName)
idCVar r_showOverDraw
void * GLimp_BackEndSleep(void)
Definition: glimp.cpp:82
const int GLS_DSTBLEND_SRC_ALPHA
Definition: tr_local.h:1020
struct drawSurf_s * subviewSurface
Definition: tr_local.h:407
idCVar r_showImages
srfTriangles_t * R_CreateVertexProgramTurboShadowVolume(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo)
void RB_NV20_DrawInteractions(void)
Definition: draw_nv20.cpp:763
float zmin
Definition: tr_local.h:56
GLclampf ref
Definition: glext.h:4237
idCVar r_showInteractions
renderLight_t parms
Definition: tr_local.h:191
idCVar r_showSkel
void R_RemoveUnecessaryViewLights(void)
Definition: tr_light.cpp:1570
idScreenRect scissorRect
Definition: tr_local.h:118
void R_FreeStaticTriSurfSilIndexes(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:654
glIndex_t * indexes
Definition: tr_local.h:1526
virtual ~idRenderEntity()
Definition: tr_local.h:167
const struct drawSurf_s * localShadows
Definition: tr_local.h:332
void Union(const idScreenRect &rect)
Definition: tr_main.cpp:113
const int GLS_DEFAULT
Definition: tr_local.h:1047
Definition: Vector.h:316
idScreenRect viewport
Definition: tr_local.h:398
virtual void GetRenderEntity(renderEntity_t *re)=0
void R_CreatePrivateShadowCache(srfTriangles_t *tri)
Definition: tr_light.cpp:140
idCVar r_showPortals
int numMirroredVerts
Definition: tr_local.h:1522
idCVar r_renderer
const drawSurf_t * surf
Definition: tr_local.h:437
void GLimp_WakeBackEnd(void *data)
Definition: glimp.cpp:63
const int GLS_DEPTHFUNC_ALWAYS
Definition: tr_local.h:1038
const float FOG_ENTER
Definition: tr_local.h:47
void R_CreateVertexProgramShadowCache(srfTriangles_t *tri)
Definition: tr_light.cpp:156
performanceCounters_t pc
Definition: tr_local.h:788
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glext.h:2878
int glStateBits
Definition: tr_local.h:608
idCVar r_showSmp
virtual void UpdateRenderLight(const renderLight_t *re, bool forceUpdate=false)=0
struct frameMemoryBlock_s frameMemoryBlock_t
renderCommand_t * next
Definition: tr_local.h:497
void R_LockSurfaceScene(viewDef_t *parms)
int texEnv
Definition: tr_local.h:598
const struct drawSurf_s * globalInteractions
Definition: tr_local.h:333
idImage * diffuseImage
Definition: tr_local.h:442
idRenderWorldLocal * primaryWorld
Definition: tr_local.h:774
unsigned short gammaTable[256]
Definition: tr_local.h:805
float modelMatrix[16]
Definition: tr_local.h:253
float lightScale
Definition: tr_local.h:653
GLclampf GLclampf blue
Definition: glext.h:2843
short x1
Definition: tr_local.h:55
float testVideoStartTime
Definition: tr_local.h:782
idCVar r_skipBump
int tiledViewport[2]
Definition: tr_local.h:759
void RB_EnterWeaponDepthHack()
Definition: tr_render.cpp:176
idCVar r_skipInteractions
void R_DeriveTangents(srfTriangles_t *tri, bool allocFacePlanes=true)
void RB_EnterModelDepthHack(float depth)
Definition: tr_render.cpp:195
const int SMP_FRAMES
Definition: tr_local.h:40
float modelDepthHack
Definition: tr_local.h:358
idRenderLightLocal * lightDef
Definition: tr_local.h:302
const int GLS_ATEST_BITS
Definition: tr_local.h:1045
void R_ResizeStaticTriSurfShadowVerts(srfTriangles_t *tri, int numVerts)
Definition: tr_trisurf.cpp:623
class idGuiModel * demoGuiModel
Definition: tr_local.h:803
srfTriangles_t * R_AllocStaticTriSurf(void)
Definition: tr_trisurf.cpp:523
idCVar r_lightScale
GLuint src
Definition: glext.h:5390
glIndex_t * silIndexes
Definition: tr_local.h:1528
GLenum GLsizei len
Definition: glext.h:3472
idList< idRenderWorldLocal * > worlds
Definition: tr_local.h:772
const struct viewEntity_s * space
Definition: tr_local.h:113
idCVar r_skipDiffuse
void R_StencilShot(void)
idCVar r_checkBounds
idCVar r_showVertexColor
void RB_ShowDestinationAlpha(void)
idCVar r_useStateCaching
idCVar r_useInteractionTable
idCVar r_useCombinerDisplayLists
GLenum GLint x
Definition: glext.h:2849
idCVar r_debugLineDepthTest
int currenttmu
Definition: tr_local.h:605
const idMaterial * material
Definition: tr_local.h:114
void RB_LoadShaderTextureMatrix(const float *shaderRegisters, const textureStage_t *texture)
Definition: tr_render.cpp:362
idCVar r_showDemo
float projectionMatrix[16]
Definition: tr_local.h:372
bool R_CheckExtension(char *name)
void R_FreeDeformInfo(deformInfo_t *deformInfo)
void R_ResizeStaticTriSurfVerts(srfTriangles_t *tri, int numVerts)
Definition: tr_trisurf.cpp:597
void RB_STD_FogAllLights(void)
idCVar r_ext_vertex_array_range
int maxDrawSurfs
Definition: tr_local.h:413
const int MAX_MULTITEXTURE_UNITS
Definition: tr_local.h:602
idCVar r_jointNameOffset
virtual void UpdateRenderEntity(const renderEntity_t *re, bool forceUpdate=false)
void RB_GetShaderTextureMatrix(const float *shaderRegisters, const textureStage_t *texture, float matrix[16])
Definition: tr_render.cpp:325
idCVar r_skipBlendLights
const viewEntity_t * currentSpace
Definition: tr_local.h:644
void RB_ExecuteBackEndCommands(const emptyCommand_t *cmds)
Definition: tr_backend.cpp:600
struct drawSurf_s drawSurf_t
srfTriangles_t * R_CopyStaticTriSurf(const srfTriangles_t *tri)
Definition: tr_trisurf.cpp:536
void * R_ClearedFrameAlloc(int bytes)
Definition: tr_main.cpp:417
stageVertexColor_t
Definition: Material.h:182
shadowFrustum_t shadowFrustums[6]
Definition: tr_local.h:224
bool R_CullLocalBox(const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes)
Definition: tr_main.cpp:675
void R_NV20_Init(void)
Definition: draw_nv20.cpp:844
void RB_LeaveDepthHack()
Definition: tr_render.cpp:214
bool isXraySubview
Definition: tr_local.h:391
idCVar r_ignore2
const idMaterial * lightShader
Definition: tr_local.h:326
idCVar r_useInteractionCulling
virtual bool IsFullScreen(void) const
idCVar r_offsetFactor
void R_ReferenceStaticTriSurfVerts(srfTriangles_t *tri, const srfTriangles_t *reference)
Definition: tr_trisurf.cpp:636
idInteraction * lastInteraction
Definition: tr_local.h:287
bool IsEmpty() const
Definition: tr_main.cpp:142
bool GLimp_SetScreenParms(glimpParms_t parms)
Definition: dedicated.cpp:91
idCVar r_showUnsmoothedTangents
idCVar r_showDynamic
void RB_BeginDrawingView(void)
Definition: tr_render.cpp:555
virtual void GetRenderEntity(renderEntity_t *re)
virtual void ForceUpdate()=0
void RB_DrawShaderPasses(drawSurf_t **drawSurfs, int numDrawSurfs)
virtual void CropRenderSize(int width, int height, bool makePowerOfTwo=false, bool forceDimensions=false)
backEndName_t backEndRenderer
Definition: tr_local.h:762
frameData_t * frameData
Definition: tr_backend.cpp:34
int * dupVerts
Definition: tr_local.h:1531
void R_RemoveDegenerateTriangles(srfTriangles_t *tri)
int currentCubeMap
Definition: tr_local.h:597
srfTriangles_t * R_MergeSurfaceList(const srfTriangles_t **surfaces, int numSurfaces)
idCVar r_useScissor
idCVar r_jitter
idVec4 diffuseColor
Definition: tr_local.h:445
const int GLS_DEPTHFUNC_EQUAL
Definition: tr_local.h:1039
bool R_IssueEntityDefCallback(idRenderEntityLocal *def)
Definition: tr_light.cpp:1060
void RB_CreateSingleDrawInteractions(const drawSurf_t *surf, void(*DrawInteraction)(const drawInteraction_t *))
Definition: tr_render.cpp:689
idBounds referenceBounds
Definition: tr_local.h:268
virtual void GetRenderLight(renderLight_t *re)
void R_FreeDerivedData(void)
struct viewLight_s * next
Definition: tr_local.h:299
idCVar r_showTrace
idVec3 * verts
Definition: tr_local.h:1442
void RB_RenderDrawSurfListWithFunction(drawSurf_t **drawSurfs, int numDrawSurfs, void(*triFunc_)(const drawSurf_t *))
Definition: tr_render.cpp:232
programParameter_t
Definition: tr_local.h:1367
idImage * specularImage
Definition: tr_local.h:443
bool GLimp_SpawnRenderThread(void(*function)(void))
virtual void DrawStretchPic(const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material, bool clip=true, float x=0.0f, float y=0.0f, float w=640.0f, float h=0.0f)
struct viewLight_s * viewLights
Definition: tr_local.h:415
idCVar r_displayRefresh
viewDef_t * viewDef
Definition: tr_local.h:493
idPlane lightProject[4]
Definition: tr_local.h:211
void RB_DetermineLightScale(void)
Definition: tr_render.cpp:500
idScreenRect R_CalcIntersectionScissor(const idRenderLightLocal *lightDef, const idRenderEntityLocal *entityDef, const viewDef_t *viewDef)
renderCommand_t * next
Definition: tr_local.h:482
virtual void BeginFrame(int windowWidth, int windowHeight)
idCVar r_singleLight
idCVar r_useShadowCulling
const int MAX_CLIP_PLANES
Definition: tr_local.h:365
GLuint dst
Definition: glext.h:5285
void RB_NV10_DrawInteractions(void)
Definition: draw_nv10.cpp:624
idFrustum viewFrustum
Definition: tr_local.h:422
bool backEndRendererHasVertexPrograms
Definition: tr_local.h:763
int dynamicModelFrameCount
Definition: tr_local.h:264
void R_FreeEntityDefOverlay(idRenderEntityLocal *def)
void RB_LogComment(const char *comment,...) id_attribute((format(printf
int viewSeesShadowPlaneBits
Definition: tr_local.h:320
idCVar r_showNormals
void R_Init(void)
void R_ListRenderEntityDefs_f(const idCmdArgs &args)
Definition: RenderWorld.cpp:83
virtual void DrawBigChar(int x, int y, int ch, const idMaterial *material)
bool R_GenerateSubViews(void)
Definition: tr_subview.cpp:549
idCVar r_showSurfaceInfo
const int GLS_SRCBLEND_BITS
Definition: tr_local.h:1014
Definition: Vector.h:52
void R_DeriveLightData(idRenderLightLocal *light)
idCVar r_frontBuffer
idCVar r_useTripleTextureARB
const shaderStage_t * RB_SetLightTexture(const idRenderLightLocal *light)
void * R_GetCommandBuffer(int bytes)
void R_CheckForEntityDefsUsingModel(idRenderModel *model)
void AddPoint(float x, float y)
Definition: tr_main.cpp:58
idCVar r_showShadows
void R_InitTriSurfData(void)
Definition: tr_trisurf.cpp:157
void R_LocalVectorToGlobal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
Definition: tr_main.cpp:532
void RB_DrawElementsImmediate(const srfTriangles_t *tri)
Definition: tr_render.cpp:49
virtual void PrintMemInfo(MemInfo_t *mi)
void Clear()
Definition: tr_main.cpp:47
virtual void Shutdown(void)
const float DEFAULT_FOG_DISTANCE
Definition: tr_local.h:44
idRenderModelDecal * decals
Definition: tr_local.h:282
viewLight_t * vLight
Definition: tr_local.h:648
bool R_RadiusCullLocalBox(const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes)
Definition: tr_main.cpp:587
const idMaterial * R_RemapShaderBySkin(const idMaterial *shader, const idDeclSkin *customSkin, const idMaterial *customShader)
idCVar r_debugLineWidth
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:3454
srfTriangles_t * firstDeferredFreeTriSurf
Definition: tr_local.h:534
virtual void TakeScreenshot(int width, int height, const char *fileName, int downSample, renderView_t *ref)
Definition: Vector.h:808
void R_R200_Init(void)
Definition: draw_r200.cpp:480
idImage * ambientCubeImage
Definition: tr_local.h:784
struct viewEntity_s * next
Definition: tr_local.h:345
idRenderModel * R_EntityDefDynamicModel(idRenderEntityLocal *def)
Definition: tr_light.cpp:1104
virtual void Init(void)
GLuint program
Definition: glext.h:3473
virtual bool RegisterFont(const char *fontName, fontInfoEx_t &font)
Definition: tr_font.cpp:283
void R_InitOpenGL(void)
void R_SurfaceToTextureAxis(const srfTriangles_t *tri, idVec3 &origin, idVec3 axis[3])
Definition: tr_guisurf.cpp:49
idImage * lightImage
Definition: tr_local.h:439
idCVar r_showViewEntitys
void R_CreateVertexNormals(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:891
idRenderWorldLocal * world
Definition: tr_local.h:198
void R_SetColorMappings(void)
void R_FreeEntityDefDerivedData(idRenderEntityLocal *def, bool keepDecals, bool keepCachedDynamicModel)
void GL_State(int stateVector)
Definition: tr_backend.cpp:239
void R_AllocStaticTriSurfPlanes(srfTriangles_t *tri, int numIndexes)
Definition: tr_trisurf.cpp:585
void GL_Cull(int cullType)
Definition: tr_backend.cpp:161
viewDef_t * primaryView
Definition: tr_local.h:776
GLuint GLuint end
Definition: glext.h:2845
areaReference_t * references
Definition: tr_local.h:229
localTrace_t R_LocalTrace(const idVec3 &start, const idVec3 &end, const float radius, const srfTriangles_t *tri)
Definition: tr_trace.cpp:43
idImage * lightFalloffImage
Definition: tr_local.h:440
int lastModifiedFrameNum
Definition: tr_local.h:204
viewEntity_t identitySpace
Definition: tr_local.h:792
renderView_t renderView
Definition: tr_local.h:370
void Expand()
Definition: tr_main.cpp:81
void R_CleanupTriangles(srfTriangles_t *tri, bool createNormals, bool identifySilEdges, bool useUnsmoothedTangents)
idVec4 specularColor
Definition: tr_local.h:446
idCVar r_skipDynamicTextures
idCVar r_skipTranslucent
idImage * falloffImage
Definition: tr_local.h:214
renderCommand_t
Definition: tr_local.h:472
virtual int GetIndex()=0
virtual int GetScreenHeight(void) const
bool R_PreciseCullSurface(const drawSurf_t *drawSurf, idBounds &ndcBounds)
Definition: tr_subview.cpp:109
virtual int GetScreenWidth(void) const
bool viewInsideLight
Definition: tr_local.h:311
idCVar r_showIntensity
idCVar r_useEntityScissors
idCVar r_useNodeCommonChildren
int memoryHighwater
Definition: tr_local.h:537
idCVar r_skipAmbient
const int GLS_ATEST_EQ_255
Definition: tr_local.h:1042
virtual void UpdateRenderEntity(const renderEntity_t *re, bool forceUpdate=false)=0
void GL_CheckErrors(void)
float fraction
Definition: tr_local.h:1660
void R_DeriveFacePlanes(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:827
int glIndex_t
Definition: Model.h:52
const int GLS_DSTBLEND_ONE_MINUS_SRC_COLOR
Definition: tr_local.h:1019
struct vertCache_s * dynamicTexCoords
Definition: tr_local.h:120
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:2853
idInteraction * firstInteraction
Definition: tr_local.h:230
idCVar r_showTangentSpace
idCVar r_forceLoadImages
const int GLS_GREENMASK
Definition: tr_local.h:1031
glstate_t glState
Definition: tr_local.h:663
idCVar r_shadowPolygonOffset
const int GLS_SRCBLEND_ONE
Definition: tr_local.h:1006
int R_FindARBProgram(GLenum target, const char *program)
Definition: draw_arb2.cpp:466
virtual void GetGLSettings(int &width, int &height)
struct areaReference_s * ownerNext
Definition: tr_local.h:144
struct frameMemoryBlock_s * next
Definition: tr_local.h:515
idCVar r_useExternalShadows
idCVar r_useShadowProjectedCull
frameMemoryBlock_t * alloc
Definition: tr_local.h:532
virtual void GetRenderLight(renderLight_t *re)=0
Definition: Plane.h:71
void R_MakeShadowFrustums(idRenderLightLocal *def)
idCVar r_showEntityScissors
idCVar r_lightAllBackFaces
virtual void CaptureRenderToFile(const char *fileName, bool fixAlpha)
idCVar r_useShadowSurfaceScissor
void GL_TexEnv(int env)
Definition: tr_backend.cpp:196
textureType_t
Definition: Image.h:130
void Intersect(const idScreenRect &rect)
Definition: tr_main.cpp:93
void R_FreeStaticTriSurf(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:489
void GLimp_DeactivateContext(void)
Definition: dedicated.cpp:87
virtual void EndFrame(int *frontEndMsec, int *backEndMsec)
void R_OrderIndexes(int numIndexes, glIndex_t *indexes)
bool R_GlobalShaderOverride(const idMaterial **shader)
idCVar r_orderIndexes
void R_AllocStaticTriSurfShadowVerts(srfTriangles_t *tri, int numVerts)
Definition: tr_trisurf.cpp:575
viewEntity_t * R_SetEntityDefViewEntity(idRenderEntityLocal *def)
Definition: tr_light.cpp:378
void R_AddDrawSurf(const srfTriangles_t *tri, const viewEntity_t *space, const renderEntity_t *renderEntity, const idMaterial *shader, const idScreenRect &scissor)
Definition: tr_light.cpp:1183
idCVar r_testGammaBias
idCVar r_offsetUnits
float backEndRendererMaxLight
Definition: tr_local.h:764
void R_NV10_Init(void)
Definition: draw_nv10.cpp:639
void R_ReCreateWorldReferences(void)
const struct drawSurf_s * translucentInteractions
Definition: tr_local.h:334
void RB_T_RenderTriangleSurface(const drawSurf_t *surf)
Definition: tr_render.cpp:167
void R_ClearEntityDefDynamicModel(idRenderEntityLocal *def)
void R_GlobalToNormalizedDeviceCoordinates(const idVec3 &global, idVec3 &ndc)
Definition: tr_main.cpp:714
virtual void DrawBigStringExt(int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material)
idCVar r_skipSuppress
void R_ReverseTriangles(srfTriangles_t *tri)
bool isMirror
Definition: tr_local.h:390
void R_TransformClipToDevice(const idPlane &clip, const viewDef_t *view, idVec3 &normalized)
Definition: tr_main.cpp:771
virtual void GetCardCaps(bool &oldCard, bool &nv10or20)
idScreenRect scissorRect
Definition: tr_local.h:355
GLenum GLsizei width
Definition: glext.h:2846
void R_FrameFree(void *data)
Definition: tr_main.cpp:438
idCVar r_demonstrateBug
idCVar r_skipPostProcess
void RenderViewToViewport(const renderView_t *renderView, idScreenRect *viewport)
bool currentRenderCopied
Definition: tr_local.h:660
void R_GlobalVectorToLocal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
Definition: tr_main.cpp:541
idRenderEntityLocal * entityDef
Definition: tr_local.h:348
emptyCommand_t * cmdTail
Definition: tr_local.h:542
GLubyte GLubyte GLubyte a
Definition: glext.h:4662
idCVar r_showAlloc
void RB_BakeTextureMatrixIntoTexgen(idPlane lightProject[3], const float textureMatrix[16])
bool R_CornerCullLocalBox(const idBounds &bounds, const float modelMatrix[16], int numPlanes, const idPlane *planes)
Definition: tr_main.cpp:625
void RB_DrawShadowElementsWithCounters(const srfTriangles_t *tri, int numIndexes)
Definition: tr_render.cpp:117
void R_BoundTriSurf(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:704
idCVar r_useLightPortalFlow
int numSilEdges
Definition: tr_local.h:1533
void R_RenderGuiSurf(idUserInterface *gui, drawSurf_t *drawSurf)
Definition: tr_guisurf.cpp:128
float RB_DrawTextLength(const char *text, float scale, int len)
float modelMatrix[16]
Definition: tr_local.h:360
void R_SetViewMatrix(viewDef_t *viewDef)
Definition: tr_main.cpp:838
void RB_DrawElementsWithCounters(const srfTriangles_t *tri)
Definition: tr_render.cpp:78
void R_RemoveDuplicatedTriangles(srfTriangles_t *tri)
idCVar r_useDepthBoundsTest
void R_TransposeGLMatrix(const float in[16], float out[16])
Definition: tr_main.cpp:821
idCVar r_brightness
float modelMatrix[16]
Definition: tr_local.h:196
idCVar r_testStepGamma
const int GLS_SRCBLEND_DST_ALPHA
Definition: tr_local.h:1011
idCVar r_showUpdates
idCVar r_useNV20MonoLights
int numSourceVerts
Definition: tr_local.h:1515
idCVar r_showInteractionScissors
void GLimp_EnableLogging(bool enable)
Definition: dedicated.cpp:75
void RB_ShowOverdraw(void)
const int GLS_ATEST_GE_128
Definition: tr_local.h:1044
GLenum GLsizei GLsizei height
Definition: glext.h:2856
idRenderModel * cachedDynamicModel
Definition: tr_local.h:266
idCVar r_useShadowVertexProgram
srfTriangles_t * R_CreateShadowVolume(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, shadowGen_t optimize, srfCullInfo_t &cullInfo)
idVec3 point
Definition: tr_local.h:1662
const int GLS_DSTBLEND_ZERO
Definition: tr_local.h:1016
const int FOG_ENTER_SIZE
Definition: tr_local.h:46
idCVar r_gamma
idCVar r_usePreciseTriangleInteractions
virtual int GetIndex()
void R_TransformModelToClip(const idVec3 &src, const float *modelMatrix, const float *projectionMatrix, idPlane &eye, idPlane &dst)
Definition: tr_main.cpp:687
virtual void FreeRenderLight()=0
const float * shaderRegisters
Definition: tr_local.h:327
srfTriangles_t * frustumTris
Definition: tr_local.h:221
idCVar r_skipSubviews
void R_FreeEntityDefFadedDecals(idRenderEntityLocal *def, int time)
void R_ScreenShot_f(const idCmdArgs &args)
virtual void ProjectOverlay(const idPlane localTextureAxis[2], const idMaterial *material)
virtual void ForceUpdate()
idCVar r_useOptimizedShadows
void void RB_ShowImages(void)
Definition: tr_backend.cpp:490
GLubyte GLubyte b
Definition: glext.h:4662
virtual void SetColor(const idVec4 &rgba)
renderCrop_t renderCrops[MAX_RENDER_CROPS]
Definition: tr_local.h:797
void R_ReferenceStaticTriSurfIndexes(srfTriangles_t *tri, const srfTriangles_t *reference)
Definition: tr_trisurf.cpp:645
void myGlMultMatrix(const float *a, const float *b, float *out)
idCVar r_screenFraction
backEndName_t
Definition: tr_local.h:672
idPlane fogPlane
Definition: tr_local.h:324
idCVar r_showDefs
idCVar r_materialOverride
void R_FreeDeferredTriSurfs(frameData_t *frame)
Definition: tr_trisurf.cpp:466
void RB_PolygonClear(void)
renderCommand_t * next
Definition: tr_local.h:492
idCVar r_glDriver
void R_GlobalPointToLocal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
Definition: tr_main.cpp:522
idCVar r_fullscreen
void R_ShutdownTriSurfData(void)
Definition: tr_trisurf.cpp:188
idCVar r_flareSize
void R_RenderView(viewDef_t *parms)
Definition: tr_main.cpp:1095
idCVar r_skipCopyTexture
void R_ReloadGuis_f(const idCmdArgs &args)
Definition: tr_guisurf.cpp:197
viewDef_t * viewDef
Definition: tr_local.h:786
idCVar r_showSurfaces
void R_AddDrawViewCmd(viewDef_t *parms)
struct viewDef_s viewDef_t
void RB_R200_DrawInteractions(void)
Definition: draw_r200.cpp:278
idCVar r_showDepth
idRenderSystemLocal tr
bool isSubview
Definition: tr_local.h:389
GLdouble GLdouble GLdouble r
Definition: glext.h:2951
idCVar r_singleArea
idCVar r_cgVertexProfile
glIndex_t * indexes
Definition: tr_local.h:1444
Definition: Matrix.h:333
const int GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA
Definition: tr_local.h:1021
idCVar r_clear
void R_ListGuis_f(const idCmdArgs &args)
Definition: tr_guisurf.cpp:217
void RB_ARB2_DrawInteractions(void)
Definition: draw_arb2.cpp:243
#define id_attribute(x)
Definition: sys_public.h:139
struct viewEntity_s * viewEntitys
Definition: tr_local.h:416
textureType_t textureType
Definition: tr_local.h:599
idCVar r_useVertexBuffers
idCVar r_cgFragmentProfile
void R_ReallyFreeStaticTriSurf(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:374
idCVar r_usePortals
idCVar r_skipFrontEnd
frameMemoryBlock_t * memory
Definition: tr_local.h:529
idCVar r_showLightScissors
idImage * image
Definition: tr_local.h:499
idCVar r_useClippedLightScissors
idCVar r_multiSamples
idCVar r_debugRenderToTexture
idCVar r_showLights
const struct drawSurf_s * globalShadows
Definition: tr_local.h:330
const int GLS_ATEST_LT_128
Definition: tr_local.h:1043
const int INITIAL_DRAWSURFS
Definition: tr_local.h:508
tuple f
Definition: idal.py:89
int numDupVerts
Definition: tr_local.h:1530
void RB_STD_LightScale(void)
void * R_ClearedStaticAlloc(int bytes)
Definition: tr_main.cpp:322
void RB_RenderDebugTools(drawSurf_t **drawSurfs, int numDrawSurfs)
idCVar r_showInteractionFrustums
GLuint in
Definition: glext.h:5388
srfTriangles_t * R_CreateTurboShadowVolume(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo)
const struct drawSurf_s * localInteractions
Definition: tr_local.h:331
bool GLimp_Init(glimpParms_t parms)
Definition: dedicated.cpp:77
void R_LocalPlaneToGlobal(const float modelMatrix[16], const idPlane &in, idPlane &out)
Definition: tr_main.cpp:554
unsigned char byte
Definition: Lib.h:75
void * R_StaticAlloc(int bytes)
Definition: tr_main.cpp:301
optimizedShadow_t SuperOptimizeOccluders(idVec4 *verts, glIndex_t *indexes, int numIndexes, idPlane projectionPlane, idVec3 projectionOrigin)
int viewportOffset[2]
Definition: tr_local.h:758
void RB_ShowTrace(drawSurf_t **drawSurfs, int numDrawSurfs)
Definition: tr_trace.cpp:353
GLuint texture
Definition: glext.h:3871
idCVar r_swapInterval
const GLcharARB * name
Definition: glext.h:3629
bool R_CreateLightingCache(const idRenderEntityLocal *ent, const idRenderLightLocal *light, srfTriangles_t *tri)
Definition: tr_light.cpp:75
int numIndexes
Definition: tr_local.h:1525
idInteraction * lastInteraction
Definition: tr_local.h:231
void RB_DrawView(const void *data)
Definition: tr_render.cpp:849
void RB_SetDefaultGLState(void)
Definition: tr_backend.cpp:46
int R_CountFrameData(void)
Definition: tr_main.cpp:274
idCVar r_skipRenderContext
idScreenRect scissor
Definition: tr_local.h:400
const struct drawSurf_s * nextOnLight
Definition: tr_local.h:117
virtual void DrawDemoPics()
virtual void DrawSmallStringExt(int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material)
void GL_SelectTexture(int unit)
Definition: tr_backend.cpp:135
idCVar r_ignore
virtual void UnCrop()
const int GLS_SRCBLEND_ZERO
Definition: tr_local.h:1005
idRenderModelOverlay * overlay
Definition: tr_local.h:283
void GLimp_Shutdown(void)
Definition: dedicated.cpp:83
idImage * bumpImage
Definition: tr_local.h:441
float modelViewMatrix[16]
Definition: tr_local.h:361
idCVar r_skipLightScale
idWinding * frustumWindings[6]
Definition: tr_local.h:220
struct areaReference_s areaReference_t
void RB_ShowLightCount(drawSurf_t **drawSurfs, int numDrawSurfs)
struct portalArea_s * area
Definition: tr_local.h:147
bool forceGlState
Definition: tr_local.h:609
idRenderEntityLocal * entity
Definition: tr_local.h:145
idCVar r_skipSpecular
idCVar r_logFile
void R_AddLightSurfaces(void)
Definition: tr_light.cpp:875
void RB_FinishStageTexture(const textureStage_t *texture, const drawSurf_t *surf)
Definition: tr_render.cpp:451
idCVar r_testARBProgram
void R_PurgeTriSurfData(frameData_t *frame)
Definition: tr_trisurf.cpp:208
int numDrawSurfs
Definition: tr_local.h:412
void * R_FrameAlloc(int bytes)
Definition: tr_main.cpp:365
idCVar r_useFrustumFarDistance
dominantTri_t * dominantTris
Definition: tr_local.h:1536
idCVar r_useDeferredTangents
int dsFlags
Definition: tr_local.h:119
idCVar r_singleEntity
idVec3 globalLightOrigin
Definition: tr_local.h:322
idPlane lightProject[4]
Definition: tr_local.h:323
const int GLS_SRCBLEND_DST_COLOR
Definition: tr_local.h:1007
struct areaReference_s * areaNext
Definition: tr_local.h:142
idCinematic * testVideo
Definition: tr_local.h:781
int current2DMap
Definition: tr_local.h:595
void R_AllocStaticTriSurfIndexes(srfTriangles_t *tri, int numIndexes)
Definition: tr_trisurf.cpp:565
virtual void DrawSmallChar(int x, int y, int ch, const idMaterial *material)
idRenderLightLocal * light
Definition: tr_local.h:146
idVec3 initialViewAreaOrigin
Definition: tr_local.h:379
idCVar r_useInfiniteFarZ
void R_FreeLightDefDerivedData(idRenderLightLocal *light)
silEdge_t * silEdges
Definition: tr_local.h:1534
int current3DMap
Definition: tr_local.h:596
renderCommand_t * next
Definition: tr_local.h:486
void R_ARB2_Init(void)
Definition: draw_arb2.cpp:521
short y1
Definition: tr_local.h:55
virtual bool IsOpenGLRunning(void) const
idCVar r_showShadowCount
virtual int GetIndex()=0
idCVar r_skipRender
idCVar r_skipBackEnd
int * mirroredVerts
Definition: tr_local.h:1523
virtual idRenderWorld * AllocRenderWorld(void)
idInteraction * firstInteraction
Definition: tr_local.h:286
idCVar r_skipNewAmbient
idRenderWorldLocal * renderWorld
Definition: tr_local.h:375
srfTriangles_t * lastDeferredFreeTriSurf
Definition: tr_local.h:535
virtual ~idRenderLight()
Definition: tr_local.h:154
const srfTriangles_t * frustumTris
Definition: tr_local.h:325
virtual void ForceUpdate()
void R_LinkLightSurf(const drawSurf_t **link, const srfTriangles_t *tri, const viewEntity_t *space, const idRenderLightLocal *light, const idMaterial *shader, const idScreenRect &scissor, bool viewInsideShadow)
Definition: tr_light.cpp:658
void RB_AddDebugLine(const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifeTime, const bool depthTest)
virtual void InitOpenGL(void)
void R_StaticFree(void *data)
Definition: tr_main.cpp:335
void R_ResizeStaticTriSurfIndexes(srfTriangles_t *tri, int numIndexes)
Definition: tr_trisurf.cpp:610
renderEntity_t parms
Definition: tr_local.h:251
idCVar r_skipDeforms
demoCommand_t
Definition: tr_local.h:70
virtual void BeginLevelLoad(void)
idCVar r_skipGuiShaders
idCVar r_debugArrowStep
void R_CreateSilIndexes(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:765
short y2
Definition: tr_local.h:55
void R_LocalPointToGlobal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
Definition: tr_main.cpp:470
void R_ToggleSmpFrame(void)
Definition: tr_main.cpp:184
void GLimp_FrontEndSleep(void)
Definition: glimp.cpp:78
idCVar r_showPrimitives
void R_FreeEntityDefCachedDynamicModel(idRenderEntityLocal *def)
void RB_BindStageTexture(const float *shaderRegisters, const textureStage_t *texture, const drawSurf_t *surf)
Definition: tr_render.cpp:410
void GLimp_ActivateContext(void)
Definition: dedicated.cpp:89
void RB_DrawBounds(const idBounds &bounds)
int R_TriSurfMemory(const srfTriangles_t *tri)
Definition: tr_trisurf.cpp:290
virtual void EndLevelLoad(void)
idVec4 ambientLightVector
Definition: tr_local.h:768
struct viewLight_s viewLight_t
void RB_RenderTriangleSurface(const srfTriangles_t *tri)
Definition: tr_render.cpp:147
void R_AxisToModelMatrix(const idMat3 &axis, const idVec3 &origin, float modelMatrix[16])
Definition: tr_main.cpp:445
idCVar r_showLightScale
idScreenRect currentScissor
Definition: tr_local.h:645
void R_ShowTriSurfMemory_f(const idCmdArgs &args)
Definition: tr_trisurf.cpp:229
void R_CreateLightRefs(idRenderLightLocal *light)
void R_AddModelSurfaces(void)
Definition: tr_light.cpp:1460
idCVar r_showTextureVectors
void R_AllocStaticTriSurfVerts(srfTriangles_t *tri, int numVerts)
Definition: tr_trisurf.cpp:555
virtual void ShutdownOpenGL(void)
viewLight_t * R_SetLightDefViewLight(idRenderLightLocal *def)
Definition: tr_light.cpp:458
void R_DeformDrawSurf(drawSurf_t *drawSurf)
Definition: tr_deform.cpp:1228
idPlane clipPlanes[MAX_CLIP_PLANES]
Definition: tr_local.h:396
void R_ShowColoredScreenRect(const idScreenRect &rect, int colorIndex)
Definition: tr_main.cpp:172
int R_DeformInfoMemoryUsed(deformInfo_t *deformInfo)
idCVar r_useLightCulling
idCVar r_shadows
void R_RangeCheckIndexes(const srfTriangles_t *tri)
Definition: tr_trisurf.cpp:671
struct viewDef_s * superView
Definition: tr_local.h:406
idCVar r_useConstantMaterials
const int GLS_DSTBLEND_BITS
Definition: tr_local.h:1024
idCVar r_useIndexBuffers
void GLimp_SwapBuffers(void)
Definition: dedicated.cpp:85
virtual void FreeRenderLight()
void RB_ClearDebugLines(int time)
void R_GlobalPlaneToLocal(const float modelMatrix[16], const idPlane &in, idPlane &out)
Definition: tr_main.cpp:547
void R_FreeStaticTriSurfVertexCaches(srfTriangles_t *tri)
Definition: tr_trisurf.cpp:343
const float * shaderRegisters
Definition: tr_local.h:116
bool isEditor
Definition: tr_local.h:393
renderView_t primaryRenderView
Definition: tr_local.h:775
glconfig_t glConfig
virtual void GlobalToNormalizedDeviceCoordinates(const idVec3 &global, idVec3 &ndc)
idCVar r_useEntityCallbacks
GLuint start
Definition: glext.h:2845
const int GLS_DEPTHMASK
Definition: tr_local.h:1029
virtual void RemoveDecals()
const idMaterial * defaultMaterial
Definition: tr_local.h:779
const int GLS_SRCBLEND_ONE_MINUS_SRC_ALPHA
Definition: tr_local.h:1010
void R_DoneFreeType(void)
Definition: tr_font.cpp:545
void RB_ShutdownDebugTools(void)
void R_SetLightProject(idPlane lightProject[4], const idVec3 origin, const idVec3 targetPoint, const idVec3 rightVector, const idVec3 upVector, const idVec3 start, const idVec3 stop)
void R_PointTimesMatrix(const float modelMatrix[16], const idVec4 &in, idVec4 &out)
Definition: tr_main.cpp:511
virtual void DrawStretchTri(idVec2 p1, idVec2 p2, idVec2 p3, idVec2 t1, idVec2 t2, idVec2 t3, const idMaterial *material)
struct areaReference_s * areaPrev
Definition: tr_local.h:143
program_t
Definition: tr_local.h:1314
idCVar r_useLightScissors
bool Equals(const idScreenRect &rect) const
Definition: tr_main.cpp:133
idCVar r_ignoreGLErrors
int numOutputVerts
Definition: tr_local.h:1520
void GLimp_SetGamma(unsigned short red[256], unsigned short green[256], unsigned short blue[256])
Definition: dedicated.cpp:79
void R_TransformEyeZToWin(float src_z, const float *projectionMatrix, float &dst_z)
Definition: tr_main.cpp:564
GLint GLenum GLboolean normalized
Definition: glext.h:3469
struct viewLight_s * viewLight
Definition: tr_local.h:227
idCVar r_showCull
void RB_ClearDebugText(int time)
idVec3 globalLightOrigin
Definition: tr_local.h:216
void RB_STD_DrawView(void)
int faceCulling
Definition: tr_local.h:607
GLclampf green
Definition: glext.h:2843
idCVar r_useCachedDynamicModels
idVec4 localViewOrigin
Definition: tr_local.h:454
idCVar r_debugPolygonFilled
void RB_AddDebugText(const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align, const int lifetime, const bool depthTest)
void RB_StencilShadowPass(const drawSurf_t *drawSurfs)
idImage * testImage
Definition: tr_local.h:780
const viewDef_t * viewDef
Definition: tr_local.h:641
idCVar r_subviewOnly