Add TexMan.SetCameraTextureAspectRatio
Allows ZScript to change the aspect ratio of a camera texture.
This commit is contained in:
parent
6432e4f6a8
commit
20d16381f8
3 changed files with 27 additions and 0 deletions
|
|
@ -78,6 +78,30 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, SetCameraToTexture, SetCameraToTexture)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SetCameraTextureAspectRatio(const FString &texturename, double aspectScale, bool useTextureRatio)
|
||||
{
|
||||
FTextureID textureid = TexMan.CheckForTexture(texturename, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
|
||||
if (textureid.isValid())
|
||||
{
|
||||
// Only proceed if the texture actually has a canvas.
|
||||
auto tex = TexMan.GetGameTexture(textureid);
|
||||
if (tex && tex->isHardwareCanvas())
|
||||
{
|
||||
static_cast<FCanvasTexture *>(tex->GetTexture())->SetAspectRatio(aspectScale, useTextureRatio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, SetCameraTextureAspectRatio, SetCameraTextureAspectRatio)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(texturename);
|
||||
PARAM_FLOAT(aspect);
|
||||
PARAM_BOOL(useTextureRatio);
|
||||
SetCameraTextureAspectRatio(texturename, aspect, useTextureRatio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
// sector_t exports
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue