Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/index-unmanaged.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@
renderer.sortObjects = false;
container.appendChild(renderer.domElement);

var options = { format: THREE.RGBAFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter };
var renderTarget = new THREE.WebGLCubeRenderTarget( 2048, options );
equi = new CubemapToEquirectangular( renderer, false );
cubeCamera = new THREE.CubeCamera( .1, 1000, 2048 );
cubeCamera = new THREE.CubeCamera( .1, 1000, renderTarget );

/*

Expand All @@ -118,7 +120,7 @@
document.getElementById( 'capture' ).addEventListener( 'click', function( e ) {

cubeCamera.position.copy( camera.position );
cubeCamera.updateCubeMap( renderer, scene );
cubeCamera.update( renderer, scene );
equi.convert( cubeCamera );

} );
Expand Down
12 changes: 6 additions & 6 deletions examples/js/CubemapToEquirectangular.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,9 @@ CubemapToEquirectangular.prototype.setSize = function( width, height ) {

CubemapToEquirectangular.prototype.getCubeCamera = function( size ) {

var cubeMapSize = Math.min( this.cubeMapSize, size );
this.cubeCamera = new THREE.CubeCamera( .1, 1000, cubeMapSize );

var options = { format: THREE.RGBAFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter };
this.cubeCamera.renderTarget = new THREE.WebGLRenderTargetCube( cubeMapSize, cubeMapSize, options );
const renderTarget = new THREE.WebGLCubeRenderTarget(size, options);
this.cubeCamera = new THREE.CubeCamera(.1, 1000, renderTarget );

return this.cubeCamera;

Expand All @@ -147,7 +145,8 @@ CubemapToEquirectangular.prototype.attachCubeCamera = function( camera ) {
CubemapToEquirectangular.prototype.convert = function( cubeCamera, download ) {

this.quad.material.uniforms.map.value = cubeCamera.renderTarget.texture;
this.renderer.render( this.scene, this.camera, this.output, true );
this.renderer.setRenderTarget(this.output);
this.renderer.render( this.scene, this.camera);

var pixels = new Uint8Array( 4 * this.width * this.height );
this.renderer.readRenderTargetPixels( this.output, 0, 0, this.width, this.height, pixels );
Expand All @@ -157,6 +156,7 @@ CubemapToEquirectangular.prototype.convert = function( cubeCamera, download ) {
if( download !== false ) {
this.download( imageData );
}
this.renderer.setRenderTarget(null);

return imageData

Expand Down Expand Up @@ -191,7 +191,7 @@ CubemapToEquirectangular.prototype.update = function( camera, scene ) {
var autoClear = this.renderer.autoClear;
this.renderer.autoClear = true;
this.cubeCamera.position.copy( camera.position );
this.cubeCamera.updateCubeMap( this.renderer, scene );
this.cubeCamera.update( this.renderer, scene );
this.renderer.autoClear = autoClear;

this.convert( this.cubeCamera );
Expand Down
Loading