protected Material CheckShaderAndCreateMaterial(Shader s, Material m2Create) { if (!s) { PPFXUtility.log("Missing shader in " + ToString()); enabled = false; return(null); } if (s.isSupported && m2Create && m2Create.shader == s) { return(m2Create); } if (!s.isSupported) { NotSupported(); PPFXUtility.log("The shader " + s.ToString() + " on effect " + ToString() + " is not supported on this platform!"); return(null); } else { m2Create = new Material(s); m2Create.hideFlags = HideFlags.DontSave; if (m2Create) { return(m2Create); } else { return(null); } } }
protected Material CreateMaterial(Shader s, Material m2Create) { if (!s) { PPFXUtility.log("Missing shader in " + ToString()); return(null); } if (m2Create && (m2Create.shader == s) && (s.isSupported)) { return(m2Create); } if (!s.isSupported) { return(null); } else { m2Create = new Material(s); m2Create.hideFlags = HideFlags.DontSave; if (m2Create) { return(m2Create); } else { return(null); } } }
public void onGUI(float x, float y) { if (GUI.Button(new Rect(x, y, 75, 20), "Default")) { m_activeConfig = new AmbientOcclusionConfig(); } if (GUI.Button(new Rect(x + 75, y, 75, 20), "Load")) { load(); } y += 25; m_activeConfig.enabled = GUI.Toggle(new Rect(x, y, 200.0f, 20.0f), m_activeConfig.enabled, "enable ambient occlusion"); y += 25; m_activeConfig.intensity = PPFXUtility.drawSliderWithLabel(x, y, 0.0f, 4.0f, "Intensity", m_activeConfig.intensity); y += 25; m_activeConfig.radius = PPFXUtility.drawSliderWithLabel(x, y, 0.0f, 2.0f, "Radius", m_activeConfig.radius); y += 25; m_activeConfig.sampleCount = (SampleCount)PPFXUtility.drawIntSliderWithLabel(x, y, 0, (int)SampleCount.Custom - 1, "Sample Count: ", m_activeConfig.getSampleCountLabel(), (int)m_activeConfig.sampleCount); y += 25; m_activeConfig.source = (OcclusionSource)PPFXUtility.drawIntSliderWithLabel(x, y, 0, 1, "Occlusion Source: ", m_activeConfig.getOcclusionSourceLabel(), (int)m_activeConfig.source); y += 25; m_activeConfig.downsampling = GUI.Toggle(new Rect(x, y, 200.0f, 20.0f), m_activeConfig.downsampling, "Enable downsampling"); y += 25; // Apply the changed configuration. applyConfig(); }
// deprecated but needed for old effects to survive upgrading bool CheckShader(Shader s) { PPFXUtility.log("The shader " + s.ToString() + " on effect " + ToString() + " is not part of the Unity 3.2+ effects suite anymore. For best performance and quality, please ensure you are using the latest Standard Assets Image Effects (Pro only) package."); if (!s.isSupported) { NotSupported(); return(false); } else { return(false); } }
public static void Serialize <T>(String filename, object instance) { TextWriter writer = null; try { writer = new StreamWriter(filename); XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); xmlSerializer.Serialize(writer, instance); } catch (Exception ex) { PPFXUtility.logException("EffectConfig: Failed to save config " + filename, ex); } finally { if (writer != null) { writer.Close(); } } }
public static T Deserialize <T>(String filename) where T : new() { TextReader reader = null; try { reader = new StreamReader(filename); XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); return((T)xmlSerializer.Deserialize(reader)); } catch (Exception ex) { PPFXUtility.logException("EffectConfig: Failed to load config " + filename, ex); } finally { if (reader != null) { reader.Close(); } } return(new T()); }
public virtual bool CheckResources() { PPFXUtility.log("CheckResources () for " + ToString() + " should be overwritten."); return(isSupported); }
protected void ReportAutoDisable() { PPFXUtility.log("The image effect " + ToString() + " has been disabled as it's not supported on the current platform."); }