Main Menu

Feature Suggestion

Started by PrimordialSoup, March 03, 2003, 08:33:06 PM

Previous topic - Next topic

PrimordialSoup

I need a way to iterate over all the Object3D's that are attached to a particular World instance.  I saw no way to do that in jPCT's API.
   I guess for now I'll just have to keep an external LinkedList to do this, but I just thought I'd make the request.  Preferably I would like to have an iterator object to work with.
   In addition, a method to remove all objects from a world would be extremely helpful to me.
On a side note (for curiousity's sake) I was wondering how does jPCT's World class store it's references to Object3D's?
reating life isn't that hard.  Creating the UNIVERSE for it to live in is HARD!

EgonOlsen

Quote from: "PrimordialSoup"I need a way to iterate over all the Object3D's that are attached to a particular World instance.  I saw no way to do that in jPCT's API.
   I guess for now I'll just have to keep an external LinkedList to do this, but I just thought I'd make the request.  Preferably I would like to have an iterator object to work with.
   In addition, a method to remove all objects from a world would be extremely helpful to me.
On a side note (for curiousity's sake) I was wondering how does jPCT's World class store it's references to Object3D's?
The references are stored in a Vector (plain and simple...and slow...but ok for the world because it's not a bottleneck at all). So i can either return this Vector (not that good IMO...) or its elements in an Enumeration. I can't use an Iterator, because that would be Java2 only and i don't want to break 1.1 compatibility. Can you live with that?
Should the "remove()"-method only empty the collection of objects or should it empty the whole world (incl. lights...)?

Anonymous

Why not seperate methods for removeAllLights() and removeAllObjects().

EgonOlsen

Ok, i've added removeAllObjects(), removeAllLights(), removeAll() (as a shortcut for both), getObjects() and (while i was there) removeObject(Object3D). I haven't tested them much though, so please let me know if they do what you want them to do.
The new version is online, but i haven't changed the version number for that...it's a silent update. :D