Change quality instance to methods. Edit Adaptive mouse to support animated charts
16
README.md
|
@ -188,6 +188,8 @@ Jzy3d depends on the following libraries that are available on [Jzy3d Maven repo
|
|||
|
||||
# How to build
|
||||
|
||||
## From command line
|
||||
|
||||
```
|
||||
mvn clean install
|
||||
```
|
||||
|
@ -197,6 +199,20 @@ sometime sensitive to thin rendering differences across computers. If they are e
|
|||
* Comment it from [Surefire plugin configuration](https://github.com/jzy3d/jzy3d-api/blob/master/pom.xml#L168). The best is to edit the Maven pom to only disable ITTest*. If you are busy, you may simply run ```mvn install -DskipTests```
|
||||
* Skip it from [Faisafe if this plugin is currently active](https://github.com/jzy3d/jzy3d-api/blob/master/pom.xml#L186) in the Maven pom. To do so run ```mvn install -DskipITs```
|
||||
|
||||
## From intellij
|
||||
|
||||
Follow these steps to import in IntelliJ
|
||||
* open an existing unrelated project
|
||||
* file->new project from version control
|
||||
* close the imported project window
|
||||
* from the unrelated project ->file-> new project from existing sources -> select the new projects location
|
||||
* from new project select top -> file -> add framework-> maven
|
||||
* file -> set module language level
|
||||
|
||||
## From eclipse
|
||||
|
||||
`Import Maven project` or `Import Maven project` from SCM
|
||||
|
||||
|
||||
# How to get help
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
|||
public class Chart {
|
||||
private static final int MOUSE_PICK_SIZE_DEFAULT = 10;
|
||||
private static final String DEFAULT_WINDOW_TITLE = "Jzy3d";
|
||||
public static final Quality DEFAULT_QUALITY = Quality.Intermediate.clone();
|
||||
public static final Quality DEFAULT_QUALITY = Quality.Intermediate();
|
||||
|
||||
protected IChartFactory factory;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ChartFactory implements IChartFactory {
|
|||
|
||||
@Override
|
||||
public Chart newChart() {
|
||||
return newChart(Quality.Advanced);
|
||||
return newChart(Quality.Advanced());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -113,5 +113,11 @@ public interface ICanvas {
|
|||
public void addCanvasListener(ICanvasListener listener);
|
||||
public void removeCanvasListener(ICanvasListener listener);
|
||||
public List<ICanvasListener> getCanvasListeners();
|
||||
|
||||
/**
|
||||
* Temporary way of enabling/disabling a thread watching pixel scale change of a native canvas
|
||||
*/
|
||||
@Deprecated
|
||||
public static final boolean ALLOW_WATCH_PIXEL_SCALE = false;
|
||||
|
||||
}
|
||||
|
|
|
@ -12,44 +12,77 @@ import org.jzy3d.plot3d.rendering.view.View;
|
|||
* GL2 initialization. The {@link Quality} may also activate an {@link AbstractOrderingStrategy}
|
||||
* algorithm that enables clean alpha results.
|
||||
*
|
||||
* Fastest: - No transparency, no color shading, just handle depth buffer.
|
||||
*
|
||||
* Intermediate: - include Fastest mode abilities - Color shading, mainly usefull to have
|
||||
* <ul>
|
||||
* <li>Fastest: No transparency, no color shading, just handle depth buffer.
|
||||
* <li>Intermediate: include Fastest mode abilities, Color shading, mainly usefull to have
|
||||
* interpolated colors on polygons.
|
||||
*
|
||||
* Advanced: - include Intermediate mode abilities - Transparency (GL2 alpha blending + polygon
|
||||
* <li>Advanced: include Intermediate mode abilities, Transparency (GL2 alpha blending + polygon
|
||||
* ordering in scene graph)
|
||||
*
|
||||
* Nicest: - include Advanced mode abilities - Anti aliasing on wires
|
||||
* <li>Nicest: include Advanced mode abilities, Anti aliasing on wires
|
||||
* </ul>
|
||||
*
|
||||
* Toggling rendering model: one may either choose to have a repaint-on-demand or
|
||||
* repaint-continuously model. Setting isAnimated(false) will desactivate a the {@link IAnimator}
|
||||
* repaint-continuously model. Setting isAnimated(false) will desactivate the {@link IAnimator}
|
||||
* updating the choosen {@link ICanvas} implementation.
|
||||
*
|
||||
* setAutoSwapBuffer(false) will equaly configure the {@link ICanvas}.
|
||||
* setAutoSwapBuffer(false) will configure the {@link ICanvas}.
|
||||
*
|
||||
* @author Martin Pernollet
|
||||
*/
|
||||
public class Quality {
|
||||
|
||||
|
||||
/**
|
||||
* Enables alpha, color interpolation and antialiasing on lines, points, and polygons.
|
||||
*/
|
||||
public static final Quality Nicest = new Quality(true, true, true, true, true, true, true);
|
||||
public static final Quality Nicest() {
|
||||
return Nicest.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables alpha and color interpolation.
|
||||
*/
|
||||
public static final Quality Advanced = new Quality(true, true, true, false, false, false, true);
|
||||
public static final Quality Advanced() {
|
||||
return Advanced.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables color interpolation.
|
||||
*/
|
||||
public static final Quality Intermediate =
|
||||
new Quality(true, false, true, false, false, false, true);
|
||||
public static final Quality Intermediate() {
|
||||
return Intermediate.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal quality to allow fastest rendering (no alpha, interpolation or antialiasing).
|
||||
*/
|
||||
public static final Quality Fastest = new Quality(true, false, false, false, false, false, true);
|
||||
public static final Quality Fastest() {
|
||||
return Fastest.clone();
|
||||
}
|
||||
|
||||
protected static final Quality Nicest = new Quality(true, true, true, true, true, true, true);
|
||||
protected static final Quality Advanced =
|
||||
new Quality(true, true, true, false, false, false, true);
|
||||
protected static final Quality Intermediate =
|
||||
new Quality(true, false, true, false, false, false, true);
|
||||
protected static final Quality Fastest =
|
||||
new Quality(true, false, false, false, false, false, true);
|
||||
|
||||
// ****************************************************************** //
|
||||
|
||||
protected boolean depthActivated;
|
||||
protected boolean alphaActivated;
|
||||
protected boolean smoothColor;
|
||||
protected boolean smoothPoint;
|
||||
protected boolean smoothLine;
|
||||
protected boolean smoothPolygon;
|
||||
protected boolean disableDepthTestWhenAlpha;
|
||||
protected boolean isAnimated = true;
|
||||
protected boolean isAutoSwapBuffer = true;
|
||||
|
||||
protected boolean preserveViewportSize = DEFAULT_PRESERVE_VIEWPORT;
|
||||
|
||||
public static boolean DEFAULT_PRESERVE_VIEWPORT = true;
|
||||
|
||||
|
||||
/** Initialize a Quality configuration for a View. */
|
||||
public Quality(boolean depthActivated, boolean alphaActivated, boolean smoothColor,
|
||||
|
@ -162,10 +195,10 @@ public class Quality {
|
|||
* If true, states that the chart should make use of HiDPI or Retina capabilities to draw more
|
||||
* good looking charts due to higher number of physical pixels.
|
||||
*
|
||||
* A convenient shortcut to
|
||||
* <code>
|
||||
* A convenient shortcut to <code>
|
||||
* setPreserveViewportSize(!hidpi)
|
||||
* </code>
|
||||
*
|
||||
* @param hidpi
|
||||
*/
|
||||
public void setHiDPIEnabled(boolean hidpi) {
|
||||
|
@ -181,17 +214,5 @@ public class Quality {
|
|||
}
|
||||
|
||||
|
||||
private boolean depthActivated;
|
||||
private boolean alphaActivated;
|
||||
private boolean smoothColor;
|
||||
private boolean smoothPoint;
|
||||
private boolean smoothLine;
|
||||
private boolean smoothPolygon;
|
||||
protected boolean disableDepthTestWhenAlpha;
|
||||
protected boolean isAnimated = true;
|
||||
protected boolean isAutoSwapBuffer = true;
|
||||
|
||||
protected boolean preserveViewportSize = DEFAULT_PRESERVE_VIEWPORT;
|
||||
|
||||
public static boolean DEFAULT_PRESERVE_VIEWPORT = true;
|
||||
}
|
||||
|
|
|
@ -191,21 +191,35 @@ public class View {
|
|||
|
||||
this.spaceTransformer = new SpaceTransformer(); // apply no transform
|
||||
|
||||
canvas.addCanvasListener(new ICanvasListener() {
|
||||
@Override
|
||||
public void pixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
TextBitmapRenderer txt = (TextBitmapRenderer)axis.getTextRenderer();
|
||||
|
||||
if(pixelScaleX<=1) {
|
||||
txt.setFont(Font.TimesRoman_10);
|
||||
txt.setFont(Font.Helvetica_12);
|
||||
// if(ICanvas.ALLOW_WATCH_PIXEL_SCALE)
|
||||
canvas.addCanvasListener(new ICanvasListener() {
|
||||
/**
|
||||
* Upon pixel scale change, either at startup or during execution of the program,
|
||||
* the listener will
|
||||
* <ul>
|
||||
* <li>reconfigure the current font of the axis text renderer
|
||||
* <li>reconfigure the current font of the colorbar
|
||||
* </ul>
|
||||
*
|
||||
* TODO : verify that pixel scale change event do not trigger if hdpi disabled
|
||||
* AND running on HiDPI screen
|
||||
*
|
||||
* TODO : add unit test to verify view changes text when pixelscale change
|
||||
*/
|
||||
@Override
|
||||
public void pixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
TextBitmapRenderer txt = (TextBitmapRenderer)axis.getTextRenderer();
|
||||
System.out.println("View:scale " + pixelScaleX);
|
||||
if(pixelScaleX<=1) {
|
||||
//txt.setFont(Font.TimesRoman_10);
|
||||
txt.setFont(Font.Helvetica_12);
|
||||
}
|
||||
else {
|
||||
//txt.setFont(Font.TimesRoman_24);
|
||||
txt.setFont(Font.Helvetica_18);
|
||||
}
|
||||
}
|
||||
else {
|
||||
txt.setFont(Font.TimesRoman_24);
|
||||
txt.setFont(Font.Helvetica_18);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public IPainter getPainter() {
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jzy3d.plot3d.rendering.ddp.algorithms.PeelingMethod;
|
|||
*/
|
||||
public class PeeledCubesDemo {
|
||||
public static void main(String[] args) {
|
||||
Chart chart = DepthPeelingChart.get(Quality.Fastest, "awt", PeelingMethod.F2B_PEELING_MODE);// DUAL_PEELING_MODE);
|
||||
Chart chart = DepthPeelingChart.get(Quality.Fastest(), "awt", PeelingMethod.F2B_PEELING_MODE);// DUAL_PEELING_MODE);
|
||||
chart.getView().setAxisDisplayed(false);
|
||||
chart.setAnimated(false);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public class PeeledDragonDemo {
|
|||
public static void main(String[] args) {
|
||||
System.err.println("May require vm argument -Xmx1024m");
|
||||
|
||||
Chart chart = DepthPeelingChart.get(Quality.Fastest, "awt");
|
||||
Chart chart = DepthPeelingChart.get(Quality.Fastest(), "awt");
|
||||
|
||||
OBJFileLoader loader = new OBJFileLoader("models/dragon.obj");
|
||||
//chart.getScene().add(new DrawableVBO(loader));
|
||||
|
|
|
@ -23,7 +23,7 @@ public class PeeledStackDemo {
|
|||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Chart chart = DepthPeelingChart.get(Quality.Fastest, "awt", PeelingMethod.WEIGHTED_SUM_MODE);
|
||||
Chart chart = DepthPeelingChart.get(Quality.Fastest(), "awt", PeelingMethod.WEIGHTED_SUM_MODE);
|
||||
|
||||
createStack(chart, STACK_WIDTH, STACK_HEIGHT, 0, STACK_FACE, STACK_WIRE);
|
||||
createStack(chart, STACK_WIDTH, STACK_HEIGHT, 20, STACK_FACE, STACK_WIRE);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class PeeledWireSurfaceDemo {
|
|||
capabilities.setHardwareAccelerated(true);
|
||||
// ATTENTION AVEC
|
||||
|
||||
Chart chart = new Chart(factory, Quality.Advanced);
|
||||
Chart chart = new Chart(factory, Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
|
||||
// Setup a colorbar
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ShaderDemo {
|
|||
IChartFactory factory = new AWTChartFactory(painter);
|
||||
|
||||
|
||||
Chart chart = factory.newChart(Quality.Nicest);
|
||||
Chart chart = factory.newChart(Quality.Nicest());
|
||||
chart.getView().setSquared(false);
|
||||
// chart.getView().setCameraMode(CameraMode.PERSPECTIVE);
|
||||
return chart;
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ShaderMandelbrotDemo {
|
|||
|
||||
IChartFactory factory = new AWTChartFactory(painter);
|
||||
|
||||
Chart chart = factory.newChart(Quality.Intermediate);
|
||||
Chart chart = factory.newChart(Quality.Intermediate());
|
||||
chart.getView().setSquared(false);
|
||||
|
||||
// chart.getView().setCameraMode(CameraMode.PERSPECTIVE);
|
||||
|
|
|
@ -25,8 +25,10 @@ public class EmulGLAnimator implements IAnimator {
|
|||
loop = true;
|
||||
|
||||
while (loop) {
|
||||
canvas.doRender();
|
||||
|
||||
synchronized (canvas) {
|
||||
if (canvas != null)
|
||||
canvas.doRender();
|
||||
}
|
||||
try {
|
||||
Thread.sleep(RENDERING_LOOP_PAUSE);
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -42,7 +44,7 @@ public class EmulGLAnimator implements IAnimator {
|
|||
public void stop() {
|
||||
if (t != null) {
|
||||
loop = false;
|
||||
//t.stop();
|
||||
// t.stop();
|
||||
t.interrupt();
|
||||
t = null;
|
||||
}
|
||||
|
|
|
@ -27,25 +27,36 @@ public class AdaptiveMouseController extends AWTCameraMouseController {
|
|||
protected AdaptiveRenderingPolicy policy;
|
||||
|
||||
/**
|
||||
* Keep track if optimization was triggered or not as mouse pressed, to ensure rollback will or
|
||||
* won't be applied at mouse release.
|
||||
* Keep track if optimization should be triggered or not. Defined at mouse pressed.
|
||||
*/
|
||||
protected boolean mustOptimizeMouseDrag = false;
|
||||
|
||||
/**
|
||||
* Keep track of drawable that have had their wireframe disabled for optimization in order to re-activate at mouse release.
|
||||
*/
|
||||
protected List<Wireframeable> wireframeToReset = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Keep track of drawable that have had their face disabled for optimization in order to re-activate at mouse release.
|
||||
* Keep track if this is the first mouse drag event since the last mouse released event. This is
|
||||
* used to trigger optimization only once when multiple successive mouse drag events are received.
|
||||
*/
|
||||
protected List<Wireframeable> faceToReset = new ArrayList<>();
|
||||
protected boolean isFirstDrag = true;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Keep track of drawable that have had their wireframe disabled for optimization in order to
|
||||
* re-activate at mouse release.
|
||||
*/
|
||||
protected List<Wireframeable> droppedWireframeToReset = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Keep track of drawable that have had their face disabled for optimization in order to
|
||||
* re-activate at mouse release.
|
||||
*/
|
||||
protected List<Wireframeable> droppedFaceAndColoredWireframeToReset = new ArrayList<>();
|
||||
|
||||
protected List<Wireframeable> droppedFaceToReset = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Keep track of canvas performance.
|
||||
*/
|
||||
//protected double lastRenderingTime = -1;
|
||||
// protected double lastRenderingTime = -1;
|
||||
|
||||
|
||||
public AdaptiveMouseController() {
|
||||
|
@ -56,46 +67,41 @@ public class AdaptiveMouseController extends AWTCameraMouseController {
|
|||
super(chart);
|
||||
setPolicy(policy);
|
||||
}
|
||||
|
||||
|
||||
public AdaptiveMouseController(Chart chart) {
|
||||
super(chart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
loadChartItems(getChart());
|
||||
loadChartFields(getChart());
|
||||
|
||||
double lastRenderingTime = getLastRenderingTimeFromCanvas();
|
||||
|
||||
// decide if an optimization should be applied
|
||||
if (!getChart().getQuality().isAnimated() && detectIfRenderingIsSlow(lastRenderingTime)) {
|
||||
if (detectIfRenderingIsSlow(lastRenderingTime)) {
|
||||
mustOptimizeMouseDrag = true;
|
||||
// never true if policy is null
|
||||
}
|
||||
|
||||
// apply optimization
|
||||
if (mustOptimizeMouseDrag) {
|
||||
if (policy.optimizeWithWireframe)
|
||||
disableWireframe(getChart());
|
||||
if (policy.optimizeWithFace)
|
||||
disableFaces(getChart());
|
||||
if (policy.optimizeWithHiDPI)
|
||||
reduceQuality(getChart());
|
||||
}
|
||||
|
||||
// do usual work
|
||||
super.mousePressed(e);
|
||||
|
||||
isFirstDrag = true;
|
||||
}
|
||||
|
||||
protected double getLastRenderingTimeFromCanvas() {
|
||||
return canvas.getLastRenderingTimeMs();
|
||||
}
|
||||
|
||||
protected boolean detectIfRenderingIsSlow(double lastRenderingTime) {
|
||||
if(policy==null)
|
||||
return false;
|
||||
else
|
||||
return policy.optimizeForRenderingTimeLargerThan < lastRenderingTime;
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (isFirstDrag) {
|
||||
isFirstDrag = false;
|
||||
|
||||
// apply optimization
|
||||
if (mustOptimizeMouseDrag) {
|
||||
startOptimizations();
|
||||
}
|
||||
}
|
||||
super.mouseDragged(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,13 +112,7 @@ public class AdaptiveMouseController extends AWTCameraMouseController {
|
|||
// If optimization did activate during mouse drag,
|
||||
// then rollback optimization as we are exiting from drag/rotation
|
||||
if (mustOptimizeMouseDrag) {
|
||||
if (policy.optimizeWithWireframe)
|
||||
reloadWireframe();
|
||||
if (policy.optimizeWithFace)
|
||||
reloadFace();
|
||||
if (policy.optimizeWithHiDPI)
|
||||
reloadQuality(getChart()); // trigger a last rendering
|
||||
|
||||
stopOptimizations();
|
||||
|
||||
// for display of this last image with the new HiDPI setting
|
||||
canvas.forceRepaint();
|
||||
|
@ -122,55 +122,127 @@ public class AdaptiveMouseController extends AWTCameraMouseController {
|
|||
|
||||
}
|
||||
|
||||
protected void loadChartItems(Chart chart) {
|
||||
// **************** PROCESS RENDERING PERF ***************** //
|
||||
|
||||
protected double getLastRenderingTimeFromCanvas() {
|
||||
return canvas.getLastRenderingTimeMs();
|
||||
}
|
||||
|
||||
protected boolean detectIfRenderingIsSlow(double lastRenderingTime) {
|
||||
if (policy == null)
|
||||
return false;
|
||||
else
|
||||
return policy.optimizeForRenderingTimeLargerThan < lastRenderingTime;
|
||||
}
|
||||
|
||||
|
||||
protected void loadChartFields(Chart chart) {
|
||||
painter = (EmulGLPainter) chart.getPainter();
|
||||
currentQuality = chart.getQuality();
|
||||
currentHiDPI = painter.getGL().isAutoAdaptToHiDPI();
|
||||
canvas = (EmulGLCanvas) chart.getCanvas();
|
||||
canvas = chart.getCanvas();
|
||||
gl = ((EmulGLPainter) chart.getPainter()).getGL();
|
||||
|
||||
|
||||
RateLimiter r = getRateLimiter();
|
||||
if(r!=null && r instanceof RateLimiterAdaptsToRenderTime) {
|
||||
((RateLimiterAdaptsToRenderTime)r).setCanvas(canvas);
|
||||
if (r instanceof RateLimiterAdaptsToRenderTime) {
|
||||
((RateLimiterAdaptsToRenderTime) r).setCanvas(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : return false if quality was not reduced before to avoid reset
|
||||
protected void reduceQuality(Chart chart) {
|
||||
// **************** START/STOP OPTIMISATION ***************** //
|
||||
|
||||
protected void startOptimizations() {
|
||||
if (policy.optimizeByDroppingWireframeOnly)
|
||||
startDroppingWireframeOnly(getChart());
|
||||
if (policy.optimizeByDroppingFace)
|
||||
startDroppingFace(getChart());
|
||||
if (policy.optimizeByDroppingFaceAndColoringWireframe)
|
||||
startDroppingFaceAndColoredWireframe(getChart());
|
||||
if (policy.optimizeByDroppingHiDPI)
|
||||
startNoHiDPI(getChart());
|
||||
}
|
||||
|
||||
protected void stopOptimizations() {
|
||||
if (policy.optimizeByDroppingWireframeOnly)
|
||||
stopDroppingWireframeOnly();
|
||||
if (policy.optimizeByDroppingFace)
|
||||
stopDroppingFace();
|
||||
if (policy.optimizeByDroppingFaceAndColoringWireframe)
|
||||
stopDroppingFaceAndColoringWireframe();
|
||||
if (policy.optimizeByDroppingHiDPI)
|
||||
stopNoHiDPI(getChart()); // trigger a last rendering
|
||||
}
|
||||
|
||||
|
||||
// OptimizeWithHiDPI
|
||||
|
||||
protected void startNoHiDPI(Chart chart) {
|
||||
Quality alternativeQuality = currentQuality.clone();
|
||||
alternativeQuality.setPreserveViewportSize(true);
|
||||
chart.setQuality(alternativeQuality);
|
||||
gl.setAutoAdaptToHiDPI(false);
|
||||
}
|
||||
|
||||
protected void reloadQuality(Chart chart) {
|
||||
protected void stopNoHiDPI(Chart chart) {
|
||||
chart.setQuality(currentQuality);
|
||||
gl.setAutoAdaptToHiDPI(currentHiDPI);
|
||||
// this force the GL image to apply the new HiDPI setting immediatly
|
||||
gl.updatePixelScale(((EmulGLCanvas)canvas).getGraphics());
|
||||
gl.updatePixelScale(((EmulGLCanvas) canvas).getGraphics());
|
||||
gl.applyViewport();
|
||||
}
|
||||
|
||||
protected void disableWireframe(Chart chart) {
|
||||
// KeepingWireframeOnly
|
||||
|
||||
protected void startDroppingWireframeOnly(Chart chart) {
|
||||
Graph graph = chart.getScene().getGraph();
|
||||
for (Drawable d : graph.getAll()) {
|
||||
if (d instanceof Wireframeable) {
|
||||
Wireframeable w = (Wireframeable) d;
|
||||
if (w.getWireframeDisplayed()) {
|
||||
wireframeToReset.add(w);
|
||||
droppedWireframeToReset.add(w);
|
||||
w.setWireframeDisplayed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void disableFaces(Chart chart) {
|
||||
protected void stopDroppingWireframeOnly() {
|
||||
for (Wireframeable w : droppedWireframeToReset) {
|
||||
w.setWireframeDisplayed(true);
|
||||
}
|
||||
}
|
||||
|
||||
// DroppingFace
|
||||
|
||||
protected void startDroppingFace(Chart chart) {
|
||||
Graph graph = chart.getScene().getGraph();
|
||||
for (Drawable d : graph.getAll()) {
|
||||
if (d instanceof Wireframeable) {
|
||||
Wireframeable w = (Wireframeable) d;
|
||||
if (w.getFaceDisplayed()) {
|
||||
faceToReset.add(w);
|
||||
droppedFaceToReset.add(w);
|
||||
w.setFaceDisplayed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void stopDroppingFace() {
|
||||
for (Wireframeable w : droppedFaceToReset) {
|
||||
w.setFaceDisplayed(true);
|
||||
w.setWireframeColorFromPolygonPoints(false);
|
||||
}
|
||||
}
|
||||
|
||||
// DroppingFaceAndColoringWireframe
|
||||
|
||||
protected void startDroppingFaceAndColoredWireframe(Chart chart) {
|
||||
Graph graph = chart.getScene().getGraph();
|
||||
for (Drawable d : graph.getAll()) {
|
||||
if (d instanceof Wireframeable) {
|
||||
Wireframeable w = (Wireframeable) d;
|
||||
if (w.getFaceDisplayed()) {
|
||||
droppedFaceAndColoredWireframeToReset.add(w);
|
||||
w.setFaceDisplayed(false);
|
||||
w.setWireframeColorFromPolygonPoints(true);
|
||||
}
|
||||
|
@ -178,22 +250,15 @@ public class AdaptiveMouseController extends AWTCameraMouseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void reloadWireframe() {
|
||||
for (Wireframeable w : wireframeToReset) {
|
||||
w.setWireframeDisplayed(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void reloadFace() {
|
||||
for (Wireframeable w : faceToReset) {
|
||||
protected void stopDroppingFaceAndColoringWireframe() {
|
||||
for (Wireframeable w : droppedFaceAndColoredWireframeToReset) {
|
||||
w.setFaceDisplayed(true);
|
||||
w.setWireframeColorFromPolygonPoints(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// GET / SET
|
||||
|
||||
public AdaptiveRenderingPolicy getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
|
|
@ -32,19 +32,27 @@ public class AdaptiveRenderingPolicy {
|
|||
*
|
||||
* Defaults to false
|
||||
*/
|
||||
public boolean optimizeWithWireframe = false;
|
||||
public boolean optimizeByDroppingWireframeOnly = false;
|
||||
|
||||
/**
|
||||
* If true, the polygon face will be desactivated between mouse pressed and mouse release.
|
||||
*
|
||||
* Defaults to true
|
||||
*/
|
||||
public boolean optimizeWithFace = true;
|
||||
public boolean optimizeByDroppingFaceAndColoringWireframe = false;
|
||||
|
||||
|
||||
/**
|
||||
* If true, the polygon face will be desactivated between mouse pressed and mouse release.
|
||||
*
|
||||
* Defaults to true
|
||||
*/
|
||||
public boolean optimizeByDroppingFace = true;
|
||||
|
||||
/**
|
||||
* If true, HiDPI will be desactivated between mouse pressed and mouse release.
|
||||
*
|
||||
* Defaults to false
|
||||
*/
|
||||
public boolean optimizeWithHiDPI = false;
|
||||
public boolean optimizeByDroppingHiDPI = false;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,17 @@ public class EmulGLPainter extends AbstractPainter implements IPainter {
|
|||
|
||||
// Blending : more beautifull with jGL without this
|
||||
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
//gl.glBlendFunc(GL.GL_DST_ALPHA, GL.GL_NONE);
|
||||
|
||||
/*gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_DST_ALPHA);
|
||||
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_COLOR);
|
||||
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_DST_COLOR);
|
||||
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_SRC_ALPHA_SATURATE);
|
||||
gl.glBlendFunc(GL.GL_DST_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);*/
|
||||
|
||||
|
||||
//GL_SRC_ALPHA_SATURATE
|
||||
// on/off is handled by each viewport (camera or image)
|
||||
|
||||
// Activate tranparency
|
||||
|
|
|
@ -98,13 +98,14 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
|
|||
} else {
|
||||
myGL.setAutoAdaptToHiDPI(false);
|
||||
}
|
||||
|
||||
myGL.addPixelScaleListener(new PixelScaleListener() {
|
||||
@Override
|
||||
public void pixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
firePixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
});
|
||||
|
||||
// if (ALLOW_WATCH_PIXEL_SCALE)
|
||||
myGL.addPixelScaleListener(new PixelScaleListener() {
|
||||
@Override
|
||||
public void pixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
firePixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,6 +147,10 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
|
|||
protected void init(int width, int height) {
|
||||
updatePainterWithGL(); // painter can call this canvas GL
|
||||
initGLUT(width, height);
|
||||
initView();
|
||||
}
|
||||
|
||||
protected void initView() {
|
||||
view.init();
|
||||
}
|
||||
|
||||
|
@ -434,7 +439,7 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
|
|||
public void removeKeyController(Object o) {
|
||||
removeKeyListener((java.awt.event.KeyListener) o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCanvasListener(ICanvasListener listener) {
|
||||
canvasListeners.add(listener);
|
||||
|
@ -444,23 +449,23 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
|
|||
public void removeCanvasListener(ICanvasListener listener) {
|
||||
canvasListeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ICanvasListener> getCanvasListeners(){
|
||||
public List<ICanvasListener> getCanvasListeners() {
|
||||
return canvasListeners;
|
||||
}
|
||||
|
||||
|
||||
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
for(ICanvasListener listener: canvasListeners) {
|
||||
for (ICanvasListener listener : canvasListeners) {
|
||||
listener.pixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *********************************************************************** */
|
||||
/* ************************** PROFILE AND DEBUG ************************** */
|
||||
/* *********************************************************************** */
|
||||
|
||||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
return null;
|
||||
|
@ -507,15 +512,13 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
|
|||
profile("Render in : " + mili + "ms", x, y * line++, c);
|
||||
|
||||
// Drawables size
|
||||
profile("Drawables : " + view.getScene().getGraph().getDecomposition().size(), x, y * line++,
|
||||
c);
|
||||
profile("Drawables : " + view.getScene().getGraph().getDecomposition().size(), x, y * line++, c);
|
||||
|
||||
// Scatters sizes
|
||||
for (Drawable d : view.getScene().getGraph().getAll()) {
|
||||
if (d instanceof Scatter) {
|
||||
Scatter s = (Scatter) d;
|
||||
profile("Scatter : " + s.coordinates.length + " points", x, y * (line++), c);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TestChart {
|
|||
*/
|
||||
@Test
|
||||
public void whenChart_IS_Animated_ThenControllers_DO_NOT_UpdateViewUponRotation() {
|
||||
Quality q = Quality.Advanced.clone();
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
// When
|
||||
Assert.assertTrue(q.isAnimated());
|
||||
|
@ -59,7 +59,7 @@ public class TestChart {
|
|||
*/
|
||||
@Test
|
||||
public void whenChart_ISNOT_Animated_ThenControllers_DO_UpdateViewUponRotation() {
|
||||
Quality q = Quality.Advanced.clone();
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
// When
|
||||
q.setAnimated(false);
|
||||
|
@ -85,7 +85,7 @@ public class TestChart {
|
|||
|
||||
@Test
|
||||
public void whenChartAnimation_CHANGE_ThenControllersConfiguration_CHANGE() {
|
||||
Quality q = Quality.Advanced.clone();
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
// When non animated chart
|
||||
q.setAnimated(false);
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.awt.event.MouseEvent;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.jzy3d.chart.Chart;
|
||||
import org.jzy3d.chart.EmulGLSkin;
|
||||
import org.jzy3d.chart.controllers.keyboard.camera.AWTCameraKeyController;
|
||||
import org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController;
|
||||
import org.jzy3d.chart.factories.EmulGLChartFactory;
|
||||
|
@ -60,9 +61,11 @@ public class TestAdaptiveMouseController {
|
|||
|
||||
MockRenderingTime mockRenderingPerf = new MockRenderingTime();// ms
|
||||
Chart chart = mockChartWithAdaptiveMouse(repaintContinuously, allowHiDPI, mockRenderingPerf);
|
||||
AdaptiveMouseController mouse = (AdaptiveMouseController) chart.addMouseCameraController();
|
||||
EmulGLCanvas canvas = (EmulGLCanvas) chart.getCanvas();
|
||||
|
||||
|
||||
EmulGLSkin skin = EmulGLSkin.on(chart);
|
||||
AdaptiveMouseController mouse = skin.getMouse();
|
||||
EmulGLCanvas canvas = skin.getCanvas();
|
||||
|
||||
// -------------------------------------
|
||||
// When : fast rendering
|
||||
mockRenderingPerf.value = 10;
|
||||
|
@ -78,14 +81,18 @@ public class TestAdaptiveMouseController {
|
|||
// When : slow rendering
|
||||
mockRenderingPerf.value = 1000;
|
||||
|
||||
// Then : optimization is triggered at mouse PRESSED
|
||||
// Then : optimization IS set to ON at MOUSE PRESS
|
||||
mouse.mousePressed(mouseEvent(canvas, 100, 100));
|
||||
Assert.assertTrue(mouse.mustOptimizeMouseDrag);
|
||||
|
||||
// Then : HiDPI is disabled DURING mouse RELEASED
|
||||
Assert.assertTrue("Just check test properly configured HiDPI", mouse.policy.optimizeWithHiDPI);
|
||||
// Then : HiDPI is disabled DURING mouse DRAGGED
|
||||
Assert.assertTrue("Just check test properly configured HiDPI", mouse.policy.optimizeByDroppingHiDPI);
|
||||
Assert.assertTrue("Did NOT start drag already", mouse.isFirstDrag);
|
||||
|
||||
mouse.mouseDragged(mouseEvent(canvas, 100, 100));
|
||||
Assert.assertFalse(canvas.getGL().isAutoAdaptToHiDPI());
|
||||
|
||||
Assert.assertFalse("Did start drag already", mouse.isFirstDrag);
|
||||
Assert.assertFalse("GL properly configured", canvas.getGL().isAutoAdaptToHiDPI());
|
||||
|
||||
// Then : HiDPI is reset to intial state (true) AFTER mouse RELEASED
|
||||
mouse.mouseReleased(mouseEvent(canvas, 100, 100));
|
||||
|
@ -98,22 +105,23 @@ public class TestAdaptiveMouseController {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void whenRepaintContinuously_ThenOptimizationNeverTriggers() {
|
||||
public void whenRepaintContinuously_ThenOptimizationTriggers() {
|
||||
// Given
|
||||
boolean repaintContinuously = true; // THIS IS THE IMPORTANT SETTING
|
||||
boolean allowHiDPI = true;
|
||||
|
||||
|
||||
MockRenderingTime mockRenderingPerf = new MockRenderingTime();// ms
|
||||
|
||||
Chart chart = mockChartWithAdaptiveMouse(repaintContinuously, allowHiDPI, mockRenderingPerf);
|
||||
|
||||
AdaptiveMouseController mouse = (AdaptiveMouseController) chart.addMouseCameraController();
|
||||
|
||||
EmulGLSkin skin = EmulGLSkin.on(chart);
|
||||
AdaptiveMouseController mouse = skin.getMouse();
|
||||
EmulGLCanvas canvas = skin.getCanvas();
|
||||
|
||||
// -------------------------------------
|
||||
// When : fast rendering
|
||||
mockRenderingPerf.value = 10;
|
||||
mouse.mousePressed(mouseEvent((EmulGLCanvas) chart.getCanvas(), 100, 100));
|
||||
mouse.mousePressed(mouseEvent(canvas, 100, 100));
|
||||
|
||||
// Then : no optimization triggered
|
||||
Assert.assertFalse(mouse.mustOptimizeMouseDrag);
|
||||
|
@ -122,17 +130,26 @@ public class TestAdaptiveMouseController {
|
|||
// When : slow rendering
|
||||
mockRenderingPerf.value = 1000;
|
||||
|
||||
// Then : optimization is NOT triggered SINCE WE REPAINT CONTINUOUSLY
|
||||
mouse.mousePressed(mouseEvent((EmulGLCanvas) chart.getCanvas(), 100, 100));
|
||||
// Then : optimization IS set to ON at MOUSE PRESS
|
||||
mouse.mousePressed(mouseEvent(canvas, 100, 100));
|
||||
|
||||
Assert.assertTrue(mouse.mustOptimizeMouseDrag);
|
||||
|
||||
// Then : HiDPI is disabled DURING mouse DRAGGED
|
||||
Assert.assertTrue("Just check test properly configured HiDPI", mouse.policy.optimizeByDroppingHiDPI);
|
||||
Assert.assertTrue("Did NOT start drag already", mouse.isFirstDrag);
|
||||
|
||||
mouse.mouseDragged(mouseEvent(canvas, 100, 100));
|
||||
|
||||
Assert.assertFalse("Did start drag already", mouse.isFirstDrag);
|
||||
Assert.assertFalse("GL properly configured", canvas.getGL().isAutoAdaptToHiDPI());
|
||||
|
||||
|
||||
// Then : HiDPI remains configured as before
|
||||
mouse.mouseReleased(mouseEvent(canvas, 100, 100));
|
||||
|
||||
Assert.assertFalse(mouse.mustOptimizeMouseDrag);
|
||||
|
||||
// Then : HiDPI remains configured as before SINCE WE REPAINT CONTINUOUSLY
|
||||
Assert.assertEquals(allowHiDPI,
|
||||
((EmulGLCanvas) chart.getCanvas()).getGL().isAutoAdaptToHiDPI());
|
||||
|
||||
// Consistent state
|
||||
Assert.assertFalse(mouse.mustOptimizeMouseDrag);
|
||||
|
||||
Assert.assertEquals(allowHiDPI, canvas.getGL().isAutoAdaptToHiDPI());
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------- //
|
||||
|
@ -166,9 +183,9 @@ public class TestAdaptiveMouseController {
|
|||
}
|
||||
};
|
||||
policy.optimizeForRenderingTimeLargerThan = 100;// ms
|
||||
policy.optimizeWithHiDPI = true;
|
||||
policy.optimizeWithWireframe = false;
|
||||
policy.optimizeWithFace = false;
|
||||
policy.optimizeByDroppingHiDPI = true;
|
||||
policy.optimizeByDroppingWireframeOnly = false;
|
||||
policy.optimizeByDroppingFaceAndColoringWireframe = false;
|
||||
|
||||
return new AdaptiveMouseController(chart, policy) {
|
||||
|
||||
|
@ -184,7 +201,7 @@ public class TestAdaptiveMouseController {
|
|||
// Configure base quality for standard case
|
||||
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory(painter);
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
q.setAnimated(repaintContinuously);
|
||||
q.setPreserveViewportSize(!allowHiDPI); // prevent HiDPI/Retina to apply hence reduce the number
|
||||
// of pixel to process
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ITTestHiDPI {
|
|||
ChartFactory factory = new EmulGLChartFactory(painter);
|
||||
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
q.setPreserveViewportSize(false); // Enable HiDPI if available on computer
|
||||
|
||||
Chart chart = factory.newChart(q);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ITTestScatterChart {
|
|||
|
||||
// When
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
Chart chart = factory.newChart(Quality.Advanced);
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
|
||||
EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas();
|
||||
c.setProfileDisplayMethod(false);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ITTestSurfaceChart {
|
|||
|
||||
// When
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
Chart chart = factory.newChart(Quality.Advanced);
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
|
||||
//System.out.println(chart.getQuality().isAlphaActivated());
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SurfaceDemoEmulGL_Alpha {
|
|||
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
|
||||
Quality q = Quality.Advanced; // assez propre avec l'ancienne méthode de setQuality
|
||||
Quality q = Quality.Advanced(); // assez propre avec l'ancienne méthode de setQuality
|
||||
|
||||
// Le mode Fastest blend la couleur mais ne fait pas le calcul de la transparence + WEIRD
|
||||
// WIREFRAME
|
||||
|
@ -48,8 +48,12 @@ public class SurfaceDemoEmulGL_Alpha {
|
|||
// Le mode Advanced active le calcul de la transparence mais BLACK BACKGROUND bug (surface
|
||||
// should be white)
|
||||
|
||||
|
||||
// READ THIS : https://opengl-notes.readthedocs.io/en/latest/topics/texturing/aliasing.html
|
||||
// ABOUT HOW ALPHA IS USED TO IMPLEMENT ANTI ALIASING
|
||||
// WHICH MAY EXPLAIN WHY NO ALPHA MAKE SURFACE UGLY WITH WIREFRAME
|
||||
q.setAlphaActivated(false);
|
||||
|
||||
|
||||
// ALPHA BUG
|
||||
// Also, q.setAlphaActivated(false) is what involve a WEIRD WIREFRAME effect
|
||||
|
||||
|
@ -62,35 +66,8 @@ public class SurfaceDemoEmulGL_Alpha {
|
|||
chart.add(surface);
|
||||
chart.getView().setAxisDisplayed(false);
|
||||
chart.open();
|
||||
chart.getMouse();
|
||||
|
||||
|
||||
|
||||
// --------------------------------
|
||||
CameraThreadController rotation = new CameraThreadController(chart);
|
||||
rotation.setStep(0.025f);
|
||||
rotation.setUpdateViewDefault(true);
|
||||
|
||||
AWTCameraMouseController mouse = (AWTCameraMouseController) chart.addMouseCameraController();
|
||||
mouse.addSlaveThreadController(rotation);
|
||||
|
||||
// chart.getView().setBackgroundColor(Color.BLUE);
|
||||
// chart.getView().setAxisDisplayed(true);
|
||||
|
||||
boolean fixWithAnimator = true;
|
||||
if (fixWithAnimator) {
|
||||
rotation.setUpdateViewDefault(true);
|
||||
mouse.setUpdateViewDefault(false); // keep to false otherwise double rendering
|
||||
((EmulGLCanvas) chart.getCanvas()).getAnimation().start();
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
chart
|
||||
.screenshot(new File("target/" + SurfaceDemoEmulGL_Alpha.class.getSimpleName() + ".png"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SurfaceDemoEmulGL_Multithreaded {
|
|||
|
||||
// --------------------------------
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
Chart chart = factory.newChart(q);
|
||||
chart.add(surface);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TestCamera_EmulGL_Offscreen {
|
|||
|
||||
};
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
Chart chart = factory.newChart(q);
|
||||
chart.getView().setBoundMode(ViewBoundMode.AUTO_FIT); // INVESTIGUER POURQUOI AUTO_FIT!!!
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TestCamera_EmulGL_Onscreen {
|
|||
|
||||
};
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
Chart chart = factory.newChart(q);
|
||||
chart.getView().setBoundMode(ViewBoundMode.AUTO_FIT); // INVESTIGUER POURQUOI AUTO_FIT!!!
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TestContinuousAndOnDemandRendering {
|
|||
|
||||
};
|
||||
|
||||
Quality q = Quality.Nicest;
|
||||
Quality q = Quality.Nicest();
|
||||
q.setAlphaActivated(true);
|
||||
|
||||
Chart chart = factory.newChart(q);
|
||||
|
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
|
@ -17,7 +17,7 @@ public class ScatterEmulGL_ReportXLS_Plot {
|
|||
Scatter scatter = scatter();
|
||||
|
||||
// --------------------------------
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
Chart chart = new EmulGLChartFactory().newChart(q);
|
||||
chart.getScene().add(scatter);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SurfaceEmulGL_ReportXLS_Dump {
|
|||
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
Chart chart = factory.newChart(q);
|
||||
chart.add(surface);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import jgl.context.gl_util;
|
|||
* gl_blend_pixel is the pixel blending class of jGL 2.4.
|
||||
*
|
||||
* It overrides gl_render_pixel to have all {@link gl_render_pixel#put_pixel(int, int, int)} methods
|
||||
* will apply blending first.
|
||||
* apply blending first.
|
||||
*
|
||||
* @version 0.1, 20 Nov. 2006
|
||||
* @author Robin Bing-Yu Chen
|
||||
|
@ -115,7 +115,12 @@ public class gl_blend_pixel extends gl_render_pixel {
|
|||
float dst[] = gl_util.ItoRGBAf(CC.ColorBuffer.Buffer[index]);
|
||||
float rst[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// Apply SRC blend func to mix source and destination color
|
||||
// and increment rst with this result
|
||||
blend_pixel(rst, src, src, dst, CC.ColorBuffer.BlendSrc);
|
||||
|
||||
// Apply DST blend func to mix source and destination color
|
||||
// and increment rst with this result
|
||||
blend_pixel(rst, dst, src, dst, CC.ColorBuffer.BlendDst);
|
||||
|
||||
//gl_render_pixel.debug_color_to_console(color);
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.jzy3d.plot3d.rendering.view.View;
|
|||
|
||||
public class AWTChartFactory extends ChartFactory {
|
||||
public static Chart chart() {
|
||||
return chart(Quality.Intermediate);
|
||||
return chart(Quality.Intermediate());
|
||||
}
|
||||
|
||||
public static Chart chart(Quality quality) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class Chart2d extends AWTNativeChart {
|
|||
/* */
|
||||
|
||||
public Chart2d() {
|
||||
this(new Chart2dFactory(), Quality.Advanced);
|
||||
this(new Chart2dFactory(), Quality.Advanced());
|
||||
}
|
||||
|
||||
public Chart2d(IChartFactory factory, Quality quality) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class Chart2dFactory extends AWTChartFactory {
|
|||
/* */
|
||||
|
||||
public static Chart2d chart() {
|
||||
return chart(Quality.Intermediate);
|
||||
return chart(Quality.Intermediate());
|
||||
}
|
||||
|
||||
public static Chart2d chart(Quality quality) {
|
||||
|
|
|
@ -80,44 +80,26 @@ public class CanvasAWT extends GLCanvas implements IScreenCanvas, INativeCanvas
|
|||
animator.stop();
|
||||
}
|
||||
|
||||
watchPixelScale();
|
||||
if(ALLOW_WATCH_PIXEL_SCALE)
|
||||
watchPixelScale();
|
||||
|
||||
if (quality.isPreserveViewportSize())
|
||||
setPixelScale(newPixelScaleIdentity());
|
||||
}
|
||||
|
||||
private void watchPixelScale() {
|
||||
exec.schedule(new Runnable() {
|
||||
double prevX = -1;
|
||||
double prevY = -1;
|
||||
|
||||
protected void watchPixelScale() {
|
||||
exec.schedule(new PixelScaleWatch() {
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
watchPixelScaleAndNotifyUponChange();
|
||||
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public double getPixelScaleY() {
|
||||
return getPixelScaleX();
|
||||
}
|
||||
|
||||
private void watchPixelScaleAndNotifyUponChange() {
|
||||
double x = getPixelScaleX();
|
||||
double y = getPixelScaleY();
|
||||
|
||||
if((prevX!=-1)&&(prevY!=-1)) {
|
||||
if((x!=prevX)||(y!=prevY)) {
|
||||
firePixelScaleChanged(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
@Override
|
||||
public double getPixelScaleX() {
|
||||
return getPixelScaleY();
|
||||
}
|
||||
@Override
|
||||
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
firePixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.jzy3d.plot3d.rendering.canvas;
|
||||
|
||||
public abstract class PixelScaleWatch implements Runnable {
|
||||
protected abstract void firePixelScaleChanged(double pixelScaleX, double pixelScaleY);
|
||||
public abstract double getPixelScaleX();
|
||||
public abstract double getPixelScaleY();
|
||||
|
||||
double prevX = -1;
|
||||
double prevY = -1;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
watchPixelScaleAndNotifyUponChange();
|
||||
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void watchPixelScaleAndNotifyUponChange() {
|
||||
double x = getPixelScaleX();
|
||||
double y = getPixelScaleY();
|
||||
|
||||
if((prevX!=-1)&&(prevY!=-1)) {
|
||||
if((x!=prevX)||(y!=prevY)) {
|
||||
firePixelScaleChanged(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -38,7 +38,7 @@ public class TestCameraNative_Projection {
|
|||
AWTChartFactory factory = new AWTChartFactory();
|
||||
factory.getPainterFactory().setOffscreen(CANVAS_SIZE);
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
// ATTENTION : viewport of a retina display has double number of pixel
|
||||
// Also, the Y value is 600, whereas the height is 578
|
||||
|
|
|
@ -33,7 +33,7 @@ public class TestCameraNative_Viewport {
|
|||
// GIVEN
|
||||
AWTChartFactory factory = new AWTChartFactory();
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
// ATTENTION : viewport of a retina display has double number of pixel
|
||||
// Also, the Y value is 600, whereas the height is 578
|
||||
|
|
|
@ -56,7 +56,7 @@ public class TestView_Interactive {
|
|||
AWTChartFactory factory = new AWTChartFactory();
|
||||
factory.getPainterFactory().setOffscreen(200, 200);
|
||||
|
||||
Chart chart = factory.newChart(Quality.Advanced);
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
chart.getScene().add(scatter);
|
||||
chart.getView().setMaximized(true);
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class TestView_Interactive {
|
|||
AWTChartFactory factory = new AWTChartFactory();
|
||||
// factory.setOffscreen(200, 200); // want to test offscreen but will use mouse events from AWT!
|
||||
|
||||
Chart chart = factory.newChart(Quality.Advanced);
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
// chart.getView().setAxeBoxDisplayed(false);
|
||||
chart.getView().setViewPositionMode(ViewPositionMode.TOP);
|
||||
chart.getView().setSquared(false);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jzy3d.painters;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import org.jzy3d.colors.Color;
|
||||
|
@ -93,6 +94,24 @@ public class NativeDesktopPainter extends AbstractPainter implements IPainter {
|
|||
|
||||
// Blending
|
||||
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// KEEP THIS DOC!!
|
||||
//gl.glBlendFunc(GL.GL_DST_ALPHA, GL.GL_ONE);
|
||||
// ONE : make a white screen
|
||||
// NONE : make surface look opaque
|
||||
// GL_ONE_MINUS_DST_ALPHA : make surface look opaque
|
||||
// GL_ONE_MINUS_SRC_ALPHA : make surface look translucent but change coloring
|
||||
// GL_SRC_ALPHA : make surface look translucent but change coloring + no wireframe
|
||||
// GL_DST_ALPHA : make a white screen
|
||||
//glBlendFunc(GL.GL_ONE_MINUS_DST_ALPHA,GL.GL_DST_ALPHA);
|
||||
|
||||
//gl.glBlen
|
||||
//ByteBuffer byteBuffer = ByteBuffer.allocate(10);
|
||||
//IntBuffer ib = byteBuffer.asIntBuffer();
|
||||
//gl.glGetIntegerv(GL.GL_BLEND_SRC_ALPHA, ib);
|
||||
//gl.glGetIntegerv(GL.GL_BLEND_DST_ALPHA, ib);
|
||||
//System.out.println(ib.array());
|
||||
|
||||
// on/off is handled by each viewport (camera or image)
|
||||
|
||||
// Activate tranparency
|
||||
|
|
|
@ -44,7 +44,7 @@ import com.jogamp.opengl.fixedfunc.GLPointerFunc;
|
|||
public class DrawableVBO extends Drawable implements IGLBindedResource {
|
||||
protected int geometry = GL.GL_TRIANGLES;
|
||||
protected float width = 1;
|
||||
protected Quality quality = Quality.Nicest;
|
||||
protected Quality quality = Quality.Nicest();
|
||||
|
||||
protected int colorChannelNumber = 3;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class DemoJzy3dFX extends Application {
|
|||
|
||||
// -------------------------------
|
||||
// Create a chart
|
||||
Quality quality = Quality.Advanced;
|
||||
Quality quality = Quality.Advanced();
|
||||
// quality.setSmoothPolygon(true);
|
||||
// quality.setAnimated(true);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class DemoJzy3dFXProblem extends Application {
|
|||
|
||||
// -------------------------------
|
||||
// Create a chart
|
||||
Quality quality = Quality.Advanced;
|
||||
Quality quality = Quality.Advanced();
|
||||
// quality.setSmoothPolygon(true);
|
||||
// quality.setAnimated(true);
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class DemoJzy3dFXProblem extends Application {
|
|||
|
||||
// -------------------------------
|
||||
// Create a chart
|
||||
Quality quality = Quality.Advanced;
|
||||
Quality quality = Quality.Advanced();
|
||||
// quality.setSmoothPolygon(true);
|
||||
// quality.setAnimated(true);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DemoPickableGraphFX extends Application {
|
|||
formatter.setHighlightedVertexColor(new Color(247 / 255f, 79 / 255f, 119 / 255f));
|
||||
|
||||
// Setup a chart
|
||||
Quality quality = Quality.Advanced;
|
||||
Quality quality = Quality.Advanced();
|
||||
// quality.setDepthActivated(false);
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class DemoSelectableScatterFX extends Application {
|
|||
}
|
||||
|
||||
private AWTNativeChart getDemoChart(JavaFXChartFactory factory, String toolkit) {
|
||||
Quality quality = Quality.Advanced;
|
||||
Quality quality = Quality.Advanced();
|
||||
int POINTS = 1000;
|
||||
SelectableScatter scatter = generateScatter(POINTS);
|
||||
AWTNativeChart chart = (AWTNativeChart) factory.newChart(quality);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class NewtChartFactory extends ChartFactory {
|
|||
static Logger logger = Logger.getLogger(NewtChartFactory.class);
|
||||
|
||||
public static Chart chart() {
|
||||
return chart(Quality.Intermediate);
|
||||
return chart(Quality.Intermediate());
|
||||
}
|
||||
|
||||
public static Chart chart(Quality quality) {
|
||||
|
|
|
@ -6,6 +6,9 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jzy3d.chart.IAnimator;
|
||||
import org.jzy3d.chart.NativeAnimator;
|
||||
|
@ -48,6 +51,8 @@ public class CanvasNewtAwt extends Panel implements IScreenCanvas, INativeCanvas
|
|||
|
||||
protected List<ICanvasListener> canvasListeners = new ArrayList<>();
|
||||
|
||||
protected ScheduledExecutorService exec = new ScheduledThreadPoolExecutor(1);
|
||||
|
||||
|
||||
public CanvasNewtAwt(IChartFactory factory, Scene scene, Quality quality,
|
||||
GLCapabilitiesImmutable glci) {
|
||||
|
@ -67,6 +72,10 @@ public class CanvasNewtAwt extends Panel implements IScreenCanvas, INativeCanvas
|
|||
if (quality.isPreserveViewportSize())
|
||||
setPixelScale(newPixelScaleIdentity());
|
||||
|
||||
if(ALLOW_WATCH_PIXEL_SCALE)
|
||||
watchPixelScale();
|
||||
|
||||
|
||||
// swing specific
|
||||
setFocusable(true);
|
||||
requestFocusInWindow();
|
||||
|
@ -80,6 +89,24 @@ public class CanvasNewtAwt extends Panel implements IScreenCanvas, INativeCanvas
|
|||
setLayout(new BorderLayout());
|
||||
add(canvas, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
protected void watchPixelScale() {
|
||||
exec.schedule(new PixelScaleWatch() {
|
||||
@Override
|
||||
public double getPixelScaleY() {
|
||||
return getPixelScaleX();
|
||||
}
|
||||
@Override
|
||||
public double getPixelScaleX() {
|
||||
return getPixelScaleY();
|
||||
}
|
||||
@Override
|
||||
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
firePixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
private Renderer3d newRenderer(IChartFactory factory, boolean traceGL, boolean debugGL) {
|
||||
return ((NativePainterFactory) factory.getPainterFactory()).newRenderer3D(view, traceGL,
|
||||
|
|
|
@ -76,48 +76,31 @@ public class CanvasSwing extends GLJPanel implements IScreenCanvas, INativeCanva
|
|||
animator.start();
|
||||
}
|
||||
|
||||
watchPixelScale();
|
||||
if(ALLOW_WATCH_PIXEL_SCALE)
|
||||
watchPixelScale();
|
||||
|
||||
if (quality.isPreserveViewportSize())
|
||||
setPixelScale(newPixelScaleIdentity());
|
||||
}
|
||||
|
||||
private void watchPixelScale() {
|
||||
exec.schedule(new Runnable() {
|
||||
double prevX = -1;
|
||||
double prevY = -1;
|
||||
|
||||
protected void watchPixelScale() {
|
||||
exec.schedule(new PixelScaleWatch() {
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
watchPixelScaleAndNotifyUponChange();
|
||||
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public double getPixelScaleY() {
|
||||
return getPixelScaleX();
|
||||
}
|
||||
|
||||
private void watchPixelScaleAndNotifyUponChange() {
|
||||
double x = getPixelScaleX();
|
||||
double y = getPixelScaleY();
|
||||
|
||||
if((prevX!=-1)&&(prevY!=-1)) {
|
||||
if((x!=prevX)||(y!=prevY)) {
|
||||
firePixelScaleChanged(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
@Override
|
||||
public double getPixelScaleX() {
|
||||
return getPixelScaleY();
|
||||
}
|
||||
@Override
|
||||
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
firePixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
private float[] newPixelScaleIdentity() {
|
||||
return new float[] {ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE};
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.jzy3d.painters.NativeDesktopPainter;
|
|||
import org.jzy3d.plot3d.rendering.canvas.ICanvasListener;
|
||||
import org.jzy3d.plot3d.rendering.canvas.INativeCanvas;
|
||||
import org.jzy3d.plot3d.rendering.canvas.IScreenCanvas;
|
||||
import org.jzy3d.plot3d.rendering.canvas.PixelScaleWatch;
|
||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||
import org.jzy3d.plot3d.rendering.scene.Scene;
|
||||
import org.jzy3d.plot3d.rendering.view.Renderer3d;
|
||||
|
@ -75,7 +76,8 @@ public class CanvasNewtSWT extends Composite implements IScreenCanvas, INativeCa
|
|||
animator.start();
|
||||
}
|
||||
|
||||
watchPixelScale();
|
||||
if(ALLOW_WATCH_PIXEL_SCALE)
|
||||
watchPixelScale();
|
||||
|
||||
addDisposeListener(e -> new Thread(() -> {
|
||||
if (animator != null) {
|
||||
|
@ -91,41 +93,24 @@ public class CanvasNewtSWT extends Composite implements IScreenCanvas, INativeCa
|
|||
}).start());
|
||||
}
|
||||
|
||||
private void watchPixelScale() {
|
||||
exec.schedule(new Runnable() {
|
||||
double prevX = -1;
|
||||
double prevY = -1;
|
||||
|
||||
protected void watchPixelScale() {
|
||||
exec.schedule(new PixelScaleWatch() {
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
watchPixelScaleAndNotifyUponChange();
|
||||
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public double getPixelScaleY() {
|
||||
return getPixelScaleX();
|
||||
}
|
||||
|
||||
private void watchPixelScaleAndNotifyUponChange() {
|
||||
double x = getPixelScaleX();
|
||||
double y = getPixelScaleY();
|
||||
|
||||
if((prevX!=-1)&&(prevY!=-1)) {
|
||||
if((x!=prevX)||(y!=prevY)) {
|
||||
firePixelScaleChanged(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
@Override
|
||||
public double getPixelScaleX() {
|
||||
return getPixelScaleY();
|
||||
}
|
||||
@Override
|
||||
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) {
|
||||
firePixelScaleChanged(pixelScaleX, pixelScaleY);
|
||||
}
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
private Renderer3d newRenderer(IChartFactory factory, boolean traceGL, boolean debugGL) {
|
||||
return ((NativePainterFactory) factory.getPainterFactory()).newRenderer3D(view, traceGL,
|
||||
debugGL);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SWTChartFactory extends ChartFactory {
|
|||
|
||||
public static Chart chart(Composite parent) {
|
||||
SWTChartFactory f = new SWTChartFactory(parent);
|
||||
return f.newChart(Quality.Intermediate);
|
||||
return f.newChart(Quality.Intermediate());
|
||||
}
|
||||
|
||||
public static Chart chart(Composite parent, Quality quality) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class SurfaceDemoSWT {
|
|||
shell.setLayout(new FillLayout());
|
||||
|
||||
SWTChartFactory f = new SWTChartFactory(shell);
|
||||
Chart chart = f.newChart(Quality.Advanced);
|
||||
Chart chart = f.newChart(Quality.Advanced());
|
||||
|
||||
// Chart chart = SWTChartFactory.chart(shell);
|
||||
chart.getScene().getGraph().add(surface);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class SurfaceDemoSWTAWTBridge {
|
|||
final Shape surface = surface();
|
||||
|
||||
// Create a chart
|
||||
Chart chart = new SWTBridgeChartFactory().newChart(Quality.Advanced);
|
||||
Chart chart = new SWTBridgeChartFactory().newChart(Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
|
||||
// TODO : let SWT Frame open in non blocking mode.
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class Abstract3dDemo {
|
|||
}
|
||||
|
||||
protected static Chart getRegressionChart(SvmMapper mapper, Coord3d[] values) {
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
q.setSmoothPoint(true);
|
||||
Chart chart = new AWTChartFactory().newChart(q);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DebugGL_Demo extends AWTAbstractAnalysis {
|
|||
surface.setWireframeDisplayed(false);
|
||||
|
||||
// Create a chart
|
||||
chart = initializeChart(Quality.Advanced);
|
||||
chart = initializeChart(Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
chart.addKeyboardCameraController();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DebugGLChart2d {
|
|||
Chart watchedChart;
|
||||
|
||||
// WatcherFactory wf = new WatcherFactory();
|
||||
Chart2d debugChart = new Chart2dFactory().newChart(Quality.Advanced);
|
||||
Chart2d debugChart = new Chart2dFactory().newChart(Quality.Advanced());
|
||||
Timer timer = new Timer();
|
||||
|
||||
public DebugGLChart2d(Chart watchedChart) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class NativeChartTester extends ChartTester {
|
|||
/** A helper to build an offscreen chart simply out of a list of {@link Drawable} */
|
||||
public static AWTChart offscreen(Drawable... drawables) {
|
||||
// Initialize chart
|
||||
Quality q = Quality.Intermediate;
|
||||
Quality q = Quality.Intermediate();
|
||||
|
||||
AWTChartFactory f = new AWTChartFactory();
|
||||
f.getPainterFactory().setOffscreen(TEST_IMG_SIZE, TEST_IMG_SIZE);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class DebugGLChart3d {
|
|||
|
||||
public DebugGLChart3d(Chart watchedChart, ChartFactory debugChartFactory) {
|
||||
this.watchedChart = watchedChart;
|
||||
this.debugChart = debugChartFactory.newChart(Quality.Advanced);
|
||||
this.debugChart = debugChartFactory.newChart(Quality.Advanced());
|
||||
this.debugChart.getView().setSquared(false);
|
||||
|
||||
spaceTransform = watchedChart.getView().getSpaceTransformer();
|
||||
|
|
|
@ -143,7 +143,7 @@ public class ChartTester {
|
|||
|
||||
// LET TEST FAIL
|
||||
|
||||
fail("Chart test failed: " + e.getMessage() + " pix("+e.getDiffCoordinates()+ " see " + diffFile);
|
||||
fail("Chart test failed: " + e.getMessage() + " see " + diffFile);
|
||||
|
||||
} catch (IOException e) {
|
||||
// -----------------------------
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DebugGL_Demo extends AWTAbstractAnalysis {
|
|||
surface.setWireframeDisplayed(false);
|
||||
|
||||
// Create a chart
|
||||
chart = initializeChart(Quality.Advanced);
|
||||
chart = initializeChart(Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
chart.addKeyboardCameraController();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class WorldMapDemo extends AWTAbstractAnalysis {
|
|||
return new CroppingView(factory, scene, canvas, quality);
|
||||
}
|
||||
};
|
||||
chart = f.newChart(Quality.Advanced);
|
||||
chart = f.newChart(Quality.Advanced());
|
||||
|
||||
// Instantiate world map and parse the file
|
||||
WorldMapLoader worldMap = new WorldMapLoader();
|
||||
|
|
|
@ -43,7 +43,7 @@ public class SquarifyDemo extends AWTAbstractAnalysis {
|
|||
surface.setWireframeDisplayed(false);
|
||||
|
||||
// Create a chart
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate);
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate());
|
||||
|
||||
// This addition keeps the aspect ratio of the X and Y data
|
||||
// but makes X and Z square
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ScatterDemoAWT extends AWTAbstractAnalysis {
|
|||
|
||||
Scatter scatter = new Scatter(points, colors);
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
// q.setPreserveViewportSize(true);
|
||||
|
||||
chart = new AWTChartFactory().newChart(q);
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.jzy3d.plot3d.rendering.canvas.Quality;
|
|||
|
||||
public class ScatterDemoEmulGL {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
q.setAnimated(false);
|
||||
q.setPreserveViewportSize(false); // need java 9+ to enable HiDPI & Retina displays
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class SurfaceDemoAWT extends AWTAbstractAnalysis {
|
|||
IPainterFactory p = new AWTPainterFactory(c);
|
||||
IChartFactory f = new AWTChartFactory(p);
|
||||
|
||||
chart = f.newChart(Quality.Advanced);
|
||||
chart = f.newChart(Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class SurfaceDemoAWTNewt extends AWTAbstractAnalysis {
|
|||
// Create a chart
|
||||
IChartFactory f = new NewtChartFactory();
|
||||
|
||||
chart = f.newChart(Quality.Advanced);
|
||||
chart = f.newChart(Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
CameraThreadControllerWithTime t = (CameraThreadControllerWithTime)chart.getThread();
|
||||
t.setSpeed(60);
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SurfaceDemoEmulGL {
|
|||
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
q.setAnimated(false); // leave CPU quiet if no need to re-render
|
||||
q.setHiDPIEnabled(true); // need java 9+ to enable HiDPI & Retina displays
|
||||
// (tutorials built with Java 8 for backward compatibility, update your runtime to get HiDPI)
|
||||
|
@ -42,7 +42,7 @@ public class SurfaceDemoEmulGL {
|
|||
|
||||
EmulGLSkin skin = EmulGLSkin.on(chart);
|
||||
skin.getCanvas().setProfileDisplayMethod(true);
|
||||
skin.getAxisTextRenderer().setFont(Font.TimesRoman_10);
|
||||
skin.getAxisTextRenderer().setFont(Font.Helvetica_12);
|
||||
|
||||
chart.open();
|
||||
chart.addMouseCameraController();
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SurfaceDemoFallback {
|
|||
public static void main(String[] args) {
|
||||
Shape surface = surface();
|
||||
|
||||
Quality quality = Quality.Advanced;
|
||||
Quality quality = Quality.Advanced();
|
||||
FallbackChartFactory factory = new FallbackChartFactory();
|
||||
Chart chart = factory.newChart(quality);
|
||||
chart.getScene().getGraph().add(surface);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SurfaceDemoSwing extends AbstractAnalysis {
|
|||
surface.setWireframeDisplayed(false);
|
||||
|
||||
// Create a chart
|
||||
chart = new SwingChartFactory().newChart(Quality.Advanced);
|
||||
chart = new SwingChartFactory().newChart(Quality.Advanced());
|
||||
chart.add(surface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BasicVolumeDemo extends AWTAbstractAnalysis {
|
|||
colorMapper, new BoundingBox3d(1, 10, 1, 10, 1, 10));
|
||||
|
||||
// Create a chart
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate);
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate());
|
||||
chart.getScene().getGraph().add(volume);
|
||||
chart.getView();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class LizardVolumeDemo extends AWTAbstractAnalysis {
|
|||
//volume.setTransformBefore(transform);
|
||||
|
||||
// Create a chart
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate);
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate());
|
||||
chart.getScene().getGraph().add(volume);
|
||||
// chart.getView().setBackgroundColor(new Color(0, 0, 0));
|
||||
// IAxeLayout axeLayout = chart.getAxeLayout();
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BigWaterfallDemo extends AWTAbstractAnalysis {
|
|||
|
||||
|
||||
// Create a chart
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate);
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate());
|
||||
chart.getScene().getGraph().add(shape);
|
||||
chart.getView();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class WaterfallDemo extends AWTAbstractAnalysis {
|
|||
build.getBounds().getZmax(), new Color(1, 1, 1, 1.0f)));
|
||||
|
||||
// Create a chart
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate);
|
||||
chart = AWTChartFactory.chart(Quality.Intermediate());
|
||||
chart.getScene().getGraph().add(build);
|
||||
chart.getView();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class SurfaceDemoEmulGL_Coplanar {
|
|||
|
||||
public static void main(String[] args) {
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
Quality q = Quality.Advanced;
|
||||
Quality q = Quality.Advanced();
|
||||
|
||||
Shape surface = surface();
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class SurfaceDemoAWT extends AWTAbstractAnalysis {
|
|||
IPainterFactory p = new AWTPainterFactory(c);
|
||||
IChartFactory f = new AWTChartFactory(p);
|
||||
|
||||
chart = f.newChart(Quality.Advanced);
|
||||
chart = f.newChart(Quality.Advanced());
|
||||
chart.getScene().getGraph().add(surface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SurfaceDemoSwing extends AbstractAnalysis {
|
|||
surface.setWireframeDisplayed(false);
|
||||
|
||||
// Create a chart
|
||||
chart = new SwingChartFactory().newChart(Quality.Advanced);
|
||||
chart = new SwingChartFactory().newChart(Quality.Advanced());
|
||||
chart.add(surface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ public class ITTestNativeScatterChart {
|
|||
|
||||
// When
|
||||
AWTChartFactory factory = new AWTChartFactory();
|
||||
factory.getPainterFactory().setOffscreen(600, 600);
|
||||
Chart chart = factory.newChart(Quality.Advanced);
|
||||
factory.getPainterFactory().setOffscreen(700, 600);
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
|
||||
chart.add(scatter());
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ public class ITTestNativeSurfaceChart {
|
|||
IChartFactory factory = new AWTChartFactory(p);
|
||||
|
||||
// AWTChartFactory factory = new AWTChartFactory();
|
||||
factory.getPainterFactory().setOffscreen(600, 600);
|
||||
factory.getPainterFactory().setOffscreen(700, 600);
|
||||
|
||||
Chart chart = factory.newChart(Quality.Advanced);
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
|
||||
chart.add(surface());
|
||||
|
||||
|
|
Before Width: | Height: | Size: 357 KiB After Width: | Height: | Size: 359 KiB |
Before Width: | Height: | Size: 198 KiB After Width: | Height: | Size: 200 KiB |