瀏覽代碼

Improved multires performance.

pull/8/head
Matthew Petroff 10 年之前
父節點
當前提交
b3dd4c31a3
共有 2 個文件被更改,包括 11 次插入3 次删除
  1. +8
    -2
      src/js/libpannellum.js
  2. +3
    -1
      src/js/pannellum.js

+ 8
- 2
src/js/libpannellum.js 查看文件

@@ -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 查看文件

@@ -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);
}
}



Loading…
取消
儲存