- cleaned out the coordinate code in FMaterial.
This commit is contained in:
parent
c178313da5
commit
31035a6cea
8 changed files with 16 additions and 81 deletions
|
|
@ -306,7 +306,7 @@ void FGLRenderer::BindToFrameBuffer(FMaterial *mat)
|
|||
FHardwareTexture::Unbind(0);
|
||||
gl_RenderState.ClearLastMaterial();
|
||||
}
|
||||
BaseLayer->BindToFrameBuffer(mat->GetWidth(), mat->GetHeight());
|
||||
BaseLayer->BindToFrameBuffer(mat->Source()->GetTexelWidth(), mat->Source()->GetTexelHeight());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -320,19 +320,18 @@ void FGLRenderer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, doub
|
|||
// This doesn't need to clear the fake flat cache. It can be shared between camera textures and the main view of a scene.
|
||||
FMaterial * gltex = FMaterial::ValidateTexture(tex, false);
|
||||
|
||||
int width = gltex->TextureWidth();
|
||||
int height = gltex->TextureHeight();
|
||||
float ratio = (float)tex->GetDisplayWidthDouble() / (float)tex->GetDisplayHeightDouble();
|
||||
|
||||
StartOffscreen();
|
||||
BindToFrameBuffer(gltex);
|
||||
|
||||
IntRect bounds;
|
||||
bounds.left = bounds.top = 0;
|
||||
bounds.width = FHardwareTexture::GetTexDimension(gltex->GetWidth());
|
||||
bounds.height = FHardwareTexture::GetTexDimension(gltex->GetHeight());
|
||||
bounds.width = FHardwareTexture::GetTexDimension(tex->GetTexelWidth());
|
||||
bounds.height = FHardwareTexture::GetTexDimension(tex->GetTexelHeight());
|
||||
|
||||
FRenderViewpoint texvp;
|
||||
RenderViewpoint(texvp, Viewpoint, &bounds, FOV, (float)width / height, (float)width / height, false, false);
|
||||
RenderViewpoint(texvp, Viewpoint, &bounds, FOV, ratio, ratio, false, false);
|
||||
|
||||
EndOffscreen();
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ void FGLRenderState::Apply()
|
|||
|
||||
void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader)
|
||||
{
|
||||
if (mat->isHardwareCanvas())
|
||||
if (mat->Source()->isHardwareCanvas())
|
||||
{
|
||||
mTempTM = TM_OPAQUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,19 +380,18 @@ void PolyFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint,
|
|||
FMaterial *mat = FMaterial::ValidateTexture(tex, false);
|
||||
auto BaseLayer = static_cast<PolyHardwareTexture*>(mat->GetLayer(0, 0));
|
||||
|
||||
int width = mat->TextureWidth();
|
||||
int height = mat->TextureHeight();
|
||||
float ratio = (float)tex->GetDisplayWidthDouble() / (float)tex->GetDisplayHeightDouble();
|
||||
DCanvas *image = BaseLayer->GetImage(tex, 0, 0);
|
||||
PolyDepthStencil *depthStencil = BaseLayer->GetDepthStencil(tex);
|
||||
mRenderState->SetRenderTarget(image, depthStencil, false);
|
||||
|
||||
IntRect bounds;
|
||||
bounds.left = bounds.top = 0;
|
||||
bounds.width = MIN(mat->GetWidth(), image->GetWidth());
|
||||
bounds.height = MIN(mat->GetHeight(), image->GetHeight());
|
||||
bounds.width = std::min(tex->GetTexelWidth(), image->GetWidth());
|
||||
bounds.height = std::min(tex->GetTexelHeight(), image->GetHeight());
|
||||
|
||||
FRenderViewpoint texvp;
|
||||
RenderViewpoint(texvp, Viewpoint, &bounds, FOV, (float)width / height, (float)width / height, false, false);
|
||||
RenderViewpoint(texvp, Viewpoint, &bounds, FOV, ratio, ratio, false, false);
|
||||
|
||||
FlushDrawCommands();
|
||||
DrawerThreads::WaitForWorkers();
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ void PolyRenderState::ApplyMaterial()
|
|||
{
|
||||
if (mMaterial.mChanged && mMaterial.mMaterial)
|
||||
{
|
||||
mTempTM = mMaterial.mMaterial->isHardwareCanvas() ? TM_OPAQUE : TM_NORMAL;
|
||||
mTempTM = mMaterial.mMaterial->Source()->isHardwareCanvas() ? TM_OPAQUE : TM_NORMAL;
|
||||
|
||||
FTexture* layer;
|
||||
auto base = static_cast<PolyHardwareTexture*>(mMaterial.mMaterial->GetLayer(0, mMaterial.mTranslation, &layer));
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ void VkRenderState::ApplyPushConstants()
|
|||
}
|
||||
|
||||
int tempTM = TM_NORMAL;
|
||||
if (mMaterial.mMaterial && mMaterial.mMaterial->isHardwareCanvas())
|
||||
if (mMaterial.mMaterial && mMaterial.mMaterial->Source()->isHardwareCanvas())
|
||||
tempTM = TM_OPAQUE;
|
||||
|
||||
mPushConstants.uFogEnabled = fogset;
|
||||
|
|
|
|||
|
|
@ -519,8 +519,7 @@ void VulkanFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint
|
|||
FMaterial *mat = FMaterial::ValidateTexture(tex, false);
|
||||
auto BaseLayer = static_cast<VkHardwareTexture*>(mat->GetLayer(0, 0));
|
||||
|
||||
int width = mat->TextureWidth();
|
||||
int height = mat->TextureHeight();
|
||||
float ratio = (float)tex->GetDisplayWidthDouble() / (float)tex->GetDisplayHeightDouble();
|
||||
VkTextureImage *image = BaseLayer->GetImage(tex, 0, 0);
|
||||
VkTextureImage *depthStencil = BaseLayer->GetDepthStencil(tex);
|
||||
|
||||
|
|
@ -534,11 +533,11 @@ void VulkanFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint
|
|||
|
||||
IntRect bounds;
|
||||
bounds.left = bounds.top = 0;
|
||||
bounds.width = MIN(mat->GetWidth(), image->Image->width);
|
||||
bounds.height = MIN(mat->GetHeight(), image->Image->height);
|
||||
bounds.width = std::min(tex->GetTexelWidth(), image->Image->width);
|
||||
bounds.height = std::min(tex->GetTexelHeight(), image->Image->height);
|
||||
|
||||
FRenderViewpoint texvp;
|
||||
RenderViewpoint(texvp, Viewpoint, &bounds, FOV, (float)width / height, (float)width / height, false, false);
|
||||
RenderViewpoint(texvp, Viewpoint, &bounds, FOV, ratio, ratio, false, false);
|
||||
|
||||
mRenderState->EndRenderPass();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue