Пример #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;
 }
Пример #2
0
        public TransparentShaderData(ConfigNode node)
        {
            string shaderName = node.GetStringValue("name");

            shader              = TexturesUnlimitedLoader.getShader(shaderName);
            alwaysTransparent   = node.GetBoolValue("alwaysTransparent", true);
            transparentKeywords = node.GetStringValues("keyword");
        }
Пример #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);
        }
Пример #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));
 }
 public void toggleDebugSphere()
 {
     if (debugSphere != null)
     {
         GameObject.Destroy(debugSphere);
         debugSphere = null;
     }
     else
     {
         debugSphere      = GameObject.CreatePrimitive(PrimitiveType.Sphere);
         debugSphere.name = "ReflectionDebugSphere";
         GameObject.DestroyImmediate(debugSphere.GetComponent <Collider>());
         debugSphere.transform.localScale = Vector3.one * 10f;
         Shader   metallic = TexturesUnlimitedLoader.getShader("SSTU/PBR/Metallic");
         Material mat      = new Material(metallic);
         mat.SetFloat("_Metallic", 1);
         mat.SetFloat("_Smoothness", 1);
         debugSphere.GetComponent <MeshRenderer>().material = mat;
     }
 }
Пример #6
0
 public TransparentShaderData(ConfigNode node)
 {
     shaderName = node.GetStringValue("name");
     shader     = TexturesUnlimitedLoader.getShader(shaderName);
 }