RenderManager: cleanup viewport computation (related to PR #217)

experimental
shadowislord 10 years ago
parent f2cd1334ec
commit 9b13b34bd5
  1. 6
      jme3-core/src/main/java/com/jme3/renderer/RenderManager.java

@ -865,8 +865,10 @@ public class RenderManager {
if (cam != prevCam || cam.isViewportChanged()) { if (cam != prevCam || cam.isViewportChanged()) {
viewX = (int) (cam.getViewPortLeft() * cam.getWidth()); viewX = (int) (cam.getViewPortLeft() * cam.getWidth());
viewY = (int) (cam.getViewPortBottom() * cam.getHeight()); viewY = (int) (cam.getViewPortBottom() * cam.getHeight());
viewWidth = ((int)(cam.getViewPortRight() * cam.getWidth())) - ((int)(cam.getViewPortLeft() * cam.getWidth())); int viewX2 = (int) (cam.getViewPortRight() * cam.getWidth());
viewHeight = ((int)(cam.getViewPortTop() * cam.getHeight())) - ((int)(cam.getViewPortBottom() * cam.getHeight())); int viewY2 = (int) (cam.getViewPortTop() * cam.getHeight());
viewWidth = viewX2 - viewX;
viewHeight = viewY2 - viewY;
uniformBindingManager.setViewPort(viewX, viewY, viewWidth, viewHeight); uniformBindingManager.setViewPort(viewX, viewY, viewWidth, viewHeight);
renderer.setViewPort(viewX, viewY, viewWidth, viewHeight); renderer.setViewPort(viewX, viewY, viewWidth, viewHeight);
renderer.setClipRect(viewX, viewY, viewWidth, viewHeight); renderer.setClipRect(viewX, viewY, viewWidth, viewHeight);

Loading…
Cancel
Save