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); } }
public bool isValid() { if (value == null || value == "") { return(true); } else if ((type & TextureTypeEnum.CubeMapMask) > 0) { return(CubemapWrapper.Exists(value, type)); } else { return(GameDatabase.Instance.ExistsTexture(value)); } }
public static void GenerateCubemapWrapper(string value, Texture2D[] textures, TextureTypeEnum cubeType, bool mipmaps, bool readable) { CubemapList[value] = new CubemapWrapper(value, textures, cubeType, mipmaps, readable); }