返回介绍

ReflectionProbe.IsFinishedRendering 是否结束渲染

发布于 2019-12-18 15:38:25 字数 2815 浏览 1043 评论 0 收藏 0

JavaScript => public function IsFinishedRendering(renderId: int): bool;
C# =>public bool IsFinishedRendering(int renderId);

Parameters 参数

renderIdAn integer representing the RenderID as returned by the RenderProbe method.

Returns 返回

bool True if the render has finished, false otherwise. See Also: timeSlicingMode

Description 描述

Checks if a probe has finished a time-sliced render.

检查探测器是否结束时间片的渲染。

JavaScript:

#pragma strict
public class UpdateProbeEvery2Seconds extends MonoBehaviour {
	private var RenderId: int = -1;
	private var TheProbe: ReflectionProbe;
	public var TargetTexture: RenderTexture;
	function Start() {
		TheProbe = GetComponent.<ReflectionProbe>();
		// set the probe to render in time-slicing mode and make sure all faces of the cubemap render the same frame.
		TheProbe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.AllFacesAtOnce;
		while ( true ) {
			new WaitForSeconds(2.0f)// render the probe over several frames and blit into TargetTexture once finished.
			RenderId = TheProbe.RenderProbe(TargetTexture);
		}
	}
	function Update() {
		if (TheProbe.IsFinishedRendering(RenderId)) {
			// Probe has finished rendering, do something with the render texture
		}
	}
}

C#:

using UnityEngine;
using System.Collections;
 
 
public class UpdateProbeEvery2Seconds : MonoBehaviour
{
	private int RenderId = -1;
	private ReflectionProbe TheProbe;
	public RenderTexture TargetTexture;
 
	IEnumerator Start ()
	{
		TheProbe = GetComponent<ReflectionProbe>();
 
    // set the probe to render in time-slicing mode and make sure all faces of the cubemap render the same frame.
		TheProbe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.AllFacesAtOnce;
		while (true)
		{
			yield return new WaitForSeconds (2.0f);
 
			// render the probe over several frames and blit into TargetTexture once finished.
			RenderId = TheProbe.RenderProbe(TargetTexture);
		}
	}
 
	void Update()
	{
		if (TheProbe.IsFinishedRendering(RenderId))
		{
			// Probe has finished rendering, do something with the render texture
		}
	}
}

reflectionprobe

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文