Ejemplo n.º 1
0
    public void OpenUVEditor()
    {
        RenderedMesh = GameObject.Find("RENDERED MESH");
        ModelViewer  = GameObject.Find("MODEL VIEWER");
        RenderFile r_file     = ModelViewer.GetComponent <RenderFile>();
        Mesh       actualMesh = r_file.ReturnActualMesh();

        Sprite    uvsprite = new Sprite();
        Texture2D _tex     = RenderedMesh.GetComponent <RenderMaterial>().Materials_[0].mainTexture as Texture2D;

        uvsprite = Sprite.Create(_tex, new Rect(0, 0, _tex.width, _tex.height), new Vector2());

        GameObject.Find("UV TEXTURE MAP").GetComponent <Image>().sprite = uvsprite;

        foreach (GameObject vertex_ in r_file.selectedVertex)
        {
            GameObject uvCoord = new GameObject();
            uvCoord.name = vertex_.name + "_t";
            uvCoord.transform.SetParent(GameObject.Find("UV TEXTURE MAP").transform);
            Image uvCoordImage = uvCoord.AddComponent <Image>();
            uvCoordImage.color = Color.green;
            uvCoordImage.rectTransform.anchoredPosition = new Vector2(actualMesh.uv[int.Parse(vertex_.name)].x * 128, actualMesh.uv[int.Parse(vertex_.name)].y * -128);
            uvCoordImage.rectTransform.sizeDelta        = new Vector2(5, 5);
        }
    }
Ejemplo n.º 2
0
    public static void Execute(RenderFile renderFile, Action <bool> onFinish)
    {
        var obj    = new GameObject("RenderDownloader");
        var render = obj.AddComponent <RenderDownloader>();

        render.mRenderFile = renderFile;
        render.onFinish    = onFinish;
    }
Ejemplo n.º 3
0
    public void RemoveToGroupByID(int ID)
    {
        RenderFile MV      = GameObject.Find("MODEL VIEWER").GetComponent <RenderFile>();
        int        GroupID = ID;

        for (int x = 0; x < MV.selectedVertex.Count; x++)
        {
            if (Groups[GroupID].Contains(MV.selectedVertex[x].transform.GetSiblingIndex()))
            {
                Groups[GroupID].Remove(MV.selectedVertex[x].transform.GetSiblingIndex());
            }
        }
    }
Ejemplo n.º 4
0
    public void UnselectGroupByID(int ID)
    {
        RenderFile MV      = GameObject.Find("MODEL VIEWER").GetComponent <RenderFile>();
        int        GroupID = ID;

        for (int x = 0; x < Groups[GroupID].Count; x++)
        {
            VertexObject V = GameObject.Find("Model Data").transform.GetChild(Groups[GroupID][x]).GetComponent <VertexObject>();
            if (V.Selected == true)
            {
                V.UnselectObject();
            }
        }
    }
Ejemplo n.º 5
0
    public void SaveUVMapping()
    {
        RenderedMesh = GameObject.Find("RENDERED MESH");
        ModelViewer  = GameObject.Find("MODEL VIEWER");
        RenderFile r_file     = ModelViewer.GetComponent <RenderFile>();
        Mesh       actualMesh = r_file.ReturnActualMesh();

        Vector2[] uv_list_new = actualMesh.uv;

        foreach (GameObject vertex_ in r_file.selectedVertex)
        {
            Image uvI = GameObject.Find("UV TEXTURE MAP").transform.Find(vertex_.name.ToString() + "_t").GetComponent <Image>();
            uv_list_new[int.Parse(vertex_.name)] = new Vector2(uvI.rectTransform.anchoredPosition.x / 128, uvI.rectTransform.anchoredPosition.x / -128);
            Destroy(uvI.gameObject);
        }
        r_file.UpdateUV(uv_list_new);
    }
Ejemplo n.º 6
0
    void Start()
    {
        ReportSegTime(3, "ToDownload");
        var key = PlayerPrefs.GetString(Key_DataFile, String.Empty);

        if (string.IsNullOrEmpty(key))
        {
            Debug.LogError("===>>>启动Unity传入参数不能为空");
            Quit();
            return;
        }
        var filepath = Path.GetFullPath(string.Format("./../renderserver/cache/{0}.json", key));

        Debug.Log(filepath);
        mRenderFile = JsonUtility.FromJson <RenderFile>(File.ReadAllText(filepath));
        if (mRenderFile == null)
        {
            Debug.LogError("===>>>渲染数据不能为空");
            Quit();
            return;
        }
        mMsg = string.Empty;
        RenderDownloader.Execute(mRenderFile, (success) =>
        {
            if (success)
            {
                ReportSegTime(4, "ToRender");
                Debug.Log("====>>>下载零件数据完成,开始渲染..");
                Render(mRenderFile.info, (files, msg) =>
                {
                    if (!string.IsNullOrEmpty(msg))
                    {
                        mMsg = msg;
                    }
                    OnFinish(files);
                });
            }
            else
            {
                mMsg = "下载零件数据失败";
                Debug.LogError("===>>>" + mMsg);
                OnFinish(null);
            }
        });
    }
Ejemplo n.º 7
0
    void Start()
    {
        SelectionSphere = GameObject.Find("Selection Sphere");
        r = this.GetComponent <RenderFile>();

        if (File.Exists(UnityEngine.Application.dataPath + "\\cfg_sensitivity.cfg"))
        {
            SensitivityMouse = int.Parse(File.ReadAllText(UnityEngine.Application.dataPath + "\\cfg_sensitivity.cfg"));
        }

        // Initialize selection box
        box = GameObject.CreatePrimitive(PrimitiveType.Cube);
        box.AddComponent <Rigidbody>();
        box.AddComponent <SelectOrtographic>();
        box.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Continuous;
        box.GetComponent <Rigidbody>().useGravity             = false;
        box.GetComponent <Rigidbody>().freezeRotation         = true;
    }
Ejemplo n.º 8
0
    void OnMouseOver()
    {
        RenderFile model = GameObject.Find("MODEL VIEWER").GetComponent <RenderFile>();

        if (model.WindowOpen == false && model.inCommand == false)
        {
            if (model.byteLength == 64 || model.byteLength == 96)
            {
                GameObject.Find("VERTEXDATA").GetComponent <Text>().text = "VERTEX " + this.name + ":\nX = " + transform.position.x + "\nY = " + transform.position.y + "\nZ = " + transform.position.z + "\n" + model.vertexBone[int.Parse(gameObject.name)].x.ToString() + " " + model.vertexBone[int.Parse(gameObject.name)].y.ToString() + " " + model.vertexBone[int.Parse(gameObject.name)].z.ToString() + " " + model.vertexBone[int.Parse(gameObject.name)].w.ToString() + "\n\nWeights:" + "\nX = " + model.vertexWeight[int.Parse(gameObject.name)].x.ToString() + "\nY = " + model.vertexWeight[int.Parse(gameObject.name)].y.ToString() + "\nZ = " + model.vertexWeight[int.Parse(gameObject.name)].z.ToString() + "\nW = " + model.vertexWeight[int.Parse(gameObject.name)].w.ToString();
            }
            else if (model.byteLength == 28)
            {
                GameObject.Find("VERTEXDATA").GetComponent <Text>().text = "VERTEX " + this.name + ":\nX = " + transform.position.x + "\nY = " + transform.position.y + "\nZ = " + transform.position.z;
            }
        }
        if (Input.GetMouseButton(0))
        {
            GameObject.Find("Selection Sphere").transform.position = this.gameObject.transform.position;
        }
    }
Ejemplo n.º 9
0
    void Start()
    {
        RenderFile R = this.gameObject.GetComponent <RenderFile>();

        AddCommand("/start", 0, "Use /help PAGE to get the full list of commands. Use /help: /command to get help on a specific command.");
        AddCommand("/help", 1, "PAGE -> prints a list of the commands in a certain page.");
        AddCommand("/help:", 1, "COMMAND -> shows a description of a certain command.");
        AddCommand("/closefile", 0, "-> closes the current file.");
        AddCommand("/loadtexture", 0, "-> loads a texture from a .png, .jpg or .bmp file.");
        AddCommand("/sensitivity", 1, "NUMBER -> sets the sensitivity of the mouse view.");

        AddCommand("/translate", 3, "X Y Z -> translates the selected vertices X Y Z units. Example: /translate 0 2 0 will translate the vertices 2 points up.");
        AddCommand("/setpos", 3, "X Y Z -> moves the selected vertices to the same point in worldspace. Example: /setpos % 2 % will set the vertices Y position to 2 while mantaining the X and Z the same as they were.");
        AddCommand("/scale", 3, "X Y Z -> scales the selected vertices using the center of the vertices as the origin. Negative magnitudes will invert the mesh. Example: /scale 2 2 2");
        AddCommand("/rotate", 3, "X Y Z -> rotates the selected vertices according to a number of degrees. Example: /rotate 90 0 0.");
        AddCommand("/selectall", 0, "-> selects all the vertices of the mesh.");

        AddCommand("/testemptybones", 0, "-> checks if there is any bones with an ID of 0, 0, 0.");
        AddCommand("/selectvertex", 1, "ID -> selects a vertex based on its ID. Example: /selectvertex 35");

        AddCommand("/addtriangle", 3, "A B C -> creates a triangle made of ABC vertices.");
        AddCommand("/undotri", 0, "-> deletes the last triangle.");
        AddCommand("/undo", 0, "-> reverts the last rotation, translation or scale (experimental).");

        AddCommand("/groups", 0, "-> shows a list of all the mesh groups.");
        AddCommand("/creategroup", 1, "NAME -> creates a group with a custom name. Example: /creategroup LeftArm");
        AddCommand("/deletegroup", 1, "NAME -> deletes the desired group. It will not delete the vertices in it, just the list of vertices inside the group.");
        AddCommand("/addtogroup", 1, "NAME -> adds the selected vertices to the desired group.");
        AddCommand("/removefromgroup", 1, "NAME -> unlists the selected vertices of a group.");
        AddCommand("/selectgroup", 1, "NAME -> selects all the vertices listed in the desired group.");
        AddCommand("/unselectgroup", 1, "NAME -> unselects all the vertices listed in the desired group");

        AddCommand("/inverttriangles", 0, "-> inverts the triangles of the mesh.");
        AddCommand("/invertnormals", 0, "-> inverts the normals of the mesh.");

        AddCommand("/renderset", 1, "NUMBER -> changes the render mode. 0 = wireframe, 1 = textured, 2 = vertex only.");
        AddCommand("/lighting", 1, "NUMBER -> changes the state of lighting. 0 = disabled, 1 = enabled.");

        AddCommand("/importobj", 0, "-> shows a file explorer to import an .obj file");
        AddCommand("/importobj:", 1, "PATH -> imports an .obj file from a path");
        AddCommand("/impobjpos", 0, "-> shows a file explorer to import only the vertices of an .obj file. Useful if there is no need to change the triangles.");
        AddCommand("/impobjpos:", 1, "PATH -> shows a file explorer to import only the vertices of an .obj file located in PATH. Useful if there is no need to change the triangles.");
        AddCommand("/exportobj", 0, "-> exports an .obj file of the actual model.");
        AddCommand("/exportobj:", 1, "PATH -> exports an .obj file of the actual model in the desired PATH.");

        AddCommand("/autorig_vertical", 3, "A B C -> tries to auto-rig the selected vertices in vertical mode.");
        AddCommand("/autorig_horizontal", 3, "A B C -> tries to auto-rig the selected vertices in horizontal mode.");

        AddCommand("/saveraw", 0, "-> exports the model as a raw file.");

        // Extra commands:
        AddCommand("/savegroupsasxfbin", 0, "-> saves each mesh group to a different .xfbin (experimental)");

        AddCommand("/github", 0, "-> opens the GitHub of UNSME.");

        int Pages = Commands.Count / 8;

        if (Commands.Count % 8 > 0)
        {
            Pages = Pages + 1;
        }
        CommandDescription[0] = CommandDescription[0] + " <color=lime>Total /help pages: " + Pages.ToString() + "</color>";
    }
Ejemplo n.º 10
0
 void Start()
 {
     r = this.GetComponent <RenderFile>();
     StartCoroutine(CheckForUpdates());
 }
Ejemplo n.º 11
0
    public void SaveGroupsToXfbin(int groupNum, string path__)
    {
        try
        {
            Transform ModelDataTransform;
            ModelDataTransform = GameObject.Find("Model Data").GetComponent <Transform>();

            List <byte> triangleFileNew = new List <byte>();
            List <byte> vertexFileNew   = new List <byte>();
            List <byte> textureFileNew  = new List <byte>();

            //DialogResult dial = MessageBox.Show("Fix vertex count and face count? This fix is only useful if you have used /importobj. However, /impobjpos does not need it.", "Warning", MessageBoxButtons.YesNo);

            rf.meshNormals   = rf.mf.mesh.normals.ToList();
            rf.meshTriangles = rf.mf.mesh.triangles.ToList();
            rf.meshVertices  = rf.mf.mesh.vertices.ToList();

            List <Vector3> meshVertices       = rf.meshVertices;
            List <int>     meshTriangles_full = rf.meshTriangles;
            List <int>     meshTriangles      = new List <int>();
            List <Vector3> meshNormals        = rf.meshNormals;
            List <Vector2> meshUVs            = rf.mf.mesh.uv.ToList();
            List <Vector4> vertexWeight       = rf.vertexWeight.ToList();
            List <Vector4> vertexBone         = rf.vertexBone.ToList();

            int            VertexCount = 0;
            GroupSelection gp          = GetComponent <GroupSelection>();

            for (int x = 0; x < meshTriangles_full.Count; x = x + 3)
            {
                if (gp.Groups[groupNum].Contains(meshTriangles_full[x + 0]) && gp.Groups[groupNum].Contains(meshTriangles_full[x + 1]) && gp.Groups[groupNum].Contains(meshTriangles_full[x + 2]))
                {
                    meshTriangles.Add(meshTriangles_full[x + 0]);
                    meshTriangles.Add(meshTriangles_full[x + 1]);
                    meshTriangles.Add(meshTriangles_full[x + 2]);
                }
            }

            VertexCount = meshVertices.Count;

            for (int x = 0; x < VertexCount; x++)
            {
                for (int z = 0; z < rf.byteLength; z++)
                {
                    vertexFileNew.Add(0x00);
                }
            }

            for (int x = 0; x < VertexCount; x++)
            {
                byte[] posx = BitConverter.GetBytes(meshVertices[x].x).ToArray();
                if (rf.stageMode == true)
                {
                    posx = BitConverter.GetBytes(meshVertices[x].x * 20).ToArray();
                }
                Array.Reverse(posx);
                vertexFileNew[0x0 + (rf.byteLength * x)] = posx[0];
                vertexFileNew[0x1 + (rf.byteLength * x)] = posx[1];
                vertexFileNew[0x2 + (rf.byteLength * x)] = posx[2];
                vertexFileNew[0x3 + (rf.byteLength * x)] = posx[3];

                byte[] posz = BitConverter.GetBytes(meshVertices[x].z).ToArray();
                if (rf.stageMode == true)
                {
                    posz = BitConverter.GetBytes(meshVertices[x].z * 20).ToArray();
                }
                Array.Reverse(posz);
                vertexFileNew[0x4 + (rf.byteLength * x)] = posz[0];
                vertexFileNew[0x5 + (rf.byteLength * x)] = posz[1];
                vertexFileNew[0x6 + (rf.byteLength * x)] = posz[2];
                vertexFileNew[0x7 + (rf.byteLength * x)] = posz[3];

                byte[] posy = BitConverter.GetBytes(meshVertices[x].y).ToArray();
                if (rf.stageMode == true)
                {
                    posy = BitConverter.GetBytes(meshVertices[x].y * 20).ToArray();
                }
                Array.Reverse(posy);
                vertexFileNew[0x8 + (rf.byteLength * x)] = posy[0];
                vertexFileNew[0x9 + (rf.byteLength * x)] = posy[1];
                vertexFileNew[0xA + (rf.byteLength * x)] = posy[2];
                vertexFileNew[0xB + (rf.byteLength * x)] = posy[3];

                if (rf.byteLength == 0x1C)
                {
                    byte[] NXA = RenderFile.ToInt(meshNormals[x].x);
                    Array.Reverse(NXA);

                    byte[] NYA = RenderFile.ToInt(meshNormals[x].y);
                    Array.Reverse(NYA);

                    byte[] NZA = RenderFile.ToInt(meshNormals[x].z);
                    Array.Reverse(NZA);

                    vertexFileNew[0xC + (rf.byteLength * x)] = NXA[0];
                    vertexFileNew[0xD + (rf.byteLength * x)] = NXA[1];

                    vertexFileNew[0xE + (rf.byteLength * x)] = NYA[0];
                    vertexFileNew[0xF + (rf.byteLength * x)] = NYA[1];

                    vertexFileNew[0x10 + (rf.byteLength * x)] = NZA[0];
                    vertexFileNew[0x11 + (rf.byteLength * x)] = NZA[1];
                }
                else if (rf.byteLength == 0x40)
                {
                    // BONE DATA
                    vertexFileNew[0x23 + (rf.byteLength * x)] = (byte)vertexBone[x].x;
                    vertexFileNew[0x27 + (rf.byteLength * x)] = (byte)vertexBone[x].y;
                    vertexFileNew[0x2B + (rf.byteLength * x)] = (byte)vertexBone[x].z;
                    vertexFileNew[0x2F + (rf.byteLength * x)] = (byte)vertexBone[x].w;

                    // WEIGHT DATA
                    byte[] weightx = BitConverter.GetBytes(vertexWeight[x].x).ToArray();
                    Array.Reverse(weightx);

                    vertexFileNew[0x30 + (rf.byteLength * x)] = weightx[0];
                    vertexFileNew[0x31 + (rf.byteLength * x)] = weightx[1];
                    vertexFileNew[0x32 + (rf.byteLength * x)] = weightx[2];
                    vertexFileNew[0x33 + (rf.byteLength * x)] = weightx[3];

                    byte[] weighty = BitConverter.GetBytes(vertexWeight[x].y).ToArray();
                    Array.Reverse(weighty);

                    vertexFileNew[0x34 + (rf.byteLength * x)] = weighty[0];
                    vertexFileNew[0x35 + (rf.byteLength * x)] = weighty[1];
                    vertexFileNew[0x36 + (rf.byteLength * x)] = weighty[2];
                    vertexFileNew[0x37 + (rf.byteLength * x)] = weighty[3];

                    byte[] weightz = BitConverter.GetBytes(vertexWeight[x].z).ToArray();
                    Array.Reverse(weightz);

                    vertexFileNew[0x38 + (rf.byteLength * x)] = weightz[0];
                    vertexFileNew[0x39 + (rf.byteLength * x)] = weightz[1];
                    vertexFileNew[0x3A + (rf.byteLength * x)] = weightz[2];
                    vertexFileNew[0x3B + (rf.byteLength * x)] = weightz[3];

                    byte[] weightw = BitConverter.GetBytes(vertexWeight[x].w).ToArray();
                    Array.Reverse(weightw);

                    vertexFileNew[0x3C + (rf.byteLength * x)] = weightw[0];
                    vertexFileNew[0x3D + (rf.byteLength * x)] = weightw[1];
                    vertexFileNew[0x3E + (rf.byteLength * x)] = weightw[2];
                    vertexFileNew[0x3F + (rf.byteLength * x)] = weightw[3];

                    // NORMALS
                    byte[] normalx = BitConverter.GetBytes(meshNormals[x].x).ToArray();
                    Array.Reverse(normalx);

                    vertexFileNew[0x10 + (rf.byteLength * x)] = normalx[0];
                    vertexFileNew[0x11 + (rf.byteLength * x)] = normalx[1];
                    vertexFileNew[0x12 + (rf.byteLength * x)] = normalx[2];
                    vertexFileNew[0x13 + (rf.byteLength * x)] = normalx[3];

                    byte[] normaly = BitConverter.GetBytes(meshNormals[x].y).ToArray();
                    Array.Reverse(normaly);

                    vertexFileNew[0x14 + (rf.byteLength * x)] = normaly[0];
                    vertexFileNew[0x15 + (rf.byteLength * x)] = normaly[1];
                    vertexFileNew[0x16 + (rf.byteLength * x)] = normaly[2];
                    vertexFileNew[0x17 + (rf.byteLength * x)] = normaly[3];

                    byte[] normalz = BitConverter.GetBytes(meshNormals[x].z).ToArray();
                    Array.Reverse(normalz);

                    vertexFileNew[0x18 + (rf.byteLength * x)] = normalz[0];
                    vertexFileNew[0x19 + (rf.byteLength * x)] = normalz[1];
                    vertexFileNew[0x1A + (rf.byteLength * x)] = normalz[2];
                    vertexFileNew[0x1B + (rf.byteLength * x)] = normalz[3];
                }
                else if (rf.byteLength == 0x20)
                {
                    // NORMALS
                    byte[] normalx = BitConverter.GetBytes(meshNormals[x].x).ToArray();
                    Array.Reverse(normalx);

                    vertexFileNew[0xC + (rf.byteLength * x)] = normalx[0];
                    vertexFileNew[0xD + (rf.byteLength * x)] = normalx[1];
                    vertexFileNew[0xE + (rf.byteLength * x)] = normalx[2];
                    vertexFileNew[0xF + (rf.byteLength * x)] = normalx[3];

                    byte[] normaly = BitConverter.GetBytes(meshNormals[x].y).ToArray();
                    Array.Reverse(normaly);

                    vertexFileNew[0x10 + (rf.byteLength * x)] = normaly[0];
                    vertexFileNew[0x11 + (rf.byteLength * x)] = normaly[1];
                    vertexFileNew[0x12 + (rf.byteLength * x)] = normaly[2];
                    vertexFileNew[0x13 + (rf.byteLength * x)] = normaly[3];

                    byte[] normalz = BitConverter.GetBytes(meshNormals[x].z).ToArray();
                    Array.Reverse(normalz);

                    vertexFileNew[0x14 + (rf.byteLength * x)] = normalz[0];
                    vertexFileNew[0x15 + (rf.byteLength * x)] = normalz[1];
                    vertexFileNew[0x16 + (rf.byteLength * x)] = normalz[2];
                    vertexFileNew[0x17 + (rf.byteLength * x)] = normalz[3];
                }
            }
            for (int x = 0; x < meshUVs.Count; x++)
            {
                if (rf.byteLength == 0x1C)
                {
                    byte[] UVXA = RenderFile.ToInt(meshUVs[x].x);
                    Array.Reverse(UVXA);

                    byte[] UVYA = RenderFile.ToInt(meshUVs[x].y);
                    Array.Reverse(UVYA);

                    vertexFileNew[0x18 + (rf.byteLength * x)] = UVXA[0];
                    vertexFileNew[0x19 + (rf.byteLength * x)] = UVXA[1];

                    vertexFileNew[0x1A + (rf.byteLength * x)] = UVYA[0];
                    vertexFileNew[0x1B + (rf.byteLength * x)] = UVYA[1];
                }
                else if (rf.byteLength == 0x20)
                {
                    byte[] UVXA = RenderFile.ToInt(meshUVs[x].x);
                    Array.Reverse(UVXA);

                    byte[] UVYA = RenderFile.ToInt(meshUVs[x].y);
                    Array.Reverse(UVYA);

                    vertexFileNew[0x18 + (rf.byteLength * x)] = UVXA[0];
                    vertexFileNew[0x19 + (rf.byteLength * x)] = UVXA[1];
                    vertexFileNew[0x1A + (rf.byteLength * x)] = UVYA[0];
                    vertexFileNew[0x1B + (rf.byteLength * x)] = UVYA[1];

                    vertexFileNew[0x1C + (rf.byteLength * x)] = 0;
                    vertexFileNew[0x1D + (rf.byteLength * x)] = 0;
                    vertexFileNew[0x1E + (rf.byteLength * x)] = 0;
                    vertexFileNew[0x1F + (rf.byteLength * x)] = 0;
                }
                else if (rf.byteLength == 0x40)
                {
                    if (rf.textureType == 0)
                    {
                        byte[] UVXA = RenderFile.ToInt(meshUVs[x].x);
                        Array.Reverse(UVXA);

                        byte[] UVYA = RenderFile.ToInt(meshUVs[x].y);
                        Array.Reverse(UVYA);

                        textureFileNew.Add(0xFF);
                        textureFileNew.Add(0xFF);
                        textureFileNew.Add(0xFF);
                        textureFileNew.Add(0xFF);

                        textureFileNew.Add(UVXA[0]);
                        textureFileNew.Add(UVXA[1]);
                        textureFileNew.Add(UVYA[0]);
                        textureFileNew.Add(UVYA[1]);
                    }
                    else if (rf.textureType == 1)
                    {
                        byte[] UVXA = RenderFile.ToInt(meshUVs[x].x);
                        Array.Reverse(UVXA);

                        byte[] UVYA = RenderFile.ToInt(meshUVs[x].y);
                        Array.Reverse(UVYA);

                        textureFileNew.Add(0xFF);
                        textureFileNew.Add(0xFF);
                        textureFileNew.Add(0xFF);
                        textureFileNew.Add(0xFF);

                        textureFileNew.Add(UVXA[0]);
                        textureFileNew.Add(UVXA[1]);
                        textureFileNew.Add(UVYA[0]);
                        textureFileNew.Add(UVYA[1]);

                        textureFileNew.Add(UVXA[0]);
                        textureFileNew.Add(UVXA[1]);
                        textureFileNew.Add(UVYA[0]);
                        textureFileNew.Add(UVYA[1]);
                    }
                }
            }

            for (int q = 0; q <= meshTriangles.Count - 3; q += 3)
            {
                byte[] tri1 = BitConverter.GetBytes(meshTriangles[q + 0]).ToArray();
                byte[] tri2 = BitConverter.GetBytes(meshTriangles[q + 1]).ToArray();
                byte[] tri3 = BitConverter.GetBytes(meshTriangles[q + 2]).ToArray();

                triangleFileNew.Add(tri3[1]);
                triangleFileNew.Add(tri3[0]);
                triangleFileNew.Add(tri2[1]);
                triangleFileNew.Add(tri2[0]);
                triangleFileNew.Add(tri1[1]);
                triangleFileNew.Add(tri1[0]);

                triangleFileNew.Add(0xFF);
                triangleFileNew.Add(0xFF);
            }

            int OriginalNDP3Size =
                rf.OriginalNDP3[0x4] * 0x1000000 +
                rf.OriginalNDP3[0x5] * 0x10000 +
                rf.OriginalNDP3[0x6] * 0x100 +
                rf.OriginalNDP3[0x7];

            int SizeBeforeNDP3Index = 0;
            int sizeMode            = 0;

            int x_ = 0;
            while (rf.OriginalXfbin[rf.NDP3Index - 4 + x_] * 0x1000000 + rf.OriginalXfbin[rf.NDP3Index - 3 + x_] * 0x10000 + rf.OriginalXfbin[rf.NDP3Index - 2 + x_] * 0x100 + rf.OriginalXfbin[rf.NDP3Index - 1 + x_] != OriginalNDP3Size)
            {
                x_--;
            }

            SizeBeforeNDP3Index = x_ - 4;

            List <byte> newNDP3File = new List <byte>();
            for (int x = 0; x < 0x10; x++)
            {
                newNDP3File.Add(rf.OriginalNDP3[x]);
            }

            //Add first section size
            for (int x = 0; x < 4; x++)
            {
                newNDP3File.Add(rf.OriginalNDP3[0x10 + x]);
            }
            int firstSectionSize_ = newNDP3File[16] * 0x1000000 + newNDP3File[17] * 0x10000 + newNDP3File[18] * 0x100 + newNDP3File[19];

            //Add triangle section size
            int TriangleSectionSize = triangleFileNew.Count;

            if (TriangleSectionSize < 0x100)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(TriangleSectionSize);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(arrayOfSize[0]);
            }
            else if (TriangleSectionSize >= 0x100 && TriangleSectionSize < 0x10000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(TriangleSectionSize);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(arrayOfSize[1]);
                newNDP3File.Add(arrayOfSize[0]);
            }
            else if (TriangleSectionSize >= 0x10000 && TriangleSectionSize < 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(TriangleSectionSize);
                newNDP3File.Add(0);
                newNDP3File.Add(arrayOfSize[2]);
                newNDP3File.Add(arrayOfSize[1]);
                newNDP3File.Add(arrayOfSize[0]);
            }
            else if (TriangleSectionSize >= 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(TriangleSectionSize);
                newNDP3File.Add(arrayOfSize[3]);
                newNDP3File.Add(arrayOfSize[2]);
                newNDP3File.Add(arrayOfSize[1]);
                newNDP3File.Add(arrayOfSize[0]);
            }

            //Check vertex length
            if (rf.byteLength == 0x40)
            {
                //Add texture section size
                int TextureSectionSize = textureFileNew.Count;

                if (TextureSectionSize < 0x100)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(TextureSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (TextureSectionSize >= 0x100 && TextureSectionSize < 0x10000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(TextureSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (TextureSectionSize >= 0x10000 && TextureSectionSize < 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(TextureSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (TextureSectionSize >= 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(TextureSectionSize);
                    newNDP3File.Add(arrayOfSize[3]);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }

                //Add vertex section size
                int VertexSectionSize = vertexFileNew.Count;

                if (VertexSectionSize < 0x100)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x100 && VertexSectionSize < 0x10000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x10000 && VertexSectionSize < 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(arrayOfSize[3]);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
            }
            else if (rf.byteLength == 0x1C)
            {
                //Add vertex section size
                int VertexSectionSize = vertexFileNew.Count;

                if (VertexSectionSize < 0x100)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x100 && VertexSectionSize < 0x10000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x10000 && VertexSectionSize < 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(arrayOfSize[3]);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
            }
            else if (rf.byteLength == 0x20)
            {
                //Add vertex section size
                int VertexSectionSize = vertexFileNew.Count;

                if (VertexSectionSize < 0x100)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x100 && VertexSectionSize < 0x10000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x10000 && VertexSectionSize < 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(0);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                else if (VertexSectionSize >= 0x1000000)
                {
                    byte[] arrayOfSize = BitConverter.GetBytes(VertexSectionSize);
                    newNDP3File.Add(arrayOfSize[3]);
                    newNDP3File.Add(arrayOfSize[2]);
                    newNDP3File.Add(arrayOfSize[1]);
                    newNDP3File.Add(arrayOfSize[0]);
                }
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
                newNDP3File.Add(0);
            }

            // Add rest of header
            for (int x = 0x20; x < 0x30; x++)
            {
                newNDP3File.Add(rf.OriginalNDP3[x]);
            }

            // Add first section
            for (int x = 0; x < firstSectionSize_; x++)
            {
                newNDP3File.Add(rf.OriginalNDP3[0x30 + x]);
            }

            // Add triangle section
            for (int x = 0; x < triangleFileNew.Count; x++)
            {
                newNDP3File.Add(triangleFileNew[x]);
            }

            if (rf.byteLength == 0x40)
            {
                // Add texture section
                for (int x = 0; x < textureFileNew.Count; x++)
                {
                    newNDP3File.Add(textureFileNew[x]);
                }
                // Add vertex section
                for (int x = 0; x < vertexFileNew.Count; x++)
                {
                    newNDP3File.Add(vertexFileNew[x]);
                }
            }
            else if (rf.byteLength == 0x1C || rf.byteLength == 0x20)
            {
                // Add vertex section
                for (int x = 0; x < vertexFileNew.Count; x++)
                {
                    newNDP3File.Add(vertexFileNew[x]);
                }
            }

            int newNDP3Size = newNDP3File.Count + OriginalNDP3Size - 48 - firstSectionSize_ - rf.triangleFile.Length - rf.textureMapFile.Length - rf.fileBytes.Length;

            List <byte> newXfbinFile = new List <byte>();

            // Copy old .xfbin file until ndp3
            for (int x = 0; x < rf.NDP3Index; x++)
            {
                newXfbinFile.Add(rf.OriginalXfbin[x]);
            }

            // Add new size before NDP3
            if (newNDP3Size < 0x100)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);

                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index]     = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 1] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 2] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 3] = arrayOfSize[0];
            }
            else if (newNDP3Size >= 0x100 && newNDP3Size < 0x10000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);

                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index]     = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 1] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 2] = arrayOfSize[1];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 3] = arrayOfSize[0];
            }
            else if (newNDP3Size >= 0x10000 && newNDP3Size < 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);

                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index]     = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 1] = arrayOfSize[2];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 2] = arrayOfSize[1];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 3] = arrayOfSize[0];
            }
            else if (newNDP3Size >= 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);

                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index]     = arrayOfSize[3];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 1] = arrayOfSize[2];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 2] = arrayOfSize[1];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index + 3] = arrayOfSize[0];
            }

            // Copy new NDP3
            for (int x = 0; x < newNDP3File.Count; x++)
            {
                newXfbinFile.Add(newNDP3File[x]);
            }

            // Fix new NDP3 size
            if (newNDP3Size < 0x100)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 4] = 0;
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 5] = 0;
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 6] = 0;
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 7] = arrayOfSize[0];
            }
            else if (newNDP3Size >= 0x100 && newNDP3Size < 0x10000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 4] = 0;
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 5] = 0;
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 6] = arrayOfSize[1];
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 7] = arrayOfSize[0];
            }
            else if (newNDP3Size >= 0x10000 && newNDP3Size < 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 4] = 0;
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 5] = arrayOfSize[2];
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 6] = arrayOfSize[1];
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 7] = arrayOfSize[0];
            }
            else if (newNDP3Size >= 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size);
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 4] = arrayOfSize[3];
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 5] = arrayOfSize[2];
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 6] = arrayOfSize[1];
                newXfbinFile[newXfbinFile.Count - newNDP3File.Count + 7] = arrayOfSize[0];
            }

            // Copy original name and rest of xfbin
            for (int x = rf.NDP3Index + (0x30 + firstSectionSize_ + rf.triangleFile.Length + rf.textureMapFile.Length + rf.fileBytes.Length); x < rf.OriginalXfbin.Length; x++)
            {
                newXfbinFile.Add(rf.OriginalXfbin[x]);
            }

            // Fix new NDP3 size 36
            int DifferenceBetweenSizes =
                (rf.OriginalXfbin[rf.NDP3Index + SizeBeforeNDP3Index - 0x24] * 0x1000000 +
                 rf.OriginalXfbin[rf.NDP3Index + SizeBeforeNDP3Index - 0x23] * 0x10000 +
                 rf.OriginalXfbin[rf.NDP3Index + SizeBeforeNDP3Index - 0x22] * 0x100 +
                 rf.OriginalXfbin[rf.NDP3Index + SizeBeforeNDP3Index - 0x21]) - OriginalNDP3Size;

            if (newNDP3Size + DifferenceBetweenSizes < 0x100)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size + DifferenceBetweenSizes);
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x24] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x23] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x22] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x21] = arrayOfSize[0];
            }
            else if (newNDP3Size + DifferenceBetweenSizes >= 0x100 && newNDP3Size + DifferenceBetweenSizes < 0x10000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size + DifferenceBetweenSizes);
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x24] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x23] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x22] = arrayOfSize[1];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x21] = arrayOfSize[0];
            }
            else if (newNDP3Size + DifferenceBetweenSizes >= 0x10000 && newNDP3Size + DifferenceBetweenSizes < 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size + DifferenceBetweenSizes);
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x24] = 0;
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x23] = arrayOfSize[2];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x22] = arrayOfSize[1];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x21] = arrayOfSize[0];
            }
            else if (newNDP3Size + DifferenceBetweenSizes >= 0x1000000)
            {
                byte[] arrayOfSize = BitConverter.GetBytes(newNDP3Size + DifferenceBetweenSizes);
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x24] = arrayOfSize[3];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x23] = arrayOfSize[2];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x22] = arrayOfSize[1];
                newXfbinFile[rf.NDP3Index + SizeBeforeNDP3Index - 0x21] = arrayOfSize[0];
            }

            // FIX 6C AND 80
            if (dial == DialogResult.Yes)
            {
                if (rf.groupCount == 1)
                {
                    //Fix 6C
                    Int32 vertexCountTemp = VertexCount;

                    if (vertexCountTemp <= 0x100)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(vertexCountTemp);
                        newXfbinFile[rf.NDP3Index + 0x6A] = 0;
                        newXfbinFile[rf.NDP3Index + 0x6B] = 0;
                        newXfbinFile[rf.NDP3Index + 0x6C] = 0;
                        newXfbinFile[rf.NDP3Index + 0x6D] = arrayOfSize[0];
                    }
                    else if (vertexCountTemp > 0x100 && vertexCountTemp <= 0x10000)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(vertexCountTemp);
                        newXfbinFile[rf.NDP3Index + 0x6A] = 0;
                        newXfbinFile[rf.NDP3Index + 0x6B] = 0;
                        newXfbinFile[rf.NDP3Index + 0x6C] = arrayOfSize[1];
                        newXfbinFile[rf.NDP3Index + 0x6D] = arrayOfSize[0];
                    }
                    else if (vertexCountTemp > 0x10000 && vertexCountTemp <= 0x1000000)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(vertexCountTemp);
                        newXfbinFile[rf.NDP3Index + 0x6A] = 0;
                        newXfbinFile[rf.NDP3Index + 0x6B] = arrayOfSize[2];
                        newXfbinFile[rf.NDP3Index + 0x6C] = arrayOfSize[1];
                        newXfbinFile[rf.NDP3Index + 0x6D] = arrayOfSize[0];
                    }
                    else if (vertexCountTemp > 0x1000000)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(vertexCountTemp);
                        newXfbinFile[rf.NDP3Index + 0x6A] = arrayOfSize[3];
                        newXfbinFile[rf.NDP3Index + 0x6B] = arrayOfSize[2];
                        newXfbinFile[rf.NDP3Index + 0x6C] = arrayOfSize[1];
                        newXfbinFile[rf.NDP3Index + 0x6D] = arrayOfSize[0];
                    }

                    //Fix 80
                    if (triangleFileNew.ToArray().Length / 2 <= 0x100)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(triangleFileNew.ToArray().Length / 2);
                        newXfbinFile[rf.NDP3Index + 0x7E] = 0;
                        newXfbinFile[rf.NDP3Index + 0x7F] = 0;
                        newXfbinFile[rf.NDP3Index + 0x80] = 0;
                        newXfbinFile[rf.NDP3Index + 0x81] = arrayOfSize[0];
                    }
                    else if (triangleFileNew.ToArray().Length / 2 > 0x100 && triangleFileNew.ToArray().Length / 2 <= 0x10000)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(triangleFileNew.ToArray().Length / 2);
                        newXfbinFile[rf.NDP3Index + 0x7E] = 0;
                        newXfbinFile[rf.NDP3Index + 0x7F] = 0;
                        newXfbinFile[rf.NDP3Index + 0x80] = arrayOfSize[1];
                        newXfbinFile[rf.NDP3Index + 0x81] = arrayOfSize[0];
                    }
                    else if (triangleFileNew.ToArray().Length / 2 > 0x10000 && triangleFileNew.ToArray().Length / 2 <= 0x1000000)
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(triangleFileNew.ToArray().Length / 2);
                        newXfbinFile[rf.NDP3Index + 0x7E] = 0;
                        newXfbinFile[rf.NDP3Index + 0x7F] = arrayOfSize[2];
                        newXfbinFile[rf.NDP3Index + 0x80] = arrayOfSize[1];
                        newXfbinFile[rf.NDP3Index + 0x81] = arrayOfSize[0];
                    }
                    else
                    {
                        byte[] arrayOfSize = BitConverter.GetBytes(triangleFileNew.ToArray().Length / 2);
                        newXfbinFile[rf.NDP3Index + 0x7E] = arrayOfSize[3];
                        newXfbinFile[rf.NDP3Index + 0x7F] = arrayOfSize[2];
                        newXfbinFile[rf.NDP3Index + 0x80] = arrayOfSize[1];
                        newXfbinFile[rf.NDP3Index + 0x81] = arrayOfSize[0];
                    }
                }
            }

            File.WriteAllBytes(path__, newXfbinFile.ToArray());
        }
        catch (Exception exception)
        {
            MessageBox.Show(exception.ToString());
        }
    }
Ejemplo n.º 12
0
 public void Start()
 {
     r_file = GameObject.Find("MODEL VIEWER").GetComponent <RenderFile>();
 }