D3D Scissor fix and Scroll events

This commit is contained in:
Jack Andersen 2015-12-30 20:34:26 -10:00
parent 1c53398b75
commit 53ad4df63d
4 changed files with 34 additions and 5 deletions

View File

@ -435,7 +435,7 @@ class D3D11ShaderPipeline : public IShaderPipeline
CD3D11_RASTERIZER_DESC rasDesc(D3D11_FILL_SOLID, backfaceCulling ? D3D11_CULL_BACK : D3D11_CULL_NONE, true,
D3D11_DEFAULT_DEPTH_BIAS, D3D11_DEFAULT_DEPTH_BIAS_CLAMP, D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS,
true, false, false, false);
true, true, false, false);
ThrowIfFailed(ctx->m_dev->CreateRasterizerState(&rasDesc, &m_rasState));
CD3D11_DEPTH_STENCIL_DESC dsDesc(D3D11_DEFAULT);
@ -783,8 +783,12 @@ struct D3D11CommandQueue : IGraphicsCommandQueue
void setScissor(const SWindowRect& rect)
{
D3D11_RECT d3drect = {rect.location[0], rect.location[1], rect.size[0], rect.size[1]};
m_deferredCtx->RSSetScissorRects(1, &d3drect);
if (m_boundTarget)
{
D3D11_RECT d3drect = {LONG(rect.location[0]), LONG(m_boundTarget->m_height - rect.location[1] - rect.size[1]),
LONG(rect.location[0] + rect.size[0]), LONG(m_boundTarget->m_height - rect.location[1])};
m_deferredCtx->RSSetScissorRects(1, &d3drect);
}
}
std::unordered_map<D3D11TextureR*, std::pair<size_t, size_t>> m_texResizes;

View File

@ -1047,8 +1047,12 @@ struct D3D12CommandQueue : IGraphicsCommandQueue
void setScissor(const SWindowRect& rect)
{
D3D12_RECT d3drect = {rect.location[0], rect.location[1], rect.size[0], rect.size[1]};
m_cmdList->RSSetScissorRects(1, &d3drect);
if (m_boundTarget)
{
D3D12_RECT d3drect = {LONG(rect.location[0]), LONG(m_boundTarget->m_height - rect.location[1] - rect.size[1]),
LONG(rect.location[0] + rect.size[0]), LONG(m_boundTarget->m_height - rect.location[1])};
m_cmdList->RSSetScissorRects(1, &d3drect);
}
}
std::unordered_map<D3D12TextureR*, std::pair<size_t, size_t>> m_texResizes;

View File

@ -267,6 +267,7 @@ public:
case WM_NCMOUSELEAVE:
case WM_MOUSEHOVER:
case WM_NCMOUSEHOVER:
case WM_MOUSEWHEEL:
case WM_CHAR:
case WM_UNICHAR:
window->_incomingEvent(&HWNDEvent(uMsg, wParam, lParam));

View File

@ -1170,6 +1170,26 @@ public:
}
return;
}
case WM_MOUSEWHEEL:
{
if (m_callback)
{
int x, y, w, h;
getWindowFrame(x, y, w, h);
SWindowCoord coord =
{
{ GET_X_LPARAM(e.lParam), h-GET_Y_LPARAM(e.lParam) },
{ GET_X_LPARAM(e.lParam), h-GET_Y_LPARAM(e.lParam) },
{ float(GET_X_LPARAM(e.lParam)) / float(w), float(h-GET_Y_LPARAM(e.lParam)) / float(h) }
};
SScrollDelta scroll =
{
{ 0, GET_WHEEL_DELTA_WPARAM(e.wParam) / double(WHEEL_DELTA) }, false
};
m_callback->scroll(coord, scroll);
}
return;
}
case WM_CHAR:
case WM_UNICHAR:
{