private void CreateRTHandles(Vector2Int dim) { m_RTSize = dim; var r = RTUtils.GetDescriptorRW(dim.x, dim.y, 0, RenderTextureFormat.RFloat); var rg = RTUtils.GetDescriptorRW(dim.x, dim.y, 0, RenderTextureFormat.RGFloat); var argb = RTUtils.GetDescriptorRW(dim.x, dim.y, 0, RenderTextureFormat.ARGBFloat); for (int i = 0; i < 2; i++) { m_HeightmapRT[i] = RTUtils.GetNewHandle(r).WithName("HydroErosion_Height" + i); m_WaterRT[i] = RTUtils.GetNewHandle(r).WithName("HydroErosion_Water" + i); m_WaterVelRT[i] = RTUtils.GetNewHandle(rg).WithName("HydroErosion_WaterVel" + i); m_FluxRT[i] = RTUtils.GetNewHandle(argb).WithName("HydroErosion_Flux" + i); m_SedimentRT[i] = RTUtils.GetNewHandle(r).WithName("HydroErosion_Sediment" + i); m_HeightmapRT[i].RT.Create(); m_WaterRT[i].RT.Create(); m_WaterVelRT[i].RT.Create(); m_FluxRT[i].RT.Create(); m_SedimentRT[i].RT.Create(); } m_ErodedRT = RTUtils.GetNewHandle(r).WithName("HydroErosion_Eroded"); m_ErodedRT.RT.Create(); m_HardnessRT = RTUtils.GetNewHandle(r).WithName("HydroErosion_Hardness"); m_HardnessRT.RT.Create(); }
public void RTHandle_Release_New() { var handle = RTUtils.GetNewHandle(descriptor); Assert.True(RTUtils.GetHandleCount() == m_PrevRTHandleCount + 1); RTUtils.Release(handle); Assert.True(RTUtils.GetHandleCount() == m_PrevRTHandleCount); }
/// <summary> /// Gather/Create all added RTHandles using the provided width, height, and depth value, if provided /// <param name="width">The width of the RTHandles to gather</param> /// <param name="height">The height of the RTHandles to gather</param> /// <param name="depth">The optional depth of the RTHandles to gather</param> /// <returns></returns> /// </summary> public void GatherRTHandles(int width, int height, int depth = 0) { foreach (int key in m_Hashes) { var desc = new RenderTextureDescriptor(width, height, m_Formats[key], depth); m_Handles[key] = RTUtils.GetNewHandle(desc); m_Handles[key].RT.Create(); } }