Hi,
I'm a moderately new-to-Processing person with little Java experience, but moderately good experience with 3D work.
My sketch is loading a dataset from MySQL, which works fine. I have an object to represent what I want to draw, and load/init about 5300 of these.
My rendering code is:
Quote:void draw() {
background(20);
lights();
camera1.feed();
text("System count: "+system_count,15,20);
for(int i=1;i<systems.length;i++) {
println("Doing "+i+"/"+system_count+"");
pushMatrix();
translate(systems[i].getX(),systems[i].getY(),systems[i].getZ());
sphere(5);
popMatrix();
}
println("Done drawing frame");
}
As you might guess from the printlns, this takes a long while to draw a frame. I'm looking for this to be capable of realtime-timescale performance, so a 0.06-frames-per-second rate is hardly acceptable! :p
My objects are:
Quote:class Color
{
private int r,g,b;
Color(int ar, int ag, int ab) {
r = ar;
g = ag;
b = ab;
}
public int getR(){return this.r;}
public int getG(){return this.g;}
public int getB(){return this.b;}
}
class System
{
private float x,y,z,radius,secstatus;
private int id;
private String name;
private Color sec_color;
System(float xpos,float ypos, float zpos, float rradius, int sysid, String sysname, float security) {
id = sysid;
name = sysname;
x = xpos;
y = ypos;
z = zpos;
radius = rradius;
secstatus = security;
if (security >= 1.0) {
sec_color = new Color(0,223,51);
} else if (security > 0.8) {
sec_color = new Color(116,223,0);
} else if (security > 0.6) {
sec_color = new Color(200,223,0);
} else if (security > 0.4) {
sec_color = new Color(233,141,0);
} else if (security > 0.2) {
sec_color = new Color(223,99,0);
} else {
sec_color = new Color(223,16,0);
}
secstatus = security;
}
public float getX(){return (this.x);}
public float getY(){return (this.y);}
public float getZ(){return (this.z);}
public float getRadius(){return this.radius;}
public float getSecStatus() {return this.secstatus;}
public int getId(){return this.id;}
public String getName(){return this.name;}
public Color getColor(){return this.sec_color;}
}
Is there an alternative rendering method I could use to improve the performance of this sketch while retaining the 3D nature of the objects. Once this works I'll be drawing connecting lines in places and then displaying a 2D overlay over the scene, if that makes sense, so suggestions on achieving this would be great