public void ApplyTexture(Material mat, string name) { GameDatabase.TextureInfo texture = null; if ((type & TextureTypeEnum.CubeMapMask) > 0) { CubemapWrapper cubeMap = CubemapWrapper.fetchCubeMap(this); if (cubeMap != null) { cubeMap.ApplyCubeMap(mat, name, index); } } else { texture = GameDatabase.Instance.GetTextureInfo(value); } if (texture != null) { texture.texture.wrapMode = isClamped ? TextureWrapMode.Clamp : TextureWrapMode.Repeat; mat.SetTexture(name, texture.texture); } if ((type & TextureTypeEnum.AlphaMapMask) > 0) { mat.EnableKeyword(alphaMask + "_" + index); mat.EnableKeyword("ALPHAMAP_" + index); Vector4 alphaMaskVector; alphaMaskVector.x = alphaMask == AlphaMaskEnum.ALPHAMAP_R ? 1 : 0; alphaMaskVector.y = alphaMask == AlphaMaskEnum.ALPHAMAP_G ? 1 : 0; alphaMaskVector.z = alphaMask == AlphaMaskEnum.ALPHAMAP_B ? 1 : 0; alphaMaskVector.w = alphaMask == AlphaMaskEnum.ALPHAMAP_A ? 1 : 0; mat.SetVector("alphaMask" + index, alphaMaskVector); } }