Open JeremyAnsel opened 2 years ago
Hello, Here is a suggestion about the reported scissor bug.
In D3dRenderer.h, I suggest to add D3D11_RECT scissor; to the DrawCommand struct.
D3dRenderer.h
D3D11_RECT scissor;
DrawCommand
In D3dRenderer.h, I suggest to add void GetScissorRect(D3D11_RECT* scissor); to the D3dRenderer class.
void GetScissorRect(D3D11_RECT* scissor);
D3dRenderer
In XwaD3dRendererHook.cpp, I suggest to add this function:
XwaD3dRendererHook.cpp
void D3dRenderer::GetScissorRect(D3D11_RECT* scissor) { unsigned short scissorLeft = *(unsigned short*)0x07D5244; unsigned short scissorTop = *(unsigned short*)0x07CA354; unsigned short scissorWidth = *(unsigned short*)0x08052B8; unsigned short scissorHeight = *(unsigned short*)0x07B33BC; float scaleX = _viewport.Width / _deviceResources->_displayWidth; float scaleY = _viewport.Height / _deviceResources->_displayHeight; // The scissor is in screen coordinates. scissor->left = (LONG)(_viewport.TopLeftX + scissorLeft * scaleX + 0.5f); scissor->top = (LONG)(_viewport.TopLeftY + scissorTop * scaleY + 0.5f); scissor->right = scissor->left + (LONG)(scissorWidth * scaleX + 0.5f); scissor->bottom = scissor->top + (LONG)(scissorHeight * scaleY + 0.5f);}
In EffectsRenderer.cpp, I suggest to add GetScissorRect(&command.scissor); before _LaserDrawCommands.push_back(command);.
EffectsRenderer.cpp
GetScissorRect(&command.scissor);
_LaserDrawCommands.push_back(command);
In EffectsRenderer.cpp, I suggest to add GetScissorRect(&command.scissor); before _TransparentDrawCommands.push_back(command);.
_TransparentDrawCommands.push_back(command);
In EffectsRenderer.cpp, I suggest to add GetScissorRect(&command.scissor); before _ShadowMapDrawCommands.push_back(command);.
_ShadowMapDrawCommands.push_back(command);
In EffectsRenderer.cpp, I suggest to add that in the RenderLasers method before RenderScene();:
RenderLasers
RenderScene();
_deviceResources->InitScissorRect(&command.scissor);
In EffectsRenderer.cpp, I suggest to add that in the RenderTransparency method before RenderScene();:
RenderTransparency
In EffectsRenderer.cpp, I suggest to add that in the RenderHangarShadowMap method before context->DrawIndexed(_trianglesCount * 3, 0, 0);:
RenderHangarShadowMap
context->DrawIndexed(_trianglesCount * 3, 0, 0);
In EffectsRenderer.cpp, I suggest to add that in the MainSceneHook method before RenderScene();:
MainSceneHook
D3D11_RECT scissor{}; GetScissorRect(&scissor); _deviceResources->InitScissorRect(&scissor);
In EffectsRenderer.cpp, I suggest to remove these lines in the RenderScene method:
RenderScene
unsigned short scissorLeft = *(unsigned short*)0x07D5244; unsigned short scissorTop = *(unsigned short*)0x07CA354; unsigned short scissorWidth = *(unsigned short*)0x08052B8; unsigned short scissorHeight = *(unsigned short*)0x07B33BC; float scaleX = _viewport.Width / _deviceResources->_displayWidth; float scaleY = _viewport.Height / _deviceResources->_displayHeight; D3D11_RECT scissor{}; // The scissor is in screen coordinates. scissor.left = (LONG)(_viewport.TopLeftX + scissorLeft * scaleX + 0.5f); scissor.top = (LONG)(_viewport.TopLeftY + scissorTop * scaleY + 0.5f); scissor.right = scissor.left + (LONG)(scissorWidth * scaleX + 0.5f); scissor.bottom = scissor.top + (LONG)(scissorHeight * scaleY + 0.5f); _deviceResources->InitScissorRect(&scissor);
Hello, Here is a suggestion about the reported scissor bug.
In
D3dRenderer.h
, I suggest to addD3D11_RECT scissor;
to theDrawCommand
struct.In
D3dRenderer.h
, I suggest to addvoid GetScissorRect(D3D11_RECT* scissor);
to theD3dRenderer
class.In
XwaD3dRendererHook.cpp
, I suggest to add this function:In
EffectsRenderer.cpp
, I suggest to addGetScissorRect(&command.scissor);
before_LaserDrawCommands.push_back(command);
.In
EffectsRenderer.cpp
, I suggest to addGetScissorRect(&command.scissor);
before_TransparentDrawCommands.push_back(command);
.In
EffectsRenderer.cpp
, I suggest to addGetScissorRect(&command.scissor);
before_ShadowMapDrawCommands.push_back(command);
.In
EffectsRenderer.cpp
, I suggest to add that in theRenderLasers
method beforeRenderScene();
:In
EffectsRenderer.cpp
, I suggest to add that in theRenderTransparency
method beforeRenderScene();
:In
EffectsRenderer.cpp
, I suggest to add that in theRenderHangarShadowMap
method beforecontext->DrawIndexed(_trianglesCount * 3, 0, 0);
:In
EffectsRenderer.cpp
, I suggest to add that in theMainSceneHook
method beforeRenderScene();
:In
EffectsRenderer.cpp
, I suggest to remove these lines in theRenderScene
method: