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 Shader * | getShader (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 () |
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.
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.
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.
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.
buf | Array in which the data will be written. |
int D3D::init | ( | HWND | _hWnd, | |
D3D::Options & | createOptions | |||
) | [static] |
Create Direct3D device, swapchain, etc. Purely boilerplate stuff.
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.
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.
void D3D::setBrightness | ( | float | brightness | ) | [static] |
Sets the in-shader brightness.
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.
flags | Unreal polyflags. | |
d3dflags | Custom flags defined in d3d.h. |
void D3D::setViewPort | ( | int | X, | |
int | Y, | |||
int | left, | |||
int | top | |||
) | [static] |
Set up the viewport. Also sets height and width in shader.
void D3D::switchToShader | ( | int | index | ) | [static] |
Set up render targets, textures, etc. for the chosen shader.
index | The number of the shader. -1 for no shader. |
void D3D::uninit | ( | ) | [static] |
Cleanup