Exemplo n.º 1
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.ProceduralMaterial o;
     o = new UnityEngine.ProceduralMaterial();
     pushObject(l, o);
     return(1);
 }
    static void ProceduralMaterial_loadingBehavior(JSVCall vc)
    {
        UnityEngine.ProceduralMaterial _this = (UnityEngine.ProceduralMaterial)vc.csObj;
        var result = _this.loadingBehavior;

        JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
    }
    static void ProceduralMaterial_isCachedDataAvailable(JSVCall vc)
    {
        UnityEngine.ProceduralMaterial _this = (UnityEngine.ProceduralMaterial)vc.csObj;
        var result = _this.isCachedDataAvailable;

        JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
    }
Exemplo n.º 4
0
 static public int set_cacheSize(IntPtr l)
 {
     UnityEngine.ProceduralMaterial  o = (UnityEngine.ProceduralMaterial)checkSelf(l);
     UnityEngine.ProceduralCacheSize v;
     checkEnum(l, 2, out v);
     o.cacheSize = v;
     return(0);
 }
Exemplo n.º 5
0
    /// <summary>
    /// Gets all necessary references.
    /// </summary>
    void Start()
    {
        networkLayer = this.GetComponent<PanelNetworkLayer>();

        substance = panelBase.GetComponent<Renderer>().material as ProceduralMaterial;

        //otherPanels = GameController.instance.GetGamePanels();
    }
 /// <summary>
 /// <para>Get the ProceduralMaterial animation update rate in millisecond.</para>
 /// </summary>
 /// <param name="material"></param>
 public int GetAnimationUpdateRate(ProceduralMaterial material)
 {
     if (material == null)
     {
         throw new ArgumentException("Invalid ProceduralMaterial");
     }
     return this.GetMaterialInformation(material).animationUpdateRate;
 }
Exemplo n.º 7
0
    static public int set_animationUpdateRate(IntPtr l)
    {
        UnityEngine.ProceduralMaterial o = (UnityEngine.ProceduralMaterial)checkSelf(l);
        int v;

        checkType(l, 2, out v);
        o.animationUpdateRate = v;
        return(0);
    }
Exemplo n.º 8
0
    static public int set_isReadable(IntPtr l)
    {
        UnityEngine.ProceduralMaterial o = (UnityEngine.ProceduralMaterial)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.isReadable = v;
        return(0);
    }
Exemplo n.º 9
0
    static public int set_isLoadTimeGenerated(IntPtr l)
    {
        UnityEngine.ProceduralMaterial o = (UnityEngine.ProceduralMaterial)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.isLoadTimeGenerated = v;
        return(0);
    }
Exemplo n.º 10
0
    static public int set_preset(IntPtr l)
    {
        UnityEngine.ProceduralMaterial o = (UnityEngine.ProceduralMaterial)checkSelf(l);
        string v;

        checkType(l, 2, out v);
        o.preset = v;
        return(0);
    }
 static public int get_isFrozen(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.isFrozen);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_loadingBehavior(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.loadingBehavior);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int ClearCache(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         self.ClearCache();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 14
0
 static public int get_loadingBehavior(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         pushEnum(l, (int)self.loadingBehavior);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 15
0
 static public int get_isReadable(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         pushValue(l, self.isReadable);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int FreezeAndReleaseSourceData(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         self.FreezeAndReleaseSourceData();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int RebuildTexturesImmediately(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         self.RebuildTexturesImmediately();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 18
0
 static public int RebuildTexturesImmediately(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         self.RebuildTexturesImmediately();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 19
0
 static public int ClearCache(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         self.ClearCache();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 20
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial o;
         o = new UnityEngine.ProceduralMaterial();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 21
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial o;
         o = new UnityEngine.ProceduralMaterial();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.ProceduralMaterial o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.ProceduralMaterial();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial o;
         o=new UnityEngine.ProceduralMaterial();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 static public int GetProceduralPropertyDescriptions(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         var ret = self.GetProceduralPropertyDescriptions();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 25
0
 static public int GetProceduralPropertyDescriptions(IntPtr l)
 {
     try{
         UnityEngine.ProceduralMaterial self             = (UnityEngine.ProceduralMaterial)checkSelf(l);
         UnityEngine.ProceduralPropertyDescription[] ret = self.GetProceduralPropertyDescriptions();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 26
0
 static public int GetGeneratedTextures(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         var ret = self.GetGeneratedTextures();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_cacheSize(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial  self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         UnityEngine.ProceduralCacheSize v;
         checkEnum(l, 2, out v);
         self.cacheSize = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 28
0
 static public int set_animationUpdateRate(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.animationUpdateRate = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 29
0
 static public int set_cacheSize(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial  self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         UnityEngine.ProceduralCacheSize v;
         checkEnum(l, 2, out v);
         self.cacheSize = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 30
0
 static public int set_isReadable(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.isReadable = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_animationUpdateRate(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.animationUpdateRate = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_isReadable(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.isReadable = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void ProceduralMaterial_isLoadTimeGenerated(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ProceduralMaterial _this = (UnityEngine.ProceduralMaterial)vc.csObj;
         var result = _this.isLoadTimeGenerated;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.ProceduralMaterial _this = (UnityEngine.ProceduralMaterial)vc.csObj;
         _this.isLoadTimeGenerated = arg0;
     }
 }
Exemplo n.º 34
0
 /// <summary>
 /// <para>Export the bitmaps generated by a ProceduralMaterial as TGA files.</para>
 /// </summary>
 /// <param name="material">The ProceduralMaterial whose output textures will be saved.</param>
 /// <param name="exportPath">Path to a folder where the output bitmaps will be saved. The folder will be created if it doesn't already exist.</param>
 /// <param name="alphaRemap">Indicates whether alpha channel remapping should be performed.</param>
 public void ExportBitmaps(ProceduralMaterial material, string exportPath, bool alphaRemap)
 {
     if (material == null)
     {
         throw new ArgumentException("Invalid ProceduralMaterial");
     }
     if (exportPath == "")
     {
         throw new ArgumentException("Invalid export path specified");
     }
     if (!Directory.CreateDirectory(exportPath).Exists)
     {
         throw new ArgumentException("Export folder " + exportPath + " doesn't exist and cannot be created.");
     }
     this.ExportBitmapsInternal(material, exportPath, alphaRemap);
 }
Exemplo n.º 35
0
 /// <summary>
 /// <para>Export a XML preset string with the value of all parameters of a given ProceduralMaterial to the specified folder.</para>
 /// </summary>
 /// <param name="material">The ProceduralMaterial whose preset string will be saved.</param>
 /// <param name="exportPath">Path to a folder where the preset file will be saved. The folder will be created if it doesn't already exist.</param>
 public void ExportPreset(ProceduralMaterial material, string exportPath)
 {
     if (material == null)
     {
         throw new ArgumentException("Invalid ProceduralMaterial");
     }
     if (exportPath == "")
     {
         throw new ArgumentException("Invalid export path specified");
     }
     if (!Directory.CreateDirectory(exportPath).Exists)
     {
         throw new ArgumentException("Export folder " + exportPath + " doesn't exist and cannot be created.");
     }
     File.WriteAllText(Path.Combine(exportPath, material.name + ".sbsprs"), material.preset);
 }
Exemplo n.º 36
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(10, 10, Screen.width / 6, Screen.height - 20));
        scrollViewVector = GUILayout.BeginScrollView(scrollViewVector);
        //scrollViewVector = GUI.BeginScrollView(new Rect(10, 10, Screen.width / 6, Screen.height - 20), scrollViewVector, new Rect(10, 10, Screen.width / 6, Screen.height*5));
        string[] bn = new string[buttonNames.Count()];
        for (int i = 0; i < buttonNames.Count(); i++)
        { bn[i] = buttonNames[i]; }
        button_selected = GUILayout.SelectionGrid(button_selected, bn, 1);
        GUILayout.EndScrollView();
        GUILayout.EndArea();
        //mt = Materials[button_selected];
        GUILayout.BeginArea(new Rect(Screen.width - (Screen.width / 6), 10, Screen.width / 6, Screen.height - 20));

        Object.GetComponent<Renderer>().sharedMaterial = Materials[button_selected];
        mt_proc = Object.GetComponent<Renderer>().sharedMaterial as ProceduralMaterial;
        //material_arguments.Clear();
        material_arguments = new List<ProceduralPropertyDescription>();
        material_arguments = mt_proc.GetProceduralPropertyDescriptions().Select(m => { return m; }).ToList();
        //prop_values = new float[material_arguments.Count()];
        //this.prop_values = new List<float>();
        //int ind = 0;
        GUILayout.BeginScrollView(Vector2.zero);
        foreach (ProceduralPropertyDescription desc in material_arguments)
        {
            Debug.Log(desc.GetType());
            if (desc.type == ProceduralPropertyType.Float)
            {
                //prop_values[ind] = GUILayout.HorizontalSlider(prop_values[ind], desc.minimum, desc.maximum);
                GUILayout.TextField(desc.name);
                mt_proc.SetProceduralFloat(desc.name, GUILayout.HorizontalSlider(mt_proc.GetProceduralFloat(desc.name), desc.minimum, desc.maximum));
                //ind++;
            }
            //else Debug.Log("There is no float");
        }
        GUILayout.EndScrollView();
        //foreach (var m in mt_proc.GetProceduralPropertyDescriptions()) { material_arguments.Add(m); Debug.Log(m.name); }
        //arg.Clear();
        //arg = new List<float>();
        //argument = GUILayout.HorizontalSlider(argument, 0, 1);
        //arg.Add(argument);
        //mt_proc.SetProceduralFloat("Age", argument);
        mt_proc.RebuildTextures();
        // Object.GetComponent<Renderer>().sharedMaterial = mt_proc;

        GUILayout.EndArea();
    }
 internal void DisplayRestrictedInspector()
 {
     this.m_MightHaveModified = false;
     if (this.m_Styles == null)
     {
         this.m_Styles = new Styles();
     }
     ProceduralMaterial target = base.target as ProceduralMaterial;
     if (m_Material != target)
     {
         m_Material = target;
         m_ShaderPMaterial = target.shader;
     }
     this.ProceduralProperties();
     GUILayout.Space(15f);
     this.GeneratedTextures();
 }
    // Implement your own editor GUI here.
    void OnGUI()
    {
        Objects = Selection.gameObjects as GameObject[];

        EditorGUI.LabelField(new Rect(10,10,position.width - 20, 16),"Selected Objs :", (Objects.Length).ToString());
        Mat = EditorGUI.ObjectField(new Rect(10,40,position.width - 20, 16),"Substance Mat.",Mat,typeof(ProceduralMaterial)) as ProceduralMaterial;

        if (GUI.Button(new Rect(10, 70, 50, 30), "Apply!"))
        {
            foreach(GameObject Object in Objects)
            {
                if (Object.GetComponent<Renderer>() != null)
                {
                    Object.renderer.sharedMaterial = Mat as ProceduralMaterial;
                }
            }
        }
    }
Exemplo n.º 39
0
		public int GetAnimationUpdateRate(ProceduralMaterial material)
		{
			return this.GetMaterialInformation(material).animationUpdateRate;
		}
Exemplo n.º 40
0
		public bool GetGenerateAllOutputs(ProceduralMaterial material)
		{
			return this.GetMaterialInformation(material).generateAllOutputs;
		}
Exemplo n.º 41
0
		public void SetGenerateAllOutputs(ProceduralMaterial material, bool generated)
		{
			ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
			materialInformation.generateAllOutputs = generated;
			this.SetMaterialInformation(material, materialInformation);
		}
Exemplo n.º 42
0
		private extern void SetMaterialInformation(ProceduralMaterial material, ProceduralMaterialInformation information);
Exemplo n.º 43
0
		public void SetMaterialScale(ProceduralMaterial material, Vector2 scale)
		{
			ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
			materialInformation.scale = scale;
			this.SetMaterialInformation(material, materialInformation);
		}
Exemplo n.º 44
0
		public void SetGenerateMipMaps(ProceduralMaterial material, bool mode)
		{
			ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
			materialInformation.generateMipMaps = mode;
			this.SetMaterialInformation(material, materialInformation);
		}
Exemplo n.º 45
0
		public extern void SetTextureAlphaSource(ProceduralMaterial material, string textureName, ProceduralOutputType alphaSource);
Exemplo n.º 46
0
		public extern bool RenameMaterial(ProceduralMaterial material, string name);
Exemplo n.º 47
0
		public extern void OnShaderModified(ProceduralMaterial material);
Exemplo n.º 48
0
		public extern void DestroyMaterial(ProceduralMaterial material);
Exemplo n.º 49
0
		public extern void ResetMaterial(ProceduralMaterial material);
Exemplo n.º 50
0
		public extern string CloneMaterial(ProceduralMaterial material);
Exemplo n.º 51
0
		internal static extern bool IsSubstanceParented(ProceduralTexture texture, ProceduralMaterial material);
Exemplo n.º 52
0
		internal extern void ExportBitmaps(ProceduralMaterial material);
Exemplo n.º 53
0
		public void SetAnimationUpdateRate(ProceduralMaterial material, int animation_update_rate)
		{
			ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
			materialInformation.animationUpdateRate = animation_update_rate;
			this.SetMaterialInformation(material, materialInformation);
		}
Exemplo n.º 54
0
		public Vector2 GetMaterialOffset(ProceduralMaterial material)
		{
			return this.GetMaterialInformation(material).offset;
		}
Exemplo n.º 55
0
		public bool GetGenerateMipMaps(ProceduralMaterial material)
		{
			return this.GetMaterialInformation(material).generateMipMaps;
		}
Exemplo n.º 56
0
		public void SetMaterialOffset(ProceduralMaterial material, Vector2 offset)
		{
			ProceduralMaterialInformation materialInformation = this.GetMaterialInformation(material);
			materialInformation.offset = offset;
			this.SetMaterialInformation(material, materialInformation);
		}
Exemplo n.º 57
0
		public extern ProceduralOutputType GetTextureAlphaSource(ProceduralMaterial material, string textureName);
Exemplo n.º 58
0
		public Vector2 GetMaterialScale(ProceduralMaterial material)
		{
			return this.GetMaterialInformation(material).scale;
		}
Exemplo n.º 59
0
		private extern ProceduralMaterialInformation GetMaterialInformation(ProceduralMaterial material);
Exemplo n.º 60
0
    //
    // This function creates a RenderToTexture for the diffuse map and stores it as a png in the Resources folders.
    //
    public void RenderDiffuse(ProceduralMaterial Diffuse, int slot)
    {
        GameObject rtObject = (GameObject)Instantiate(Resources.Load("RTTSubTerrain"));
        Camera cam = rtObject.transform.Find("RTTSubCamera").GetComponent<Camera>();

        // Create Render To Texture
        Vector2 TexSize = new Vector2((float)Math.Pow(2,Diffuse.GetProceduralVector("$outputsize").x), (float)Math.Pow(2,Diffuse.GetProceduralVector("$outputsize").y));
        RenderTexture rt = new RenderTexture((int)TexSize.x, (int)TexSize.y, 32);
        cam.targetTexture = rt;
        rtObject.transform.Find("RTTSubPlane").GetComponent<Renderer>().sharedMaterial.mainTexture = Diffuse.GetTexture ("_MainTex");
        cam.Render();
        RenderTexture.active = rt;
        Texture2D dif = new Texture2D((int)TexSize.x, (int)TexSize.y, TextureFormat.ARGB32, false);
        dif.ReadPixels(new Rect(0, 0, (int)TexSize.x, (int)TexSize.y), 0, 0);

        // Clean up
        cam.targetTexture = null;
        RenderTexture.active = null; // added to avoid errors
        DestroyImmediate(rt,true);
        DestroyImmediate(rtObject,true);

        // Write Diffuse map as PNG
          	byte[] bytes = dif.EncodeToPNG();
        string filename = Application.dataPath + "/SubTerrain/Resources/" + gameObject.name+"_splat" + slot.ToString() + ".png";
        System.IO.File.WriteAllBytes(filename, bytes);
        AssetDatabase.ImportAsset( "Assets/SubTerrain/Resources/" + gameObject.name+"_splat" + slot.ToString() + ".png" );

        DestroyImmediate(dif,true);
    }