25#define GBI_DISPLAY_LIST_STACK_SIZE 10
28#define GBI_MATRIX_STACK_RESET_DEPTH 10
410 int nUpperLeftX,
int nUpperLeftY,
int nLowerRightX,
int nLowerRightY,
int nTile);
486#define GBI_LIGHT_COUNT 8
724 char abUnknown2C[0x10];
728 int nRenderBufferIndex;
807extern float g_fDepthScale;
813extern float g_fDepthOffset;
851 GrVertex *pDest,
const GbiVertexSource *pSource,
float fRed,
float fGreen,
float fBlue);
855#define GBI_VERTEX_CACHE_SIZE 128
858#define GBI_CLIP_VERTEX_POOL_SIZE 64
960#define RENDER_BUFFER_SIZE 512
974extern int g_nVertexPoolCount;
981extern D3DTLVERTEX g_renderBuffer[RENDER_BUFFER_SIZE];
988extern int g_nRenderBufferIndex;
995extern WORD g_awRenderIndexBuffer[RENDER_BUFFER_SIZE];
1002extern int g_nRenderIndexCount;
1010void ResetRenderBufferAndVertexPool(
void);
1017extern float g_fVertexFogRange;
1024extern int g_dwFogAlphaCutoff;
1031void UpdateD3DFogRenderState(
void);
1041int SubmitVertexToRenderBuffer(
GbiVertex *pVertex);
1051int SubmitVertexToRenderBufferEx(
GbiVertex *pVertex);
1061int SubmitVertexToRenderBufferConstColor(
GbiVertex *pVertex);
1071int SubmitVertexToRenderBufferFogged(
GbiVertex *pVertex);
1078extern int (*g_pfnSubmitVertexToRenderBuffer)(
GbiVertex *pVertex);
1201void SubmitIndexedTriangle(
int nVertex0,
int nVertex1,
int nVertex2);
1212void SubmitIndexedTriangleRasterized(
int nVertex0,
int nVertex1,
int nVertex2);
1219void FlushIndexedRenderBuffer(
void);
1227void FlushDirtyRenderStates(
void);
1234extern DWORD g_dwD3DAlphaFunc;
1238#define OVERLAY_DISPLAY_LIST_SIZE 0x8000
1240#define OVERLAY_TEXT_SIZE 20
1242#define OVERLAY_TEXT_X 0
1244#define OVERLAY_TEXT_Y 60
1246#define GBI_END_DISPLAY_LIST_W0 0xb8000000
1249#define DEBUG_OVERLAY_TEXT_SIZE 0x408
1640extern DWORD g_dwD3DZFunc;
1658extern D3DCOLOR g_dwVertexConstantColor;
1665#define GBI_HANDLER_COUNT 256
float g_aGbiModelViewStack[GBI_MATRIX_STACK_RESET_DEPTH][4][4]
The stack of model-view matrices used by display-list matrix commands.
GbiCommand * HandleGbiBindTextureEntry(GbiCommand *pCommand)
Draw the triangles waiting, and bind a texture the game loaded in place of the commands that load it ...
GbiCommand * HandleGbiPopMatrix(GbiCommand *pCommand)
Pop the stack of matrices.
unsigned char g_bGbiFillColorA
The alpha of the fill colour, 0 or 255.
GbiCommand * HandleGbiMatrix(GbiCommand *pCommand)
Multiply or load the projection or the model view matrix, and update g_GbiMvpMatrix.
void SelectVertexSubmitterForCombineMode(unsigned dwCombineHi, unsigned dwCombineLo)
Choose the routine that submits vertices for a combine mode, and the colour of the combine modes that...
unsigned char g_bGbiFillColorR
The red of the fill colour.
int g_nBoundTextureEntry
The entry whose texture is bound, or -1 after texture initialization.
unsigned g_dwGbiCombineModeLo
The second word of the combine mode set last.
GbiCommand * HandleGbiSetScissorIntCoords(GbiCommand *pCommand)
Set the scissor from corners in whole pixels of the console, and clip the device to it.
void ComputeVertexDirectionalLight(const ConvertedModelVertex *pVertex, GbiVertexSource *pDest)
Light a vertex normal with the first directional light and the ambient colour.
void ScaleVertexTexCoords(GrVertex *pVertex, const GbiVertexSource *pSource)
Scale the texture coordinates of a vertex as it was loaded into those of both units of the vertex,...
GbiCommand * HandleGbiSetTexRectW(GbiCommand *pCommand)
Set the scale of the width of a texture rectangle.
const Light * g_pGbiLookAtY
The second vector of the look-at of the display lists, as a move memory command gives it.
GbiCommand * HandleGbiSetTileSize(GbiCommand *pCommand)
Set the edges of the tile, and its width and height in whole texels.
int g_dwTileSizeUls
The left edge of the tile, in texels with two bits of fraction.
GbiCommand * HandleGbiDisplayList(GbiCommand *pCommand)
Branch to a display list, or call it when bits 16 to 23 of the first word are clear.
int g_dwGbiMatrixStackDepth
The depth of the stack of matrices.
void TransformVertexToScreen(GrVertex *pDest, const GbiVertexSource *pSource, float fRed, float fGreen, float fBlue)
Take a vertex inside the view to the screen with a colour, its position snapped to a quarter of a pix...
void ClipPolygonTopPlane(GbiClipPolygon *pPolygon)
Clip a polygon against the top plane, where Y is at most W.
GbiCommand * HandleGbiSetGeometryMode(GbiCommand *pCommand)
Set bits of the geometry mode.
void DrawFillRectangle(int nLeft, int nTop, int nRight, int nBottom)
Fill a rectangle of the screen with the fill colour.
void GenerateGbiVertexTextureCoordinates(const ConvertedModelVertex *pInput, GbiVertexSource *pSource)
Generate tile-relative texture coordinates from the transformed vertex normal.
GbiCommand * HandleGbiTri1Flat(GbiCommand *pCommand)
Draw one triangle with flat shading, after giving the device the dirty render states.
void ApplyRdpRenderMode(unsigned dwRenderMode)
Apply the blending, the depth, and the test of alpha of a render mode of the console.
void DrawTextureRectangle(int nUpperLeftX, int nUpperLeftY, int nLowerRightX, int nLowerRightY, int nTile)
Draw a rectangle of a tile of texture.
Vec3f g_GbiLight0Direction
The direction of the first directional light.
GbiCommand * HandleGbiMoveMem(GbiCommand *pCommand)
Set the viewport, a vector of the look-at, a light, or g_GbiMvpMatrix from memory.
GbiCommand * HandleGbiSetViewport(GbiCommand *pCommand)
Set the viewport.
int g_bRdpBlendStateOverride
Whether a render mode set the blend of the frame.
int g_dwScissorTop
The top edge of the scissor, in pixels from the bottom of the screen.
GbiCommand * HandleGbiSetScissor(GbiCommand *pCommand)
Set the scissor from corners in pixels of the console with two bits of fraction, dropping the fractio...
float g_fGbiAmbientColorG
The green channel of the ambient light.
int g_dwTileSizeHeight
The height of the tile, in whole texels.
GbiVertexSource * LerpVertexFromPool(const GbiVertexSource *pFirst, const GbiVertexSource *pSecond, float fFraction)
Take a clipping vertex from the free list and interpolate its attributes.
unsigned char g_bGbiFillColorB
The blue of the fill colour.
DWORD g_dwGbiLastFrameTime
The time the last frame was shown, in milliseconds.
GbiCommand * HandleGbiSetFillColor(GbiCommand *pCommand)
Set the fill colour from the RGBA 5551 colour in the low 16 bits of the command.
int g_dwGbiNumLights
The number of lights the display lists set, as their command gives it.
float g_fGbiPrimColorG
The green of the primitive colour, from 0 to 1.
GbiCommand * HandleGbiSetFogColor(GbiCommand *pCommand)
Set the colour of the fog of the device from the RGBA colour of the command.
float g_fViewportScaleX
The scale of x of the viewport, in pixels.
GbiCommand * HandleGbiNoOp(GbiCommand *pCommand)
Skip a command.
void ExecuteGbiDisplayList(GbiCommand *pCommand)
Run a display list through g_apfnGbiHandlers until a handler returns nullptr.
int g_bCombineModeSpecialSubmitter
Whether the combine mode takes the routine that modulates the lighting by the environment colour.
void(* g_pfnBindTextureEntry)(int nEntry)
Bind a texture the game loaded, set by InitializeTextureSubsystem().
unsigned g_dwGbiGeometryMode
The geometry mode.
GbiCommand * HandleGbiTextureRectangle(GbiCommand *pCommand)
Draw a texture rectangle of a command of one word pair, its corners in pixels with two bits of fracti...
float g_fGbiEnvColorB
The blue of the environment colour, from 0 to 1.
GbiCommand * HandleGbiTri1SmoothNoZBuffer(GbiCommand *pCommand)
Draw one triangle with smooth shading without the depth buffer, after giving the device the dirty ren...
const Light * g_pGbiLookAtX
The first vector of the look-at of the display lists, as a move memory command gives it.
GbiCommand * HandleGbiSetOtherModeL(GbiCommand *pCommand)
Set the low word of the other modes.
float g_fViewportScaleY
The scale of y of the viewport, in pixels, negative for Direct3D.
float g_fGbiEnvColorG
The green of the environment colour, from 0 to 1.
int g_bGbiLightsTransformed
Whether the lights were transformed since they last changed.
float g_fGbiLight0ColorG
The green channel of the first directional light.
void BindTextureEntry(int nEntry)
Bind an entry's device texture and stage its addressing, scale and active tile bounds.
GbiCommand * HandleGbiTri1Smooth(GbiCommand *pCommand)
Draw one triangle with smooth shading, after giving the device the dirty render states.
GbiCommand * HandleGbiSetPrimColor(GbiCommand *pCommand)
Set the primitive colour from the RGBA colour of the command.
GbiCommand * HandleGbiVertexLitNoZBuffer(GbiCommand *pCommand)
Load vertices with lighting without the depth buffer.
std::array< GbiHandler, GBI_HANDLER_COUNT > g_apfnGbiHandlers
The handlers of the commands of the display lists, by the opcode in the high byte of the first word.
unsigned g_dwGbiCombineModeHi
The first word of the combine mode set last.
float g_fViewportTranslateY
The translation of y of the viewport, in pixels, from the bottom of the screen for Glide.
void ApplyGeometryModeChanges(void)
Apply the geometry mode after a change: the culling and the comparison of depth of the device when th...
int g_dwScissorRight
The right edge of the scissor, in pixels.
float g_fGbiEnvColorA
The alpha of the environment colour, from 0 to 1.
GbiCommand * HandleGbiVertexLitEnvColorModulated(GbiCommand *pCommand)
Load vertices with lighting modulated by the environment colour.
int g_dwScissorBottom
The bottom edge of the scissor, in pixels from the bottom of the screen.
GbiVertexSource * g_pVertexFreeList
The first available clipping vertex in the pool, or NULL when the pool is full.
float g_fGbiAmbientColorR
The red channel of the ambient light.
void DrawFlatShadedTriangle(int nVertex0, int nVertex1, int nVertex2)
Draw a triangle of g_aGbiVertexCache in the colour of its first vertex.
GbiCommand * HandleGbiLoadPreparedTexture(GbiCommand *pCommand)
Upload a texture the game loaded to its surface.
void RenderGbiDisplayListFrame(GbiCommand *pDisplayList)
Draw a frame of the game: set the render states the display lists start from, run the display list an...
float g_fTexRectScaleW
The scale of the width of a texture rectangle.
void ClipAndSubmitTriangleAtFarDepth(GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2)
Clip a triangle to the planes of the view and submit what remains at the far depth.
void(* g_pfnUploadTextureEntryToSurface)(int nEntry, TextureUploadData payload)
Upload a texture the game loaded to its surface, set by InitializeTextureSubsystem().
GbiCommand * g_apGbiDisplayListReturnStack[GBI_DISPLAY_LIST_STACK_SIZE]
The commands that follow the calls of display lists, to return to.
GbiCommand * HandleGbiTri1FlatNoZBuffer(GbiCommand *pCommand)
Draw one triangle with flat shading without the depth buffer, after giving the device the dirty rende...
GbiCommand * HandleGbiTri2SmoothNoZBuffer(GbiCommand *pCommand)
Draw two triangles with smooth shading without the depth buffer, after giving the device the dirty re...
void ClipPolygonNearZPlane(GbiClipPolygon *pPolygon)
Clip a polygon against the near plane, where Z is at least negative W.
GbiCommand * HandleGbiLoadMatrix(GbiCommand *pCommand)
Copy the matrix of the command into g_GbiMvpMatrix.
int ComputeVertexClipCodes(const GbiVertexSource *pVertex)
Mark every homogeneous clip plane outside pVertex, including unordered coordinates.
GbiCommand * HandleGbiFillRectangleIntCoords(GbiCommand *pCommand)
Fill a rectangle given in whole pixels of the console, whose rows run up from the bottom of the scree...
GbiCommand * HandleGbiMoveWord(GbiCommand *pCommand)
Set the number of lights or the colour of a light.
GbiCommand * HandleGbiClearGeometryMode(GbiCommand *pCommand)
Clear bits of the geometry mode.
float g_fGbiPrimColorB
The blue of the primitive colour, from 0 to 1.
void ClipPolygonLeftPlane(GbiClipPolygon *pPolygon)
Clip a polygon against the left plane, where X is at least negative W.
void DrawFlatShadedTriangleDepthScaled(int nVertex0, int nVertex1, int nVertex2)
Draw a triangle of g_aGbiVertexCache in the colour of its first vertex, without the depth buffer.
GbiCommand * HandleGbiSetTexRectDepth(GbiCommand *pCommand)
Set the depth of a texture rectangle.
float g_fGbiPrimColorA
The alpha of the primitive colour, from 0 to 1.
float g_fGbiAmbientColorB
The blue channel of the ambient light.
float g_fViewportTranslateX
The translation of x of the viewport, in pixels.
void HalveGbiTriangleVertexIndices(GbiCommand *pCommand)
Convert the packed indices of a single-triangle command from doubled byte offsets to vertices.
float g_GbiProjectionMatrix[4][4]
The current projection matrix of the display-list interpreter.
GbiVertexSource g_aClipVertexPool[GBI_CLIP_VERTEX_POOL_SIZE]
The temporary vertices used while clipping display-list geometry.
GbiCommand * HandleGbiEndDisplayList(GbiCommand *pCommand)
Return from a display list to the command after its call.
GbiCommand * HandleGbiTextureRectangleNative(GbiCommand *pCommand)
Draw a texture rectangle of the console, which takes three commands, its corners as the console gives...
float g_fTexCoordScaleS
The scale from the s of a vertex to its u.
GbiLight g_aGbiLights[GBI_LIGHT_COUNT]
The lights of the display lists.
void GenerateGbiVertexTextureCoordinatesLinear(const ConvertedModelVertex *pInput, GbiVertexSource *pSource)
Generate texture coordinates with the linear-mode vertical arcsine mapping.
GbiCommand * HandleGbiTri2Smooth(GbiCommand *pCommand)
Draw two triangles with smooth shading, after giving the device the dirty render states.
void HalveGbiTrianglePairVertexIndices(GbiCommand *pCommand)
Convert both packed triangle index triples from doubled byte offsets to vertices.
int g_dwScissorLeft
The left edge of the scissor, in pixels.
float g_fTexCoordScaleT
The scale from the t of a vertex to its v.
void ClipPolygonAndSubmitFlat(GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2, float fRed, float fGreen, float fBlue)
Clip and submit a triangle with one colour for all surviving vertices.
char g_szDebugOverlayText[DEBUG_OVERLAY_TEXT_SIZE]
The text drawn over each frame.
GbiCommand * HandleGbiFillRectangle(GbiCommand *pCommand)
Fill a rectangle given in pixels of the console with two bits of fraction, whose rows run up from the...
GbiCommand * HandleGbiSetRenderMode(GbiCommand *pCommand)
Set the render mode.
unsigned g_dwGbiRenderMode
The render mode of the console the display lists set last.
unsigned char g_bGbiFillColorG
The green of the fill colour.
int g_dwTileSizeUlt
The top edge of the tile, in texels with two bits of fraction.
int g_dwTileSizeWidth
The width of the tile, in whole texels.
int g_dwTileSizeLrt
The bottom edge of the tile, in texels with two bits of fraction.
void ClipPolygonRightPlane(GbiClipPolygon *pPolygon)
Clip a polygon against the right plane, where X is at most W.
GbiCommand * HandleGbiTri2FlatNoZBuffer(GbiCommand *pCommand)
Draw two triangles with flat shading without the depth buffer, after giving the device the dirty rend...
GbiCommand * HandleGbiTri2Flat(GbiCommand *pCommand)
Draw two triangles with flat shading, after giving the device the dirty render states.
float g_fGbiLight0ColorR
The red channel of the first directional light.
float g_fGbiPrimColorR
The red of the primitive colour, from 0 to 1.
void ClipPolygonFarZPlane(GbiClipPolygon *pPolygon)
Clip a polygon against the far plane, where Z is at most W.
#define DEBUG_OVERLAY_TEXT_SIZE
The size of g_szDebugOverlayText, the room before the next datum.
Definition displaylist.h:1249
unsigned g_dwGbiPrevGeometryMode
The geometry mode before the last change.
void ClipPolygonBottomPlane(GbiClipPolygon *pPolygon)
Clip a polygon against the bottom plane, where Y is at least negative W.
GbiCommand * HandleGbiVertexUnlitNoZBuffer(GbiCommand *pCommand)
Load vertices without lighting without the depth buffer.
Light GbiLight
A light of the display lists, in the shared console format.
Definition displaylist.h:483
void ClipAndSubmitTriangle(GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2)
Clip a triangle to the planes of the view and submit what remains.
float g_fGbiLight0ColorB
The blue channel of the first directional light.
GbiCommand * HandleGbiSetEnvColor(GbiCommand *pCommand)
Set the environment colour from the RGBA colour of the command.
float g_GbiMvpMatrix[4][4]
The matrix that takes a vertex of the display lists to the screen.
int g_dwTileSizeLrs
The right edge of the tile, in texels with two bits of fraction.
GbiCommand * HandleGbiSetCombine(GbiCommand *pCommand)
Set the combine mode and choose the routine that submits vertices for it.
float g_fGbiEnvColorR
The red of the environment colour, from 0 to 1.
GbiCommand * HandleGbiVertexLit(GbiCommand *pCommand)
Load vertices with lighting.
DWORD g_dwGbiFrameDeltaTime
The time between the last two frames shown, in milliseconds.
#define GBI_MATRIX_STACK_RESET_DEPTH
The depth g_dwGbiMatrixStackDepth takes when a pop empties it.
Definition displaylist.h:28
GbiCommand * HandleGbiVertexTexGen(GbiCommand *pCommand)
Load vertices that generate their texture coordinates.
GbiVertex g_aGbiVertexCache[GBI_VERTEX_CACHE_SIZE]
The vertices the display lists loaded.
#define GBI_DISPLAY_LIST_STACK_SIZE
The number of entries of g_apGbiDisplayListReturnStack.
Definition displaylist.h:25
void ClipPolygonPositiveWPlane(GbiClipPolygon *pPolygon)
Clip a polygon to vertices with nonnegative homogeneous W.
void ClipPolygonAndSubmitDepthScaled(GbiVertex *pVertex0, GbiVertex *pVertex1, GbiVertex *pVertex2, float fRed, float fGreen, float fBlue)
Clip and submit a triangle with one colour at the fixed far depth.
#define GBI_CLIP_VERTEX_POOL_SIZE
The number of vertices available while clipping display-list geometry.
Definition displaylist.h:858
#define GBI_LIGHT_COUNT
The number of entries of g_aGbiLights.
Definition displaylist.h:486
float g_fTexRectDepth
The depth of a texture rectangle.
#define GBI_VERTEX_CACHE_SIZE
The number of entries of g_aGbiVertexCache and g_apVertexPool.
Definition displaylist.h:855
int g_dwGbiDisplayListStackDepth
The number of entries of g_apGbiDisplayListReturnStack in use.
GbiCommand * HandleGbiVertexTexGenLinear(GbiCommand *pCommand)
Load vertices that generate their texture coordinates linearly.
GbiCommand * HandleGbiVertexUnlit(GbiCommand *pCommand)
Load vertices without lighting.
A model vertex converted into the renderer's working format.
Definition convertedvertex.h:7
A circular list of vertices undergoing homogeneous clipping.
Definition displaylist.h:886
int nCount
Definition displaylist.h:888
GbiVertexSource * pHead
Definition displaylist.h:887
A command of a display list of the game.
Definition gbicommand.h:30
The vertex a command of the display lists loaded.
Definition displaylist.h:695
GbiVertexSource * pNext
Definition displaylist.h:696
float fT
Definition displaylist.h:701
float fBlue
Definition displaylist.h:705
float fRed
Definition displaylist.h:703
float fX
Definition displaylist.h:697
float fY
Definition displaylist.h:698
float fZ
Definition displaylist.h:699
float fS
Definition displaylist.h:700
float fGreen
Definition displaylist.h:704
float fW
Definition displaylist.h:702
A vertex of the display lists after its transform.
Definition displaylist.h:732
int nClipFlags
Definition displaylist.h:734
GrVertex vertex
Definition displaylist.h:733
GbiVertexSource source
Definition displaylist.h:735
A point or direction in space.
Definition vecmath.h:17
A directional light, aligned for the RSP.
Definition gbi.h:33
A texture upload receives numeric command data or a pixel buffer.
Definition textureupload.h:7
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...