简体   繁体   中英

Three.js save modified mesh vertices r67

I have created a plane and when I click on a vertex, the vertex will move and render as expected . My problem is saving the mesh to a text file.The vertices don't seem to update on the file as expected.

If I move a vertex before the second render the vertex position will reflect on the external text file.

My question is once I have moved around a bunch of vertices x,y,z positions how do I save the result that appears on my screen as it seems to only save the original mesh .

       var guiControls = new function () {
           var t = ['Test Save File'];
           this.save_mesh = function () {
           for (var i = 0, j = ground.geometry.vertices.length; i < j; i++) {
           t.push('['+ ground.geometry.vertices[i].x+','+ ground.geometry.vertices[i].y+ ','+ objects[0].geometry.vertices[i].z+ '@:'+']');
           }

           function passMesh(){
           var data = {
           value: t
           };

       $.post("./php/savefile.php", data);
       }
       passMesh();

     };

I have tried to use the updates available:

        geo.dynamic = true;
        geo.computeVertexNormals();
        geo.computeFaceNormals();
        geo.verticesNeedUpdate = true;
        geo.normalsNeedUpdate = true;

Any help is appreciated.

In 3D graphics all changes are only matrix transformations of the original mesh, which do not actually change this mesh. So my guess is that you need to apply the transformations to you objects prior to the export. try: .applyMatrix

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM