Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"configurations": [
{
"type": "java",
"name": "Launch Main",
"request": "launch",
"mainClass": "C19326126.Main",
"projectName": "java"
},
{
"type": "java",
"name": "CodeLens (Launch) - Main",
"request": "launch",
"mainClass": "ie.tudublin.Main",
"mainClass": "C19326126.Main",
"projectName": "java"
}
]
Expand Down
11 changes: 11 additions & 0 deletions java/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1616171615251</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Empty file added java/bin/C19326126/Practice
Empty file.
41 changes: 41 additions & 0 deletions java/src/C19326126/Example.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package C19326126;

import processing.core.PApplet;

public class Example extends PApplet{
float r;
float ex, ey;

public void settings(){
size(800,800);
}

public void setup(){
ex = 140;
ey = 0;
}

public void draw(){
background(0);
//beginning matrix
pushMatrix();
translate(width/2, height/2); //middle of screen
rotate(radians(r)); //starting rotation
//sun
fill(255,255,0); //placing first sphere
ellipse(0,0,100,100);
//earth
fill(0,255,100); //placing second sphere
ellipse(ex,ey,20,20);
pushMatrix();
//moon
translate(ex,ey); //sets center to center of the earth
rotate(radians(-r*3));
fill(255);
ellipse(25,ey,5,5);
popMatrix();
popMatrix();
r += 1;
}

}
33 changes: 33 additions & 0 deletions java/src/C19326126/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package C19326126;

import example.AudioBandsVisual;
import example.CubeVisual;
import example.MyVisual;
import example.RotatingAudioBands;

public class Main
{

public void StarSystem()
{
String[] a = {"MAIN"};
processing.core.PApplet.runSketch( a, new StarSystem());
}

public void Example()
{
String[] a = {"MAIN"};
processing.core.PApplet.runSketch( a, new Example());
}
public void Work()
{
String[] a = {"MAIN"};
processing.core.PApplet.runSketch( a, new Work());
}

public static void main(String[] args)
{
Main main = new Main();
main.StarSystem();
}
}
Empty file added java/src/C19326126/Practice
Empty file.
189 changes: 189 additions & 0 deletions java/src/C19326126/StarSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
package C19326126;

import processing.core.PApplet;

public class StarSystem extends PApplet{
float rotation;
float rotation2;
float rotation3;
float rotation4;
float rotation5;
Boolean generation = false;

//Star Coordinates & Sizes
float x [] = new float[200];
float y [] = new float[200];
float z [] = new float[200];
float size[] = new float[200];
float x2 [] = new float[200];
float y2 [] = new float[200];
float z2 [] = new float[200];
float size2[] = new float[200];

Sun Sun1, Sun2, Sun3, Sun4, Sun5, Sun6, Sun7, Sun8;



public void settings(){
fullScreen(P3D, SPAN);
//color, position X/Y, size
Sun1 = new Sun(color(255, 255, 0), 0, 0, 50);//Sun
Sun2 = new Sun(color(0, 255, 0), 10, 0, 20);//Earth
Sun3 = new Sun(color(0, 0, 255), 10, 0, 5);//Moon
Sun4 = new Sun(color(255, 0, 50), 10, 0, 18);//Mars
Sun5 = new Sun(color(255, 0, 50), 10, 0, 4);//Moon2
Sun6 = new Sun(color(255, 0, 50), 10, 0, 6);//Moon3
Sun7 = new Sun(color(200, 100, 20), 10, 0, 15);//Mercury
Sun8 = new Sun(color(200,180,40), 10, 0, 35);//Jupiter
}


public void setup(){

}

public void draw(){
background(0);
lights();
camera(mouseX*2, mouseY, (height/2) / tan(PI/5), width/2, height/2, 0, 0, 1, 0);

pushMatrix();//Sun
translate(width/2, height/2);
rotate(radians(rotation));
Sun1.display();

Mercury();

Earth();

Mars();

Jupiter();

popMatrix(); //end Sun

pushMatrix(); //begin star generation

translate(width/2, height/2);
StarField();

popMatrix(); //end star genertaion

//rotational constants for different planets
rotation += .15;
rotation2 += .85;
rotation3 += 1.5;
rotation4 += .65;
rotation5 -= .1;
}
private void StarField(){
if(!generation){

//seperate i's with if statements to be able to make stars of diff audio bands
//eg if i > 25 &&i < 50 stroke map diffcolor * bands.length


for(int i = 0; i < 200; i++){
x[i] = random(-3500,3500);
y[i] = random(-3000,3000);
z[i] = random(50,3000);
size[i] = random(3,18);
}
for(int j = 0; j < 200; j++){
x2[j] = random(-3500,3500);
y2[j] = random(-3000,3000);
z2[j] = random(-3000,-50);
size2[j] = random(3,18);
}


generation = true;
}
for(int i = 0; i < 200; i++){
//Z values ensure Planets won't strike a star
pushMatrix();
translate(x[i], y[i], z[i]);
fill(120,120,255);
sphere(size[i]);
popMatrix();
}
for(int j = 0; j < 200; j++){
pushMatrix();
translate(x2[j], y2[j], z2[j]);
fill(120,120,255);
sphere(size2[j]);
popMatrix();
}
}//end StarField

private void Mercury() {
pushMatrix();
rotate(radians(rotation));
translate(-150, -10);
Sun7.display();
popMatrix();
}//End Mercury


private void Earth() {
pushMatrix();//Earth
rotate(radians(rotation2));

translate(350, 0);
Sun2.display();
rotate(radians(rotation2));
pushMatrix(); //Moon
translate(40, 0);
Sun3.display();
popMatrix(); //End Moon
popMatrix(); //End earth
}//End Earth


void Mars(){
pushMatrix();
translate(480,0);
rotate(radians(rotation4));
Sun4.display();//Mars
pushMatrix(); //Mars Moons
rotate(radians(rotation3));
translate(29, 0);
Sun5.display();
popMatrix();
pushMatrix();
rotate(radians(rotation));
translate(40, 15);
Sun5.display();
popMatrix(); //End Mars Moon
popMatrix(); //End Mars
}//End Mars

private void Jupiter() {
pushMatrix();
rotate(radians(rotation5));
translate(-650, 30);
Sun8.display();
popMatrix();
}

public class Sun{
int c;
int s;
float xpos = 0;
float ypos = 0;

Sun(int tempC, float tempXpos, float tempYpos, int size){
c = tempC;
xpos= tempXpos;
ypos= tempYpos;
s = size;
}//End Sun

public void display(){
//For loops for music and changing stroke and size
noStroke();
fill(c);
sphere(s);
}//End display
}
}
46 changes: 46 additions & 0 deletions java/src/C19326126/Work.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package C19326126;

import processing.core.PApplet;
import ddf.minim.analysis.*;
import ddf.minim.*;


public class Work extends PApplet{
AudioPlayer player;
Minim minim;

public void settings(){
size(1920, 1080, P3D);
}

public void setup(){
smooth(8);
minim = new Minim(this);
player = minim.loadFile("heroplanet.mp3");
player.play();
}

public void draw(){
translate(width/2, height/2);
background(0);
rotateY( (float) 1.6);
for( int i = 0; i< player.bufferSize() -1; i++){
rotateX(50+player.right.get(i)/100);

pushMatrix();
fill(255,0,0);
popMatrix();
strokeWeight(1+player.right.get(i));

stroke(0);
box(10,10,55+player.right.get(i)*200);
box(55 + player.right.get(i)*50,10,10);
box(10,55 + player.right.get(i)*50, 10);




}
}

}
Loading