Skip to content

Commit

Permalink
Merge pull request #470 from guycalledfrank/setcamerafix
Browse files Browse the repository at this point in the history
don't clear 2 times
  • Loading branch information
guycalledfrank committed Dec 10, 2015
2 parents 662aa51 + ef49b55 commit 0b95582
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/scene/scene_forwardrenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,20 @@ pc.extend(pc, function () {
}

pc.extend(ForwardRenderer.prototype, {

updateCameraFrustum: function(camera) {
var projMat = camera.getProjectionMatrix();

var pos = camera._node.getPosition();
var rot = camera._node.getRotation();
viewInvMat.setTRS(pos, rot, pc.Vec3.ONE);
this.viewInvId.setValue(viewInvMat.data);

viewMat.copy(viewInvMat).invert();

camera._frustum.update(projMat, viewMat);
},

setCamera: function (camera, cullBorder) {
// Projection Matrix
var projMat = camera.getProjectionMatrix();
Expand Down Expand Up @@ -577,7 +591,7 @@ pc.extend(pc, function () {
var visible;
var btype;
var cullTime = pc.now();
this.setCamera(camera);
this.updateCameraFrustum(camera);

// Update all skin matrices to properly cull skinned objects (but don't update rendering data)
for (i = 0; i < drawCallsCount; i++) {
Expand Down

0 comments on commit 0b95582

Please sign in to comment.