本文整理汇总了C++中UTexture2D::SetForceMipLevelsToBeResident方法的典型用法代码示例。如果您正苦于以下问题:C++ UTexture2D::SetForceMipLevelsToBeResident方法的具体用法?C++ UTexture2D::SetForceMipLevelsToBeResident怎么用?C++ UTexture2D::SetForceMipLevelsToBeResident使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTexture2D
的用法示例。
在下文中一共展示了UTexture2D::SetForceMipLevelsToBeResident方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void FPaperExtractSpritesViewportClient::Draw(FViewport* Viewport, FCanvas* Canvas)
{
// Super will clear the viewport
FPaperEditorViewportClient::Draw(Viewport, Canvas);
UTexture2D* Texture = TextureBeingExtracted.Get();
if (Texture != nullptr)
{
const bool bUseTranslucentBlend = Texture->HasAlphaChannel();
// Fully stream in the texture before drawing it.
Texture->SetForceMipLevelsToBeResident(30.0f);
Texture->WaitForStreaming();
FLinearColor TextureDrawColor = Settings->TextureTint;
//FLinearColor RectOutlineColor = FLinearColor::Yellow;
const FLinearColor RectOutlineColor = Settings->OutlineColor;
const float XPos = -ZoomPos.X * ZoomAmount;
const float YPos = -ZoomPos.Y * ZoomAmount;
const float Width = Texture->GetSurfaceWidth() * ZoomAmount;
const float Height = Texture->GetSurfaceHeight() * ZoomAmount;
Canvas->DrawTile(XPos, YPos, Width, Height, 0.0f, 0.0f, 1.0f, 1.0f, TextureDrawColor, Texture->Resource, bUseTranslucentBlend);
for (FPaperExtractedSprite Sprite : ExtractedSprites)
{
DrawRectangle(Canvas, RectOutlineColor, Sprite.Rect);
}
}
}
示例2: SetForceMipLevelsToBeResident
void UMaterialInterface::SetForceMipLevelsToBeResident( bool OverrideForceMiplevelsToBeResident, bool bForceMiplevelsToBeResidentValue, float ForceDuration, int32 CinematicTextureGroups )
{
TArray<UTexture*> Textures;
GetUsedTextures(Textures, EMaterialQualityLevel::Num, false, ERHIFeatureLevel::Num, true);
for ( int32 TextureIndex=0; TextureIndex < Textures.Num(); ++TextureIndex )
{
UTexture2D* Texture = Cast<UTexture2D>(Textures[TextureIndex]);
if ( Texture )
{
Texture->SetForceMipLevelsToBeResident( ForceDuration, CinematicTextureGroups );
if (OverrideForceMiplevelsToBeResident)
{
Texture->bForceMiplevelsToBeResident = bForceMiplevelsToBeResidentValue;
}
}
}
}