Ok, here it is.
import com.threed.jpct.*;
import java.util.*;
class Test {
public static void main(String args[])throws Exception{
Object3De ob = new Object3De(6000,"JO");
World w = new World();
w.newCamera();
w.setAmbientLight(200,200,200);
Camera c = w.getCamera();
c.moveCamera(Camera.CAMERA_MOVEOUT,300);
FrameBuffer b = new FrameBuffer(800,600,FrameBuffer.SAMPLINGMODE_NORMAL);
b.enableRenderer(IRenderer.RENDERER_OPENGL,FrameBuffer.SAMPLINGMODE_NORMAL );
b.disableRenderer(IRenderer.RENDERER_SOFTWARE);
ob.build();
w.addObject(ob);
Object3D sphere = Primitives.getSphere(30);
sphere.build();
MoldIn mold = new MoldIn(ob,sphere);
//w.removeObject(ob);
mold.mold();
ob.build();
//w.addObject(ob);
while(true){
b.clear();
//System.out.println("RENDERSCENE");
w.renderScene(b);
//System.out.println("DRAW");
w.draw(b);
//System.out.println("UPDATE");
b.update();
//System.out.println("GLONLY");
b.displayGLOnly();
//Thread.yield();
Thread.sleep(10);
}
}
}
class MoldIn {
private Object3De in;
private Object3D from;
private PolygonManager man;
private Controller controller;
private static int index=0;
public MoldIn(Object3De into, Object3D source){
from=source;
in=into;
}
public MoldIn(Object3De into, Object3D source,Controller c){
from=source;
in=into;
}
public void mold(){
System.out.println("-----IN MOLD() "+index+"--------");
from.build();
man = from.getPolygonManager();
int id = man.getMaxPolygonID();
in.build();
in.unbuild();
try{Thread.sleep(100);}catch(Exception ee){}
int place=0;
System.out.println("NUMBER OF POLYGONS TO COPY " + id + " NUMBER OF POLYGONS AVAILABLE " + in.tric + " going " + id/4);
for(int i = 0; i<id&&in.currentadd<in.tric; i++){
//System.out.println("Copy " + i);
//System.out.println("" + man.getTransformedVertex(place,0) + " " + man.getTransformedVertex(place,1) + " " + man.getTransformedVertex(place,2) + " ");
in.addTriangle(man.getTransformedVertex(i,0),man.getTransformedVertex(i,1),man.getTransformedVertex(i,2));
in.currentadd++;
}
in.build();
System.out.println("_________DONE WITH MOLD()_______");
}
}
class Controller{}
class TabbedObject{}
class Object3De extends Object3D{
public transient TabbedObject controlspanel;
public transient ArrayList<SimpleVector> vectors;
public transient int count=0;
public transient static int count2=0;
public transient int tric;
public transient static SimpleVector v1 = new SimpleVector(0,0,0);
public transient static SimpleVector v2 = new SimpleVector(0,0,0);
public transient static SimpleVector v3 = new SimpleVector(0,0,0);
private transient SimpleVector b1;
private transient SimpleVector b2;
private transient SimpleVector b3;
private transient SimpleVector t1;
private transient SimpleVector t2;
private transient SimpleVector t3;
public transient PolygonManager p;
public transient String name;
public transient int transs=-1;
public transient String colors="notset";
public transient String basets="notset";
public transient String texts="notset";
public transient String bumpts="notset";
public transient String bumps="notset";
public transient String blends="notset";
public transient String boards="notset";
public transient String collisions="notset";
public transient String cullings="notset";
public transient String envs="notset";
public transient String ellips="notset";
public transient int index=0;
public static int currentadd=0;
public transient int type = 0;//2==shaper 0=basic 1=terrain
private int index2=0;
private transient boolean haslistener=false;
private transient HashMap<Float,HashMap<Float,HashMap<Float,Integer>>> vertexes;
private transient float[][][] indexes;
private transient HashMap<Float,Integer> z;
private transient HashMap<Float,HashMap<Float,Integer>> y;
/* 0=basic 1=terrian 2=shaper; */
public HashMap<Float,HashMap<Float,HashMap<Float,Integer>>> getVertexes(){
return vertexes;
}
public float[][][] getIndexes(){
return indexes;
}
public Object3De(int trianglenumber, String n){
super(trianglenumber+1);
setName(n);
//Object3Ds.render2=false;
System.out.println("Creating object named " + n + " with " + trianglenumber + " triangles.");
count=0;
tric=trianglenumber;
name=n;
vectors = new ArrayList<SimpleVector>();
int m =1;
currentadd=0;
build();
}
/* Tests to see if this object3de is a type of shaper */
public synchronized boolean isShaper(){
if(type==2){
return true;
}
return false;
}
/* Tests to see if this object3de is a type of basic */
public synchronized boolean isBasic(){
if(type==0)
return true;
return false;
}
/*Tests to see if this object3de is a type of terrian */
public synchronized boolean isTerrain(){
System.out.println("" + type);
if(type==1)
return true;
return false;
}
private void addXRow(float length, float number, float start){
float z = length;
float begin=0;
for(int i = 0; i<number; i++){
b1 = new SimpleVector(begin,0,0+start);
b2 = new SimpleVector(begin+length,0,0+start);
b3 = new SimpleVector(begin,0,z+start);
t1 = new SimpleVector(begin,0,z+start);
t2 = new SimpleVector(begin+length,0,0+start);
t3 = new SimpleVector(begin+length,0,z+start);
addTriangle(b1,b2,b3);
addTriangle(t1,t2,t3);
begin = begin+length;
}
}
public static int getCurrentAdd(){
return currentadd;
}
public int getCount(){
return this.count;
}
public synchronized boolean hasListen(){
return haslistener;
}
public synchronized void addCollisionListener(CollisionListener col){
if(hasListen()!=true){
super.addCollisionListener(col);
haslistener=true;
}
else{
System.out.println("THIS object already has a listener");
}
}
}
I know that is a lot of stuff,but this is what I tested. Also controller and tabbedobject are "real" classes but I just made fake substitutes for them here. It still throws the exception for me.
Jman