Skip to content

Commit 13c5a6a

Browse files
committed
Replae renderer with mode in app.rb
1 parent bc51543 commit 13c5a6a

File tree

14 files changed

+104
-397
lines changed

14 files changed

+104
-397
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ v0.8.0 Refactor processing code to jdk8 syntax, include lambda, switch on string
4040

4141
v0.7.1 Oops fix `GfxRender` had not been merged
4242

43-
v0.7.0 Refactor sketch_writer to load params from ~/.picrate/sketch.yml. `AppRender => GfxRender` because we only need `PGraphics` in renderer.
43+
v0.7.0 Refactor sketch_writer to load params from ~/.picrate/sketch.yml. `GfxRender => GfxRender` because we only need `PGraphics` in renderer.
4444

4545
v0.6.0 Re-branding with new 'pick'/'eight' svg for PiCrate
4646

docs/_classes/app_render/app_render.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
layout: post
3-
title: "AppRender and ShapeRender"
4-
keywords: to_vertex, Vec3D, Vec2D, AppRender, ShapeRender
3+
title: "GfxRender and ShapeRender"
4+
keywords: to_vertex, Vec3D, Vec2D, GfxRender, ShapeRender
55
---
6-
Vec2D and Vec3D classes can be efficiently rendered as both PApplet vertices, and PShape vertices using AppRender and ShapeRender utility classes. To use the AppRender renderer you should create a single instance in the processing setup see below example:-
6+
Vec2D and Vec3D classes can be efficiently rendered as both PApplet vertices, and PShape vertices using GfxRender and ShapeRender utility classes. To use the GfxRender renderer you should create a single instance in the processing setup see below example:-
77

8-
### AppRender
8+
### GfxRender
99

1010
```ruby
1111
attr_reader :renderer
1212
...
1313
def setup
14-
@renderer = AppRender.new(self)
14+
@renderer = GfxRender.new(self)
1515
end
1616
...
1717
```

lib/picrate/app.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def self.inherited(subclass)
8484
class << self
8585
# Handy getters and setters on the class go here:
8686
attr_accessor :sketch_class, :library_loader, :arguments, :options
87-
attr_reader :surface, :width, :height, :renderer
87+
attr_reader :surface, :width, :height, :mode
8888
def load_libraries(*args)
8989
library_loader ||= LibraryLoader.new
9090
library_loader.load_library(*args)
@@ -132,11 +132,11 @@ def initialize(options = {}, arguments = [])
132132
end
133133

134134
def size(*args)
135-
w, h, renderer = *args
135+
w, h, mode = *args
136136
@width ||= w
137137
@height ||= h
138-
@renderer ||= renderer
139-
import_opengl if /opengl/ =~ renderer
138+
@mode ||= mode
139+
import_opengl if /opengl/ =~ mode
140140
super(*args)
141141
end
142142

src/main/java/monkstone/complex/JComplex.java

Lines changed: 0 additions & 252 deletions
This file was deleted.

src/main/java/monkstone/vecmath/GfxRender.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
import processing.core.PGraphics;
44

55
/**
6-
*
76
*
87
* @author Martin Prout
98
*/
109
public class GfxRender implements JRender {
1110

12-
final PGraphics g;
11+
final PGraphics graphics;
1312

1413
/**
1514
*
16-
* @param gfx PGraphics
15+
* @param graphics PGraphics
1716
*/
18-
public GfxRender(final PGraphics gfx) {
19-
this.g = gfx;
17+
public GfxRender(final PGraphics graphics) {
18+
this.graphics = graphics;
2019
}
2120

2221
/**
@@ -26,7 +25,7 @@ public GfxRender(final PGraphics gfx) {
2625
*/
2726
@Override
2827
public void vertex(double x, double y) {
29-
g.vertex((float) x, (float) y);
28+
graphics.vertex((float) x, (float) y);
3029
}
3130

3231
/**
@@ -36,7 +35,7 @@ public void vertex(double x, double y) {
3635
*/
3736
@Override
3837
public void curveVertex(double x, double y) {
39-
g.curveVertex((float) x, (float) y);
38+
graphics.curveVertex((float) x, (float) y);
4039
}
4140

4241
/**
@@ -47,7 +46,7 @@ public void curveVertex(double x, double y) {
4746
*/
4847
@Override
4948
public void vertex(double x, double y, double z) {
50-
g.vertex((float) x, (float) y, (float) z);
49+
graphics.vertex((float) x, (float) y, (float) z);
5150
}
5251

5352
/**
@@ -58,7 +57,7 @@ public void vertex(double x, double y, double z) {
5857
*/
5958
@Override
6059
public void normal(double x, double y, double z) {
61-
g.normal((float) x, (float) y, (float) z);
60+
graphics.normal((float) x, (float) y, (float) z);
6261
}
6362

6463
/**
@@ -71,7 +70,7 @@ public void normal(double x, double y, double z) {
7170
*/
7271
@Override
7372
public void vertex(double x, double y, double z, double u, double v) {
74-
g.vertex((float) x, (float) y, (float) z, (float) u, (float) v);
73+
graphics.vertex((float) x, (float) y, (float) z, (float) u, (float) v);
7574
}
7675

7776
/**
@@ -82,6 +81,6 @@ public void vertex(double x, double y, double z, double u, double v) {
8281
*/
8382
@Override
8483
public void curveVertex(double x, double y, double z) {
85-
g.curveVertex((float) x, (float) y, (float) z);
84+
graphics.curveVertex((float) x, (float) y, (float) z);
8685
}
8786
}

0 commit comments

Comments
 (0)