Author Topic: Feature Suggestion  (Read 3866 times)

Offline PrimordialSoup

  • byte
  • *
  • Posts: 9
    • View Profile
Feature Suggestion
« on: March 03, 2003, 08:33:06 pm »
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!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Feature Suggestion
« Reply #1 on: March 03, 2003, 10:56:56 pm »
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

  • Guest
Feature Suggestion
« Reply #2 on: March 04, 2003, 08:32:21 pm »
Why not seperate methods for removeAllLights() and removeAllObjects().

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Feature Suggestion
« Reply #3 on: March 04, 2003, 09:14:19 pm »
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