I was wondering how I would be able to call an instance of a class from the main sketch in on of the classes i have created.
For example here how would I call the instance of WETriangleMesh "cave" in the new class meshpts. I have put notes where I am getting the error.
I have tried to run this in both IntelliJ and Eclipse but I can,t seem to figure it out.
Root Sketch
import processing.core.PApplet;
import peasy.*;
import toxi.geom.mesh.*;
import toxi.processing.ToxiclibsSupport;
public class MainApp extends PApplet {
PeasyCam cam;
ToxiclibsSupport gfx;
WETriangleMesh cave;
Meshpts pts;
public static void main(String[] args){
PApplet.main("MainApp", args);
}
public void settings(){
size(1400, 800,P3D);
smooth();
}
public void setup(){
cam = new PeasyCam(this,750,750,0,2200);
cave = (WETriangleMesh) new STLReader().loadBinary(sketchPath("data/"+"cave.stl"), STLReader.WEMESH);
pts = new Meshpts(this);
gfx=new ToxiclibsSupport(this);
}
public void draw(){
background(0);
stroke(255, 0, 0);
noFill();
cave.run();
pushMatrix();
fill(40, 120);
noStroke();
strokeWeight(1);
stroke(10);
lights();
gfx.mesh(cave, false, 10);
popMatrix();
}
}
Class Meshpts
import processing.core.PApplet;
public class Meshpts{
PApplet p;
public Flock(PApplet p){
this.p = p;
}
void run() {
cave.computeCentroid(); // error is here
}
}