Hi there. I'm trying to make a vector of pointers to Objects. I'm using vectors as opposed to arrays becuase i don't know how many objects I'm going to have.
this is all within the same java file:
class World
{
...
Vector objects = new Vector();
...
ShadeRec hit( Ray ray){
int num_objects = objects.size();
for (int j = 0; j<num_objects; j++){
if (objects[j].hit(ray,t,sr) && (t<tmin)){
sr.hit_an_object = true;
tmin = t;
sr.colour = objects[j].get_colour();
}
}
return sr;
}
Im getting errors for "objects[j]" (in both occurances) that say "Array required, but java.Util.Vector found".
I don't understand why it's saying this as "objects" is a vector so why does it need an array??