From 86d299d368eb75cf37abcc911e2d2ad04ac2dca8 Mon Sep 17 00:00:00 2001 From: Yannis Gravezas Date: Fri, 5 Jan 2018 22:39:43 +0100 Subject: [PATCH] use Scene.onBeforeRender and .onAfterRender --- examples/webgl_tiled_forward.html | 343 ++++++++++++++++++++++++++++++ src/renderers/WebGLRenderer.js | 4 + 2 files changed, 347 insertions(+) create mode 100644 examples/webgl_tiled_forward.html diff --git a/examples/webgl_tiled_forward.html b/examples/webgl_tiled_forward.html new file mode 100644 index 00000000000000..2be4fb01cd3292 --- /dev/null +++ b/examples/webgl_tiled_forward.html @@ -0,0 +1,343 @@ + + + + three.js webgl - tiled forward lighting + + + + + +
+ threejs - Tiled forward lighting
+ Created by wizgrav. +
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 2fcc08e6f2bfd8..4807b35db95d02 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -1105,6 +1105,8 @@ function WebGLRenderer( parameters ) { } + scene.onBeforeRender( _this, scene, camera, renderTarget ); + _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); _frustum.setFromMatrix( _projScreenMatrix ); @@ -1207,6 +1209,8 @@ function WebGLRenderer( parameters ) { state.setPolygonOffset( false ); + scene.onAfterRender( _this, scene, camera, renderTarget ); + if ( vr.enabled ) { vr.submitFrame();