function sceneToJSON() {

        var json = __scene.toJSON();

        json.object.children.forEach(function (ele) {

            // AreaLight is not handled atm, so we do it
            if (ele.type === "AreaLight") {

                __scene.traverse(
                    function (mesh) {

                        if (mesh.uuid === ele.uuid) {

                            ele.intensity = mesh.intensity;

                            ele.width = mesh.width;
                            ele.height = mesh.height;

                            ele.constantAttenuation = mesh.constantAttenuation;
                            ele.linearAttenuation = mesh.linearAttenuation;
                            ele.quadraticAttenuation = mesh.quadraticAttenuation;

                        }

                    }
                );

            }

        });

        json.materials.forEach(function (ele) {

                // Material.map is not handled atm, so we do it
                if (ele.type === "MeshBasicMaterial" || ele.type === "MeshLambertMaterial" || ele.type === "MeshPhongmaterial") {

                    __scene.traverse(
                        function (mesh) {

                            if (mesh.material !== undefined && mesh.material.uuid === ele.uuid && mesh.material.map !== null && mesh.material.map.image.data !== undefined) {

                                ele.map = {image: mesh.material.map.image};

                            }

                        }
                    );

                }

            }
        );

        return json;
    }
/**
     * Creates a JSON from the entire scene (scene.toJSON).
     * It also handles AreaLights which are not supported in r71
     * @returns {*}
     */
Creates a JSON from the entire scene (scene.toJSON).
It also handles AreaLights which are not supported in r71
@returns {*}
Creates a JSON from the entire scene ( scene . toJSON ) . It also handles AreaLights which are not supported in r71 @returns { * }
function sceneToJSON() {
        var json = __scene.toJSON();
        json.object.children.forEach(function (ele) {
            if (ele.type === "AreaLight") {
                __scene.traverse(
                    function (mesh) {
                        if (mesh.uuid === ele.uuid) {
                            ele.intensity = mesh.intensity;
                            ele.width = mesh.width;
                            ele.height = mesh.height;
                            ele.constantAttenuation = mesh.constantAttenuation;
                            ele.linearAttenuation = mesh.linearAttenuation;
                            ele.quadraticAttenuation = mesh.quadraticAttenuation;
                        }
                    }
                );
            }
        });
        json.materials.forEach(function (ele) {
                if (ele.type === "MeshBasicMaterial" || ele.type === "MeshLambertMaterial" || ele.type === "MeshPhongmaterial") {
                    __scene.traverse(
                        function (mesh) {
                            if (mesh.material !== undefined && mesh.material.uuid === ele.uuid && mesh.material.map !== null && mesh.material.map.image.data !== undefined) {
                                ele.map = {image: mesh.material.map.image};
                            }
                        }
                    );
                }
            }
        );
        return json;
    }
function sceneToJSON ( ) { var json = __scene . toJSON ( ) ; json . object . children . forEach ( function ( ele ) { if ( ele . type === "AreaLight" ) { __scene . traverse ( function ( mesh ) { if ( mesh . uuid === ele . uuid ) { ele . intensity = mesh . intensity ; ele . width = mesh . width ; ele . height = mesh . height ; ele . constantAttenuation = mesh . constantAttenuation ; ele . linearAttenuation = mesh . linearAttenuation ; ele . quadraticAttenuation = mesh . quadraticAttenuation ; } } ) ; } } ) ; json . materials . forEach ( function ( ele ) { if ( ele . type === "MeshBasicMaterial" || ele . type === "MeshLambertMaterial" || ele . type === "MeshPhongmaterial" ) { __scene . traverse ( function ( mesh ) { if ( mesh . material !== undefined && mesh . material . uuid === ele . uuid && mesh . material . map !== null && mesh . material . map . image . data !== undefined ) { ele . map = { image : mesh . material . map . image } ; } } ) ; } } ) ; return json ; }
Creates a JSON from the entire scene (scene.toJSON).
Creates a JSON from the entire scene ( scene . toJSON ) .
// AreaLight is not handled atm, so we do it // Material.map is not handled atm, so we do it