Exemplo n.º 1
0
 /// <summary>
 /// Sets the shader and properties to the input material
 /// </summary>
 /// <param name="material"></param>
 public void apply(Material material)
 {
     material.shader = TexturesUnlimitedLoader.getShader(shader);
     TextureSet.updateMaterialProperties(material, shaderProperties);
     TextureSet.fillEmptyStockTextureSlots(material);
     material.renderQueue = TexturesUnlimitedLoader.isTransparentMaterial(material) ? TexturesUnlimitedLoader.transparentTextureRenderQueue : TexturesUnlimitedLoader.diffuseTextureRenderQueue;
 }
Exemplo n.º 2
0
        public Material createMaterial(string name)
        {
            string   shdName = string.IsNullOrEmpty(this.shader) ? "KSP/Diffuse" : this.shader;
            Shader   shd     = KSPShaderLoader.getShader(shdName);
            Material mat     = new Material(shd);

            mat.name = name;
            TextureSet.updateMaterialProperties(mat, props);
            return(mat);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Return a new material instances instatiated with the shader and properties for this material data.
        /// Does not include applying any recoloring data -- that needs to be handled externally.
        /// </summary>
        /// <returns></returns>
        public Material createMaterial()
        {
            if (string.IsNullOrEmpty(this.shader))
            {
                //TODO -- include texture set name somehow...
                throw new NullReferenceException("ERROR: No shader specified for texture set.");
            }
            Shader   shader   = TexturesUnlimitedLoader.getShader(this.shader);
            Material material = new Material(shader);

            TextureSet.updateMaterialProperties(material, shaderProperties);
            material.renderQueue = TexturesUnlimitedLoader.isTransparentMaterial(material) ? TexturesUnlimitedLoader.transparentTextureRenderQueue : TexturesUnlimitedLoader.diffuseTextureRenderQueue;
            return(material);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the shader and properties to the input material
 /// </summary>
 /// <param name="material"></param>
 public void apply(Material material, bool isIcon = false)
 {
     if (isIcon)
     {
         material.shader = TexturesUnlimitedLoader.iconShaders[shader].iconShader;
     }
     else
     {
         material.shader = TexturesUnlimitedLoader.getShader(shader);
     }
     TextureSet.updateMaterialProperties(material, shaderProperties);
     TextureSet.fillEmptyStockTextureSlots(material);
     material.renderQueue       = renderQueue;
     material.mainTextureOffset = textureOffset;
     material.mainTextureScale  = textureScale;
     Log.replacement("Updated material properties\n" + Debug.getMaterialPropertiesDebug(material));
 }
Exemplo n.º 5
0
 public void applyRecoloring(Material mat, RecoloringData[] userColors)
 {
     TextureSet.updateMaterialProperties(mat, TextureSet.getRecolorProperties(userColors, shaderProperties));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Update the current recoloring data for this texture set.  Does not adjust any other material properties.
 /// </summary>
 /// <param name="mat"></param>
 /// <param name="userColors"></param>
 public void applyRecoloring(Transform root, RecoloringData[] userColors)
 {
     TextureSet.updateMaterialProperties(root, meshNames, excludedMeshes, TextureSet.getRecolorProperties(userColors, shaderProperties));
 }