Skip to content

Commit 3b9b996

Browse files
committed
refactor
1 parent f9b91e3 commit 3b9b996

File tree

14 files changed

+41
-27
lines changed

14 files changed

+41
-27
lines changed

pom.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
'maven.compiler.target' => '1.8',
2424
'janino.version' => '3.0.12',
2525
'jogl.version' => '2.3.2',
26-
'processing.version' => '3.3.5'
26+
'processing.version' => '3.3.7'
2727
)
2828

2929
jar 'org.processing:core:${processing.version}'
@@ -53,7 +53,7 @@
5353
)
5454
end
5555

56-
plugin( :compiler, '3.6.0',
56+
plugin( :compiler, '3.8.0',
5757
source: '${maven.compiler.source}',
5858
target: '${maven.compiler.target}'
5959
)

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ DO NOT MODIFIY - GENERATED CODE
6565
<maven.compiler.source>1.8</maven.compiler.source>
6666
<maven.compiler.target>1.8</maven.compiler.target>
6767
<polyglot.dump.pom>pom.xml</polyglot.dump.pom>
68-
<processing.version>3.3.5</processing.version>
68+
<processing.version>3.3.7</processing.version>
6969
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
7070
<source.directory>src</source.directory>
7171
</properties>
@@ -135,7 +135,7 @@ DO NOT MODIFIY - GENERATED CODE
135135
</plugin>
136136
<plugin>
137137
<artifactId>maven-compiler-plugin</artifactId>
138-
<version>3.6.0</version>
138+
<version>3.8.0</version>
139139
<configuration>
140140
<source>${maven.compiler.source}</source>
141141
<target>${maven.compiler.target}</target>

src/main/java/SunflowGUI.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.awt.datatransfer.Transferable;
77
import java.awt.datatransfer.UnsupportedFlavorException;
88
import java.awt.event.ActionEvent;
9-
import java.awt.event.ActionListener;
109
import java.beans.PropertyVetoException;
1110
import java.io.BufferedReader;
1211
import java.io.File;
@@ -346,14 +345,20 @@ public static void main(String[] args) {
346345
if (i > args.length - 2) {
347346
usage(false);
348347
} String baketype = args[i + 1];
349-
if (baketype.equals("view")) {
348+
switch (baketype) {
349+
case "view":
350350
bakeViewdep = true;
351-
} else if (baketype.equals("ortho")) {
351+
break;
352+
case "ortho":
352353
bakeViewdep = false;
353-
} else {
354+
break;
355+
default:
354356
usage(false);
355-
} i += 2;
357+
break;
358+
}
359+
i += 2;
356360
break;
361+
357362
case "-filter":
358363
if (i > args.length - 2) {
359364
usage(false);

src/main/java/org/sunflow/AsciiFileSunflowAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class AsciiFileSunflowAPI extends FileSunflowAPI {
1414

15-
private OutputStream stream;
15+
private final OutputStream stream;
1616

1717
AsciiFileSunflowAPI(String filename) throws IOException {
1818
stream = new BufferedOutputStream(new FileOutputStream(filename));

src/main/java/org/sunflow/BinaryFileSunflowAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class BinaryFileSunflowAPI extends FileSunflowAPI {
1414

15-
private DataOutputStream stream;
15+
private final DataOutputStream stream;
1616

1717
BinaryFileSunflowAPI(String filename) throws FileNotFoundException {
1818
stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(filename)));

src/main/java/org/sunflow/SunflowAPI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ public static SunflowAPI create(String filename, int frameNumber) {
639639
if (filename == null) {
640640
return new SunflowAPI();
641641
}
642-
SunflowAPI api = null;
642+
SunflowAPI api;
643643
if (filename.endsWith(".java")) {
644644
Timer t = new Timer();
645645
UI.printInfo(Module.API, "Compiling \"" + filename + "\" ...");
@@ -684,7 +684,7 @@ public static SunflowAPI create(String filename, int frameNumber) {
684684
* @return <code>true</code> upon success, <code>false</code> otherwise
685685
*/
686686
public static boolean translate(String filename, String outputFilename) {
687-
FileSunflowAPI api = null;
687+
FileSunflowAPI api;
688688
try {
689689
if (outputFilename.endsWith(".sca")) {
690690
api = new AsciiFileSunflowAPI(outputFilename);

src/main/java/org/sunflow/core/GIEngine.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ public interface GIEngine {
2121
public Color getGlobalRadiance(ShadingState state);
2222

2323
/**
24-
* Initialize the engine. This is called before rendering begins.
24+
* Initialize the engine.This is called before rendering begins.
2525
*
26+
* @param options
27+
* @param scene
2628
* @return <code>true</code> if the init phase succeeded, <code>false</code>
2729
* otherwise
2830
*/

src/main/java/org/sunflow/core/ImageSampler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ public interface ImageSampler {
1010
/**
1111
* Prepare the sampler for rendering an image of w x h pixels
1212
*
13+
* @param options
14+
* @param scene
1315
* @param w width of the image
1416
* @param h height of the image
17+
* @return
1518
*/
1619
public boolean prepare(Options options, Scene scene, int w, int h);
1720

src/main/java/org/sunflow/core/InstanceList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
final class InstanceList implements PrimitiveList {
88

9-
private Instance[] instances;
9+
private final Instance[] instances;
1010
private Instance[] lights;
1111

1212
InstanceList() {

src/main/java/org/sunflow/core/IntersectionState.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public static final class StackNode {
3636
* Initializes all traversal stacks.
3737
*/
3838
public IntersectionState() {
39-
for (int i = 0; i < stacks.length; i++) {
40-
for (int j = 0; j < stacks[i].length; j++) {
41-
stacks[i][j] = new StackNode();
39+
for (StackNode[] stack : stacks) {
40+
for (int j = 0; j < stack.length; j++) {
41+
stack[j] = new StackNode();
4242
}
4343
}
4444
}
@@ -102,13 +102,14 @@ public final void setIntersection(int id, float u, float v) {
102102
}
103103

104104
/**
105-
* Record an intersection with the specified primitive id. The parent object
106-
* is assumed to be the current instance. The u and v parameters are used to
107-
* pinpoint the location on the surface if needed.
105+
* Record an intersection with the specified primitive id.The parent object
106+
is assumed to be the current instance. The u and v parameters are used to
107+
pinpoint the location on the surface if needed.
108108
*
109109
* @param id primitive id of the intersected object
110110
* @param u u surface paramater of the intersection point
111111
* @param v v surface parameter of the intersection point
112+
* @param w
112113
*/
113114
public final void setIntersection(int id, float u, float v, float w) {
114115
instance = current;

0 commit comments

Comments
 (0)