当前位置: 首页>>代码示例>>C++>>正文


C++ FIntRect::Area方法代码示例

本文整理汇总了C++中FIntRect::Area方法的典型用法代码示例。如果您正苦于以下问题:C++ FIntRect::Area方法的具体用法?C++ FIntRect::Area怎么用?C++ FIntRect::Area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FIntRect的用法示例。


在下文中一共展示了FIntRect::Area方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateTextureRaw

void FSlateOpenGLTexture::UpdateTextureRaw(const void* Buffer, const FIntRect& Dirty)
{
	// Ensure texturing is enabled before setting texture properties
#if USE_DEPRECATED_OPENGL_FUNCTIONALITY
	glEnable(GL_TEXTURE_2D);
#endif // USE_DEPRECATED_OPENGL_FUNCTIONALITY
	glBindTexture(GL_TEXTURE_2D, ShaderResource);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
#if USE_DEPRECATED_OPENGL_FUNCTIONALITY
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
#endif // USE_DEPRECATED_OPENGL_FUNCTIONALITY
	
	// Upload the texture data
#if !PLATFORM_USES_ES2

	if (bHasPendingResize || Dirty.Area() == 0)
	{
		glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, SizeX, SizeY, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, Buffer);
		bHasPendingResize = false;
	}
	else
	{
		glPixelStorei(GL_UNPACK_ROW_LENGTH, SizeX);
		glTexSubImage2D(GL_TEXTURE_2D, 0, Dirty.Min.X, Dirty.Min.Y, Dirty.Width(), Dirty.Height(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, (uint8*)Buffer + Dirty.Min.Y * SizeX * 4 + Dirty.Min.X * 4);
		glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
	}
#else
	glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8_EXT, SizeX, SizeY, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, Buffer);
#endif
	CHECK_GL_ERRORS;
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:33,代码来源:SlateOpenGLTextures.cpp

示例2: DisplaySubtitles

/**
 * Display the currently queued subtitles and cleanup after they have finished rendering
 *
 * @param  Canvas - where to render the subtitles
 * @param  CurrentTime - current world time
 */
void FSubtitleManager::DisplaySubtitles( FCanvas* InCanvas, FIntRect& InSubtitleRegion, float InAudioTimeSeconds )
{
	check( GEngine );
	check( InCanvas );

	if( !GEngine->GetSubtitleFont() )
	{
		UE_LOG(LogSubtitle, Warning, TEXT( "NULL GEngine->GetSubtitleFont() - subtitles not rendering!" ) );
		return;
	}
	
	if (InSubtitleRegion.Area() > 0)
	{
		// Work out the safe zones
		TrimRegionToSafeZone( InCanvas, InSubtitleRegion );

		// If the lines have not already been split, split them to the safe zone now
		SplitLinesToSafeZone( InCanvas, InSubtitleRegion );

		// Find the subtitle to display
		PTRINT HighestPriorityID = FindHighestPrioritySubtitle( InAudioTimeSeconds );

		// Display the highest priority subtitle
		if( HighestPriorityID )
		{
			FActiveSubtitle* Subtitle = ActiveSubtitles.Find( HighestPriorityID );
			DisplaySubtitle( InCanvas, Subtitle, InSubtitleRegion, FLinearColor::White );
		}
		else
		{
			CurrentSubtitleHeight = 0.0f;
		}
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:40,代码来源:SubtitleManager.cpp

示例3:

void FSlateD3DTexture::UpdateTextureRaw(const void* Buffer, const FIntRect& Dirty)
{
	bool bUseStagingTexture = StagingTexture.IsValid();
	ID3D11Texture2D* TextureToUpdate = bUseStagingTexture ? StagingTexture : D3DTexture;

	D3D11_BOX Region;
	Region.front = 0;
	Region.back = 1;
	if (bUseStagingTexture && Dirty.Area() > 0)
	{
		Region.left = Dirty.Min.X;
		Region.top = Dirty.Min.Y;
		Region.right = Dirty.Max.X;
		Region.bottom = Dirty.Max.Y;
	}
	else
	{
		Region.left = 0;
		Region.right = SizeX;
		Region.top = 0;
		Region.bottom = SizeY;
	}

	D3D11_MAPPED_SUBRESOURCE Resource;
	HRESULT Hr = GD3DDeviceContext->Map(TextureToUpdate, 0, bUseStagingTexture?D3D11_MAP_READ_WRITE:D3D11_MAP_WRITE_DISCARD, 0, &Resource);
	uint32 SourcePitch = SizeX * BytesPerPixel;
	uint32 CopyRowBytes = (Region.right - Region.left) * BytesPerPixel;
	uint8* Destination = (uint8*)Resource.pData + Region.left * BytesPerPixel + Region.top * Resource.RowPitch;
	uint8* Source = (uint8*)Buffer + Region.left * BytesPerPixel + Region.top * SourcePitch;
	for (uint32 Row = Region.top; Row < Region.bottom; ++Row, Destination += Resource.RowPitch, Source += SourcePitch)
	{
		FMemory::Memcpy(Destination, Source, CopyRowBytes);
	}
	GD3DDeviceContext->Unmap(TextureToUpdate, 0);
	if (bUseStagingTexture)
	{
		GD3DDeviceContext->CopySubresourceRegion(D3DTexture, 0, Region.left, Region.top, Region.front, StagingTexture, 0, &Region);
	}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:39,代码来源:SlateD3DTextures.cpp

示例4: InternalClearMRT

void FVulkanCommandListContext::InternalClearMRT(FVulkanCmdBuffer* CmdBuffer, bool bClearColor, int32 NumClearColors, const FLinearColor* ClearColorArray, bool bClearDepth, float Depth, bool bClearStencil, uint32 Stencil, FIntRect ExcludeRect)
{
#if VULKAN_USE_NEW_RENDERPASSES
	const VkExtent2D& Extents = RenderPassState.CurrentRenderPass->GetLayout().GetExtent2D();
	if (ExcludeRect.Min.X == 0 && ExcludeRect.Width() == Extents.width && ExcludeRect.Min.Y == 0 && Extents.height)
	{
		//if (ForceFullScreen == EForceFullScreenClear::EDoNotForce)
		{
			return;
		}
		//else
		{
			//ensureMsgf(false, TEXT("Forced Full Screen Clear ignoring Exclude Rect Restriction"));
		}
	}

	ensure(ExcludeRect.Area() == 0);

	if (RenderPassState.CurrentRenderPass)
	{
		VkClearRect Rect;
		FMemory::Memzero(Rect);
		Rect.rect.offset.x = 0;
		Rect.rect.offset.y = 0;
		Rect.rect.extent = Extents;

		VkClearAttachment Attachments[MaxSimultaneousRenderTargets + 1];
		FMemory::Memzero(Attachments);

		uint32 NumAttachments = NumClearColors;
		if (bClearColor)
		{
			for (int32 i = 0; i < NumClearColors; ++i)
			{
				Attachments[i].aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
				Attachments[i].colorAttachment = i;
				Attachments[i].clearValue.color.float32[0] = ClearColorArray[i].R;
				Attachments[i].clearValue.color.float32[1] = ClearColorArray[i].G;
				Attachments[i].clearValue.color.float32[2] = ClearColorArray[i].B;
				Attachments[i].clearValue.color.float32[3] = ClearColorArray[i].A;
			}
		}

		if (bClearDepth || bClearStencil)
		{
			Attachments[NumClearColors].aspectMask = bClearDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : 0;
			Attachments[NumClearColors].aspectMask |= bClearStencil ? VK_IMAGE_ASPECT_STENCIL_BIT : 0;
			Attachments[NumClearColors].colorAttachment = 0;
			Attachments[NumClearColors].clearValue.depthStencil.depth = Depth;
			Attachments[NumClearColors].clearValue.depthStencil.stencil = Stencil;
			++NumAttachments;
		}

		VulkanRHI::vkCmdClearAttachments(CmdBuffer->GetHandle(), NumAttachments, Attachments, 1, &Rect);
	}
	else
	{
		ensure(0);
		//VulkanRHI::vkCmdClearColorImage(CmdBuffer->GetHandle(), )
	}
#else
#if VULKAN_ALLOW_MIDPASS_CLEAR
	const VkExtent2D& Extents = PendingState->GetRenderPass().GetLayout().GetExtent2D();
	if (ExcludeRect.Min.X == 0 && ExcludeRect.Width() == Extents.width && ExcludeRect.Min.Y == 0 && Extents.height)
	{
		//if (ForceFullScreen == EForceFullScreenClear::EDoNotForce)
		{
			return;
		}
		//else
		{
			//ensureMsgf(false, TEXT("Forced Full Screen Clear ignoring Exclude Rect Restriction"));
		}
	}

	ensure(ExcludeRect.Area() == 0);

	VkClearRect Rect;
	FMemory::Memzero(Rect);
	Rect.rect.offset.x = 0;
	Rect.rect.offset.y = 0;
	Rect.rect.extent = PendingState->GetRenderPass().GetLayout().GetExtent2D();

	VkClearAttachment Attachments[MaxSimultaneousRenderTargets + 1];
	FMemory::Memzero(Attachments);

	uint32 NumAttachments = NumClearColors;
	if (bClearColor)
	{
		for (int32 i = 0; i < NumClearColors; ++i)
		{
			Attachments[i].aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
			Attachments[i].colorAttachment = i;
			Attachments[i].clearValue.color.float32[0] = ClearColorArray[i].R;
			Attachments[i].clearValue.color.float32[1] = ClearColorArray[i].G;
			Attachments[i].clearValue.color.float32[2] = ClearColorArray[i].B;
			Attachments[i].clearValue.color.float32[3] = ClearColorArray[i].A;
		}
	}

//.........这里部分代码省略.........
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:101,代码来源:VulkanCommands.cpp


注:本文中的FIntRect::Area方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。