function exportLightMaps(fileName, pngBool) {

            var saveFun;
            var content;
            var zip;

            if (pngBool === undefined) {

                pngBool = false;

            }

            if (fileName === undefined || fileName === null) {

                fileName = getCurrentHtmlFileName() + ".zip";

            }

            try {

                if (typeof JSZip === "undefined") {

                    log("JSZip undefined");
                    return;
                }

                if (typeof saveAs === "undefined") {

                    // Fallback(polyfill)
                    saveFun = saveAs;

                } else {

                    saveFun = saveAs;

                }

                zip = new JSZip();

                __scene.traverse(function (m) {

                    var folderName;

                    if (m.userData.baking !== undefined && m.userData.baking.bakeMe === true) {

                        folderName = "mesh" + m.id;
                        if (pngBool) {

                            var canvas = getCanvas(m.userData.baking.textureWidth, m.userData.baking.textureHeight, m.material.lightMap.image.data);
                            var dataurl = canvas.toDataURL("image/png");

                            zip.folder(folderName).file(_lightMapPngFileName, dataurl.substr(dataurl.indexOf(",") + 1), {base64: true});

                        }
                        zip.folder(folderName).file(_lightMapFileName, m.material.lightMap.image.data);
                        zip.folder(folderName).file(_uvsetFileName, JSON.stringify(m.geometry.faceVertexUvs[1]));
                        zip.folder(folderName).file(_bakingFileName, JSON.stringify(m.userData.baking));

                    }

                });

                zip.file(_configFileName, toJSON());

                content = zip.generate({type: "blob"});
                saveFun(content, fileName);

            } catch (e) {

                log(e);

            }
        }
/**
         *
         * Export all baked lightmaps into a zip file.
         *
         * Attention:
         * - only works with jszip (source: https://stuk.github.io/jszip/)
         * - if saveAs doesn't work, use FileSaver fromh ttps://github.com/eligrey/FileSaver.js
         *
         * @param scene
         * @param fileName
         */
Export all baked lightmaps into a zip file.

@param scene
@param fileName
Export all baked lightmaps into a zip file . @param scene @param fileName
function exportLightMaps(fileName, pngBool) {
            var saveFun;
            var content;
            var zip;
            if (pngBool === undefined) {
                pngBool = false;
            }
            if (fileName === undefined || fileName === null) {
                fileName = getCurrentHtmlFileName() + ".zip";
            }
            try {
                if (typeof JSZip === "undefined") {
                    log("JSZip undefined");
                    return;
                }
                if (typeof saveAs === "undefined") {
                    saveFun = saveAs;
                } else {
                    saveFun = saveAs;
                }
                zip = new JSZip();
                __scene.traverse(function (m) {
                    var folderName;
                    if (m.userData.baking !== undefined && m.userData.baking.bakeMe === true) {
                        folderName = "mesh" + m.id;
                        if (pngBool) {
                            var canvas = getCanvas(m.userData.baking.textureWidth, m.userData.baking.textureHeight, m.material.lightMap.image.data);
                            var dataurl = canvas.toDataURL("image/png");
                            zip.folder(folderName).file(_lightMapPngFileName, dataurl.substr(dataurl.indexOf(",") + 1), {base64: true});
                        }
                        zip.folder(folderName).file(_lightMapFileName, m.material.lightMap.image.data);
                        zip.folder(folderName).file(_uvsetFileName, JSON.stringify(m.geometry.faceVertexUvs[1]));
                        zip.folder(folderName).file(_bakingFileName, JSON.stringify(m.userData.baking));
                    }
                });
                zip.file(_configFileName, toJSON());
                content = zip.generate({type: "blob"});
                saveFun(content, fileName);
            } catch (e) {
                log(e);
            }
        }
function exportLightMaps ( fileName , pngBool ) { var saveFun ; var content ; var zip ; if ( pngBool === undefined ) { pngBool = false ; } if ( fileName === undefined || fileName === null ) { fileName = getCurrentHtmlFileName ( ) + ".zip" ; } try { if ( typeof JSZip === "undefined" ) { log ( "JSZip undefined" ) ; return ; } if ( typeof saveAs === "undefined" ) { saveFun = saveAs ; } else { saveFun = saveAs ; } zip = new JSZip ( ) ; __scene . traverse ( function ( m ) { var folderName ; if ( m . userData . baking !== undefined && m . userData . baking . bakeMe === true ) { folderName = "mesh" + m . id ; if ( pngBool ) { var canvas = getCanvas ( m . userData . baking . textureWidth , m . userData . baking . textureHeight , m . material . lightMap . image . data ) ; var dataurl = canvas . toDataURL ( "image/png" ) ; zip . folder ( folderName ) . file ( _lightMapPngFileName , dataurl . substr ( dataurl . indexOf ( "," ) + 1 ) , { base64 : true } ) ; } zip . folder ( folderName ) . file ( _lightMapFileName , m . material . lightMap . image . data ) ; zip . folder ( folderName ) . file ( _uvsetFileName , JSON . stringify ( m . geometry . faceVertexUvs [ 1 ] ) ) ; zip . folder ( folderName ) . file ( _bakingFileName , JSON . stringify ( m . userData . baking ) ) ; } } ) ; zip . file ( _configFileName , toJSON ( ) ) ; content = zip . generate ( { type : "blob" } ) ; saveFun ( content , fileName ) ; } catch ( e ) { log ( e ) ; } }
Export all baked lightmaps into a zip file.
Export all baked lightmaps into a zip file .
// Fallback(polyfill)