public void SetGpuData(int slotIndex, TextureId id, int textureWidth, int textureHeight, float sdfScale) { int offset = slotIndex * k_SlotSize; float texelWidth = 1f / textureWidth; float texelHeight = 1f / textureHeight; m_GpuTextures[offset + 0] = new Vector4(id.ConvertToGpu(), texelWidth, texelHeight, sdfScale); m_GpuTextures[offset + 1] = new Vector4(textureWidth, textureHeight, 0, 0); }
public void Bind(TextureId id, int slot, MaterialPropertyBlock mat) { Texture tex = textureRegistry.GetTexture(id); m_Textures[slot] = id; MarkUsed(slot); m_GpuTextures[slot] = new Vector4(id.ConvertToGpu(), 1f / tex.width, 1f / tex.height, 0); mat.SetTexture(slotIds[slot], tex); mat.SetVectorArray(textureTableId, m_GpuTextures); }