Compare commits

...

4 Commits

Author SHA1 Message Date
ALEXTANGXIAO
4c8c37ffd8 异步加载原生文件接口问题修正。
异步加载原生文件接口问题修正。
2023-10-04 18:58:45 +08:00
ALEXTANG
5f694c2bed WebGL毛玻璃效果使用默认
WebGL毛玻璃效果使用默认
2023-09-18 16:41:08 +08:00
ALEXTANG
7ff74bb747 Update GameTime.cs 2023-09-18 16:40:51 +08:00
ALEXTANG
a5de63397a Update 3-4-对象池模块.md 2023-09-18 12:00:36 +08:00
4 changed files with 41 additions and 9 deletions

View File

@@ -104,7 +104,7 @@ namespace TEngine
int renderWidth = src.width >> DownSampleNum;
int renderHeight = src.height >> DownSampleNum;
m_renderTexture = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, RenderTextureFormat.RGB111110Float);
m_renderTexture = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, RenderTextureFormat.Default);
m_renderTexture.filterMode = FilterMode.Bilinear;
Graphics.Blit(src, m_renderTexture, material, 0);
@@ -117,7 +117,7 @@ namespace TEngine
material.SetFloat(DownSampleValue, BlurSpreadSize * widthMod + iterationOffs);
// 【2.2】处理Shader的通道1垂直方向模糊处理 || Pass1,for vertical blur
// 定义一个临时渲染的缓存tempBuffer
RenderTexture tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, RenderTextureFormat.RGB111110Float);
RenderTexture tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, RenderTextureFormat.Default);
// 拷贝rawTexture中的渲染数据到tempBuffer,并仅绘制指定的pass1的纹理数据
Graphics.Blit(m_renderTexture, tempBuffer, material, 1);
// 清空rawTexture
@@ -126,7 +126,7 @@ namespace TEngine
m_renderTexture = tempBuffer;
// 【2.3】处理Shader的通道2竖直方向模糊处理 || Pass2,for horizontal blur
// 获取临时渲染纹理
tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, RenderTextureFormat.RGB111110Float);
tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, RenderTextureFormat.Default);
// 拷贝rawTexture中的渲染数据到tempBuffer,并仅绘制指定的pass2的纹理数据
Graphics.Blit(m_renderTexture, tempBuffer, m_material, 2);
//【2.4】得到pass0、pass1和pass2的数据都已经准备好的rawTexture

View File

@@ -4,20 +4,38 @@ namespace TEngine
{
/// <summary>
/// 游戏时间。
/// <remarks>统一封装调用。</remarks>
/// <remarks>提供从Unity获取时间信息的接口。</remarks>
/// </summary>
public static class GameTime
{
/// <summary>
/// 此帧开始时的时间(只读)。
/// </summary>
public static float time;
/// <summary>
/// 从上一帧到当前帧的间隔(秒)(只读)。
/// </summary>
public static float deltaTime;
/// <summary>
/// timeScale从上一帧到当前帧的独立时间间隔以秒为单位只读
/// </summary>
public static float unscaledDeltaTime;
/// <summary>
/// 执行物理和其他固定帧速率更新如MonoBehavior的MonoBehaviour.FixedUpdate的时间间隔以秒为单位
/// </summary>
public static float fixedDeltaTime;
/// <summary>
/// 自游戏开始以来的总帧数(只读)。
/// </summary>
public static float frameCount;
/// <summary>
/// timeScale此帧的独立时间只读。这是自游戏开始以来的时间以秒为单位
/// </summary>
public static float unscaledTime;
public static void StartFrame()

View File

@@ -587,14 +587,13 @@ namespace TEngine
/// <param name="location">资源定位地址。</param>
/// <param name="cancellationToken">取消操作Token。</param>
/// <returns>原生文件资源实例操作句柄。</returns>
/// <remarks>需要自行释放资源句柄(RawFileOperationHandle)。</remarks>
public async UniTask<RawFileOperationHandle> LoadRawAssetAsync(string location, CancellationToken cancellationToken)
{
RawFileOperationHandle handle = YooAssets.LoadRawFileAsync(location);
bool cancelOrFailed = await handle.ToUniTask().AttachExternalCancellation(cancellationToken).SuppressCancellationThrow();
handle.Dispose();
return cancelOrFailed ? null : handle;
}

View File

@@ -13,6 +13,19 @@ public class Actor : ObjectBase
/// </summary>
/// <param name="isShutdown">是否是关闭对象池时触发。</param>
protected override void Release(bool isShutdown){}
/// <summary>
/// 创建Actor对象。
/// </summary>
/// <param name="actorName">对象名称。</param>
/// <param name="target">对象持有实例。</param>
/// <returns></returns>
public static Actor Create(string name, object target)
{
var actor = MemoryPool.Acquire<Actor>();
actor.Initialize(name, target);
return actor;
}
}
/// <summary>
@@ -29,8 +42,10 @@ void Start()
/// <summary>
/// 创建Actor对象。
/// </summary>
/// <returns>Actor对象实例。</returns>
public Actor CreateActor()
/// <param name="actorName">对象名称。</param>
/// <param name="target">对象持有实例。</param>
/// <returns>Actor对象实例</returns>
public Actor CreateActor(string actorName, GameObject target)
{
Actor ret = null;
if (_actorPool.CanSpawn())
@@ -39,7 +54,7 @@ public Actor CreateActor()
}
else
{
ret = MemoryPool.Acquire<Actor>();
ret = Actor.Create(actorName, target);
_actorPool.Register(ret,true);
}