Skip to content

Commit

Permalink
Partial fix for issue #72
Browse files Browse the repository at this point in the history
at least the image is retained; but now the rescaled perspective is somewhat broken :(
  • Loading branch information
bwlewis committed Jan 31, 2018
1 parent 206196f commit a830093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Package
Title: Interactive 3D Scatter Plots, Networks and Globes
Description: Create interactive 3D scatter plots, network plots, and
globes using the 'three.js' visualization library (<https://threejs.org>).
Version: 0.3.1
Version: 0.3.2
Date: 2017-08-11
Authors@R: c(
person("B. W.", "Lewis", role=c("aut","cre"), email="[email protected]"),
Expand Down
7 changes: 4 additions & 3 deletions inst/htmlwidgets/globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ HTMLWidgets.widget(
stuff.renderer.setSize( width, height );
stuff.width = width;
stuff.height = height;
stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far);
// stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far); // XXX FIX ME
stuff.camera.lookAt(stuff.scene.position);
stuff.renderer.render( stuff.scene, stuff.camera );
},
Expand Down Expand Up @@ -60,7 +60,8 @@ HTMLWidgets.widget(
var img, geometry, tex, earth;
var down = false;
var sx = 0, sy = 0;
tex = THREE.ImageUtils.loadTexture(x.img, {}, function() {render();});
// tex = THREE.ImageUtils.loadTexture(x.img, {}, function() {render();});
tex = new THREE.TextureLoader().load(x.img);

var vertexShader = [
'uniform vec3 viewVector;',
Expand Down Expand Up @@ -272,7 +273,7 @@ HTMLWidgets.widget(
if(GL) stuff.camera.fov -= event.wheelDeltaY * 0.02;
else stuff.camera.fov -= event.wheelDeltaY * 0.0075;
stuff.camera.fov = Math.max( Math.min( stuff.camera.fov, fovMAX ), fovMIN );
stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far);
// stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far); // XXX FIX ME
render();
}
el.onmousewheel = function(ev) {ev.preventDefault();};
Expand Down

0 comments on commit a830093

Please sign in to comment.