Fixed project setup by:
Moving pointclouds to resources/pointclouds Adding "gulp webserver" command option to start a local webserver for development.
This commit is contained in:
parent
d7725694f1
commit
d7ef627a3b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16
build/potree/potree.min.js
vendored
16
build/potree/potree.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
65
gulpfile.js
65
gulpfile.js
@ -8,6 +8,7 @@ var rename = require('gulp-rename');
|
||||
var uglify = require('gulp-uglify');
|
||||
var gutil = require('gulp-util');
|
||||
var through = require('through');
|
||||
var connect = require('gulp-connect');
|
||||
var os = require('os');
|
||||
var File = gutil.File;
|
||||
|
||||
@ -94,12 +95,12 @@ gulp.task("workers", function(){
|
||||
.pipe(encodeWorker('laslaz-worker.js', "Potree.workers.laslaz"))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/workers'));
|
||||
|
||||
|
||||
gulp.src(workers.LASDecoder)
|
||||
.pipe(encodeWorker('lasdecoder-worker.js', "Potree.workers.lasdecoder"))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/workers'));
|
||||
|
||||
|
||||
gulp.src(workers.BinaryDecorder)
|
||||
.pipe(encodeWorker('BinaryDecoderWorker.js', "Potree.workers.binaryDecoder"))
|
||||
.pipe(size({showFiles: true}))
|
||||
@ -122,12 +123,12 @@ gulp.task("scripts", ['workers','shaders'], function(){
|
||||
.pipe(uglify({preserveComments: 'some'}))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/potree'));
|
||||
|
||||
|
||||
gulp.src(paths.laslaz)
|
||||
.pipe(concat('laslaz.js'))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/potree'));
|
||||
|
||||
|
||||
gulp.src(paths.html)
|
||||
.pipe(gulp.dest('build/potree'));
|
||||
|
||||
@ -136,44 +137,48 @@ gulp.task("scripts", ['workers','shaders'], function(){
|
||||
|
||||
gulp.task('build', ['scripts']);
|
||||
|
||||
gulp.task('webserver', function() {
|
||||
connect.server();
|
||||
});
|
||||
|
||||
|
||||
var encodeWorker = function(fileName, varname, opt){
|
||||
if (!fileName) throw new PluginError('gulp-concat', 'Missing fileName option for gulp-concat');
|
||||
if (!opt) opt = {};
|
||||
if (!opt.newLine) opt.newLine = gutil.linefeed;
|
||||
|
||||
|
||||
var buffer = [];
|
||||
var firstFile = null;
|
||||
|
||||
|
||||
function bufferContents(file){
|
||||
if (file.isNull()) return; // ignore
|
||||
if (file.isStream()) return this.emit('error', new PluginError('gulp-concat', 'Streaming not supported'));
|
||||
|
||||
|
||||
if (!firstFile) firstFile = file;
|
||||
|
||||
|
||||
var string = file.contents.toString('utf8');
|
||||
buffer.push(string);
|
||||
}
|
||||
|
||||
|
||||
function endStream(){
|
||||
if (buffer.length === 0) return this.emit('end');
|
||||
|
||||
|
||||
var joinedContents = buffer.join("");
|
||||
var content = varname + " = new Potree.WorkerManager(atob(\"" + new Buffer(joinedContents).toString('base64') + "\"));";
|
||||
|
||||
|
||||
var joinedPath = path.join(firstFile.base, fileName);
|
||||
|
||||
|
||||
var joinedFile = new File({
|
||||
cwd: firstFile.cwd,
|
||||
base: firstFile.base,
|
||||
path: joinedPath,
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
|
||||
|
||||
this.emit('data', joinedFile);
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
|
||||
return through(bufferContents, endStream);
|
||||
};
|
||||
|
||||
@ -181,33 +186,33 @@ var encodeShader = function(fileName, varname, opt){
|
||||
if (!fileName) throw new PluginError('gulp-concat', 'Missing fileName option for gulp-concat');
|
||||
if (!opt) opt = {};
|
||||
if (!opt.newLine) opt.newLine = gutil.linefeed;
|
||||
|
||||
|
||||
var buffer = [];
|
||||
var files = [];
|
||||
var firstFile = null;
|
||||
|
||||
|
||||
function bufferContents(file){
|
||||
if (file.isNull()) return; // ignore
|
||||
if (file.isStream()) return this.emit('error', new PluginError('gulp-concat', 'Streaming not supported'));
|
||||
|
||||
|
||||
if (!firstFile) firstFile = file;
|
||||
|
||||
|
||||
var string = file.contents.toString('utf8');
|
||||
buffer.push(string);
|
||||
files.push(file);
|
||||
}
|
||||
|
||||
|
||||
function endStream(){
|
||||
if (buffer.length === 0) return this.emit('end');
|
||||
|
||||
|
||||
var joinedContent = "";
|
||||
for(var i = 0; i < buffer.length; i++){
|
||||
var b = buffer[i];
|
||||
var file = files[i];
|
||||
|
||||
|
||||
var fname = file.path.replace(file.base, "");
|
||||
console.log(fname);
|
||||
|
||||
|
||||
var content = new Buffer(b).toString();
|
||||
var prep = "Potree.Shaders[\"" + fname + "\"] = [\n";
|
||||
var lines = content.split("\n");
|
||||
@ -217,28 +222,22 @@ var encodeShader = function(fileName, varname, opt){
|
||||
prep += " \"" + line + "\",\n";
|
||||
}
|
||||
prep += "].join(\"\\n\");\n\n";
|
||||
|
||||
|
||||
joinedContent += prep;
|
||||
}
|
||||
|
||||
|
||||
var joinedPath = path.join(firstFile.base, fileName);
|
||||
|
||||
|
||||
var joinedFile = new File({
|
||||
cwd: firstFile.cwd,
|
||||
base: firstFile.base,
|
||||
path: joinedPath,
|
||||
contents: new Buffer(joinedContent)
|
||||
});
|
||||
|
||||
|
||||
this.emit('data', joinedFile);
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
|
||||
return through(bufferContents, endStream);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
"devDependencies": {
|
||||
"gulp": "~3.5.2",
|
||||
"gulp-concat": "~2.1.7",
|
||||
"gulp-connect": "^2.3.1",
|
||||
"gulp-rename": "~1.0.0",
|
||||
"gulp-uglify": "~0.2.1",
|
||||
"gulp-util": "~2.2.20",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user