Stuff
This commit is contained in:
parent
df876748c1
commit
cc03554e5c
|
@ -28,6 +28,10 @@ L3D.ReplayCamera = function() {
|
||||||
|
|
||||||
this.isArrow = false;
|
this.isArrow = false;
|
||||||
|
|
||||||
|
this.totalTime = 0;
|
||||||
|
|
||||||
|
this.quittingTime = Infinity;
|
||||||
|
|
||||||
};
|
};
|
||||||
L3D.ReplayCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
|
L3D.ReplayCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
|
||||||
L3D.ReplayCamera.prototype.constructor = L3D.ReplayCamera;
|
L3D.ReplayCamera.prototype.constructor = L3D.ReplayCamera;
|
||||||
|
@ -44,6 +48,10 @@ L3D.ReplayCamera.prototype.start = function() {
|
||||||
|
|
||||||
// Update function
|
// Update function
|
||||||
L3D.ReplayCamera.prototype.update = function(time) {
|
L3D.ReplayCamera.prototype.update = function(time) {
|
||||||
|
this.totalTime += time;
|
||||||
|
if (this.totalTime > this.quittingTime) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
if (this.started) {
|
if (this.started) {
|
||||||
if (this.event.type == 'camera') {
|
if (this.event.type == 'camera') {
|
||||||
this.cameraMotion(time);
|
this.cameraMotion(time);
|
||||||
|
@ -111,6 +119,10 @@ L3D.ReplayCamera.prototype.nextEvent = function() {
|
||||||
|
|
||||||
if (self.isArrow) {
|
if (self.isArrow) {
|
||||||
self.isArrow = false;
|
self.isArrow = false;
|
||||||
|
if (typeof self.logReco === 'function') {
|
||||||
|
var info = self.logReco(false, self.totalTime);
|
||||||
|
require('fs').appendFileSync(info.path, info.value);
|
||||||
|
}
|
||||||
process.stderr.write('\033[31mArrowclicked finished !\033[0m\n');
|
process.stderr.write('\033[31mArrowclicked finished !\033[0m\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +159,12 @@ L3D.ReplayCamera.prototype.nextEvent = function() {
|
||||||
// })(this);
|
// })(this);
|
||||||
} else if (this.event.type == 'arrow') {
|
} else if (this.event.type == 'arrow') {
|
||||||
self.isArrow = true;
|
self.isArrow = true;
|
||||||
|
if (typeof self.logReco === 'function') {
|
||||||
|
var info = self.logReco(true, self.totalTime);
|
||||||
|
require('fs').appendFileSync(info.path, info.value);
|
||||||
|
}
|
||||||
process.stderr.write('\033[33mArrowclicked ! ' + JSON.stringify(self.cameras[self.event.id].camera.position) + '\033[0m\n');
|
process.stderr.write('\033[33mArrowclicked ! ' + JSON.stringify(self.cameras[self.event.id].camera.position) + '\033[0m\n');
|
||||||
|
self.quittingTime = self.totalTime + 6000;
|
||||||
if (this.shouldRecover) {
|
if (this.shouldRecover) {
|
||||||
(function(self, tmp) {
|
(function(self, tmp) {
|
||||||
self.event.type = 'camera';
|
self.event.type = 'camera';
|
||||||
|
|
|
@ -155,11 +155,15 @@ geo.MeshStreamer = function(path) {
|
||||||
*/
|
*/
|
||||||
this.texCoords = [];
|
this.texCoords = [];
|
||||||
|
|
||||||
|
this.minThreshold = 0.75;
|
||||||
|
this.maxThreshold = 0.85;
|
||||||
|
this.currentlyPrefetching = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of element to send by packet
|
* Number of element to send by packet
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
*/
|
*/
|
||||||
this.chunk = 1250 / 2;
|
this.chunk = 1250;
|
||||||
|
|
||||||
this.previousReco = 0;
|
this.previousReco = 0;
|
||||||
|
|
||||||
|
@ -386,22 +390,35 @@ geo.MeshStreamer.prototype.start = function(socket) {
|
||||||
var config;
|
var config;
|
||||||
var didPrefetch = false;
|
var didPrefetch = false;
|
||||||
|
|
||||||
if (!self.prefetch || (recommendationClicked === null && score < 0.85)) {
|
if (!self.prefetch) {
|
||||||
|
// Case without prefetch
|
||||||
console.log("Score not good enough, no prefetch");
|
console.log("No prefetching");
|
||||||
config = [{ frustum: cameraFrustum, proportion: 1}];
|
config = [{ frustum: cameraFrustum, proportion: 1}];
|
||||||
|
|
||||||
} else if (recommendationClicked !== null) {
|
} else if (recommendationClicked !== null) {
|
||||||
|
|
||||||
|
// Case full reco
|
||||||
console.log("Recommendation is clicking : full for " + JSON.stringify(self.mesh.recommendations[recommendationClicked].position));
|
console.log("Recommendation is clicking : full for " + JSON.stringify(self.mesh.recommendations[recommendationClicked].position));
|
||||||
config = [{frustum: cameraFrustum, proportion:0.5}, {frustum : self.mesh.recommendations[recommendationClicked], proportion: 0.5}];
|
// config = [{frustum: cameraFrustum, proportion:0.5}, {frustum : self.mesh.recommendations[recommendationClicked], proportion: 0.5}];
|
||||||
|
config = [{frustum : self.mesh.recommendations[recommendationClicked], proportion: 1}];
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
console.log("Good % (" + score + "), allow some prefetching");
|
} else if (score < self.minThreshold || (!self.currentlyPrefetching && score < self.maxThreshold)) {
|
||||||
|
|
||||||
|
// Case no prefetch
|
||||||
|
console.log("Not good % (" + score + ", prefetch = " + self.currentlyPrefetching + "), full frustum");
|
||||||
|
config = [{ frustum: cameraFrustum, proportion: 1}];
|
||||||
|
|
||||||
|
if (score < self.minThreshold)
|
||||||
|
self.currentlyPrefetching = false;
|
||||||
|
|
||||||
|
} else { // if (score > self.maxThreshold || (self.currentlyPrefetching && score > self.minThreshold) {
|
||||||
|
|
||||||
|
// Case full prefetch
|
||||||
|
console.log("Good % (" + score + ", prefetch = " + self.currentlyPrefetching + "), allow some prefetching");
|
||||||
|
|
||||||
didPrefetch = true;
|
didPrefetch = true;
|
||||||
config = [{ frustum: cameraFrustum, proportion : 0.5}];
|
config = []; // [{ frustum: cameraFrustum, proportion : 0.5}];
|
||||||
// config = [];
|
// config = [];
|
||||||
|
|
||||||
// Find best recommendation
|
// Find best recommendation
|
||||||
|
@ -425,7 +442,7 @@ geo.MeshStreamer.prototype.start = function(socket) {
|
||||||
|
|
||||||
config.push({
|
config.push({
|
||||||
|
|
||||||
proportion : self.predictionTable[self.previousReco][i] / (2 * sum),
|
proportion : self.predictionTable[self.previousReco][i] / sum,
|
||||||
frustum : self.mesh.recommendations[i-1]
|
frustum : self.mesh.recommendations[i-1]
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -434,12 +451,12 @@ geo.MeshStreamer.prototype.start = function(socket) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(config.map(function(o) { return o.proportion; }));
|
if (score > self.maxThreshold)
|
||||||
|
self.currentlyPrefetching = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// For sponza
|
process.stderr.write('ERROR : PREDICTION TABLE IF UNDEFINED');
|
||||||
bestReco = self.mesh.recommendations[0];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue