Pārlūkot izejas kodu

Improved multires performance.

pull/8/head
Matthew Petroff pirms 10 gadiem
vecāks
revīzija
b3dd4c31a3
2 mainītis faili ar 11 papildinājumiem un 3 dzēšanām
  1. +8
    -2
      src/js/libpannellum.js
  2. +3
    -1
      src/js/pannellum.js

+ 8
- 2
src/js/libpannellum.js Parādīt failu

@@ -214,6 +214,13 @@ function Renderer(canvas, image, imageType) {
var ntmp = new MultiresNode(vtmp, sides[s], 1, 0, 0, this.image.path);
this.testMultiresNode(rotPersp, ntmp, pitch, yaw, hfov);
}
// Only process one tile per frame to improve responsiveness
for ( var i = 0; i < program.currentNodes.length; i++ ) {
if (!program.currentNodes[i].texture) {
setTimeout(this.processNextTile(program.currentNodes[i], pitch, yaw, hfov), 0);
break;
}
}
// Draw tiles
this.multiresDraw()
@@ -286,7 +293,6 @@ function Renderer(canvas, image, imageType) {
if (!inCurrent) {
//node.color = [Math.random(), Math.random(), Math.random()];
node.timestamp = program.nodeCacheTimestamp++;
setTimeout(this.processNextTile(node, pitch, yaw, hfov), 0);
program.currentNodes.push(node);
program.nodeCache.push(node);
}
@@ -590,7 +596,7 @@ var vMulti = [
'uniform mat4 u_cubeMatrix;',
'uniform mat4 u_perspMatrix;',

'varying highp vec2 v_texCoord;',
'varying mediump vec2 v_texCoord;',

'void main(void) {',
// Set position


+ 3
- 1
src/js/pannellum.js Parādīt failu

@@ -404,13 +404,15 @@ function onDocumentResize() {

function animate() {
render();
if(isUserInteracting || (renderer && renderer.isLoading())) {
if(isUserInteracting) {
requestAnimationFrame(animate);
} else if(keysDown[0] || keysDown[1] || keysDown[2] || keysDown[3]
|| keysDown[4] || keysDown[5] || keysDown[6] || keysDown[7]
|| keysDown[8] || keysDown[9] || config.autoRotate) {
keyRepeat();
requestAnimationFrame(animate);
} else if(renderer && renderer.isLoading()) {
requestAnimationFrame(animate);
}
}



Notiek ielāde…
Atcelt
Saglabāt