Author Topic: Visible Objects  (Read 923 times)

Offline aZen

  • int
  • **
  • Posts: 94
    • View Profile
Visible Objects
« on: February 08, 2013, 07:09:44 pm »
Is there an efficient way to get all visible objects (or all objects rendered in last frame)? I tried using world.getVisibilityList(), but did not understand how to access the VisList object.

Thanks for your help!
aZen

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Visible Objects
« Reply #1 on: February 08, 2013, 09:08:48 pm »
You could use the VisList, but i don't advise to do it because the way how to get the information you need depends on the renderer you are using. It's better to get the objects from the world and query each for wasVisible(). However, you have to use the latest beta for this to work correctly, because wasVisible() had a bug in former versions. Get the beta jar from here: http://jpct.de/download/beta/jpct.jar

Offline aZen

  • int
  • **
  • Posts: 94
    • View Profile
Re: Visible Objects
« Reply #2 on: February 08, 2013, 11:00:09 pm »
Downloaded the new jar file and yes, wasVisible() worked!

Can I also query for all objects that are in the view of the camera? Even those that did not get rendered? At the moment I'm converting all object centers into 2D and checking those.

Btw super fast reply, thank you!
« Last Edit: February 08, 2013, 11:07:42 pm by aZen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Visible Objects
« Reply #3 on: February 08, 2013, 11:14:17 pm »
wasVisible() returns all the objects that are/were in view. It can't determine if an object is actually visible, i.e. not overdrawn by some other.

Offline aZen

  • int
  • **
  • Posts: 94
    • View Profile
Re: Visible Objects
« Reply #4 on: February 08, 2013, 11:55:46 pm »
http://www.jpct.net/doc/com/threed/jpct/Object3D.html#wasVisible%28%29

Oh, so it doesn't return true for empty, visible dummy objects (e.g. no triangles added)? At least that's what my testing shows. It's fine for now. Enough optimization :)
« Last Edit: February 08, 2013, 11:57:58 pm by aZen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Visible Objects
« Reply #5 on: February 09, 2013, 09:31:28 am »
I'm not sure how it behaves for dummy objects. What meant was that it will still return true even if the object is hidden by a wall.