Public Member Functions | |
Abstract in parent class | |
UBOOL | Init (UViewport *InViewport, INT NewX, INT NewY, INT NewColorBytes, UBOOL Fullscreen) |
UBOOL | SetRes (INT NewX, INT NewY, INT NewColorBytes, UBOOL Fullscreen) |
void | Exit () |
void | Flush (UBOOL AllowPrecache) |
void | Lock (FPlane FlashScale, FPlane FlashFog, FPlane ScreenClear, DWORD RenderLockFlags, BYTE *HitData, INT *HitSize) |
void | Unlock (UBOOL Blit) |
void | DrawComplexSurface (FSceneNode *Frame, FSurfaceInfo &Surface, FSurfaceFacet &Facet) |
void | DrawGouraudPolygon (FSceneNode *Frame, FTextureInfo &Info, FTransTexture **Pts, int NumPts, DWORD PolyFlags, FSpanBuffer *Span) |
void | DrawTile (FSceneNode *Frame, FTextureInfo &Info, FLOAT X, FLOAT Y, FLOAT XL, FLOAT YL, FLOAT U, FLOAT V, FLOAT UL, FLOAT VL, class FSpanBuffer *Span, FLOAT Z, FPlane Color, FPlane Fog, DWORD PolyFlags) |
void | Draw2DLine (FSceneNode *Frame, FPlane Color, DWORD LineFlags, FVector P1, FVector P2) |
void | Draw2DPoint (FSceneNode *Frame, FPlane Color, DWORD LineFlags, FLOAT X1, FLOAT Y1, FLOAT X2, FLOAT Y2, FLOAT Z) |
void | ClearZ (FSceneNode *Frame) |
void | PushHit (const BYTE *Data, INT Count) |
void | PopHit (INT Count, UBOOL bForce) |
void | GetStats (TCHAR *Result) |
void | ReadPixels (FColor *Pixels) |
Optional but implemented | |
UBOOL | Exec (const TCHAR *Cmd, FOutputDevice &Ar) |
void | SetSceneNode (FSceneNode *Frame) |
void | PrecacheTexture (FTextureInfo &Info, DWORD PolyFlags) |
void | EndFlash () |
void | StaticConstructor () |
Private Attributes | |
D3D::Options | D3DOptions |
struct { | |
int precache | |
int autoFOV | |
int FPSLimit | |
int unlimitedViewDistance | |
} | options |
Helpers | |
| |
static void | debugs (char *s) |
int | getOption (TCHAR *name, int defaultVal, bool isBool) |
This is the interface between the game and the graphics API. For the D3D10 renderer, an effort was made to have it not work directly with D3D types and objects; it is purely concerned with answering the game and putting data in correct structures for further processing. This leaves this class relatively clean and easy to understand, and should make it a good basis for further work. It contains only the bare essential functions to implement the renderer interface. There are two exceptions: UD3D10RenderDevice::debugs() and UD3D10RenderDevice::getOption are helpers not required by the game.
Called UD3D10RenderDevice as Unreal leaves out first letter when accessing the class; now it can be accessed as D3D10RenderDevice.
void UD3D10RenderDevice::ClearZ | ( | FSceneNode * | Frame | ) |
Clear the depth buffer. Used to draw the skybox behind the rest of the geometry, and weapon in front.
void UD3D10RenderDevice::debugs | ( | char * | s | ) | [static] |
Prints text to the game's log and the standard output if in debug mode.
s | A the message to print. |
void UD3D10RenderDevice::Draw2DLine | ( | FSceneNode * | Frame, | |
FPlane | Color, | |||
DWORD | LineFlags, | |||
FVector | P1, | |||
FVector | P2 | |||
) |
For UnrealED.
void UD3D10RenderDevice::Draw2DPoint | ( | FSceneNode * | Frame, | |
FPlane | Color, | |||
DWORD | LineFlags, | |||
FLOAT | X1, | |||
FLOAT | Y1, | |||
FLOAT | X2, | |||
FLOAT | Y2, | |||
FLOAT | Z | |||
) |
For UnrealED.
void UD3D10RenderDevice::DrawComplexSurface | ( | FSceneNode * | Frame, | |
FSurfaceInfo & | Surface, | |||
FSurfaceFacet & | Facet | |||
) |
Complex surfaces are used for map geometry. They consists of facets which in turn consist of polys (triangle fans).
Frame | The scene. See SetSceneNode(). | |
Surface | Holds information on the various texture passes and the surface's PolyFlags.
| |
Facet | Contains coordinates and polygons.
|
void UD3D10RenderDevice::DrawGouraudPolygon | ( | FSceneNode * | Frame, | |
FTextureInfo & | Info, | |||
FTransTexture ** | Pts, | |||
int | NumPts, | |||
DWORD | PolyFlags, | |||
FSpanBuffer * | Span | |||
) |
Gouraud shaded polygons are used for 3D models and surprisingly decals and shadows. They are sent with a call of this function per triangle fan, worldview transformed and lit. They do have normals and texture coordinates (no panning).
Frame | The scene. See SetSceneNode(). | |
Info | The texture for the model. Models only come with diffuse textures. | |
Pts | A triangle fan stored as an array. Each element has a normal, light (i.e. color) and fog (color due to being in fog). | |
NumPts | Number of verts in fan. | |
PolyFlags | Contains the correct flags for this model. See polyflags.h | |
Span | Probably for software renderers. |
void UD3D10RenderDevice::DrawTile | ( | FSceneNode * | Frame, | |
FTextureInfo & | Info, | |||
FLOAT | X, | |||
FLOAT | Y, | |||
FLOAT | XL, | |||
FLOAT | YL, | |||
FLOAT | U, | |||
FLOAT | V, | |||
FLOAT | UL, | |||
FLOAT | VL, | |||
class FSpanBuffer * | Span, | |||
FLOAT | Z, | |||
FPlane | Color, | |||
FPlane | Fog, | |||
DWORD | PolyFlags | |||
) |
Used for 2D UI elements, smoke.
Frame | The scene. See SetSceneNode(). | |
Info | The texture for the quad. | |
X | X coord in screen space. | |
Y | Y coord in screen space. | |
XL | Width in pixels | |
YL | Height in pixels | |
U | Texure U coordinate for left. | |
V | Texture V coordinate for top. | |
UL | U+UL is coordinate for right. | |
VL | V+VL is coordinate for bottom. | |
Span | Probably for software renderers. | |
Z | coordinate (similar to that of other primitives). | |
Color | color | |
Fog | fog (unused) | |
PolyFlags | Contains the correct flags for this tile. See polyflags.h |
void UD3D10RenderDevice::EndFlash | ( | ) |
Other renderers handle flashes here by saving the related structures; this one does it in Lock().
Seems this is called before HUD elements are drawn so the flash doesn't overlay them.
Postprocess scene and then draw HUD to buffer used in last pass so it doesn't get postprocessed
UBOOL UD3D10RenderDevice::Exec | ( | const TCHAR * | Cmd, | |
FOutputDevice & | Ar | |||
) |
Various command from the game. Can be used to intercept input. First let the parent class handle the command.
Cmd | The command
| |
Ar | A class to which to log responses using Ar.Log(). |
void UD3D10RenderDevice::Exit | ( | ) |
Cleanup.
void UD3D10RenderDevice::Flush | ( | UBOOL | AllowPrecache | ) |
Empty texture cache.
AllowPrecache | Enabled if the game allows us to precache; respond by setting URenderDevice::PrecacheOnFlip = 1 if wanted. This does make load times longer. |
int UD3D10RenderDevice::getOption | ( | TCHAR * | name, | |
int | defaultVal, | |||
bool | isBool | |||
) |
Attempts to read a property from the game's config file; on failure, a default is written (so it can be changed by the user) and returned.
name | A string identifying the config file options. | |
defaultVal | The default value to write and return if the option is not found. | |
isBool | Whether the parameter's a boolean or integer |
void UD3D10RenderDevice::GetStats | ( | TCHAR * | Result | ) |
Something to do with FPS counters etc, not needed.
UBOOL UD3D10RenderDevice::Init | ( | UViewport * | InViewport, | |
INT | NewX, | |||
INT | NewY, | |||
INT | NewColorBytes, | |||
UBOOL | Fullscreen | |||
) |
Initialization of renderer.
InViewport | viewport parameters, can get the window handle. | |
NewX | Viewport width. | |
NewY | Viewport height. | |
NewColorBytes | Color depth. | |
Fullscreen | Whether fullscreen mode should be used. |
void UD3D10RenderDevice::Lock | ( | FPlane | FlashScale, | |
FPlane | FlashFog, | |||
FPlane | ScreenClear, | |||
DWORD | RenderLockFlags, | |||
BYTE * | InHitData, | |||
INT * | InHitSize | |||
) |
Clear screen and depth buffer, prepare buffers to receive data.
FlashScale | To do with flash effects, see notes. | |
FlashFog | To do with flash effects, see notes. | |
ScreenClear | The color with which to clear the screen. Used for Rune fog. | |
RenderLockFlags | Signify whether the screen should be cleared. Depth buffer should always be cleared. | |
InHitData | Something to do with clipping planes; safe to ignore. | |
InHitSize | Something to do with clipping planes; safe to ignore. |
void UD3D10RenderDevice::PopHit | ( | INT | Count, | |
UBOOL | bForce | |||
) |
Something to do with clipping planes, not needed.
void UD3D10RenderDevice::PrecacheTexture | ( | FTextureInfo & | Info, | |
DWORD | PolyFlags | |||
) |
Store a texture in the renderer-kept texture cache. Only called by the game if URenderDevice::PrecacheOnFlip is 1.
Info | Texture (meta)data. Includes a CacheID with which to index. | |
PolyFlags | Contains the correct flags for this texture. See polyflags.h |
void UD3D10RenderDevice::PushHit | ( | const BYTE * | Data, | |
INT | Count | |||
) |
Something to do with clipping planes, not needed.
void UD3D10RenderDevice::ReadPixels | ( | FColor * | Pixels | ) |
Used for screenshots and savegame previews.
Pixels | An array of 32 bit pixels in which to dump the back buffer. |
UBOOL UD3D10RenderDevice::SetRes | ( | INT | NewX, | |
INT | NewY, | |||
INT | NewColorBytes, | |||
UBOOL | Fullscreen | |||
) |
Resize buffers and viewport.
void UD3D10RenderDevice::SetSceneNode | ( | FSceneNode * | Frame | ) |
This optional function can be used to set the frustum and viewport parameters per scene change instead of per drawXXXX() call.
Frame | Contains various information with which to build frustum and viewport. |
void UD3D10RenderDevice::StaticConstructor | ( | ) |
Constructor called by the game when the renderer is first created.
void UD3D10RenderDevice::Unlock | ( | UBOOL | Blit | ) |
Finish rendering. /param Blit Whether the front and back buffers should be swapped.
Turn on auto field of view setting
60FPS frame limiter
struct { ... } UD3D10RenderDevice::options [private] |
User configurable options
Turn on precaching
Set frustum to max map size