screenprojection helper in device

This commit is contained in:
turanszkij
2016-09-16 00:56:03 +02:00
parent d5b1b13607
commit f9da039e14
5 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -304,7 +304,7 @@ void wiFont::Draw(GRAPHICSTHREAD threadID, bool scissorTest){
ConstantBuffer cb;
cb.mTransform = XMMatrixTranspose(
XMMatrixTranslation(newProps.posX, newProps.posY, 0)
* XMMatrixOrthographicOffCenterLH(0, (float)device->GetScreenWidth(), (float)device->GetScreenHeight(), 0, -1, 1)
* device->GetScreenProjection()
);
device->UpdateBuffer(constantBuffer,&cb,threadID);
+5
View File
@@ -68,6 +68,11 @@ namespace wiGraphicsTypes
};
virtual bool CheckCapability(GRAPHICSDEVICE_CAPABILITY capability) = 0;
XMMATRIX GetScreenProjection()
{
return XMMatrixOrthographicOffCenterLH(0, (float)GetScreenWidth(), (float)GetScreenHeight(), 0, -1, 1);
}
///////////////Thread-sensitive////////////////////////
virtual void BindViewports(UINT NumViewports, const ViewPort *pViewports, GRAPHICSTHREAD threadID = GRAPHICSTHREAD_IMMEDIATE) = 0;
+1 -1
View File
@@ -280,7 +280,7 @@ void wiImage::Draw(Texture2D* texture, const wiImageEffects& effects,GRAPHICSTHR
XMMatrixScaling(effects.scale.x*effects.siz.x, effects.scale.y*effects.siz.y, 1)
* XMMatrixRotationZ(effects.rotation)
* XMMatrixTranslation(effects.pos.x, effects.pos.y, 0)
* XMMatrixOrthographicOffCenterLH(0, (float)device->GetScreenWidth(), (float)device->GetScreenHeight(), 0, -1, 1)
* device->GetScreenProjection()
);
}
else if(effects.typeFlag==WORLD){
+1 -1
View File
@@ -7,7 +7,7 @@ namespace wiVersion
// minor features, major bug fixes
const int minor = 8;
// minor bug fixes, alterations, refactors
const int revision = 48;
const int revision = 49;
long GetVersion()
+1 -1
View File
@@ -1116,7 +1116,7 @@ void wiColorPicker::Render(wiGUI* gui)
}
XMMATRIX __cam = XMMatrixOrthographicOffCenterLH(0, (float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight(), 0, -1, 1);
XMMATRIX __cam = wiRenderer::GetDevice()->GetScreenProjection();
wiRenderer::GetDevice()->BindConstantBufferVS(wiRenderer::constantBuffers[CBTYPE_MISC], CBSLOT_RENDERER_MISC, threadID);
wiRenderer::GetDevice()->BindRasterizerState(wiRenderer::rasterizers[RSTYPE_DOUBLESIDED], threadID);