Classes | |
struct | CachedTexture |
struct | Options |
struct | TextureMetaData |
struct | Vec2 |
struct | Vec3 |
struct | Vec4 |
struct | Vec4_byte |
struct | Vertex |
Public Types | |
enum | TexturePass { PASS_DIFFUSE, PASS_LIGHT, PASS_DETAIL, PASS_FOG, PASS_MACRO, DUMMY_NUM_PASSES } |
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) |
Setup/clear frame | |
static void | newFrame () |
static void | clear () |
static void | clearDepth () |
Prepare and render buffers | |
static void | map (bool clear) |
static void | render () |
static void | present () |
Index and buffer vertices | |
static void | indexTriangleFan (int num) |
static void | indexQuad () |
static D3D::Vertex * | getVertex () |
Set state (projection, flags) | |
static void | setViewPort (int X, int Y, int left, int top) |
static void | setProjectionOnOff (bool on) |
static void | setProjection (float aspect, float XoverZ) |
static void | setFlags (int flags) |
Texture cache | |
static ID3D10Texture2D * | createTexture (D3D10_TEXTURE2D_DESC &desc, D3D10_SUBRESOURCE_DATA &data) |
static void | updateMip (DWORD64 id, int mipNum, D3D10_SUBRESOURCE_DATA &data) |
static void | cacheTexture (DWORD64 id, TextureMetaData &metadata, ID3D10Texture2D *tex) |
static bool | textureIsCached (DWORD64 id) |
static D3D::TextureMetaData & | getTextureMetaData (DWORD64 id) |
static D3D::TextureMetaData * | setTexture (D3D::TexturePass pass, DWORD64 id) |
static void | deleteTexture (DWORD64 id) |
static void | flush () |
Misc | |
static void | flash (bool enable, D3D::Vec4 &color) |
static TCHAR * | getModes () |
static void | getScreenshot (D3D::Vec4_byte *buf) |
static void | setBrightness (float brightness) |
Static Private Member Functions | |
static int | createRenderTargetViews () |
static int | findAALevel () |
static void | commit () |
An effort is made to reduce the amount of needed draw() calls. As such, state is only changed when absolutely necessary.
TODO: Take out d3dx? Different shaders/input layouts for different drawXXXX renderer calls for smaller vertex size?
enum D3D::TexturePass |
List of texture passes that can be bound.
void D3D::clear | ( | ) | [static] |
Clear backbuffer
void D3D::clearDepth | ( | ) | [static] |
Clear depth
void D3D::commit | ( | ) | [static, private] |
Commit buffered polys; i.e. draw and remap. Do this before changing state.
int D3D::createRenderTargetViews | ( | ) | [static, private] |
Create a render target view from the backbuffer and depth stencil buffer.
ID3D10Texture2D * D3D::createTexture | ( | D3D10_TEXTURE2D_DESC & | desc, | |
D3D10_SUBRESOURCE_DATA & | data | |||
) | [static] |
Create a texture from a descriptor and data to fill it with.
desc | Direct3D texture description. | |
data | Data to fill the texture with. |
void D3D::deleteTexture | ( | DWORD64 | id | ) | [static] |
Delete a texture (so it can be overwritten with an updated one).
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 | ( | bool | enable, | |
D3D::Vec4 & | color | |||
) | [static] |
Notify the shader a flash effect should be drawn.
void D3D::flush | ( | ) | [static] |
Clear texture cache.
TCHAR * D3D::getModes | ( | ) | [static] |
Create a string of supported display modes.
Deus Ex only shows 16 resolutions, so for it make it the 16 highest ones.
void D3D::getScreenshot | ( | D3D::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. |
D3D::TextureMetaData & D3D::getTextureMetaData | ( | DWORD64 | id | ) | [static] |
Returns texture metadata.
id | CacheID for texture. |
D3D::Vertex * D3D::getVertex | ( | ) | [static] |
Returns a pointer to the next vertex in the buffer; this can then be set to buffer a model etc.
void D3D::indexQuad | ( | ) | [static] |
Generate index data for a quad. See indexTriangleFan().
void D3D::indexTriangleFan | ( | int | num | ) | [static] |
Generate index data so a triangle fan with 'num' vertices is converted to a triangle list. Should be called BEFORE those vertices are buffered.
num | Number of vertices in the triangle fan. |
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::map | ( | bool | clear | ) | [static] |
Memory map index and vertex buffer for writing.
Clear | Sets whether the buffer is restarted from the beginning; This is done when the buffers are about to overflow, and at the start of a new frame (Microsoft recommendation). |
void D3D::newFrame | ( | ) | [static] |
Set up things for rendering a new frame. For example, update shader time.
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 | ) | [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.
void D3D::setProjection | ( | float | aspect, | |
float | XoverZ | |||
) | [static] |
Set projection matrix parameters.
aspect | The viewport aspect ratio. | |
XoverZ | Ratio between frustum X and Z. Projection parameters are for z=1, so x over z gives x coordinate; and x/z*aspect=y/z=y. |
D3D::TextureMetaData * D3D::setTexture | ( | D3D::TexturePass | pass, | |
DWORD64 | id | |||
) | [static] |
Set the texture for a texture pass (diffuse, lightmap, etc). Texture is only set if it's not already the current one for that pass. Cached polygons (using the previous set of textures) are drawn before the switch is made.
id | CacheID for texture. NULL sets no texture for the pass (by disabling it using a shader constant). |
void D3D::setViewPort | ( | int | X, | |
int | Y, | |||
int | left, | |||
int | top | |||
) | [static] |
Set up the viewport. Also sets height and width in shader.
bool D3D::textureIsCached | ( | DWORD64 | id | ) | [static] |
Returns true if texture is in cache.
id | CacheID for texture. |
void D3D::uninit | ( | ) | [static] |
Cleanup
void D3D::updateMip | ( | DWORD64 | id, | |
int | mipNum, | |||
D3D10_SUBRESOURCE_DATA & | data | |||
) | [static] |
Update a single texture mip using a copy operation.
id | CacheID to insert texture with. | |
mipNum | Mip level to update. | |
data | Data to write to the mip. |