@@ -253,7 +253,13 @@ p5.Shader.prototype.unbindTextures = function() {
253
253
} ;
254
254
255
255
p5 . Shader . prototype . _setMatrixUniforms = function ( ) {
256
- this . setUniform ( 'uProjectionMatrix' , this . _renderer . uPMatrix . mat4 ) ;
256
+ const viewMatrix = this . _renderer . _curCamera . cameraMatrix ;
257
+ const projectionMatrix = this . _renderer . uPMatrix ;
258
+ const modelViewMatrix = this . _renderer . uMVMatrix ;
259
+
260
+ const modelViewProjectionMatrix = modelViewMatrix . copy ( ) ;
261
+ modelViewProjectionMatrix . mult ( projectionMatrix ) ;
262
+
257
263
if ( this . isStrokeShader ( ) ) {
258
264
if ( this . _renderer . _curCamera . cameraType === 'default' ) {
259
265
// strokes scale up as they approach camera, default
@@ -263,8 +269,10 @@ p5.Shader.prototype._setMatrixUniforms = function() {
263
269
this . setUniform ( 'uPerspective' , 0 ) ;
264
270
}
265
271
}
266
- this . setUniform ( 'uModelViewMatrix' , this . _renderer . uMVMatrix . mat4 ) ;
267
- this . setUniform ( 'uViewMatrix' , this . _renderer . _curCamera . cameraMatrix . mat4 ) ;
272
+ this . setUniform ( 'uViewMatrix' , viewMatrix . mat4 ) ;
273
+ this . setUniform ( 'uProjectionMatrix' , projectionMatrix . mat4 ) ;
274
+ this . setUniform ( 'uModelViewMatrix' , modelViewMatrix . mat4 ) ;
275
+ this . setUniform ( 'uModelViewProjectionMatrix' , modelViewProjectionMatrix . mat4 ) ;
268
276
if ( this . uniforms . uNormalMatrix ) {
269
277
this . _renderer . uNMatrix . inverseTranspose ( this . _renderer . uMVMatrix ) ;
270
278
this . setUniform ( 'uNormalMatrix' , this . _renderer . uNMatrix . mat3 ) ;
0 commit comments