- cleaned out the coordinate code in FMaterial.

This commit is contained in:
Christoph Oelckers 2020-04-15 00:48:04 +02:00
commit 31035a6cea
8 changed files with 16 additions and 81 deletions

View file

@ -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();