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