Skip to content

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

@Thornton-developer

Description

@Thornton-developer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions