Przeglądaj źródła

Fix render target screenshot when multiple cameras active

Popov72 4 lat temu
rodzic
commit
f2b1723050
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      src/Misc/screenshotTools.ts

+ 5 - 1
src/Misc/screenshotTools.ts

@@ -130,11 +130,15 @@ export class ScreenshotTools {
         var previousCamera: Nullable<Camera> = null;
         var previousCameras = scene.activeCameras;
 
-        if (scene.activeCamera !== camera || scene.activeCameras && scene.activeCameras.length) {
+        scene.activeCameras = null;
+
+        if (scene.activeCamera !== camera) {
             previousCamera = scene.activeCamera;
             scene.activeCamera = camera;
         }
 
+        scene.render();
+
         // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)
         var texture = new RenderTargetTexture("screenShot", targetTextureSize, scene, false, false, Constants.TEXTURETYPE_UNSIGNED_INT, false, Texture.NEAREST_SAMPLINGMODE, undefined, enableStencilBuffer, undefined, undefined, undefined, samples);
         texture.renderList = null;