Skip to content

Commit

Permalink
[FIX] Camera debug shape is now properly updated when the canvas is r…
Browse files Browse the repository at this point in the history
…esized
  • Loading branch information
vkalpias committed May 11, 2015
1 parent 35a4ed3 commit 9f5e351
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/framework/components/camera/camera_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,17 @@ pc.extend(pc, function () {
var vertexBuffer = component.model.meshInstances[0].mesh.vertexBuffer;

// Retrieve the characteristics of the camera frustum
var aspectRatio = component.camera.getAspectRatio();
var nearClip = component.nearClip;
var farClip = component.farClip;
var fov = component.fov * Math.PI / 180.0;
var projection = component.projection;

// calculate aspect ratio based on the current width / height of the
// graphics device
var device = this.app.graphicsDevice;
var rect = component.rect;
var aspectRatio = (device.width * rect.z) / (device.height * rect.w);

var x, y;
if (projection === pc.PROJECTION_PERSPECTIVE) {
y = Math.tan(fov / 2.0) * nearClip;
Expand Down

0 comments on commit 9f5e351

Please sign in to comment.