Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.opengl.*;
- import java.awt.Color;
- import sunflowapiapi.P5SunflowAPIAPI;
- import org.sunflow.math.Point3;
- import org.sunflow.math.Vector3;
- PFont font;
- ArrayList cubes;
- int maxCubes = 10; // Max num of cubes
- boolean rendered = false;
- P5SunflowAPIAPI sunflow;
- void setup() {
- size(600, 600, "sunflowapiapi.P5SunflowAPIAPI");
- sunflow = (P5SunflowAPIAPI) g;
- smooth();
- //Load font for debug Info
- font = loadFont("LucidaGrande-12.vlw");
- textFont(font);
- //Create ArrayList of Cubes
- cubes = new ArrayList();
- for (int i = 0; i < maxCubes; i++) {
- cubes.add(new cube(int(random(100, 200)), int(random(100, 200)), 200));
- }
- }
- void draw() {
- background(90);
- for (int i = cubes.size() - 1; i >= 0; i--) {
- cube Cube = (cube) cubes.get(i);
- Cube.run();
- }
- info();
- if(rendered){
- noLoop();
- }
- }
- //Debug Info
- void info() {
- text("Frame", 10, 20);
- text(frameCount, 60, 20);
- text("FPS", 10, 40);
- text(round(frameRate), 60, 40);
- }
- void keyPressed(){
- sunflow.setSunSkyLight("mySunskyLight");
- sunflow.setDirectionalLight("myDirectionalLight1", new Point3(0, 1, 0), new Vector3(1, 1, 0), 100, new Color(125, 125, 125));
- sunflow.setDiffuseShader();
- sunflow.setInstantGIEngine(16, 1, 1.0, 1);
- sunflow.render();
- rendered = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement