Example #1
0
exports.num_render_targets = function() {

    var list = [];

    var memory = 0;

    var scene = m_scenes.get_active();

    var subscenes = m_scenes.get_all_subscenes(scene);

    for (var i = 0; i < subscenes.length; i++) {

        var subs = subscenes[i];

        if (subs.type == "SINK")
            continue;

        var cam = subs.camera;
        var c_at = cam.color_attachment;
        var d_at = cam.depth_attachment;

        var subs_textures = [cam.color_attachment, cam.depth_attachment];
        subs_textures.push.apply(subs_textures, subs.textures_internal);

        for (var j = 0; j < subs_textures.length; j++) {
            var tex = subs_textures[j];
            if (m_textures.is_texture(tex) && list.indexOf(tex) == -1) {
                list.push(tex);
                memory += cam.width * cam.height * m_textures.get_texture_texel_size(tex);
            }
        }
    }

    return {"number": list.length, "memory": (memory / 1024 / 1024)};
}
Example #2
0
exports.object_info = function(name) {
    var scene = m_scenes.get_active();

    var objs = m_obj.get_scene_objs(scene, "MESH", m_obj.DATA_ID_ALL);

    for (var i = 0; i < objs.length; i++) {
        var obj = objs[i];

        if (obj.name != name)
            continue;

        m_print.log("Object", obj);

        var subscenes = m_scenes.get_all_subscenes(scene);

        for (var j = 0; j < subscenes.length; j++) {
            var subs = subscenes[j];
            var bundles = subs.bundles;

            var print_bundles = [];

            for (var k = 0; k < bundles.length; k++) {
                if (bundles[k].obj_render == obj.render)
                    print_bundles.push(bundles[k]);
            }

            m_print.log("Subscene " + subs.type, print_bundles);
        }
    }
}
Example #3
0
exports.geometry_stats = function() {

    var scene = m_scenes.get_active();
    var subscenes = m_scenes.get_all_subscenes(scene);
    var unique_batches = {};

    for (var i = 0; i < subscenes.length; i++) {

        var subs = subscenes[i];

        if (subs.type == "SINK" || subs.type == "WIREFRAME")
            continue;

        var bundles = subs.bundles;
        for (var j = 0; j < bundles.length; j++) {
            var batch = bundles[j].batch;
            var render = bundles[j].obj_render;
            // NOTE: some objects (particles) do not have any submesh
            if (batch)
                if (subs.type != "COLOR_PICKING" && subs.type != "OUTLINE_MASK"
                        || render.origin_selectable || render.origin_outlining)
                    unique_batches[batch.id] = batch;
        }
    }

    var vbo_number = 0;
    var vbo_memory = 0;
    var ibo_number = 0;
    var ibo_memory = 0;

    for (var id in unique_batches) {
        var batch = unique_batches[id];
        var bufs_data = batch.bufs_data;

        if (bufs_data.debug_ibo_bytes) {
            ibo_number++;
            ibo_memory += bufs_data.debug_ibo_bytes / (1024 * 1024);
        }

        vbo_number++;
        vbo_memory += bufs_data.debug_vbo_bytes / (1024 * 1024);
    }

    return {"vbo_number": vbo_number, "vbo_memory": vbo_memory,
            "ibo_number": ibo_number, "ibo_memory": ibo_memory};
}