Visible Objects

Started by aZen, February 08, 2013, 07:09:44 PM

Previous topic - Next topic

aZen

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

EgonOlsen

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

aZen

#2
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!

EgonOlsen

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.

aZen

#4
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 :)

EgonOlsen

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.