D3D Class Reference

List of all members.

Classes

struct  Options

Public Types

enum  ShaderName {
  SHADER_TILE, SHADER_GOURAUDPOLYGON, SHADER_COMPLEXSURFACE, SHADER_FOGSURFACE,
  SHADER_FIRSTPASS, SHADER_HDR, SHADER_FINALPASS, DUMMY_NUM_SHADERS
}

Static Public Member Functions

API initialization/upkeep

static int init (HWND hwnd, D3D::Options &createOptions)
static void uninit ()
static int resize (int X, int Y, bool fullScreen)
static ID3D10Device * getDevice ()
static DXGI_FORMAT getDrawPassFormat ()
Setup/clear frame

static void newFrame (float time)
Prepare and render buffers

static void render ()
static void postprocess ()
static void present ()
Set state (projection, flags)

static void switchToShader (int index)
static ShadergetShader (int index)
static void setViewPort (int X, int Y, int left, int top)
static void setFlags (int flags, int d3dflags)
Misc

static void flash (Vec4 &color)
static TCHAR * getModes ()
static void getScreenshot (Vec4_byte *buf)
static void setBrightness (float brightness)

Static Private Member Functions

static int createRenderTargetViews ()
static int findAALevel ()
static bool initShaders ()

Detailed Description

Main Direct3D functionality; self-contained, does not call external functions apart from the debug output one. Does not use Unreal data apart from a couple of PolyFlags. Does not require the renderer interface to deal with Direct3D structures. Quite a lot of code, but splitting this up does not really seem worth it.

An effort is made to reduce the amount of needed draw() calls. As such, state is only changed when absolutely necessary.


Member Function Documentation

int D3D::createRenderTargetViews (  )  [static, private]

Create a render target view from the backbuffer and depth stencil buffer.

int D3D::findAALevel (  )  [static, private]

Find the maximum level of MSAA supported by the device and clamp the options.MSAA setting to this.

Returns:
1 if succesful.
void D3D::flash ( Vec4 color  )  [static]

Notify the shader a flash effect should be drawn.

DXGI_FORMAT D3D::getDrawPassFormat (  )  [static]

Get the format to use to draw geometry, HDR passes

TCHAR * D3D::getModes (  )  [static]

Create a string of supported display modes.

Returns:
String of modes. Caller must delete[] this.
Note:
No error checking.
Deus Ex and Unreal (non-Gold) only show 16 resolutions, so for it make it the 16 highest ones. Also for Unreal Gold for compatibity with v226.
void D3D::getScreenshot ( Vec4_byte buf  )  [static]

Return screen data by copying the back buffer to a staging resource and copying this into an array.

Parameters:
buf Array in which the data will be written.
Note:
No error checking.
int D3D::init ( HWND  _hWnd,
D3D::Options createOptions 
) [static]

Create Direct3D device, swapchain, etc. Purely boilerplate stuff.

Parameters:
hWnd Window to use as a surface.
createOptions the D3D::Options which to use.
void D3D::newFrame ( float  time  )  [static]

Set up things for rendering a new frame. For example, update shader time.

Parameters:
time Time since last frame in seconds
void D3D::present (  )  [static]

Flip

void D3D::render (  )  [static]

Draw current buffer contents.

int D3D::resize ( int  X,
int  Y,
bool  fullScreen 
) [static]

Set resolution and windowed/fullscreen.

Note:
DX10 is volatile; the order in which the steps are taken is critical.
void D3D::setBrightness ( float  brightness  )  [static]

Sets the in-shader brightness.

Parameters:
brightness Brightness 0-1.
void D3D::setFlags ( int  flags,
int  D3DFlags 
) [static]

Handle flags that change depth or blend state. See polyflags.h. Only done if flag is different from current. If there's any buffered geometry, it will drawn before setting the new flags.

Parameters:
flags Unreal polyflags.
d3dflags Custom flags defined in d3d.h.
Note:
Bottleneck; make sure buffers are only rendered due to flag changes when absolutely necessary
Deus Ex requires other different precedence rules for holoconvos with glasses-wearing characters to look good.
void D3D::setViewPort ( int  X,
int  Y,
int  left,
int  top 
) [static]

Set up the viewport. Also sets height and width in shader.

Note:
Buffered polys must be committed first, otherwise glitches will occur (for example, Deus Ex security cams).
void D3D::switchToShader ( int  index  )  [static]

Set up render targets, textures, etc. for the chosen shader.

Parameters:
index The number of the shader. -1 for no shader.
Note:
Current buffer contents will be drawn unless switch is to -1. Use this to prevent static buffers from being redrawn on switch.
void D3D::uninit (  )  [static]

Cleanup


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2