GetProceduralVector() public method

Get a named Procedural vector property.

public GetProceduralVector ( string inputName ) : Vector4
inputName string
return Vector4
 static public int GetProceduralVector(IntPtr l)
 {
     try {
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         var ret = self.GetProceduralVector(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #2
0
 static public int GetProceduralVector(IntPtr l)
 {
     try{
         UnityEngine.ProceduralMaterial self = (UnityEngine.ProceduralMaterial)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         UnityEngine.Vector4 ret = self.GetProceduralVector(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #3
0
ファイル: SubTerrain.cs プロジェクト: alextalvan/Ships2
    //
    // 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);
    }