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


C++ Time::GetDeltaSeconds方法代码示例

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


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

示例1: GetScene

ObjectPtr<ITexture2D> DX11DeferredRenderer::Draw(const Time& time, unsigned int width, unsigned int height){
	
	graphics_.PushEvent(L"Frame");

	auto& context = DX11Graphics::GetInstance().GetContext();

	// Context setup - The depth and the blend state should be defined per render section, however we support only opaque geometry without any fancy stuffs

	context.PushPipelineState(DX11PipelineState::kDefault);
	
	// Draws only if there's a camera

	ObjectPtr<ITexture2D> output = nullptr;

	auto main_camera = GetScene().GetMainCamera();

	if (main_camera){

		FrameInfo frame_info;

		frame_info.scene = &GetScene();
		frame_info.aspect_ratio = static_cast<float>(width) / static_cast<float>(height);
		frame_info.width = width;
		frame_info.height = height;
		frame_info.view_matrix = main_camera->GetViewTransform().matrix();
		frame_info.view_proj_matrix = GetViewProjectionMatrix(frame_info.aspect_ratio);		// This matrix must be the "real" view projection matrix, regardless of whether the camera is locked or not.
		frame_info.time_delta = time.GetDeltaSeconds();
		frame_info.enable_global_illumination = enable_global_illumination_;

		if (!lock_camera_) {

			frame_info.camera = main_camera;
			
			main_camera->Clone(*locked_camera_);

		}
		else {

			frame_info.camera = locked_camera_;

		}

		DrawGBuffer(frame_info);							// Scene -> GBuffer
		
		if (enable_global_illumination_) {

			voxelization_->Update(frame_info);				// Dynamic voxelization of the scene

		}

		output = ComputeLighting(frame_info);				// Scene, GBuffer, DepthBuffer -> LightBuffer

	}

	// Cleanup

	context.PopPipelineState();

	immediate_context_->ClearState();
	
	// Done

	graphics_.PopEvent();

	return output;

}
开发者ID:Tiriath,项目名称:GI,代码行数:67,代码来源:dx11deferred_renderer.cpp


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