I'm too good, progressive streaming with only frustum sent, and if
nothing, just stream
This commit is contained in:
@@ -714,3 +714,30 @@ PointerCamera.prototype.redoable = function() {
|
||||
return this.history.redoable();
|
||||
}
|
||||
|
||||
PointerCamera.prototype.toList = function() {
|
||||
this.updateMatrix();
|
||||
this.updateMatrixWorld();
|
||||
|
||||
var frustum = new THREE.Frustum();
|
||||
var projScreenMatrix = new THREE.Matrix4();
|
||||
projScreenMatrix.multiplyMatrices(this.projectionMatrix, this.matrixWorldInverse);
|
||||
|
||||
frustum.setFromMatrix(new THREE.Matrix4().multiplyMatrices(this.projectionMatrix, this.matrixWorldInverse));
|
||||
|
||||
var ret =
|
||||
[[this.position.x, this.position.y, this.position.z],
|
||||
[this.target.x, this.target.y, this.target.z]];
|
||||
|
||||
for (var i = 0; i < frustum.planes.length; i++) {
|
||||
|
||||
var p = frustum.planes[i];
|
||||
|
||||
ret.push([
|
||||
p.normal.x, p.normal.y, p.normal.z, p.constant
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,8 +202,7 @@ ProgressiveLoaderGeometry.prototype.getCamera = function() {
|
||||
if (this.camera === null)
|
||||
return null;
|
||||
|
||||
return [this.camera.position.x, this.camera.position.y, this.camera.position.z,
|
||||
this.camera.target.x, this.camera.target.y, this.camera.target.z];
|
||||
return this.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
25
js/prototype/initScene.js
vendored
25
js/prototype/initScene.js
vendored
@@ -637,14 +637,23 @@ function initSponzaScene(scene, collidableObjects, loader, camera) {
|
||||
|
||||
|
||||
loader.getCamera = function() {
|
||||
return [
|
||||
loader.camera.position.x * 10,
|
||||
loader.camera.position.y * 10,
|
||||
loader.camera.position.z * 10,
|
||||
loader.camera.target.x * 10,
|
||||
loader.camera.target.y * 10,
|
||||
loader.camera.target.z * 10
|
||||
];
|
||||
var ret = loader.camera.toList();
|
||||
ret[0][0] *= 10;
|
||||
ret[0][1] *= 10;
|
||||
ret[0][2] *= 10;
|
||||
|
||||
ret[1][0] *= 10;
|
||||
ret[1][1] *= 10;
|
||||
ret[1][2] *= 10;
|
||||
|
||||
// Planes
|
||||
for (var i = 2; i < ret.length; i++) {
|
||||
|
||||
ret[i][3] *= 10;
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
loader.obj.scale.set(0.1,0.1,0.1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user