Ejemplo n.º 1
0
    public static string DoExport(GameObject go, string comment)
    {
        bool makeSubmeshes = false;

        string meshName = go.GetComponent <MeshFilter>().sharedMesh.name;

        ShadowVolume_ObjExporterScript.Start();

        StringBuilder meshString = new StringBuilder();

        meshString.Append(comment + "\n");
        meshString.Append("#" + meshName + ".obj"
                          + "\n#" + System.DateTime.Now.ToLongDateString()
                          + "\n#" + System.DateTime.Now.ToLongTimeString()
                          + "\n#-------"
                          + "\n\n");

        Transform t = go.transform;

        Vector3 originalPosition = t.position;

        t.position = Vector3.zero;

        if (!makeSubmeshes)
        {
            meshString.Append("g ").Append(t.name).Append("\n");
        }
        meshString.Append(processTransform(t, makeSubmeshes));

        t.position = originalPosition;

        ShadowVolume_ObjExporterScript.End();

        return(meshString.ToString());
    }
Ejemplo n.º 2
0
    static string processTransform(Transform t, bool makeSubmeshes)
    {
        StringBuilder meshString = new StringBuilder();

        meshString.Append("#" + t.name
                          + "\n#-------"
                          + "\n");

        if (makeSubmeshes)
        {
            meshString.Append("g ").Append(t.name).Append("\n");
        }

        MeshFilter mf = t.GetComponent <MeshFilter>();

        if (mf)
        {
            meshString.Append(ShadowVolume_ObjExporterScript.MeshToString(mf, t));
        }

        return(meshString.ToString());
    }