Skip to content

Commit b317f89

Browse files
committed
Renderer updates the camera
1 parent 6749662 commit b317f89

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/gameobjects/layer3d/Layer3D.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ var Layer3D = new Class({
9090
* @type {Phaser.GameObjects.Layer3DLight}
9191
* @since 3.50.0
9292
*/
93-
this.light = new Layer3DLight(this, 0, -100, 0);
93+
this.light = new Layer3DLight(this, 0, 100, 0);
9494

9595
/**
9696
* The color of the fog.
@@ -517,8 +517,6 @@ var Layer3D = new Class({
517517
this._prevHeight = height;
518518
}
519519

520-
camera.update();
521-
522520
var models = this.models;
523521

524522
for (var i = 0; i < models.length; i++)

src/gameobjects/layer3d/Layer3DCamera.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,27 @@ var Layer3DCamera = new Class({
389389
}
390390
},
391391

392+
/**
393+
* Internal method that is called by the Layer3D instance that owns this camera
394+
* during its `render` step. If the view matrix is dirty, it is recalculated
395+
* and then applied to the view projection matrix, ready for rendering.
396+
*
397+
* @method Phaser.GameObjects.Layer3DCamera#update
398+
* @since 3.50.0
399+
*/
400+
update: function ()
401+
{
402+
if (this.dirtyView)
403+
{
404+
this.updateViewMatrix();
405+
}
406+
407+
if (this.dirtyView || this.dirtyProjection)
408+
{
409+
this.projectionMatrix.multiplyToMat4(this.viewMatrix, this.viewProjectionMatrix);
410+
}
411+
},
412+
392413
/**
393414
* Internal method that handles the update of the view transform matrix, based on the rotation
394415
* and position of the camera. Called automatically when the camera is updated.
@@ -414,27 +435,6 @@ var Layer3DCamera = new Class({
414435
this.viewMatrix.copy(matView).invert();
415436
},
416437

417-
/**
418-
* Internal method that is called by the Layer3D instance that owns this camera
419-
* during its `preUpdate` step. If the view matrix is dirty, it is recalculated
420-
* and then applied to the view projection matrix, ready for rendering.
421-
*
422-
* @method Phaser.GameObjects.Layer3DCamera#update
423-
* @since 3.50.0
424-
*/
425-
update: function ()
426-
{
427-
if (this.dirtyView)
428-
{
429-
this.updateViewMatrix();
430-
}
431-
432-
if (this.dirtyView || this.dirtyProjection)
433-
{
434-
this.projectionMatrix.multiplyToMat4(this.viewMatrix, this.viewProjectionMatrix);
435-
}
436-
},
437-
438438
/**
439439
* Internal method that is called by the Layer3D instance that owns this camera
440440
* during its `preUpdate` step. If the projection matrix is dirty, or the renderer

src/gameobjects/layer3d/Layer3DWebGLRenderer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ var Layer3DWebGLRenderer = function (renderer, src)
3030

3131
renderer.pipelines.clear();
3232

33+
src.camera.update();
34+
3335
var pipeline = renderer.pipelines.set(src.pipeline, src);
3436

3537
for (var m = 0; m < totalModels; m++)

0 commit comments

Comments
 (0)