X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FRenderingContext.java;h=afbe22d13a5cc449d52d584cf85370f845b204c6;hp=a16c2d5cfe433bfc69e091bf54402f5d9c37cfea;hb=e56f9b775bd49c31e8efab7204bee699036942b3;hpb=6213716671ccab6b7256de41838e1f5401ce173c diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java index a16c2d5..afbe22d 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java @@ -1,10 +1,10 @@ /* - * Sixth - System for data storage, computation, exploration and interaction. - * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * + * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License * or later as published by the Free Software Foundation. + * */ package eu.svjatoslav.sixth.e3d.gui; @@ -20,21 +20,14 @@ import java.awt.image.WritableRaster; public class RenderingContext { public static final int bufferedImageType = BufferedImage.TYPE_4BYTE_ABGR; - - public final BufferedImage bufferedImage; - public final Graphics2D graphics; - - public final byte[] bytes; - + public final byte[] pixels; public final int width; public final int height; - public final int xCenter; public final int yCenter; - public final double zoom; - + final BufferedImage bufferedImage; public int frameNumber = 0; /** @@ -44,13 +37,17 @@ public class RenderingContext { */ public boolean doRender = true; // TODO: make use of the variable + /** + * Mouse click. During rendering we can detect which item user clicked on. + */ public MouseClick mouseClick; + /** + * Item that user clicked on. + */ public MouseInteractionController clickedItem; - public RenderingContext(final int width, final int height, - final RenderingContext oldContext) { - + public RenderingContext(final int width, final int height) { this.width = width; this.height = height; @@ -63,20 +60,11 @@ public class RenderingContext { final WritableRaster raster = bufferedImage.getRaster(); final DataBufferByte dbi = (DataBufferByte) raster.getDataBuffer(); - bytes = dbi.getData(); + pixels = dbi.getData(); graphics = (Graphics2D) bufferedImage.getGraphics(); - - graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - - if (oldContext != null) { - mouseClick = oldContext.mouseClick; - clickedItem = oldContext.clickedItem; - } + graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } }