Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xeogl.stats doesn't update on deletion of components from a scene. #333

Open
Thornton-developer opened this issue Dec 18, 2020 · 0 comments

Comments

@Thornton-developer
Copy link

I am trying to optimize my OBJ model using MergeVertices API. while checking for the parameters(modified indices, positions, uvs, normals) using xeogl.stats, It does update the stats, but wrongly, or abruptly(example : normals =65.3333).

Please see the code below.
function loadObj(objFile) {
var scene = xeogl.getDefaultScene();
// scene.clear();
logJSON({});

var mesh;
xeogl.loadOBJGeometry(scene, objFile, function (geometry) {
    var position_indices=xeogl.math.mergeVertices(geometry.positions,geometry.normals,geometry.uv,geometry.indices);
    var geom=new xeogl.Geometry(scene,{
        id:geometry.id+"_",
        meta:geometry.meta,
        primitive:geometry.primitive,
        positions:position_indices.positions,
        normals:position_indices.normals,
        uv:position_indices.uv,
        colors:geometry.colors,
        indices:position_indices.indices,
        quantized:true,
        combined:true,
        edgeThreshold:geometry._edgeThreshold
      });
    
    // scene.components["_18_"].destroy();
    geometry= geom;
    mesh = new xeogl.Mesh({        
    geometry:geom
    });
   
    scene.on("tick", function () {
         stats = xeogl.stats;
        logJSON(stats);
    });
});

new xeogl.CameraControl();

}

function onModelChange(elem) {
let objURL = URL.createObjectURL(elem.files[0]);
loadObj(objURL);
}

function logJSON(json) {
// json.client.browser = json.client.browser.substring(0, 10) + "...";
document.getElementById("logs").innerHTML = JSON.stringify(json, null, 4);
}

Expected behavior
It should display updated values after removing the duplicate vertices(using MergeVertices API) but instead of reducing the values of parameters, xeogl.stats produces higher values(normals before were 200, after merge vertices API call xeogl.stats shows 65.333 ,which is wrong).

Desktop (please complete the following information):

  • Browser : chrome, Firefox
    xeogl stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant