未验证 提交 d5c49f58 编写于 作者: P puxiao 提交者: GitHub

Update webgl_panorama_cube.html (#22065)

* Update webgl_panorama_cube.html

* Update webgl_panorama_cube.html

* Update webgl_panorama_cube.html
上级 31ed7930
......@@ -73,28 +73,25 @@
}
const imageObj = new Image();
new THREE.ImageLoader()
.load( atlasImgUrl, ( image ) => {
imageObj.onload = function () {
let canvas, context;
const tileWidth = image.height;
let canvas, context;
const tileWidth = imageObj.height;
for ( let i = 0; i < textures.length; i ++ ) {
for ( let i = 0; i < textures.length; i ++ ) {
canvas = document.createElement( 'canvas' );
context = canvas.getContext( '2d' );
canvas.height = tileWidth;
canvas.width = tileWidth;
context.drawImage( image, tileWidth * i, 0, tileWidth, tileWidth, 0, 0, tileWidth, tileWidth );
textures[ i ].image = canvas;
textures[ i ].needsUpdate = true;
canvas = document.createElement( 'canvas' );
context = canvas.getContext( '2d' );
canvas.height = tileWidth;
canvas.width = tileWidth;
context.drawImage( imageObj, tileWidth * i, 0, tileWidth, tileWidth, 0, 0, tileWidth, tileWidth );
textures[ i ].image = canvas;
textures[ i ].needsUpdate = true;
}
}
};
imageObj.src = atlasImgUrl;
} );
return textures;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册